Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 108866 - freeradius init-script doesn't work with user defined user/group
Summary: freeradius init-script doesn't work with user defined user/group
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: New packages (show other bugs)
Hardware: All Linux
: High normal (vote)
Assignee: Gentoo Dialup Developers
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-10-11 06:53 UTC by Gudleik Rasch
Modified: 2005-10-16 01:52 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Gudleik Rasch 2005-10-11 06:53:51 UTC
The init script that comes with net-dialup/freeradius-1.0.5 is grepping /etc/passwd and /etc/group for 
hardcoded user and group:
       if [ -z "`grep radiusd /etc/passwd`" ] || [ -z "`grep radiusd /etc/group`" ]; then
                eerror "radiusd user missing!"
                return 1
        fi                     

This obviously won't work when 
  a) user wants to run radius under different user or group (as configured in /etc/raddb/radius.conf)
  b) users are stored in LDAP or other database than /etc/passwd (as configured in nsswitch.conf)

My suggestion is to skip the user & group check. The check-radiusd-config script, which is called from 
the same init-script, will fail if the user specified in /etc/raddb/radius.conf don't exist.

Alternatively, getent should be used instead. Then you'll also have to get the correct user and group to 
look for.
Something like this should do the trick:
    # Verify that user & group exists
    RADIUSD_USER=`egrep "^user[ ]+=" /etc/raddb/radiusd.conf | awk -F"=" '{print $2}'`
    RADIUSD_GROUP=`egrep "^group[ ]+=" /etc/raddb/radiusd.conf | awk -F"=" '{print $2}'`
    test `getent passwd $RADIUSD_USER` || {
        eerror "$RADIUSD_USER user missing!"
        return 1
    }

    test `getent group $RADIUSD_GROUP` || {
        eerror "$RADIUSD_GROUP group missing"!
        return 1
    }     

But this kind of complexity will also make the ebuild more error-prone.
Comment 1 Alin Năstac (RETIRED) gentoo-dev 2005-10-16 01:52:14 UTC
Unfortunately I need to change owner/group/permissions on
/var/log/radius/radius.log. Otherwise, radiusd daemon will fail to write
anything after it drops the privileges.

I've fixed it using grep, cut and getent, which should exist on any gentoo install.