aboutsummaryrefslogtreecommitdiffstats
path: root/testing
diff options
context:
space:
mode:
authorAndreas Steffen <andreas.steffen@strongswan.org>2010-09-02 13:19:24 +0200
committerAndreas Steffen <andreas.steffen@strongswan.org>2010-09-02 22:19:37 +0200
commitc0cecc0a0e7739288d0659d574560d6cc019aa95 (patch)
treee0944c920e9f726e55734b76e7362f05ae22834f /testing
parentf9cfb5c83673e2605507c63642e7d78320d3a107 (diff)
downloadstrongswan-c0cecc0a0e7739288d0659d574560d6cc019aa95.tar.bz2
strongswan-c0cecc0a0e7739288d0659d574560d6cc019aa95.tar.xz
added radius init script mit increased debugging
Diffstat (limited to 'testing')
-rwxr-xr-xtesting/hosts/alice/etc/init.d/radiusd64
1 files changed, 64 insertions, 0 deletions
diff --git a/testing/hosts/alice/etc/init.d/radiusd b/testing/hosts/alice/etc/init.d/radiusd
new file mode 100755
index 000000000..8334385f9
--- /dev/null
+++ b/testing/hosts/alice/etc/init.d/radiusd
@@ -0,0 +1,64 @@
+#!/sbin/runscript
+
+opts="${opts} reload"
+
+depend() {
+ need net
+ use dns
+}
+
+checkconfig() {
+ # set the location of log files
+ 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
+
+ RADIUSD_OPTS="-xx"
+ 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 are dropped - 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 $?
+}