-
Notifications
You must be signed in to change notification settings - Fork 0
fix(fish): route DNS through exit node so vpn works #2084
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -3,21 +3,23 @@ function _vpn_function --description "Connect/disconnect Tailscale exit node thr | |
|
|
||
| switch "$argv[1]" | ||
| case on | ||
| tailscale set --exit-node=$kyber_host | ||
| # --accept-dns=true routes DNS through the exit node; without it | ||
| # DNS queries break while tunnelled and name resolution fails. | ||
| tailscale set --exit-node=$kyber_host --accept-dns=true | ||
| and echo "VPN connected through kyber" | ||
| case off | ||
| tailscale set --exit-node= | ||
| tailscale set --exit-node= --accept-dns=false | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nit: add a symmetric comment on the |
||
| and echo "VPN disconnected" | ||
| case status | ||
| tailscale status | ||
| case '' | ||
| # Toggle: if exit node is set, turn off; otherwise turn on | ||
| set -l current (tailscale status --json 2>/dev/null | jq -r '.ExitNodeStatus.ID // empty') | ||
| if test -n "$current" | ||
| tailscale set --exit-node= | ||
| tailscale set --exit-node= --accept-dns=false | ||
| and echo "VPN disconnected" | ||
| else | ||
| tailscale set --exit-node=$kyber_host | ||
| tailscale set --exit-node=$kyber_host --accept-dns=true | ||
| and echo "VPN connected through kyber" | ||
| end | ||
| case '*' | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Latent:
offhard-disablesaccept-dnsregardless of host baseline — This currently matchesnix-darwin/config/networking.nix:33-37, which activates withtailscale set --accept-dns=falsealongside the/etc/resolver/ts.netsplit-DNS setup, so on macOS it correctly restores the declared baseline. On a host that instead relies on Tailscale MagicDNS while the exit node is off (e.g. a future Linux/NixOS machine using this same fish function),vpn offwill flip--accept-dnstofalseand silently break.ts.netlookups until the user re-enables it. Worth either scoping this to macOS or reading the current preference before overwriting.