3
# /etc/rc.d/init.d/sslh
4
# sslh This shell script takes care of starting and stopping
5
# sslh - a daemon switching incoming connection between SSH and SSL/HTTPS servers
7
# Author: Andre Krajnik akrajnik@gmail.com
11
# chkconfig: 2345 13 87
13
# description: sslh - a daemon switching incoming connection between SSH and SSL/HTTPS servers
3
# sslh Startup script for the SSL/SSH multiplexer
6
# description: Sslh accepts connections on specified ports, and forwards
7
# them further based on tests performed on the first data
8
# packet sent by the remote client.
10
# config: /etc/sslh.cfg
11
# config: /etc/sysconfig/sslh
12
# pidfile: /var/run/sslh/sslh.pid
15
# Andre Krajnik akrajnik@gmail.com - 2010-03-20
16
# Julien Thomas julthomas@free.fr - 2013-08-25
15
18
# Source function library.
16
19
. /etc/init.d/functions
18
# ./sslh -p 0.0.0.0:8443 -l 127.0.0.1:443 -s 127.0.0.1:22
20
SSLH="/usr/local/sbin/sslh"
21
PIDFILE="/var/run/sslh"
23
OPTIONS="--user nobody --pidfile $PIDFILE -p 0.0.0.0:8443 --ssl 127.0.0.1:443 --ssh 127.0.0.1:22"
25
21
if [ -f /etc/sysconfig/sslh ]; then
26
22
. /etc/sysconfig/sslh
26
SSLH=${SSLH:-/usr/sbin/sslh-select}
27
SSLH_LANG=${SSLH_LANG:-C}
28
CONFIG=${CONFIG:-/etc/sslh.cfg}
29
PIDFILE=${PIDFILE:-/var/run/sslh/sslh.pid}
30
LOCKFILE=${LOCKFILE:-/var/lock/subsys/sslh}
31
STOP_TIMEOUT=${STOP_TIMEOUT:-10}
30
echo -n "Starting SSL-SSH-Switch: "
31
if [ -f $PIDFILE ]; then
33
echo sslh already running: $PID
39
[ $RETVAL -eq 0 ] && touch $PIDFILE
35
echo -n "Starting $PROGNAME: "
36
LANG=$SSLH_LANG daemon --pidfile="$PIDFILE" \
37
${SSLH_USER:+--user="${SSLH_USER}"} \
38
"$SSLH" ${CONFIG:+-F "$CONFIG"} "$OPTIONS"
41
[ $RETVAL = 0 ] && touch "$LOCKFILE"
46
echo -n "Shutting down SSL-SSH-Switch: "
46
echo -n "Stopping $PROGNAME: "
47
killproc -p "$PIDFILE" -d "$STOP_TIMEOUT" "$SSLH"
50
[ $RETVAL = 0 ] && rm -f "$LOCKFILE" "$PIDFILE"
53
# See how we were called.