diff options
author | Natanael Copa <ncopa@alpinelinux.org> | 2009-10-13 14:07:23 +0000 |
---|---|---|
committer | Natanael Copa <ncopa@alpinelinux.org> | 2009-10-13 14:07:23 +0000 |
commit | f7712d880d1957876a7a33e63ae75f288c37ca05 (patch) | |
tree | a634d9db83977eea7cf8929e7a43b6efd950736f /testing/freeradius/freeradius.initd | |
parent | 19c14941f5b586b27853092cc04ce4480062c9b3 (diff) | |
download | aports-f7712d880d1957876a7a33e63ae75f288c37ca05.tar.bz2 aports-f7712d880d1957876a7a33e63ae75f288c37ca05.tar.xz |
testing/freeradius: new aport (moved from unstable)
RADIUS (Remote Authentication Dial-In User Service) server
http://freeradius.org/
Diffstat (limited to 'testing/freeradius/freeradius.initd')
-rw-r--r-- | testing/freeradius/freeradius.initd | 70 |
1 files changed, 70 insertions, 0 deletions
diff --git a/testing/freeradius/freeradius.initd b/testing/freeradius/freeradius.initd new file mode 100644 index 000000000..86909adef --- /dev/null +++ b/testing/freeradius/freeradius.initd @@ -0,0 +1,70 @@ +#!/sbin/runscript + +opts="${opts} reload" + +depend() { + need net + after firewall + use dns +} + +checkconfig() { + #set the location of log files, including startup.log created by check-radiusd-config + if ! cd /var/log/radius ; then + eerror "Failed to change current directory to /var/log/radius" + return 1 + fi + + if [ ! -d /var/run/radiusd ] && ! mkdir /var/run/radiusd ; then + eerror "Failed to create /var/run/radiusd" + return 1 + fi + + if [ ! -f /etc/raddb/radiusd.conf ] ; then + eerror "No /etc/raddb/radiusd.conf file exists!" + return 1 + fi + + if [ "`/usr/sbin/check-radiusd-config >/dev/null 2>&1; echo $?`" != "0" ] ; then + eerror "Config not ok! (try /usr/sbin/check-radiusd-config )" + return 1 + fi + + RADIUSD_USER=`grep '^ *user *=' /etc/raddb/radiusd.conf | cut -d ' ' -f 3` + RADIUSD_GROUP=`grep '^ *group *=' /etc/raddb/radiusd.conf | cut -d ' ' -f 3` + if [ -n "${RADIUSD_USER}" ] && ! getent passwd ${RADIUSD_USER} > /dev/null ; then + eerror "${RADIUSD_USER} user missing!" + return 1 + fi + if [ -n "${RADIUSD_GROUP}" ] && ! getent group ${RADIUSD_GROUP} > /dev/null ; then + eerror "${RADIUSD_GROUP} group missing!" + return 1 + fi + + #radius.log is created before privileges drop; we need to set proper permissions on it + [ -f radius.log ] || touch radius.log || return 1 + + chown -R "${RADIUSD_USER:-root}:${RADIUSD_GROUP:-root}" . /var/run/radiusd && \ + chmod -R u+rwX,g+rX . /var/run/radiusd || return 1 +} + +start() { + checkconfig || return 1 + + ebegin "Starting radiusd" + start-stop-daemon --start --quiet --exec /usr/sbin/radiusd -- ${RADIUSD_OPTS} >/dev/null + eend $? +} + +stop () { + ebegin "Stopping radiusd" + start-stop-daemon --stop --quiet --pidfile=/var/run/radiusd/radiusd.pid + eend $? +} + +reload () { + ebegin "Reloading radiusd" + kill -HUP `</var/run/radiusd/radiusd.pid` + eend $? +} + |