git: 94f671fb0ef2 - main - security/tailscale: Robustify rc.d script
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Fri, 13 May 2022 04:12:27 UTC
The branch main has been updated by ashish:
URL: https://cgit.FreeBSD.org/ports/commit/?id=94f671fb0ef24b2b94a4b6d66228028a82e23b5d
commit 94f671fb0ef24b2b94a4b6d66228028a82e23b5d
Author: Ashish SHUKLA <ashish@FreeBSD.org>
AuthorDate: 2022-05-11 04:37:09 +0000
Commit: Ashish SHUKLA <ashish@FreeBSD.org>
CommitDate: 2022-05-13 04:11:09 +0000
security/tailscale: Robustify rc.d script
Check for orphaned network interface at the time of start, and if such
an interface exists then destroy it before starting tailscaled. When
tailscaled terminates unexpectedly it fails to cleanup, leaving the
orphaned interface behind. This results in it failing to start until
the interface is cleaned up, making it unsuitable for being monitored
by a service monitoring software (e.g. monit)
Reported by: ler
---
security/tailscale/Makefile | 1 +
security/tailscale/files/tailscaled.in | 6 ++++++
2 files changed, 7 insertions(+)
diff --git a/security/tailscale/Makefile b/security/tailscale/Makefile
index 0a336ea028c9..93a2c9db290a 100644
--- a/security/tailscale/Makefile
+++ b/security/tailscale/Makefile
@@ -1,5 +1,6 @@
PORTNAME= tailscale
PORTVERSION= 1.24.2
+PORTREVISION= 1
DISTVERSIONPREFIX= v
CATEGORIES= security
diff --git a/security/tailscale/files/tailscaled.in b/security/tailscale/files/tailscaled.in
index b1cb480b92bc..9300e901357c 100644
--- a/security/tailscale/files/tailscaled.in
+++ b/security/tailscale/files/tailscaled.in
@@ -65,6 +65,12 @@ stop_postcmd="${name}_poststop"
tailscaled_start()
{
+ # Check for orphaned tailscale network interface
+ # And if it exists, then destroy it
+ /sbin/ifconfig ${tailscale_tap_dev} >/dev/null 2>&1 && (
+ /sbin/ifconfig ${tailscale_tap_dev} | fgrep -qw PID ||
+ /sbin/ifconfig ${tailscale_tap_dev} destroy
+ )
env CACHE_DIRECTORY=/var/db/tailscale /usr/sbin/daemon -f ${tailscaled_syslog_output_flags} -p ${pidfile} ${procname} --port ${tailscaled_port}
}