Skip to content

Commit fdebbb2

Browse files
committed
fix(tailscale): reset stale serve state on restart
- Purpose: backport PR #2600 to the 7.2 branch so Docker template changes clear old Tailscale Serve and Funnel exposure.\n- Before: switching a container from Funnel or Serve to No removed the env vars but left the persisted Tailscale serve/funnel config active after restart.\n- Why: the container hook only applied new serve settings when TAILSCALE_SERVE_PORT was present and never reset existing serve state stored in the Tailscale state directory.\n- What: reset both tailscale funnel and tailscale serve state after tailscale comes online, then reapply the current template-managed mode when configured.\n- How: add explicit reset commands before the Serve/Funnel capability check and before issuing any new serve or funnel command.\n- Source: cherry-picked from b90ca2f.
1 parent 2ac392d commit fdebbb2

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

share/docker/tailscale_container_hook

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -298,6 +298,13 @@ while true; do
298298
sleep 2
299299
done
300300

301+
# Clear persisted Serve/Funnel state before applying the current template mode.
302+
# Without this, switching the template from Funnel/Serve to No leaves the old
303+
# config active in the existing Tailscale state directory after restart.
304+
echo "Resetting Tailscale Serve/Funnel configuration"
305+
tailscale funnel reset >/dev/null 2>&1 || true
306+
tailscale serve reset >/dev/null 2>&1 || true
307+
301308
if [ ! -z "${TAILSCALE_SERVE_PORT}" ] && [ "$(tailscale status --json | jq -r '.CurrentTailnet.MagicDNSEnabled')" != "false" ] && [ -z "$(tailscale status --json | jq -r '.Self.Capabilities[] | select(. == "https")')" ]; then
302309
echo "ERROR: Enable MagicDNS and HTTPS on your Tailscale account to use Tailscale Serve/Funnel."
303310
echo "See: https://tailscale.com/kb/1153/enabling-https"

0 commit comments

Comments
 (0)