Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 18 Oct 2021 11:44:12 GMT
From:      Mikael Urankar <mikael@FreeBSD.org>
To:        ports-committers@FreeBSD.org, dev-commits-ports-all@FreeBSD.org, dev-commits-ports-main@FreeBSD.org
Subject:   git: d1557166daf3 - main - security/tailscale: Add tailscaled_exitnode_enable in rc script.
Message-ID:  <202110181144.19IBiC5J079342@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch main has been updated by mikael:

URL: https://cgit.FreeBSD.org/ports/commit/?id=d1557166daf359c493a37d7b3311289a95b4ee4d

commit d1557166daf359c493a37d7b3311289a95b4ee4d
Author:     Ollivier Robert <roberto@FreeBSD.org>
AuthorDate: 2021-10-18 10:39:39 +0000
Commit:     Mikael Urankar <mikael@FreeBSD.org>
CommitDate: 2021-10-18 11:43:57 +0000

    security/tailscale: Add tailscaled_exitnode_enable in rc script.
    
    PR:             259237
---
 security/tailscale/Makefile            |  1 +
 security/tailscale/files/tailscaled.in | 13 +++++++++++++
 2 files changed, 14 insertions(+)

diff --git a/security/tailscale/Makefile b/security/tailscale/Makefile
index ab6ae1d35a9b..cbf5a8db586a 100644
--- a/security/tailscale/Makefile
+++ b/security/tailscale/Makefile
@@ -1,6 +1,7 @@
 PORTNAME=	tailscale
 PORTVERSION=	1.14.6
 DISTVERSIONPREFIX=	v
+PORTREVISION=	1
 CATEGORIES=	security
 
 MAINTAINER=	mikael@FreeBSD.org
diff --git a/security/tailscale/files/tailscaled.in b/security/tailscale/files/tailscaled.in
index ffbc5350f7de..b1cb480b92bc 100644
--- a/security/tailscale/files/tailscaled.in
+++ b/security/tailscale/files/tailscaled.in
@@ -17,6 +17,8 @@
 #						Default is "info". See daemon(8).
 # tailscaled_syslog_output_facility (str):	Set syslog facility if syslog enabled.
 #						Default is "daemon". See daemon(8).
+# tailscaled_exitnode_enable (bool):	Set it to YES to announce tailscaled as
+#                                       an exit node. Default is "NO".
 
 . /etc/rc.subr
 
@@ -27,6 +29,7 @@ load_rc_config $name
 
 : ${tailscaled_enable:="NO"}
 : ${tailscaled_port:="41641"}
+: ${tailscaled_exitnode_enable:="NO"}
 
 DAEMON=$(/usr/sbin/daemon 2>&1 | grep -q syslog ; echo $?)
 if [ ${DAEMON} -eq 0 ]; then
@@ -51,11 +54,13 @@ fi
 
 pidfile=/var/run/${name}.pid
 procname="%%PREFIX%%/bin/${name}"
+ctlname="%%PREFIX%%/bin/tailscale"
 
 # XXX: Can we have multiple interfaces?
 tailscale_tap_dev="tailscale0"
 
 start_cmd="${name}_start"
+start_postcmd="${name}_poststart"
 stop_postcmd="${name}_poststop"
 
 tailscaled_start()
@@ -63,6 +68,14 @@ tailscaled_start()
 	env CACHE_DIRECTORY=/var/db/tailscale /usr/sbin/daemon -f ${tailscaled_syslog_output_flags} -p ${pidfile} ${procname} --port ${tailscaled_port}
 }
 
+tailscaled_poststart()
+{
+        if checkyesno tailscaled_exitnode_enable; then
+		logger -s -t tailscale "Enabling Exit node mode"
+                ${ctlname} up --advertise-exit-node
+        fi
+}
+
 tailscaled_poststop()
 {
 	/sbin/ifconfig ${tailscale_tap_dev} >/dev/null 2>&1 && (



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202110181144.19IBiC5J079342>