Skip to content

DNS sovereignty: Firefox canary, Private Relay switch, DoT / DoH refusals (#45) - #76

Merged
Cd1s merged 1 commit into
mainfrom
feat/dns-sovereignty
Sep 26, 2026
Merged

Cd1s merged 1 commit into
mainfrom
feat/dns-sovereignty

Conversation

@Cd1s

@Cd1s Cd1s commented Sep 26, 2026

Copy link
Copy Markdown
Owner

What

New dns.sovereignty block:

key default effect
firefox_canary on use-application-dns.net → NXDOMAIN, so Firefox does not turn DoH on by itself
private_relay allow block: mask.icloud.com / mask-h2.icloud.com → NXDOMAIN
block_dot off LAN → port 853 (TCP DoT / UDP DoQ) refused at once
doh_blocklist_file — IPs / CIDRs of public DoH resolvers; LAN → 443 of them refused (TCP and HTTP/3)
  • Both dnsmasq instances (main and proxy) answer the NXDOMAIN names.
  • The refusals live in their own chain, dns_guard (prerouting, priority mangle − 1). It runs before the policy marks and the proxy's tproxy, so a resolver inside a proxied range is refused, not tunnelled. It matches only LAN-side bridges and never the router's own addresses.
  • doh_blocklist_file: a bad line stops the render; the error names the line number but never echoes the line. It is a *_file key, so agents and API tokens cannot set it.
  • Web UI: DNS › 基本 gains a 防绕过 card.

Why

Encrypted DNS that bypasses the router skips local names, the DNS split, policy routes by domain and the proxy's fake-ip split. ECH doesn't matter here, because the split keys on the DNS name, not the TLS SNI.

Verification

  • Go tests: defaults, validation, blocklist parsing. The golden home dnsmasq.conf gains only the canary line.
  • tools/ci.d/dns.sh: the lab dnsmasq, run with no upstream, answers use-application-dns.net, mask.icloud.com and mask-h2.icloud.com with NXDOMAIN.
  • tools/ci.d/fw.sh, real packets through the lab ruleset:
    • LAN and guest → 853, and → 443 of a listed resolver, are refused over IPv4 and IPv6.
    • DoT to a proxied range is refused before a transparent socket can take it.
    • The router's own 853 and the resolver's other ports are still reachable.
  • nft -c of the chain passes on a 6.18 kernel.
  • sh tools/ci.sh: ALL CHECKS PASSED.

Closes #45

https://claude.ai/code/session_01HWeUjo1dmS7gBkCYHrVjCr

…DoH refusals

Keeps LAN devices on the router's DNS, which local names, the DNS split, policy routes by domain
and the proxy's fake-ip split rely on (dns.sovereignty):

- firefox_canary (default on): use-application-dns.net answers NXDOMAIN.
- private_relay: block answers NXDOMAIN for mask.icloud.com / mask-h2.icloud.com (default allow).
- block_dot: LAN -> port 853 (TCP DoT, UDP DoQ) refused at once.
- doh_blocklist_file: IPs / CIDRs of public DoH resolvers; LAN -> 443 of them refused (TCP, HTTP/3).

Both dnsmasq instances answer the NXDOMAIN names. The refusals are a chain of their own (dns_guard,
prerouting mangle - 1) ahead of the policy marks and the proxy's tproxy, so a resolver inside a
proxied range is refused rather than tunnelled.

Tests, real-packet CI (lab ruleset, lab dnsmasq), web UI card, docs/modules/dns.md.

Closes #45

Claude-Session: https://claude.ai/code/session_01HWeUjo1dmS7gBkCYHrVjCr
@Cd1s
Cd1s merged commit 76f9e0a into main Sep 26, 2026
2 checks passed
@Cd1s
Cd1s deleted the feat/dns-sovereignty branch September 26, 2026 01:05
@Cd1s Cd1s mentioned this pull request Sep 26, 2026
52 tasks done
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.

提议:DNS 主导权(防设备绕过路由器 DNS:Firefox 金丝雀、DoT/DoH 管控)

1 participant