2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-08-28 04:58:04 +00:00

43777 Commits

Author SHA1 Message Date
Mark Andrews
5a5217877b DROP 2025-08-27 13:49:24 -07:00
Evan Hunt
8db40614c4 dnssec-signzone -Z none removes ZONEMD records
"dnssec-signzone -Z none" removes pre-existing ZONEMD records from a
signed zone. If followed by another -Z option, a new ZONEMD record
will be added to replace the existing ones. This can be used, for
instance, to switch from one scheme/digest to the other.
2025-08-27 13:49:24 -07:00
Evan Hunt
fcbd4bea02 add "zonemd" option to dnssec-policy
"zonemd <scheme> <digest>;" now causes a ZONEMD record to be
added when inline signing.

"zonemd yes;" is a synonym for "zonemd simple sha384;".
2025-08-27 13:49:19 -07:00
Evan Hunt
b05ab7b2a1 Test "named-checkzone -z fail" for unsigned ZONEMD
Add a test case in which a zone is generated containing an
unsigned but otherwise valid ZONEMD record, and confirm that
"named-checkzone -z fail" loads it. Add the same ZONEMD
record to a different zone, and confirm that "named-checkzone
-z fail" rejects it.
2025-08-27 11:09:24 -07:00
Mark Andrews
7ac337e221 dnssec-signzone now updates ZONEMD records
If the zone already contains ZONEMD records, they will be updated
when signing the zone. If not, ZONEMD records can be added by using
the "-Z" option: for instance, "dnssec-signzone -Z - -S example.com".

Also, dnssec-verify now verifies the ZONEMD records, if any are
present. If run with the "-Z" flag, ZONEMD is mandatory, and the
zone will be rejected if it is not present.

Some zones in the mirror system test are now signed with ZONEMD.
2025-08-27 11:09:24 -07:00
Mark Andrews
3cc8da40aa Check ZONEMD records when loading or transferring a zone
If ZONEMD is present in a zone and zonemd-check is active,
check the hash of the zone contents against the ZONEMD record.

When loading primary zones only, an expired signature is permitted
for the ZONEMD RRset.  This will allow the zone to be re-signed
by named.

When loading or transferring a mirror zone, the zone will now
be DNSSEC validated only if there was no signed ZONEMD to check.
(Note that ZONEMD is more protective than DNSSEC validation,
because it covers glue as well as in-zone data.)
2025-08-27 11:09:24 -07:00
Mark Andrews
1ffa3fa470 Add ZONEMD checking options
Add options (not yet functional) to named.conf and the
named-checkzone command line to enable ZONEMD checks.
Update documentation to describe them.
2025-08-27 11:09:24 -07:00
Mark Andrews
7d20872308 Update ZONEMD records as part of UPDATE processing
dns_update_zonemd() has been added to update ZONEMD records.

dns_update_signaturesinc() has been extended to update (via
dns_update_zonemd) and sign ZONEMD records.
2025-08-27 11:09:24 -07:00
Mark Andrews
21f69b010f Add dns_zonemd functions
- dns_zonemd_buildrdata() iterates a zone database and constructs a
  ZONEMD record using the SIMPLE digest scheme described in RFC 8976.

- dns_zonemd_supported() checks a ZONEMD record and returns true if
  the scheme and hash algorithm are supported by this server. (Currently
  the only supported scheme is SIMPLE, and the supported hash algorithms
  are SHA-384 and SHA-512.)
2025-08-27 11:09:24 -07:00
Mark Andrews
6229dad838 Only test digest lengths if the scheme is known
The test zones in RFC 8976 refused to load because one of the
ZONEMD records is too short for the specified digest type.  This
change allows the test zone to load.  There is an open errata
covering this.  https://www.rfc-editor.org/errata/eid6425
2025-08-27 11:09:24 -07:00
Arаm Sаrgsyаn
bcca7a6834 fix: usr: Fix a catalog zone issue when having an unset 'default-primaries' configuration clause
A catalog zone with an unset ``default-primaries`` clause could cause
an unexpected termination of the :iscman:`named` process after two
reloading or reconfiguration commands. This has been fixed.

Closes #5494

Merge branch '5494-catz-crash-with-unset-default-primaries-and-double-reconfig' into 'main'

