Unbound 1.22.0rc1 pre-release

Hi,

Unbound 1.22.0rc1 pre-release is available:
https://nlnetlabs.nl/downloads/unbound/unbound-1.22.0rc1.tar.gz
sha256 3c121143c99a927b411668d096c506beda31f9f7f91dc9c45dca4691e0b3898b
pgp https://nlnetlabs.nl/downloads/unbound/unbound-1.22.0rc1.tar.gz.asc

This release has an option to harden against unverified glue, it
is enabled with `harden-unverified-glue: yes`. It was contributed
by Karthik Umashankar from Microsoft. This protects Unbound against
bad glue, that is out of zone, by performing a lookup for it.
Because it uses the original information as a last resort if nothing
works, it should not give lookup failures, and add protection.

There are options to configure the scrubbing for NS records and
the CNAME scrubbing and the max global quota lookup limit from
previous security fix releases. They can be configured with the
options `iter-scrub-ns`, `iter-scrub-cname` and `max-global-quota`.

For redis use, with cachedb, it is possible to specify the
timeout for the initial connection separately from the timeout
for commands. With the options `redis-command-timeout: 20` and
`redis-connect-timeout: 200` they can be set separately, for
a longer connect attempt, but a short command timeout to keep
resolution faster.

It is possible to log with ISO8601 format with `log-time-iso: yes`
this also logs time in milliseconds. Useful if the server writes to
file, syslog may have its own format.

DNS over QUIC is support is added, if compiled with libngtcp2 and
with the openssl+quic that it uses. Use `--with-libngtcp2` for that,
and enable it with `quic-port: 853`. There is a post about it
on https://blog.nlnetlabs.nl/dns-over-quic-in-unbound [that is to
appear after the release].

Features
- Add iter-scrub-ns, iter-scrub-cname and max-global-quota
   configuration options.
- Merge patch to fix for glue that is outside of zone, with
   `harden-unverified-glue`, from Karthik Umashankar (Microsoft).
   Enabling this option protects the Unbound resolver against bad
   glue, that is unverified out of zone glue, by resolving them.
   It uses the records as last resort if there is no other working
   glue.
- Add redis-command-timeout: 20 and redis-connect-timeout: 200,
   that can set the timeout separately for commands and the
   connection set up to the redis server. If they are not
   specified, the redis-timeout value is used.
- Fix #1144: [FR] log timestamps in ISO8601 format with timezone.
   This adds the option `log-time-iso: yes` that logs in ISO8601
   format.
- Merge #871: DNS over QUIC. This adds `quic-port: 853` and
   `quic-size: 8m` that enable dnsoverquic, and the counters
   `num.query.quic` and `mem.quic` in the statistics output.
   The feature needs to be enabled by compiling with libngtcp2,
   with `--with-libngtcp2=path` and libngtcp2 needs openssl+quic,
   pass that with `--with-ssl=path` to compile unbound as well.

Bug Fixes
- Fix #1126: unbound-control-setup hangs while testing for openssl
   presence starting from version 1.21.0.
- Add cross platform freebsd, openbsd and netbsd to github ci.
- Fix for char signedness warnings on NetBSD.
- Fix #1127: error: "memory exhausted" when defining more than 9994
   local-zones.
- Fix documentation for cache_fill_missing function.
- Fix #1130: Loads of logs: "validation failure: key for validation
   <domain>. is marked as invalid because of a previous" for
   non-DNSSEC signed zone.
- Fix that when rpz is applied the message does not get picked up by
   the validator. That stops validation failures for the message.
- Fix that stub-zone and forward-zone clauses do not exhaust memory
   for long content.
- Unit test for auth zone transfer TLS, and TLS failure.
- Fix to print port number in logs for auth zone transfer activities.
- Merge #1132: b.root renumbering.
- Fix for #1132, adjusted unit test for change in the test file.
- Fix for #1132, comment about adjusted copy of reference check.
- Merge #1135: Add new IANA trust anchor.
- Fix config file read for dnstap-sample-rate.
- Fix alloc-size and calloc-transposed-args compiler warnings.
- Fix comment to not trigger doxygen unknown command.
- Fix to limit NSEC and NSEC3 TTL when aggressive nsec is
   enabled (RFC9077).
- Add unit test for ttl limit for aggressive nsec.
- Fix and add comments in testdata/val_negcache_ttl.rpl.
- Merge #1140: Fix spelling mistake in comments.
- Fix doxygen warnings by commenting out CLANG_ASSISTED_PARSING,
   CLANG_ADD_INC_PATHS, CLANG_OPTIONS and CLANG_DATABASE_PATH; they were
   already disabled.
- Fix dns64 with prefetch that the prefetch is stored in cache.
- Attempt to further fix doh_downstream_buffer_size.tdir flakiness.
- More clear text for prefetch and minimal-responses in the
   unbound.conf man page.
