NLnetLabs / unbound

Unbound is a validating, recursive, and caching DNS resolver.
https://nlnetlabs.nl/unbound
BSD 3-Clause "New" or "Revised" License
3.14k stars 358 forks source link

unbound-anchor: fails on exclusive DNS over TLS setups #597

Open swhite2 opened 2 years ago

swhite2 commented 2 years ago

Describe the bug See https://github.com/opnsense/core/issues/5441 for a detailed description of the issue, as well as the steps to take to reproduce the issue.

Short description: Blocking outbound packets on UDP/53 on a remote machine, while running DNS over TLS with DNSSEC support enabled, causes unbound-anchor to block for a long time, since no packets are leaving the network. A workaround would be to explicitly block outbound UDP/53 locally, however, this might have consequences for the validity of the root trust anchor over time, since any update cannot take place.

While it is obvious that the main DNSKEY UDP queries are therefore blocked, the failover as described in https://github.com/NLnetLabs/unbound/blob/master/smallapp/unbound-anchor.c#L49-L51 will also fail, as any DNS resolving is blocked - therefore a HTTPS connection cannot be established. Deleting the root.key file will result in Unbound not starting at all during boot/restart.

Expected behavior I would expect unbound-anchor to also resolve it's nameservers via port 853 over TLS, though it is unclear to me whether such a thing can be achieved via the configuration settings.

System:

Additional information Please refer to the linked issue mentioned above.

pemensik commented 2 years ago

Unbound anchor uses separate configuration and does not read unbound's configuration file. But you don't need unbound-anchor if you run full unbound.

Use auto-trust-anchor-file: "/var/lib/unbound/root.key" in your configuration. That should do exactly what unbound-anchor does, but should be able to use TLS servers for it.

pemensik commented 2 years ago

I think you can use unbound-anchor -C /etc/unbound/unbound.conf parameter, which makes it possible to prepare root.key only via TLS.

Or better use shared configuration in /etc/unbound/conf.d/tls.conf, which would be used in unbound automatically. Then you can use this config for unbound-anchor or unbound-host.