See merge request isc-projects/bind9!10896
2025-08-27 16:16:05 +00:00
Aram Sargsyan
40d040b7d5 Add a catalog zone with an unset 'default-primaries' to the catz test
And unset 'default-primaries' is causing an assertion failure after
two reload/reconfig commands. Add such a catalog zone to check the fix.
2025-08-27 15:01:02 +00:00
Aram Sargsyan
db36ae47d2 Fix a bug in configure_catz_zone()
When dns_catz_zone_add() returns ISC_R_EXISTS and there is no
'default-primaries' or 'default-masters', the ISC_R_EXISTS result
code doesn't get reset to ISC_R_SUCCESS, and the function returns
ISC_R_EXISTS instead of ISC_R_SUCCESS. Which means that the zone
is successfully added, but the caller assumes that the function has
failed.

Reset 'result' to ISC_R_SUCCESS when dns_catz_zone_add() returns
ISC_R_EXISTS (it's not an error condition).

Refactor the code go call dns_catz_zone_add() when all other error
conditions are already checked.
2025-08-27 15:01:02 +00:00
Petr Špaček
6a76b143a7 chg: doc: Clarify forward, stub, and static-stub zone usage
Merge branch 'pspacek/doc-forward-stub-zones' into 'main'

See merge request isc-projects/bind9!10417
2025-08-27 14:17:19 +00:00
Petr Špaček
e84b98a9fc Clarify forward, stub, and static-stub zone usage
Clarify that forwarding points to a resolver and stub to auths.
Add cross-links. Rewrite stub zone type description.
2025-08-27 14:12:58 +00:00
Ondřej Surý
af0594f482 chg: dev: Rewrite the bit rotate functions using __builtin or generic
In gcc 15, __builtin_stdc_rotate_{left,right} was added.  Use these
builtins when available otherwise rewrite the ISC_ROTATE_LEFT and
ISC_ROTATE_RIGHT using _Generic.

Merge branch 'ondrej/use-__builtin_stdc_rotate_left_right' into 'main'

See merge request isc-projects/bind9!10893
2025-08-27 11:53:13 +02:00
Ondřej Surý
e01151f729 Rewrite the bit rotate functions using __builtin or generic
In gcc 15, __builtin_stdc_rotate_{left,right} was added.  Use these
builtins when available otherwise rewrite the ISC_ROTATE_LEFT and
ISC_ROTATE_RIGHT using _Generic.
2025-08-27 11:53:05 +02:00
Colin Vidal
7e12c7de0b chg: dev: move keystores handle from the zone to the view
The list of keystores is owned by the single server object
(named_g_server), but dns_zone_t has a pointer into it in order to
preserve encapsulation (lib/dns won't link to bin/named for good
reasons).

However, getting the keystores from the zone uses the zone lock whereas
this is not needed (as the pointer value doesn't depends on the zone,
and is initialized only with the same named_g_server->keystores value);
also storing an extra pointer per zone is not needed; also, there was a
logic based on the zone->secure property which was not needed (as there
is only one keystore).

The keystores pointer is now accessible and lock-free at view level,
it also simplifies a bit the various zone configuration APIs (server.c,
zoneconf.c).

Merge branch 'colin/move-keystore-to-view' into 'main'

See merge request isc-projects/bind9!10895
2025-08-27 11:01:15 +02:00
Colin Vidal
529fd913db move keystores handle from the zone to the view
The list of keystores is owned by the single server object
(named_g_server), but dns_zone_t has a pointer into it in order to
preserve encapsulation (lib/dns won't link to bin/named for good
reasons).

However, getting the keystores from the zone uses the zone lock whereas
this is not needed (as the pointer value doesn't depends on the zone,
and is initialized only with the same named_g_server->keystores value);
also storing an extra pointer per zone is not needed; also, there was a
logic based on the zone->secure property which was not needed (as there
is only one keystore).

The keystores pointer is now accessible and lock-free at view level,
it also simplifies a bit the various zone configuration APIs (server.c,
zoneconf.c).
2025-08-27 10:25:20 +02:00
Ondřej Surý
72189af7bf fix: usr: Prevent spurious SERVFAILs for certain 0-TTL resource records
Under certain circumstances, BIND 9 can return SERVFAIL when updating
existing entries in the cache with new NS, A, AAAA, or DS records with 0-TTL.

Closes #5294

Merge branch '5294-preserve-ZEROTTL-on-cache-update' into 'main'

See merge request isc-projects/bind9!10897
2025-08-26 21:03:43 +02:00
Ondřej Surý
9f7ba584cf
Don't preserve cache entries if new TTL is smaller than existing
Under certain circumstances, cache entries with equivalent rdataset
might not get replaced.  Previously such entry would get preserved
regardless of the new TTL and expire time on the existing header would
get updated when the expire time was less than the expire time on the
existing header.  Change the logic to preserve the existing header only
if the new expire time is larger than the existing one and replace the
existing cache entry when the new expire time is less than the existing
one.

Co-authored-by: Jinmei Tatuya <jtatuya@infoblox.com>
2025-08-26 18:26:34 +02:00
Ondřej Surý
982ca161c2
Preserve ZEROTTL attribute when replacing NS RRset
Previously, BIND 9 would drop the ZEROTTL attribute when updating
previously cached NS entry with ZEROTTL attribute set.

Co-authored-by: Jinmei Tatuya <jtatuya@infoblox.com>
2025-08-26 18:26:34 +02:00
Ondřej Surý
bfbc58063a chg: dev: Improve C23 compatibility
Use C23 stdckdint.h when available and define ckd_{mul,add,sub} shims to __builtin_{mul,add,sub}_overflow(). Require all the __builtin functions to be supported to further simplify the non-C23 implementation.  Rename the <stdbit.h>-shims in <isc/bit.h> to their C23 names.

Merge branch 'ondrej/use-stdckdint.h-if-available' into 'main'

See merge request isc-projects/bind9!10818
2025-08-26 16:35:53 +02:00
Ondřej Surý
443bbc6491
Use the <stdbit.h> names for bit manipulation shims
When <stdbit.h> is unavailable, use the stdc names like stdc_count_zeros
instead of ISC_COUNT_ZERO macros to simplify the code.
2025-08-26 15:32:53 +02:00
Ondřej Surý
38124cfcb2
Simplify add/sub/mul overflow checks
Use C23 stdckdint.h when available and define ckd_{mul,add,sub} shims to
__builtin_{mul,add,sub}_overflow().  Require the __builtin functions
unconditionally.
2025-08-26 15:32:53 +02:00
Ondřej Surý
40fda03e50
Require the __builtin functions unconditionally
Currently following __builtin functions are used:

    __builtin_add_overflow
    __builtin_mul_overflow
    __builtin_prefetch
    __builtin_sub_overflow
    __builtin_unreachable

These are generally available on our supported platform, and also we use
some of these unconditionally anyway in qp.c.  Thus make the support for
these functions mandatory so we fail early in the 'setup' step.
2025-08-26 15:32:53 +02:00
Petr Špaček
56704f4bfb fix: ci: Reverse config grammar checks and docs builds
See #5379

Merge branch 'pspacek/fix-doc-misc-patch-generator' into 'main'

See merge request isc-projects/bind9!10891
2025-08-26 10:13:10 +00:00
Petr Špaček
9f318b21b5 Reverse config grammar checks and docs builds
Make grammar check in CI more user friendly. Previously Sphinx docs
build might have failed because outdated grammar files and this would
have prevented CI from generating grammar file patch.
2025-08-26 10:13:00 +00:00
Ondřej Surý
492fd02409 fix: dev: Update fxhash constants
The fxhash implementation was missing a constant for 32-bit platforms.
This has been fixed.  Constant for 64-bit platform was update to match
the current Rust constants.

Merge branch 'ondrej/update-fxhash-constants' into 'main'

See merge request isc-projects/bind9!10894
2025-08-26 09:46:14 +02:00
Ondřej Surý
24ba4ba3ad
Update fxhash constants
The fxhash implementation was missing a constant for 32-bit platforms.
This has been fixed.  Constant for 64-bit platform was update to match
the current Rust constants.
2025-08-26 09:45:58 +02:00
Ondřej Surý
11bbef0eec fix: dev: Allow negative RRSIGs in the qpcache again
The previous refactoring added an assertion failure when negative RRSIG
would be added to the cache database.  As result, any query for RRSIG in
any unsigned zone would trigger that assertion failure.

Allow the negative RRSIG entries to be stored in the cache database
again as not caching these would trigger new remote fetch every time
such query would be received from a client.

Closes #5489

Merge branch '5489-allow-negative-RRSIGs-in-qpcache' into 'main'

See merge request isc-projects/bind9!10876
2025-08-26 09:40:53 +02:00
Ondřej Surý
91289eb1b0
Allow negative RRSIGs in the qpcache again
The previous refactoring added an assertion failure when negative RRSIG
would be added to the cache database.  As result, any query for RRSIG in
any unsigned zone would trigger that assertion failure.

Allow the negative RRSIG entries to be stored in the cache database
again as not caching these would trigger new remote fetch every time
such query would be received from a client.
2025-08-26 09:03:04 +02:00
Ondřej Surý
bdd59dace8
Add a test for non-existence of RRSIG in the unsigned zone
This tests that the result is NOERROR and a single SOA record is
returned.
2025-08-26 09:03:04 +02:00
Ondřej Surý
449245b059 fix: dev: Fix ISC_ROTATE_LEFTSIZE macro on MacOS"
Closes #5497

Merge branch '5497-isc_rotate_leftsize-doesn-t-work-on-macos' into 'main'

See merge request isc-projects/bind9!10892
2025-08-26 07:33:22 +02:00
Ondřej Surý
a274cf6ce6
Workaround the compile failure on macOS
The following check:

    __builtin_types_compatible_p(size_t, uint64_t)

doesn't work with default compiler on macOS.  Workaround the issue
by typing the size_t to matching unsigned int type.
2025-08-26 06:53:27 +02:00
Aydın Mercan
160bc1a198 fix: dev: switch bit rotation functions to statement expressions
Using `static inline` functions in the headers break gcov as it cannot
properly track the hits. To fix the issue, convert the expressions to
statement macros. The added static assertions will ensure integer
promotion cannot occur unlike its previous function counterpart.

Merge branch 'aydin/rotate-as-macro' into 'main'

See merge request isc-projects/bind9!10878
2025-08-25 15:08:44 +03:00
Aydın Mercan
7b7c853c07
switch bit rotation functions to statement expressions
Using `static inline` functions in the headers break gcov as it cannot
properly track the hits. To fix the issue, convert the expressions to
statement macros. The added static assertions will ensure integer
promotion cannot occur unlike its previous function counterpart.
2025-08-25 13:02:03 +03:00
Arаm Sаrgsyаn
ec1e919389 new: usr: Add a new 'servfail-until-ready' configuration option for RPZ
By default, when :iscman:`named` is started it may start answering to
queries before the response policy zones are completely loaded
and processed. This new feature gives an option to the users to
tell :iscman:`named` that incoming requests should result in SERVFAIL answer
until all the response policy zones are processed and ready. Note that if
one or more response policy zones fail to load, :iscman:`named` starts
responding to queries according to those zones that did load.

Closes #5222

Merge branch '5222-stop-sending-responses-until-rpz-is-ready' into 'main'

See merge request isc-projects/bind9!10839
2025-08-22 18:37:20 +00:00
Aram Sargsyan
924230f05a Test the new 'servfail-until-ready' option
Test whether 'servfail-until-ready yes' works by enabling slow
RPZ loading with a USDT probe activation, and checking that named
returns SERVFAIL during the initial RPZ zones processing stage.

The test requires SystemTap (stap, dtrace) to activate the USDT
probe.
2025-08-22 17:17:28 +00:00
Aram Sargsyan
5e718dd220 Implement '-T slowrpz' named testing option
When used, named processes RPZ zones slowly. Useful for system tests.
2025-08-22 16:31:17 +00:00
Aram Sargsyan
41387b8d30 Add a new 'servfail-until-ready' configuration option for RPZ
By default, when named is started it may start answering to
queries before the response policy zones are completely loaded
and processed. This new feature gives an option to the users to
tell named that incoming requests should result in SERVFAIL anwser
until all the response policy zones are procesed and ready.
2025-08-22 16:31:17 +00:00
Aram Sargsyan
88ed81e12d Add 'first_time' member to 'dns_rpz_zones_t'
During the initial configuration of named after startup, 'first_time'
is true. This is needed for implementing the new 'servfail-until-ready'
configuration option, which should take into effect only during the
initial configuration.
2025-08-22 16:31:17 +00:00
Matthijs Mekking
888b5f55a8 new: usr: Add manual mode configuration option to dnsec-policy
Add a new option ``manual-mode`` to :any:`dnssec-policy`. The intended use is that if it is enabled, it will not automatically move to the
next state transition, but instead the transition is logged. Only after manual confirmation with ``rndc dnssec -step`` the transition is made.

Closes #4606

Merge branch '4606-dnssec-policy-dry-run' into 'main'

See merge request isc-projects/bind9!10774
2025-08-21 15:18:15 +00:00
Matthijs Mekking
e4529b6308 Test manual-mode error case
If we hit an error when issuing an 'rndc dnssec -step' command, and the
keymgr runs again at a later scheduled time, we don't want to enforce
transitions.
2025-08-21 16:09:55 +02:00
Matthijs Mekking
1df76e2c24 Test manual-mode while enabling DNSSEC
Similar to previous commit.

Parametrize each test case and in case of manual-mode, execute
additional checks. First a keymgr run should not change the existing
key state (with exceptions of timing events such as moving from
RUMOURED to OMNIPRESENT, and from UNRETENTIVE to HIDDEN). Appropriate
messages must be logged.

After enforcing the next step with 'rndc dnssec -step', the key state
should be the same as if the step were to be taken automatically.
2025-08-21 16:09:55 +02:00
Matthijs Mekking
0aa5dee474 Test manual-mode with ZSK rollover
Similar to previous commit.

Parametrize each test case and in case of manual-mode, execute
additional checks. First a keymgr run should not change the existing
key state (with exceptions of timing events such as moving from
RUMOURED to OMNIPRESENT, and from UNRETENTIVE to HIDDEN). Appropriate
messages must be logged.

After enforcing the next step with 'rndc dnssec -step', the key state
should be the same as if the step were to be taken automatically.
2025-08-21 16:09:55 +02:00
Matthijs Mekking
6904e43510 Test manual-mode with KSK rollover
Similar to previous commit.

Parametrize each test case and in case of manual-mode, execute
additional checks. First a keymgr run should not change the existing
key state (with exceptions of timing events such as moving from
RUMOURED to OMNIPRESENT, and from UNRETENTIVE to HIDDEN). Appropriate
messages must be logged.

After enforcing the next step with 'rndc dnssec -step', the key state
should be the same as if the step were to be taken automatically.
2025-08-21 16:09:55 +02:00
Matthijs Mekking
e35e103d7f Test manual-mode with CSK rollover (2)
Similar to previous commit.

Parametrize each test case and in case of manual-mode, execute
additional checks. First a keymgr run should not change the existing
key state (with exceptions of timing events such as moving from
RUMOURED to OMNIPRESENT, and from UNRETENTIVE to HIDDEN). Appropriate
messages must be logged.

After enforcing the next step with 'rndc dnssec -step', the key state
should be the same as if the step were to be taken automatically.
2025-08-21 16:09:55 +02:00
Matthijs Mekking
73ecc7223e Test manual-mode with CSK rollover (1)
Similar to previous commits.

Parametrize each test case and in case of manual-mode, execute
additional checks. First a keymgr run should not change the existing
key state (with exceptions of timing events such as moving from
RUMOURED to OMNIPRESENT, and from UNRETENTIVE to HIDDEN). Appropriate
messages must be logged.

After enforcing the next step with 'rndc dnssec -step', the key state
should be the same as if the step were to be taken automatically.
2025-08-21 16:09:55 +02:00
Matthijs Mekking
6b5c69d431 Test manual-mode with KSK/ZSK algorithm rollover
Similar to the previous commit that tests CSK algorithm rollover.

Parametrize each test case and in case of manual-mode, execute
additional checks. First a keymgr run should not change the existing
key state (with exceptions of timing events such as moving from
RUMOURED to OMNIPRESENT, and from UNRETENTIVE to HIDDEN). Appropriate
messages must be logged.

After enforcing the next step with 'rndc dnssec -step', the key state
should be the same as if the step were to be taken automatically.
2025-08-21 16:09:55 +02:00