xref: /OK3568_Linux_fs/buildroot/package/sslh/S35sslh (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1#!/bin/sh
2#
3# Starts the SSLH server
4#
5
6# default setup : listen on port 8090 forward ssh traffic to
7# localhost:22 and http traffic to localhost:80
8SSLH_ARGS="--listen 0.0.0.0:8090 --ssh 127.0.0.1:22 --http 127.0.0.1:80"
9
10# Allow a few customizations from a config file (overrides
11# default setup)
12test -r /etc/default/sslh && . /etc/default/sslh
13
14start() {
15	SSLH_ARGS="$SSLH_ARGS --user root"
16	echo -n "Starting sslh: "
17	start-stop-daemon -S -q -p /var/run/sslh.pid \
18		--exec /usr/sbin/sslh -- $SSLH_ARGS
19	[ $? = 0 ] && echo "OK" || echo "FAIL"
20}
21
22stop() {
23	printf "Stopping sslh: "
24	start-stop-daemon -K -q -p /var/run/sslh.pid
25	[ $? = 0 ] && echo "OK" || echo "FAIL"
26}
27
28restart() {
29	stop
30	start
31}
32
33case "$1" in
34  start)
35	start
36	;;
37  stop)
38	stop
39	;;
40  restart|reload)
41	restart
42	;;
43  *)
44	echo "Usage: $0 {start|stop|restart}"
45	exit 1
46esac
47
48exit $?
49