diff options
author | Othmar Gsenger <otti@anytun.org> | 2010-01-23 22:58:51 +0000 |
---|---|---|
committer | Othmar Gsenger <otti@anytun.org> | 2010-01-23 22:58:51 +0000 |
commit | 4b91b6003cc6b6a50426e327f4b69ee6e4eb7a48 (patch) | |
tree | 0cf42f061dbd91445b3b24338a6a4be5c4c717b9 /etc/init.d | |
parent | now using sigtimedwait instead of sigwait (diff) |
fixed init script for differend Config dirs and multiconnection with no default key derivation
important: fixed priviledge dropping with multi connection (anytun-controlld), was not working with default config files
Diffstat (limited to 'etc/init.d')
-rwxr-xr-x | etc/init.d/anytun | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/etc/init.d/anytun b/etc/init.d/anytun index 752eb8d..9fc4d4a 100755 --- a/etc/init.d/anytun +++ b/etc/init.d/anytun @@ -55,12 +55,13 @@ start_configd () { test -d $VARCONFIG_DIR || mkdir -p $VARCONFIG_DIR chmod 700 $VARCONFIG_DIR rm -f $VARCONFIG_DIR/$NAME 2>/dev/null + KDPRF=`sed 's/#.*//' < $CONFIG_DIR/$NAME/config | grep -e 'kd-prf' | sed 's/^/ --/' | xargs echo` for CLIENTNAME in `ls $CONFIG_DIR/$NAME/conf.d`; do echo -n " ($CLIENTNAME)" DAEMONARG=`sed 's/#.*//' < $CONFIG_DIR/$NAME/conf.d/$CLIENTNAME | grep -e '\w' | sed 's/^/ --/' | xargs echo` - $ANYTUNCONFIG $DAEMONARG >> $VARCONFIG_DIR/$NAME + $ANYTUNCONFIG $DAEMONARG $CIPHER $AUTHALGO $KDPRF >> $VARCONFIG_DIR/$NAME done - CONTROLHOST=`sed 's/#.*//' < $CONFIG_DIR/$NAME/config | grep -e 'control-host' | sed 's/^/ --/'` + CONTROLHOST=`sed 's/#.*//' < $CONFIG_DIR/$NAME/config | grep -e 'control-host' | sed 's/^/ --/' | xargs echo` $CONTROLDAEMON -f $VARCONFIG_DIR/$NAME $DAEMONOPTS $CONTROLHOST \ --write-pid $VARCONFIG_DIR/$NAME.pid # rm -f $VARCONFIG_DIR/$NAME @@ -68,7 +69,7 @@ start_configd () { } stop_configd () { if [ -d $CONFIG_DIR/$NAME/conf.d ] ; then - echo -n " ($NAME)" + echo -n " ($NAME-controlld)" kill `cat $VARCONFIG_DIR/$NAME.pid` || true rm $VARCONFIG_DIR/$NAME.pid fi @@ -102,7 +103,7 @@ case "$1" in echo -n "Stoping $DESC:" if test -z "$2" ; then for PIDFILE in `ls $VARRUN_DIR/*.pid 2> /dev/null`; do - NAME=`echo $PIDFILE | cut -c17-` + NAME=`basename $PIDFILE` NAME=${NAME%%.pid} echo -n " $NAME" stop_vpn @@ -112,7 +113,7 @@ case "$1" in [ -z "$1" ] && break if test -e $VARRUN_DIR/$1.pid ; then PIDFILE=`ls $VARRUN_DIR/$1.pid 2> /dev/null` - NAME=`echo $PIDFILE | cut -c17-` + NAME=`basename $PIDFILE` NAME=${NAME%%.pid} echo -n " $NAME" stop_vpn @@ -127,7 +128,7 @@ case "$1" in echo -n "Reloading $DESC:" if test -z "$2" ; then for PIDFILE in `ls $VARRUN_DIR/*.pid 2> /dev/null`; do - NAME=`echo $PIDFILE | cut -c17-` + NAME=`basename $PIDFILE` NAME=${NAME%%.pid} echo -n " $NAME" if [ -d $CONFIG_DIR/$NAME/conf.d ] ; then @@ -143,7 +144,7 @@ case "$1" in [ -z "$1" ] && break if test -e $VARRUN_DIR/$1.pid ; then PIDFILE=`ls $VARRUN_DIR/$1.pid 2> /dev/null` - NAME=`echo $PIDFILE | cut -c17-` + NAME=`basename $PIDFILE` NAME=${NAME%%.pid} echo -n " $NAME" if [ -d $CONFIG_DIR/$NAME/conf.d ] ; then @@ -164,7 +165,7 @@ case "$1" in echo -n "Restarting $DESC:" if test -z "$2" ; then for PIDFILE in `ls $VARRUN_DIR/*.pid 2> /dev/null`; do - NAME=`echo $PIDFILE | cut -c17-` + NAME=`basename $PIDFILE` NAME=${NAME%%.pid} echo -n " $NAME" stop_vpn @@ -176,7 +177,7 @@ case "$1" in [ -z "$1" ] && break if test -e $VARRUN_DIR/$1.pid ; then PIDFILE=`ls $VARRUN_DIR/$1.pid 2> /dev/null` - NAME=`echo $PIDFILE | cut -c17-` + NAME=`basename $PIDFILE` NAME=${NAME%%.pid} echo -n " $NAME" stop_vpn |