summaryrefslogtreecommitdiff
path: root/net/sslh/files/sslh.in
blob: 6ed10885808df05ac948bb76f3decd680f588ab9 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
#!/bin/sh

# $FreeBSD$
#
# sslh startup script
#
# PROVIDE: sslh
# REQUIRE: login
# KEYWORD: shutdown

#
# Add the following to /etc/rc.conf[.local] to enable this service
#
# sslh_enable="YES"
#
# You can fine tune others variables too:
# sslh_fib="NONE"
# sslh_pidfile="/var/run/sslh.pid"
# sslh_ssltarget="localhost:443"
# sslh_sshtarget="localhost:22"
# sslh_sshtimeout="2"
# sslh_listening="0.0.0.0:8443"	
# sslh_uid="nobody"
# sslh_flags

sslh_setfib() {
	sysctl net.fibs >/dev/null 2>&1 || return 0

	case "$sslh_fib" in
	[Nn][Oo][Nn][Ee])
		;;
	*)
		command="setfib -F ${sslh_fib} ${command}"
		;;
	esac
} 

. /etc/rc.subr

name="sslh"
rcvar=`set_rcvar`

command="%%PREFIX%%/sbin/${name}"
start_precmd="sslh_setfib"

load_rc_config $name

sslh_enable=${sslh_enable:-"NO"}
sslh_fib=${sslh_fib:-"NONE"}
sslh_listening=${sslh_listening:-"0.0.0.0:443"}
sslh_sshtarget=${sslh_sshtarget:-"localhost:22"}
sslh_ssltarget=${sslh_ssltarget:-"localhost:8443"}
sslh_uid=${sslh_uid:-"nobody"}
sslh_sshtimeout=${sslh_sshtimeout:-"2"}
sslh_ssltarget=${sslh_ssltarget:-"localhost:8443"}

pidfile=${sslh_pidfile:-"/var/run/sslh.pid"}

command_args="-t ${sslh_sshtimeout} -p ${sslh_listening} \
	-l ${sslh_ssltarget} -s ${sslh_sshtarget} -P ${pidfile} \
	-u ${sslh_uid}"

run_rc_command "$1"