Files: 2781c75ff99cd5da7b25f6b883d78ff3de987308 / scripts / etc.rc.d.init.d.sslh.centos
1546 bytesRaw
1 | #!/bin/bash |
2 | # |
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 |
6 | # |
7 | # Author: Andre Krajnik akrajnik@gmail.com |
8 | # 2010-03-20 |
9 | # |
10 | # |
11 | # chkconfig: 2345 13 87 |
12 | # |
13 | # description: sslh - a daemon switching incoming connection between SSH and SSL/HTTPS servers |
14 | |
15 | # Source function library. |
16 | . /etc/init.d/functions |
17 | |
18 | # ./sslh -p 0.0.0.0:8443 -l 127.0.0.1:443 -s 127.0.0.1:22 |
19 | |
20 | SSLH="/usr/local/sbin/sslh" |
21 | PIDFILE="/var/run/sslh" |
22 | |
23 | OPTIONS="--user nobody --pidfile $PIDFILE -p 0.0.0.0:8443 --ssl 127.0.0.1:443 --ssh 127.0.0.1:22" |
24 | |
25 | if [ -f /etc/sysconfig/sslh ]; then |
26 | . /etc/sysconfig/sslh |
27 | fi |
28 | |
29 | start() { |
30 | echo -n "Starting SSL-SSH-Switch: " |
31 | if [ -f $PIDFILE ]; then |
32 | PID=`cat $PIDFILE` |
33 | echo sslh already running: $PID |
34 | exit 2; |
35 | else |
36 | daemon $SSLH $OPTIONS |
37 | RETVAL=$? |
38 | echo |
39 | [ $RETVAL -eq 0 ] && touch $PIDFILE |
40 | return $RETVAL |
41 | fi |
42 | |
43 | } |
44 | |
45 | stop() { |
46 | echo -n "Shutting down SSL-SSH-Switch: " |
47 | echo |
48 | killproc sslh |
49 | echo |
50 | rm -f $PIDFILE |
51 | return 0 |
52 | } |
53 | |
54 | case "$1" in |
55 | start) |
56 | start |
57 | ;; |
58 | stop) |
59 | stop |
60 | ;; |
61 | status) |
62 | status sslh |
63 | ;; |
64 | restart) |
65 | stop |
66 | start |
67 | ;; |
68 | *) |
69 | echo "Usage: {start|stop|status|restart}" |
70 | exit 1 |
71 | ;; |
72 | esac |
73 | exit $? |
74 | |
75 | |
76 | |
77 |
Built with git-ssb-web