-
-
Notifications
You must be signed in to change notification settings - Fork 431
Description
Context: I'm using pfsense with unbound configured as its recursive resolver. pfsense automatically adds static dhcp mappings as local-data and local-data-ptr to the unbound configuration. It also adds a local-zone for the system domain (type is configurable; defaults to transparent.
Suppose my system domain is homelab.tld. I'm trying to set up a configuration with unbound that satisfies all of the following:
- Any
*.homelab.tld, where*is not defined anywhere (whetherlocal-data,forward-zone, orstub-zone) resolves to10.0.0.2 - Any
<host>.homelab.tldwhere<host>is the hostname of a dhcp static mapping resolves to the host's assigned ip - Same as above but for
PTRrecords - Any subdomain of
.offsite.homelab.tldis forwarded to another recursive resolver at10.1.0.2 - but requests to
public.offsite.homelab.tld, though are resolved via specific authoritative nameservers - Requests to
_acme-challenge.homelab.tldare recursed transparently - All DNS requests not directed to unbound are blocked
2-5 are fairly easy. The local-zone, local-data, and local-data-ptr added by pfsense take care of local hosts with static dhcp mappings. 4 is set up with a forward-zone, 5. with a stub-zone (this is to avoid 10.1.0.2 recursing it locally). 6 is a local-zone: ... transparent.
Everything except for 1 plays nicely. 1 sucks. It's a huge pain because unbound doesn't support CNAME in local-data. The typical way you'd set this up is with a local-zone: ... redirect, but then you can't have any other local-data, breaking 2 and 3.
An auth-zone with a zone file seemed promising because you can do a * IN CNAME homelab.tld and @ IN A<ip>, but it breaks the zones for 4, 5, and 6. I tried various combinations of for-upstream and for-downstream, but it didn't help. I considered adding extra NS records instead, but that not only defeats the purpose of having a recursive resolver, it also violates 7.
I've scoured the documentation, github issues, and the internet, but after a couple of days, I can't find a solution short of setting up a second DNS server which I'd like to avoid.
Am I missing anything? TIA!