aboutsummaryrefslogtreecommitdiff
path: root/net/iodine/files/iodined.in
blob: bf9c6008fc702d711ff2771341c73069a857f16c (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
#!/bin/sh

# PROVIDE: iodined
# REQUIRE: LOGIN
#
# Add the following lines to /etc/rc.conf.local or /etc/rc.conf
# to enable this service:
#
# iodined_enable (bool):       Set to NO by default.
#               Set it to YES to enable iodined.
# iodined_password (string):   Not set by default, mandatory.
#               Password used for client authentication.
#               Note that the password will be visible to ps(1) et al.
# iodined_domain (string):     Not set by default, mandatory.
#               Tunnel domain delegated to iodined, e.g. "t.example.net".
# iodined_addr (string):       Set to 172.16.0.1 by default.
#               IPv4 address used for the daemon end of the tunnel.
# iodined_flags (string):      Set to "-u _iodined -t /var/empty" by default.
#               Additional flags to iodined, see manual page.
#

. /etc/rc.subr

name="iodined"
rcvar=${name}_enable

command=%%PREFIX%%/sbin/${name}

load_rc_config $name

: ${iodined_enable="NO"}
: ${iodined_password=""}
: ${iodined_domain=""}
: ${iodined_addr="172.16.0.1"}
: ${iodined_flags="-u _iodined -t /var/empty"}

command_args="-P $iodined_password $iodined_addr $iodined_domain"

start_precmd="iodined_precmd"

iodined_precmd()
{
	if checkyesno iodined_enable; then
		if [ -z "$iodined_password" ]; then
			err 1 'Must set $iodined_password in rc.conf or rc.conf.local'
		fi
		if [ -z "$iodined_domain" ]; then
			err 1 'Must set $iodined_domain in rc.conf or rc.conf.local'
		fi
		if [ -z "$iodined_addr" ]; then
			err 1 'Must set $iodined_addr in rc.conf or rc.conf.local'
		fi
	fi
}

run_rc_command "$1"