For many months now, I have been running a patched WireGuard macOS app that enables a split DNS configuration. I would like to try to upstream my patches for split DNS.
There has been some interest in this patch: - "Mac APP DNS Search Domain" thread from July and August 2021 [1] - A commenter on my GitHub fork of wireguard-apple. What is split DNS? It allows sending DNS queries to a specific server based on the domain name. Systemd-resolved calls it a routing domain. Apple's Network Extension framework calls it a match domain. Split DNS is especially useful for internal DNS servers. For example, if corp.example.com is a routing domain for the DNS server at 192.0.2.1 (only accessible over WireGuard), then server.corp.example.com is resolved using 192.0.2.1 while www.example.com is resolved using some other DNS resolver (depending on the other network settings in macOS). The proposed patch adds new syntax to the wg-quick DNS= line. Specifically, a tilde prefixed domain is treated as a routing domain. Multiple routing domains can be added. Limitations: - Needs modifications to iOS UI to work on iOS. - Only matching routing domains are sent to the DNS servers specified in the DNS= config line. No separate fallback catch-all DNS server can be set. - Routing/match domains are also included in the list of search domains. This could be changed with the matchDomainsNoSearch API, but lacking more UI or config file changes to expose this option to the user, I went with the default. [1] https://lore.kernel.org/wireguard/[email protected]/T/ [2] https://github.com/slarew/wireguard-apple/commit/6ebc356d9e11ab91443e06de5e89f1af57fcdff8
