ipn/ipnlocal: always stop the engine on auth when key has expired

If seamless key renewal is enabled, we typically do not stop the engine
(deconfigure networking). However, if the node key has expired there is
no point in keeping the connection up, and it might actually prevent
key renewal if auth relies on endpoints routed via app connectors.

Fixes tailscale/corp#5800

Signed-off-by: Anton Tolchanov <[email protected]>
This commit is contained in:
Anton Tolchanov authored and Anton Tolchanov committed 2024-04-24 14:47:57 +01:00
1 parent 1d3e77f373
commit 31e6bdbc82
1 file changed
+5 -2
+5 -2
View File
@@ -2440,9 +2440,12 @@ func (b *LocalBackend) popBrowserAuthNow() {
b.authURL = "" // but NOT clearing authURLSticky
b.mu.Unlock()
b.logf("popBrowserAuthNow: url=%v", url != "")
b.logf("popBrowserAuthNow: url=%v, key-expired=%v, seamless-key-renewal=%v", url != "", b.keyExpired, b.seamlessRenewalEnabled())
if !b.seamlessRenewalEnabled() {
// Deconfigure the local network data plane if:
// - seamless key renewal is not enabled;
// - key is expired (in which case tailnet connectivity is down anyway).
if !b.seamlessRenewalEnabled() || b.keyExpired {
b.blockEngineUpdates(true)
b.stopEngineAndWait()
}