|
4 | 4 | # |
5 | 5 |
|
6 | 6 | # Should probably in the future allow running as non-root |
7 | | -# and enable multiple interfaces in some cleaner way. |
| 7 | +# and enable multiple interfaces in some way in the future. |
8 | 8 |
|
9 | 9 | # PROVIDE: tangd |
10 | 10 | # REQUIRE: NETWORKING DAEMON |
11 | | -# KEYWORD: nojail |
12 | 11 |
|
13 | 12 | . /etc/rc.subr |
14 | 13 |
|
15 | 14 | name="tangd" |
16 | 15 | desc="Network Presence Binding Daemon (tang)" |
17 | 16 | rcvar="tangd_enable" |
18 | | -command="/usr/local/bin/socat" |
19 | 17 |
|
20 | 18 | load_rc_config $name |
21 | 19 | : ${tangd_enable:=no} |
22 | | -: ${tangd_ip="127.0.0.1"} |
23 | 20 | : ${tangd_port="8888"} |
24 | 21 | : ${tangd_jwkdir="@jwkdir@"} |
25 | 22 | : ${tangd_logfile="/var/log/tang"} |
26 | | -: ${tangd_executable="@libexecdir@/tangd"} |
27 | 23 |
|
28 | | -pidfile="/var/run/${name}.pid" |
29 | | -required_files="@libexecdir@/${name}" |
30 | 24 | required_dirs="${tangd_jwkdir}" |
31 | 25 |
|
32 | | -start_postcmd="${name}_poststart" |
33 | | -_tangd_listen_args="TCP-LISTEN:${tangd_port},bind=${tangd_ip},fork" |
34 | | -command_args="${_tangd_listen_args} SYSTEM:\"${tangd_executable} ${tangd_jwkdir} 2>> ${tangd_logfile} \" &" |
35 | | - |
36 | | -# Since we may not be the only socat running we can't use the built-in process |
37 | | -# management, so we'll need to use a pid file and find the pid from unique arguments. |
38 | | -tangd_poststart() { |
39 | | - ps_pid=`ps ax -o pid= -o command= | grep ${_tangd_listen_args} | grep -v grep | awk '{print $1}'` |
40 | | - if [ -z "$ps_pid" ]; then |
41 | | - err 1 "Cannot get pid for ${command} ${command_args}" |
42 | | - fi |
43 | | - echo $ps_pid > ${pidfile} |
44 | | - return $? |
45 | | -} |
| 26 | +command="@libexecdir@/${name}" |
| 27 | +command_args="-p ${tangd_port} -l ${tangd_jwkdir} 2>> ${tangd_logfile} &" |
46 | 28 |
|
47 | 29 | run_rc_command "$1" |
0 commit comments