1
0
Fork 0
mirror of https://gitlab.alpinelinux.org/alpine/aports.git synced 2025-07-17 22:15:17 +03:00
aports/testing/tang/tang.initd
Michał Polański aa9083b19e testing/tang: new aport
Server for binding data to network presence
https://github.com/latchset/tang
2022-06-17 04:04:54 +02:00

27 lines
703 B
Bash

#!/sbin/openrc-run
name="Tang server"
description="Server for binding data to network presence"
: ${tang_port:="7500"}
: ${tang_address:="127.0.0.1"}
: ${socat_address:="tcp-listen:$tang_port,bind=$tang_address,fork"}
command="/usr/bin/socat"
command_user="tang:tang"
command_args="$socat_address exec:/usr/libexec/tangd-wrapper"
command_background="yes"
extra_commands="rotate_keys"
description_rotate_keys="Perform rotation of tang keys"
pidfile="/run/$RC_SVCNAME.pid"
rotate_keys() {
ebegin "Performing rotation of tang keys"
su ${command_user%:*} -s /bin/sh -c "/usr/libexec/tangd-rotate-keys -d /var/lib/tang"
eend $?
}
start_pre() {
checkpath -d -m 0750 -o $command_user /var/lib/tang
}