- Merge #1143: Fix cache update when serve expired is used. Expired
   records are favored over resolution and validation failures when
   serve-expired is used.
- Fix negative cache NSEC3 parameter compares for zero length NSEC3
   salt.
- Fix unbound dnstap socket test program analyzer warnings about
   unused variable assignments and variable initialization.
- Fix #1149: unbound-control-setup hangs sometimes depending on
   the openssl version.
- Fix #1128: Cannot override tcp-upstream and tls-upstream with
   forward-tcp-upstream and forward-tls-upstream.
- Fix to limit NSEC TTL for messages from cachedb. Fix to limit the
   prefetch ttl for messages after a CNAME with short TTL.
- Fix for dnstap compile of doqclient with doq disabled.
- Fix cookie_file test sporadic fails for time change during
   the test.
- Fix add reallocarray to alloc stats unit test, and disable
   override of strdup in unbound-host, and the result of config
   get option is freed properly.

Best regards, Wouter

This release has an option to harden against unverified glue, it
is enabled with `harden-unverified-glue: yes`. It was contributed
by Karthik Umashankar from Microsoft. This protects Unbound against
bad glue, that is out of zone, by performing a lookup for it.

I am quite surprised that this wasn't dropped before this release?
Do you mean to say unverified (no DNSSEC signed) glue records that
were out of zone / bailiwick were just added to the cache before?
If so, that would be CVE worthy. And shouldn't need an option to
enable/disable.

Because it uses the original information as a last resort if nothing
works, it should not give lookup failures, and add protection.

So this is different from an A lookup for nohats.ca. that contains
glue for cnn.com ? Those are unused and not placed in the cache?

There are options to configure the scrubbing for NS records and
the CNAME scrubbing and the max global quota lookup limit from
previous security fix releases. They can be configured with the
options `iter-scrub-ns`, `iter-scrub-cname` and `max-global-quota`.

I am not sure I understand enough to give these sane values?

For redis use, with cachedb, it is possible to specify the
timeout for the initial connection separately from the timeout
for commands. With the options `redis-command-timeout: 20` and
`redis-connect-timeout: 200` they can be set separately, for
a longer connect attempt, but a short command timeout to keep
resolution faster.

Maybe make valkey-* aliases and slowly phase out the redis- options?

Paul

Hi Paul,

The unverified glue is about glue that is outside of the strict or narrow glue definition of in zone glue, not about glue that is outside of bailiwick or outside of parent zone, of course, that is already scrubbed. Something about policies at registrars and ownership of domains. So, not the case you cite; that would already be scrubbed by code in earlier releases.

There are defaults for those options, that are values suggested by the researchers. I guess it is possible to toggle these kinds options if the server is placed in a situation where they do not apply.

The naming of the redis options could be changed, if that is nicer for the users of it. Aliases make for neat backwards compatibility, that is nice.

Best regards, Wouter

Hi, Wouter:

The harden-unverified-glue patch sounds interesting so I started reading
the code. It looks like this was added in commit 1e0cf1e86b.

I see where an extra 'flags' parameter was added to
the cache_fill_missing() function in order to pass the
PACKED_RRSET_UNVERIFIED_GLUE flag through to the rrset_cache_lookup()
function.

However, I only see the flags being passed through for the
LDNS_RR_TYPE_A case here [0]:

    akey = rrset_cache_lookup(env->rrset_cache, ns->name,
        ns->namelen, LDNS_RR_TYPE_A, qclass, flags, now, 0);
                                         ^^^^^^

And not for the LDNS_RR_TYPE_AAAA case here [1]:

    akey = rrset_cache_lookup(env->rrset_cache, ns->name,
        ns->namelen, LDNS_RR_TYPE_AAAA, qclass, 0, now, 0);
                                            ^^

Is this a bug or is there some reason that A vs. AAAA records are
treated differently?

Also, do I understand correctly that the 'flags' parameter is part
of the hash key, so that the RRsets stored with 'flags' set to
PACKED_RRSET_UNVERIFIED_GLUE can never be retrieved unless that exact
'flags' value is specified by a subsequent lookup?

Thanks!

[0] https://github.com/NLnetLabs/unbound/blame/8b7782e8fc11148abb8abe115f2a12b7974d9619/services/cache/dns.c#L379-L380

[1] https://github.com/NLnetLabs/unbound/blame/8b7782e8fc11148abb8abe115f2a12b7974d9619/services/cache/dns.c#L400-L401

Hi Wouter,

The "quic is enabled" detection is not working well here.
I compiled with "--without-libngtcp2" while libngtcp2-dev was present.

