From aa5af06165c8c82e6a1bca15b81014cabae2c87b Mon Sep 17 00:00:00 2001 From: Sonia Appasamy Date: Thu, 2 Nov 2023 12:32:36 -0400 Subject: [PATCH] ipn/ipnlocal: include web client port in setTCPPortsIntercepted Updates tailscale/corp#14335 Signed-off-by: Sonia Appasamy --- ipn/ipnlocal/local.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/ipn/ipnlocal/local.go b/ipn/ipnlocal/local.go index 4102c1e5f..291e22c18 100644 --- a/ipn/ipnlocal/local.go +++ b/ipn/ipnlocal/local.go @@ -4210,6 +4210,9 @@ func (b *LocalBackend) ResetForClientDisconnect() { func (b *LocalBackend) ShouldRunSSH() bool { return b.sshAtomicBool.Load() && envknob.CanSSHD() } +// ShouldRunWebClient reports whether the web client is being run +// within this tailscaled instance. ShouldRunWebClient is safe to +// call regardless of whether b.mu is held or not. func (b *LocalBackend) ShouldRunWebClient() bool { return b.webClientAtomicBool.Load() } func (b *LocalBackend) setWebClientAtomicBoolLocked(nm *netmap.NetworkMap, prefs ipn.PrefsView) { @@ -4467,6 +4470,9 @@ func (b *LocalBackend) setTCPPortsInterceptedFromNetmapAndPrefsLocked(prefs ipn. if prefs.Valid() && prefs.RunSSH() && envknob.CanSSHD() { handlePorts = append(handlePorts, 22) } + if b.ShouldRunWebClient() { + handlePorts = append(handlePorts, 5252) + } b.reloadServeConfigLocked(prefs) if b.serveConfig.Valid() {