Skip to content

Can't create a wildcard for top level of a zone #1423

@kaysond

Description

@kaysond

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:

  1. Any *.homelab.tld, where * is not defined anywhere (whether local-data, forward-zone, or stub-zone) resolves to 10.0.0.2
  2. Any <host>.homelab.tld where <host> is the hostname of a dhcp static mapping resolves to the host's assigned ip
  3. Same as above but for PTR records
  4. Any subdomain of .offsite.homelab.tld is forwarded to another recursive resolver at 10.1.0.2
  5. but requests to public.offsite.homelab.tld, though are resolved via specific authoritative nameservers
  6. Requests to _acme-challenge.homelab.tld are recursed transparently
  7. 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!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions