2013-07-10 17:11:40 -04:00
|
|
|
#!/bin/bash
|
|
|
|
#
|
2013-08-26 15:00:51 -04:00
|
|
|
# sslh Startup script for the SSL/SSH multiplexer
|
2013-07-10 17:11:40 -04:00
|
|
|
#
|
2013-08-26 15:00:51 -04:00
|
|
|
# chkconfig: - 13 87
|
|
|
|
# description: Sslh accepts connections on specified ports, and forwards
|
|
|
|
# them further based on tests performed on the first data
|
|
|
|
# packet sent by the remote client.
|
|
|
|
# processname: sslh
|
|
|
|
# config: /etc/sslh.cfg
|
|
|
|
# config: /etc/sysconfig/sslh
|
|
|
|
# pidfile: /var/run/sslh/sslh.pid
|
2013-07-10 17:12:42 -04:00
|
|
|
#
|
2013-08-26 15:00:51 -04:00
|
|
|
# Authors:
|
|
|
|
# Andre Krajnik akrajnik@gmail.com - 2010-03-20
|
|
|
|
# Julien Thomas julthomas@free.fr - 2013-08-25
|
2013-07-10 17:11:40 -04:00
|
|
|
|
|
|
|
# Source function library.
|
|
|
|
. /etc/init.d/functions
|
|
|
|
|
|
|
|
if [ -f /etc/sysconfig/sslh ]; then
|
|
|
|
. /etc/sysconfig/sslh
|
|
|
|
fi
|
|
|
|
|
2013-08-26 15:00:51 -04:00
|
|
|
PROGNAME=sslh
|
|
|
|
SSLH=${SSLH:-/usr/sbin/sslh-select}
|
|
|
|
SSLH_LANG=${SSLH_LANG:-C}
|
|
|
|
CONFIG=${CONFIG:-/etc/sslh.cfg}
|
|
|
|
PIDFILE=${PIDFILE:-/var/run/sslh/sslh.pid}
|
|
|
|
LOCKFILE=${LOCKFILE:-/var/lock/subsys/sslh}
|
|
|
|
STOP_TIMEOUT=${STOP_TIMEOUT:-10}
|
|
|
|
RETVAL=0
|
2013-07-10 17:11:40 -04:00
|
|
|
|
2013-08-26 15:00:51 -04:00
|
|
|
start() {
|
|
|
|
echo -n "Starting $PROGNAME: "
|
|
|
|
LANG=$SSLH_LANG daemon --pidfile="$PIDFILE" \
|
|
|
|
${SSLH_USER:+--user="${SSLH_USER}"} \
|
|
|
|
"$SSLH" ${CONFIG:+-F "$CONFIG"} "$OPTIONS"
|
|
|
|
RETVAL=$?
|
|
|
|
echo
|
|
|
|
[ $RETVAL = 0 ] && touch "$LOCKFILE"
|
|
|
|
return $RETVAL
|
2013-07-10 17:11:40 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
stop() {
|
2013-08-26 15:00:51 -04:00
|
|
|
echo -n "Stopping $PROGNAME: "
|
|
|
|
killproc -p "$PIDFILE" -d "$STOP_TIMEOUT" "$SSLH"
|
|
|
|
RETVAL=$?
|
|
|
|
echo
|
|
|
|
[ $RETVAL = 0 ] && rm -f "$LOCKFILE" "$PIDFILE"
|
2013-07-10 17:11:40 -04:00
|
|
|
}
|
|
|
|
|
2013-08-26 15:00:51 -04:00
|
|
|
# See how we were called.
|
2013-07-10 17:11:40 -04:00
|
|
|
case "$1" in
|
|
|
|
start)
|
|
|
|
start
|
|
|
|
;;
|
|
|
|
stop)
|
|
|
|
stop
|
|
|
|
;;
|
|
|
|
status)
|
2013-08-26 15:00:51 -04:00
|
|
|
status -p "$PIDFILE" "$SSLH"
|
|
|
|
RETVAL=$?
|
2013-07-10 17:11:40 -04:00
|
|
|
;;
|
|
|
|
restart)
|
|
|
|
stop
|
|
|
|
start
|
|
|
|
;;
|
|
|
|
*)
|
2013-08-26 15:00:51 -04:00
|
|
|
echo "Usage: $PROGNAME {start|stop|status|restart}"
|
|
|
|
RETVAL=2
|
2013-07-10 17:11:40 -04:00
|
|
|
;;
|
|
|
|
esac
|
2013-07-10 17:12:42 -04:00
|
|
|
|
2013-08-26 15:00:51 -04:00
|
|
|
exit $RETVAL
|