Skip to content

ipnlocal: support automatic exit node disablement when captive portal detected#13430

Open
agottardo wants to merge 1 commit intomainfrom
angott/captive-exit-node-disablement
Open

ipnlocal: support automatic exit node disablement when captive portal detected#13430
agottardo wants to merge 1 commit intomainfrom
angott/captive-exit-node-disablement

Conversation

@agottardo
Copy link
Copy Markdown
Contributor

@agottardo agottardo commented Sep 10, 2024

Introduces a new capability DisableExitNodeBehindCaptivePortal. When enabled and a captive portal is detected by the detection machinery introduced in v1.72, any zero route due to an active exit node is dropped by the backend until connectivity is re-established. This allows the user to authenticate with the captive portal web UI.

We're going to need another change (later) to additionally disable CorpDNS when a captive portal is detected, as in some configurations it might be impossible to reach the DNS resolvers behind the captive portal.

@agottardo agottardo force-pushed the angott/captive-exit-node-disablement branch from f75dfe4 to 72c9f0f Compare September 16, 2024 20:08
@agottardo agottardo requested a review from andrew-d September 16, 2024 20:08
@agottardo agottardo marked this pull request as ready for review September 16, 2024 20:09
@agottardo agottardo requested a review from a team as a code owner September 16, 2024 20:09
b.mu.Lock()
defer b.mu.Unlock()
res := b.ControlKnobs().DisableExitNodeBehindCaptivePortal.Load()
b.logf("wantsExitNodeDisablementBehindCaptivePortal = %v", res)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This could be pretty noisy in the false sense; do we want to log this at [v1], or maybe just in the true case? Especially since we log inside the if b.wantsExitNodeDisablementBehindCaptivePortal above.

}
}

b.logf("routerConfig: b.captiveDetected is %v", b.captiveDetected)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This log line is also quite verbose, IMO, since it'll get logged every time any part of the routerConfig changes.

b.logf("captive portal detected, dropping zero routes")
// If a captive portal is present, remove the zero routes (ipv4Default and ipv6Default)
// to allow the user to authenticate with the captive portal.
rs.Routes = slices.DeleteFunc(rs.Routes, isZeroRouteFunc)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I need to think a bit more about whether this is the right place for this, vs further up the stack; let me get back to you on that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants