Skip to content

Commit d0fb068

Browse files
committed
A few small changes for BSD support after standalone changes and keep up with Ubuntu in tests.
1 parent 3d6efb1 commit d0fb068

File tree

3 files changed

+10
-21
lines changed

3 files changed

+10
-21
lines changed

.github/workflows/build.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ jobs:
1717
- debian:testing
1818
- debian:latest
1919
- ubuntu:rolling
20+
- ubuntu:jammy
21+
- ubuntu:focal
2022
- ubuntu:bionic
2123
stable: [true]
2224
include:

tests/helpers

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,12 @@ random_port() {
3535
}
3636

3737
check_if_port_listening() {
38+
if [ -n "${TANG_BSD}" ]; then
39+
sockstat -nl|grep "[\:\.]${1}" >/dev/null 2>&1
40+
else
41+
3842
ss -anl|grep "[\:\.]${1}"|grep LISTEN >/dev/null 2>&1
43+
fi
3944
}
4045

4146
wait_for_port()

units/tangd.rc.in

Lines changed: 3 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -4,44 +4,26 @@
44
#
55

66
# 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.
88

99
# PROVIDE: tangd
1010
# REQUIRE: NETWORKING DAEMON
11-
# KEYWORD: nojail
1211

1312
. /etc/rc.subr
1413

1514
name="tangd"
1615
desc="Network Presence Binding Daemon (tang)"
1716
rcvar="tangd_enable"
18-
command="/usr/local/bin/socat"
1917

2018
load_rc_config $name
2119
: ${tangd_enable:=no}
22-
: ${tangd_ip="127.0.0.1"}
2320
: ${tangd_port="8888"}
2421
: ${tangd_jwkdir="@jwkdir@"}
2522
: ${tangd_logfile="/var/log/tang"}
26-
: ${tangd_executable="@libexecdir@/tangd"}
2723

28-
pidfile="/var/run/${name}.pid"
29-
required_files="@libexecdir@/${name}"
3024
required_dirs="${tangd_jwkdir}"
3125

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} &"
4628

4729
run_rc_command "$1"

0 commit comments

Comments
 (0)