feat(dns): add DNS over HTTPS (DoH) support via blocky#200
feat(dns): add DNS over HTTPS (DoH) support via blocky#200awlx wants to merge 2 commits intoCachyOS:developfrom
Conversation
Add a 'Custom' option to the DNS server dropdown allowing users to specify their own DNS server addresses and DoT hostname, addressing use cases like NextDNS or other custom resolvers. Changes: - Add 'Custom' entry to DNS server combo box with IPv4, IPv6, and DoT hostname input fields - Use NetworkManager's native 'address#hostname' notation to persist DoT hostnames across restarts - Read back DoT state and hostname from NM on startup - Add SNI hostname validation (RFC-compliant DNS labels) - Add 'set-custom' CLI subcommand for custom DNS from command line - Fix preset servers to include DoT hostname in addr#hostname format - Add i18n strings for custom DNS to all 31 locales Closes: CachyOS#144
vnepogodin
left a comment
There was a problem hiding this comment.
looks good overall, besides AUR package
|
Found a bug after applying the DoH config and restarting |
|
Ok, it's now fixed and tested all kinds of scenarios:
|
51b7e89 to
2bfe65b
Compare
There was a problem hiding this comment.
Pull request overview
Adds DNS-over-HTTPS (DoH) support by introducing a local blocky DNS proxy (127.0.0.1:53) and wiring it into both the GUI DNS page and the CLI, alongside existing DoT/custom DNS functionality.
Changes:
- Add DoH toggle/support for preset providers and custom servers (GUI + CLI), using
blockyas a local proxy. - Generate/read
blockyYAML config to persist and detect active DoH server across restarts. - Adjust NetworkManager DNS application/reset logic and extend i18n keys for new UI/CLI strings.
Reviewed changes
Copilot reviewed 35 out of 35 changed files in this pull request and generated 9 comments.
Show a summary per file
| File | Description |
|---|---|
src/pages/dns.rs |
GUI: add DoH toggle, custom DNS fields (including DoH URL), and apply logic for DoH via blocky |
src/dns.rs |
Add DoH URL map, blocky config generation + parsing helpers, and CLI arg extensions |
src/cli_handler.rs |
CLI: add --doh/custom DoH handling and show DoH URLs in list-servers |
src/actions.rs |
Implement blocky install/config/start flow, DoH NM wiring, and new DNS parsing helpers |
i18n/*/cachyos_hello.ftl |
Add new strings for DoH + custom DNS UI/CLI messages |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| enable-doh = Enable DNS over HTTPS (DoH) | ||
| doh-tooltip = Encrypt DNS queries using HTTPS via blocky local proxy (requires server support, installs blocky) | ||
| doh-blocky-install-failed = Failed to install blocky for DoH support! |
There was a problem hiding this comment.
New zh-CN locale entries for DoH/custom DNS are still in English (e.g. enable-doh, doh-tooltip, custom-dns-*). This is inconsistent with the rest of the zh-CN file and will show English UI text for Chinese users. Please provide Chinese translations (or, if the project convention is to keep untranslated strings elsewhere, consider documenting that and/or using a consistent fallback strategy).
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 35 out of 35 changed files in this pull request and generated 6 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 35 out of 35 changed files in this pull request and generated 5 comments.
Comments suppressed due to low confidence (2)
src/actions.rs:175
conn_name.replace('\'', "'\\'")does not correctly escape single quotes for use inside a single-quoted shell string (and can break the nmcli command / enable injection). Use the standard bash single-quote escape sequence ('\'') or a shared shell-escape helper, consistent with the escaping used forescaped_configabove.
src/actions.rs:265conn_name.replace('\'', "'\\'")is also used here and has the same incorrect single-quote escaping issue, which can break the command string passed tobash -c. Please switch to the correct bash-safe escaping ('\'') or a shared escape helper.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Add DoH support to the DNS settings page using blocky as a local DNS proxy. When DoH is enabled, blocky is installed (blocky-bin from AUR), configured with the selected server's DoH URL, and started as a systemd service. NetworkManager is pointed to 127.0.0.1 for resolution. Changes: - Add DoH URL map for 14 DNS servers that support DNS over HTTPS - Add blocky config generation with DoT-encrypted bootstrap DNS when the server supports it, falling back to plaintext IPs otherwise - Add DoH checkbox to DNS settings GUI (mutually exclusive with DoT) - Add --doh flag to 'dns set' CLI subcommand (conflicts_with dot) - Add --doh and --doh-url flags to 'dns set-custom' for custom DoH servers, using the custom IPv4/IPv6 addresses and DoT hostname for bootstrap resolution - Add DoH URL input field to the custom DNS server form - Auto-install blocky-bin via paru with pkexec for GUI password prompt - Stop and disable blocky on DNS reset or when switching to DoT/plain - Show DoH support in 'dns list-servers' output - Add i18n strings for DoH to all 31 locales Built on top of CachyOS#196 (custom DNS server support). Note: DNS over QUIC (DoQ) can be added once blocky ships with 0xERR0R/blocky#2013 (DoQ upstream support) Addresses: CachyOS#156, CachyOS#144
|
@ptr1337 @vnepogodin all the relevant Copilot suggestions should now be addressed. I tested all the combinations again and it works for me :). As a follow-up (don't want to over do this PR), I wonder if when pressing "reset" the selection should jump to "DHCP (automatic)" so people clearly see that none of the DNS servers is used. Same for the defaults on first start. I can add a separate PR for that if it's something you are interested in, otherwise this now works :). |
|
Will review in the coming days. Yeah "reset" should reset to the previous state without CachyOS Hello modifications |
|
Yep, it does that already. I just thought of also making that visually more clear. But as said, it's probably something for a follow-up PR for now the behavior is the same as before :). |
Adds DNS over HTTPS (DoH) support using blocky as a lightweight local DNS proxy. When DoH is enabled, blocky handles resolution over HTTPS and NetworkManager points to
127.0.0.1.Built on top of #196 (custom DNS server support).
What changed
DNS over HTTPS (DoH)
127.0.0.1:53tcp-tls:hostnamewithips:list) when the server supports DoT, falls back to plaintext IPs otherwiseblockyinstalled from CachyOS repo viapacmanwithpkexecGUI password promptstrictfor predictable resolution order--dohflag ondns setsubcommandCustom DNS with DoH
dns set-customgets--dohand--doh-urlflagsNetworkManager hardening
ipv4.ignore-auto-dns yesandipv6.ignore-auto-dns yeswhen setting DNS (both DoT and DoH) to prevent DHCP-provided DNS servers from leaking alongside the configured encrypted serversignore-auto-dns nofor both protocolsi18n
Why blocky over dnscrypt-proxy
tcp-tls:upstream withips:for encrypted bootstrap, dnscrypt-proxy only supports plaintext bootstrapMore details on blocky: https://0xerr0r.github.io/blocky/latest/
Testing
Tested on CachyOS with NetworkManager 1.52, systemd-resolved, and blocky 0.29.0:
cachyos-hello dns set -c "Starlink" -s cloudflare --doh— sets Cloudflare with DoH enabledcachyos-hello dns set-custom -c "Starlink" --ipv4 "45.90.28.220,45.90.30.220" --doh --doh-url "https://dns.nextdns.io/eb9cb4" --dot-hostname "eb9cb4.dns.nextdns.io"— custom NextDNS DoH with DoT bootstrapcachyos-hello dns set-custom -c "Starlink" --ipv4 "45.90.28.220" --doh --doh-url "https://dns.nextdns.io/eb9cb4"— custom DoH without DoT hostname (plaintext bootstrap)cachyos-hello dns list-servers— shows DoH URLs alongside DoT hostnamescachyos-hello dns reset -c "Starlink"— resets DNS, stops blocky, restores DHCPdig @127.0.0.1tcp-tls:cloudflare-dns.comwith IPs when DoT availableresolvectl query --cache=noshowsencrypted transport: yesfor DoTignore-auto-dnsprevents DHCP DNS leaks on both IPv4 and IPv6Related issues
Future: DNS over QUIC (DoQ)
DoQ support can be added with minimal changes once blocky ships 0xERR0R/blocky#2013. The implementation would be a new
doq://upstream URL in the blocky config — no architectural changes needed.