fix: drop 8.8.8.8 from default-nameserver to survive enterprise SSL VPN UDP/53 interception#73
Merged
Conversation
…PN UDP/53 interception The default-nameserver list (used to bootstrap-resolve DNS server domains like doh.pub before DoH/DoT can be used) included 8.8.8.8 in two code paths: - applyTunConfig (Enhanced Mode/TUN bring-up) - clashWriteEnhancedConfig (writing enhanced config to disk) When users run an enterprise SSL VPN that intercepts UDP/53 (e.g. SangFor Easy Connect, which DNATs all dport 53 UDP to its internal DNS proxy), the bootstrap query to 8.8.8.8:53 times out, blocking DoH/DoT from coming online. nameserver/fallback lists already preferred DoH (https://) + DoT (tls://...:853) so the in-flight queries themselves are safe — but bootstrap is still UDP. Replace 8.8.8.8 with 119.29.29.29 (Tencent DNSPod, domestic) for parity with nameserverPolicyForConvertedProxies (lines 491-495, already domestic-only). Domestic DNS UDP/53 is generally allowed by enterprise VPN policies because corporate DNS itself usually forwards to upstream domestic resolvers. No new dependencies, no API change, no template-version bump required. Companion to ClashX-Pro/ClashX#20 (which aligned that project's share-link Go DNS defaults with our DoH/DoT design).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Removes
8.8.8.8from the bootstrapdefault-nameserverlist in two code paths, eliminating the last UDP/53 dependency on a public foreign DNS server. Companion to ClashX-Pro/ClashX#20 — which fixed the same class of issue in our sister project.Background
default-nameserveris the bootstrap resolver used before DoH/DoT can come online — it's the resolver that turnsdoh.pubinto an IP so the realnameserverlist can be queried over HTTPS. Because of that bootstrap role, mihomo requiresdefault-nameserverentries to be plain IPs (not URLs), so they always go over plain UDP/53.Two locations still listed
8.8.8.8:applyTunConfig— Enhanced Mode (TUN) bring-upclashWriteEnhancedConfig— writing the enhanced config to diskUsers on networks that intercept
dport 53UDP — most prominently SangFor Easy Connect (Chinese enterprise SSL VPN), which installs a PF DNAT rule redirecting all UDP/53 traffic to its internal DNS proxy at127.0.0.1:5373— see the bootstrap query to8.8.8.8:53time out. The downstream DoH/DoT lookups never get a chance because their server hostnames can't be resolved.The
nameserver/fallbacklists in the same file already prefer DoH (https://) + DoT (tls://...:853), so once bootstrap completes, in-flight DNS is safe. This PR just patches the remaining bootstrap-stage hole.Change
Two-line replacement:
8.8.8.8→119.29.29.29(Tencent DNSPod, domestic) in both default-nameserver lists.```diff
if len(rawCfg.DNS.DefaultNameserver) == 0 {
rawCfg.DNS.DefaultNameserver = []string{
"114.114.114.114",
"223.5.5.5",
}
}
```
```diff
if dns["default-nameserver"] == nil {
}
```
Now field-for-field consistent with
nameserverPolicyForConvertedProxies(lines 491-495), which has been domestic-only since day one.Why Domestic Plain UDP/53 Is Safe
Enterprise VPN clients on macOS commonly DNAT
dport 53to a corporate DNS forwarder. That forwarder will resolve domestic names (the corporate resolver itself almost always forwards to upstream domestic resolvers like Aliyun/CNNIC), it just can't reach8.8.8.8directly. So:223.5.5.5(Aliyun) — resolved by the corporate forwarder, returns correct A record fordoh.pub114.114.114.114(114DNS) — same119.29.29.29(Tencent) — sameAfter bootstrap completes, the real
nameserverlist (DoH/DoT) takes over, and from then on everything goes over TCP/443 or TCP/853, completely bypassing the PF DNAT rule on UDP/53.Verification
LSP clean. The only remaining
8.8.8.8literal inmain.goistls://8.8.8.8:853(Cloudflare/Google DoT fallback at line 508), which intentionally stays — DoT is encapsulated in TCP/853 and is unaffected by UDP/53 interception.Impact
default-nameserveris empty).