unbound.conf:
     server:
         do-daemonize: no
         logfile: ""
         do-ip6: no
         interface: 0.0.0.0@853

root@6fe7bb039693:/# unbound -c /config/unbound.conf
[1728592163] unbound[30:0] notice: init module 0: subnetcache
[1728592163] unbound[30:0] notice: init module 1: validator
[1728592163] unbound[30:0] notice: init module 2: iterator
[1728592163] unbound[30:0] warning: Unbound is not compiled with ngtcp2. This is required to use DNS over QUIC.
[1728592163] unbound[30:0] error: can't create commpoint
[1728592163] unbound[30:0] error: could not create listening sockets
[1728592163] unbound[30:0] fatal error: Could not initialize main thread

This even does not change if I explicit enable DoT or DoH ("https-port: 853" or "tls-port: 853")
There error above goes away if I change the port to 852 or 854 for example...

Andreas

Hi Andreas,

It is fixed in
https://github.com/NLnetLabs/unbound/commit/1b7e14dc39256b172a93412e23a60cde86a7548c

The quic port is set at 853, so with quic-port: 854 or so the error would likely go away. But the commit fixes it so that with no quic compiled it would also not use the quic port for service. Thank you for the report, that is an ifdef check that is good to fix!

Best regards, Wouter

Hi Robert,

It is fixed in commit
https://github.com/NLnetLabs/unbound/commit/bd1813b126b047ccec490fadf1485c385eaed9d4

Those flags should be passed to the cache fill missing rrset cache lookup also for RR type AAAA. Those are also tagged with the flag, and treated similarly to RR type A.

That is correct, the flag is part of the hash key for the rrset cache lookup.

Thank you for the code improvement! It was not caught by two other code reviews.

Best regards, Wouter

Hello Wouter,

I confirm, the error no longer occur. But...

As said, I've build with '--without-libngtcp2'
now I could write:
unbound.conf:
     server:
         do-daemonize: no
         logfile: ""
         do-ip6: no
         interface: 0.0.0.0@853
         quic-port:853

Shouldn't this raise an error as quic is unavailable? Instead, unbound serve Do53 on Port 853 with this configuration.
It's the same for any other port.
I think, if compiled with '--without-libngtcp2' the configuration option 'quic-port' should raise a similar warning as doqclient:

root@5fa727139f4e:/# doqclient
Compiled without ngtcp2 for QUIC, cannot run doqclient.

I also tried to compile with '--without-libnghttp2' If I now add 'https-port: 443' unbound warn:
[1728767572] unbound[26:0] warning: Unbound is not compiled with nghttp2. This is required to use DNS-over-HTTPS.

same should happen for "quic-port" ...

Andreas

Hi Andreas,

The suggestion is implemented in the commit
https://github.com/NLnetLabs/unbound/commit/114edf2c3819dc2bb02784c7ba3f9776aa8cde3b

That prints the warning if the 'quic-port' setting is used but dnsoverquic was not enabled when compiled.

Best regards, Wouter

Hi,

Unbound 1.22.0 is available:
https://nlnetlabs.nl/downloads/unbound/unbound-1.22.0.tar.gz
sha256 c5dd1bdef5d5685b2cedb749158dd152c52d44f65529a34ac15cd88d4b1b3d43
pgp https://nlnetlabs.nl/downloads/unbound/unbound-1.22.0.tar.gz.asc

Unbound 1.22.0

This release has an option to harden against unverified glue, it
is enabled with `harden-unverified-glue: yes`. It was contributed
by Karthik Umashankar from Microsoft. This protects Unbound against
bad glue, that is out of zone, by performing a lookup for it.
Because it uses the original information as a last resort if nothing
works, it should not give lookup failures, and add protection.

There are options to configure the scrubbing for NS records and
the CNAME scrubbing and the max global quota lookup limit from
previous security fix releases. They can be configured with the
options `iter-scrub-ns`, `iter-scrub-cname` and `max-global-quota`.

For redis use, with cachedb, it is possible to specify the
timeout for the initial connection separately from the timeout
for commands. With the options `redis-command-timeout: 20` and
`redis-connect-timeout: 200` they can be set separately, for
a longer connect attempt, but a short command timeout to keep
resolution faster.

It is possible to log with ISO8601 format with `log-time-iso: yes`
this also logs time in milliseconds. Useful if the server writes to
file, syslog may have its own format.

DNS over QUIC is support is added, if compiled with libngtcp2 and
with the openssl+quic that it uses. Use `--with-libngtcp2` for that,
and enable it with `quic-port: 853`. There is a post about it
on https://blog.nlnetlabs.nl/dns-over-quic-in-unbound [that is to
appear after the release].

Compared to the rc1 there are a fixes for contrib/aaaa-filter-iterator.patch and also for quic detection for ports configuration and for dnsoverquic to extend the stream number, display a warning if enabled but not present, and compile with dnstap.

