iOS: leak-proof kill switch — protect engine sockets so includeAllNetworks doesn't collapse the connection #6708
VishalDobariya26
started this conversation in
Ideas & Feature Requests
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Before posting
Product area
Mobile app
Problem or use case
As a developer integrating the NetBird gomobile SDK into an iOS app
(NEPacketTunnelProvider with an exit node advertising 0.0.0.0/0),
I want to offer a leak-proof kill switch — no traffic ever leaves outside the tunnel, including during reconnects.
Because this is impossible on iOS today:
includeAllNetworks captures the engine's OWN signal/relay sockets and loops them into the tunnel. (Peer was relayed in our tests.)
Proposed solution
Provide one (or both) on the mobile SDK:
A) Protect the engine's own sockets so they stay OFF the tunnel interface (equivalent to WireGuard-go's protect() / bind-to-interface / socket mark). This makes includeAllNetworks usable directly — no app-side exclusions needed.
Preferred: cleanest and most robust.
B) If A isn't feasible, expose the signal, relay/TURN, and management endpoints currently in use (getters + a change notification), plus a supported way to update the exclusion set without a full tunnel reset, so integrators can maintain excludedRoutes dynamically.
Acceptance: an iOS integrator can enable includeAllNetworks (or an SDK-provided "block non-tunnel traffic" mode) without the control plane collapsing, so no traffic egresses outside the tunnel at any point, including during reconnects.
Alternatives or workarounds considered
Community impact and priority
Examples from other tools or products
Commercial iOS VPNs (NordVPN, Proton VPN, Mullvad) ship leak-proof kill switches by controlling their own WireGuard/IKEv2 stack and using includeAllNetworks while excluding their own server endpoints. WireGuard-go keeps its socket off the tunnel via protect()/bind-to-interface.
Security, privacy, and compatibility considerations
Without this, an iOS user's real IP and DNS can leak during reconnects — a privacy gap for a VPN product. The requested fix (protecting the engine's own sockets) is a standard technique and should be transparent to other platforms and existing behavior.
Implementation ideas
Mirror WireGuard-go's protect() / bind-to-interface / socket-mark so the engine's management, signal, and relay sockets never route over the utun. Alternatively, expose those endpoints via the SDK with a change callback so integrators can maintain excludedRoutes dynamically (without a tunnel reset).
Are you willing to help?
Not at this time.
Additional context
No response
All reactions