Features
- Add iter-scrub-ns, iter-scrub-cname and max-global-quota
   configuration options.
- Merge patch to fix for glue that is outside of zone, with
   `harden-unverified-glue`, from Karthik Umashankar (Microsoft).
   Enabling this option protects the Unbound resolver against bad
   glue, that is unverified out of zone glue, by resolving them.
   It uses the records as last resort if there is no other working
   glue.
- Add redis-command-timeout: 20 and redis-connect-timeout: 200,
   that can set the timeout separately for commands and the
   connection set up to the redis server. If they are not
   specified, the redis-timeout value is used.
- Fix #1144: [FR] log timestamps in ISO8601 format with timezone.
   This adds the option `log-time-iso: yes` that logs in ISO8601
   format.
- Merge #871: DNS over QUIC. This adds `quic-port: 853` and
   `quic-size: 8m` that enable dnsoverquic, and the counters
   `num.query.quic` and `mem.quic` in the statistics output.
   The feature needs to be enabled by compiling with libngtcp2,
   with `--with-libngtcp2=path` and libngtcp2 needs openssl+quic,
   pass that with `--with-ssl=path` to compile unbound as well.

Bug Fixes
- Fix #1126: unbound-control-setup hangs while testing for openssl
   presence starting from version 1.21.0.
- Add cross platform freebsd, openbsd and netbsd to github ci.
- Fix for char signedness warnings on NetBSD.
- Fix #1127: error: "memory exhausted" when defining more than 9994
   local-zones.
- Fix documentation for cache_fill_missing function.
- Fix #1130: Loads of logs: "validation failure: key for validation
   <domain>. is marked as invalid because of a previous" for
   non-DNSSEC signed zone.
- Fix that when rpz is applied the message does not get picked up by
   the validator. That stops validation failures for the message.
- Fix that stub-zone and forward-zone clauses do not exhaust memory
   for long content.
- Unit test for auth zone transfer TLS, and TLS failure.
- Fix to print port number in logs for auth zone transfer activities.
- Merge #1132: b.root renumbering.
- Fix for #1132, adjusted unit test for change in the test file.
- Fix for #1132, comment about adjusted copy of reference check.
- Merge #1135: Add new IANA trust anchor.
- Fix config file read for dnstap-sample-rate.
- Fix alloc-size and calloc-transposed-args compiler warnings.
- Fix comment to not trigger doxygen unknown command.
- Fix to limit NSEC and NSEC3 TTL when aggressive nsec is
   enabled (RFC9077).
- Add unit test for ttl limit for aggressive nsec.
- Fix and add comments in testdata/val_negcache_ttl.rpl.
- Merge #1140: Fix spelling mistake in comments.
- Fix doxygen warnings by commenting out CLANG_ASSISTED_PARSING,
   CLANG_ADD_INC_PATHS, CLANG_OPTIONS and CLANG_DATABASE_PATH; they were
   already disabled.
- Fix dns64 with prefetch that the prefetch is stored in cache.
- Attempt to further fix doh_downstream_buffer_size.tdir flakiness.
- More clear text for prefetch and minimal-responses in the
   unbound.conf man page.
- Merge #1143: Fix cache update when serve expired is used. Expired
   records are favored over resolution and validation failures when
   serve-expired is used.
- Fix negative cache NSEC3 parameter compares for zero length NSEC3
   salt.
- Fix unbound dnstap socket test program analyzer warnings about
   unused variable assignments and variable initialization.
- Fix #1149: unbound-control-setup hangs sometimes depending on
   the openssl version.
- Fix #1128: Cannot override tcp-upstream and tls-upstream with
   forward-tcp-upstream and forward-tls-upstream.
- Fix to limit NSEC TTL for messages from cachedb. Fix to limit the
   prefetch ttl for messages after a CNAME with short TTL.
- Fix for dnstap compile of doqclient with doq disabled.
- Fix cookie_file test sporadic fails for time change during
   the test.
- Fix add reallocarray to alloc stats unit test, and disable
   override of strdup in unbound-host, and the result of config
   get option is freed properly.
- Fix to disable detection of quic configured ports when quic is
   not compiled in.
- Fix harden-unverified-glue for AAAA cache_fill_missing lookups.
- Fix contrib/aaaa-filter-iterator.patch for change in call
   signature for cache_fill_missing.
- Fix to display warning if quic-port is set but dnsoverquic is not
   enabled when compiled.
- Fix dnsoverquic to extend the number of streams when one is closed.
- Fix for dnstap with dnscrypt and dnstap without dnsoverquic.
- Fix for dnsoverquic and dnstap to use the correct dnstap
   environment.

Best regards, Wouter