Commit graph

43069 commits

Author SHA1 Message Date
Mark Andrews
6440743bdc RPZ canonical warning displays zone entry incorrectly
Do not insert a NUL into ip_str too early as the full value
is needed later.  Only insert the NUL immediately before
displaying just the prefix string.

(cherry picked from commit 283da99f02)
2025-09-02 23:43:40 +00:00
Matthijs Mekking
ec484f6727 [9.20] chg: test: Wait for rekey_done log in rollover system tests
Waiting for "keymgr: done" logs caused some manual-mode tests to fail intermittently. Waiting for "rekey done" logs should be more reliable.

Closes #5493

Backport of MR !10923

Merge branch 'backport-5493-algoroll-csk-step3-manual-unstable-test-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!10929
2025-09-02 13:40:47 +00:00
Matthijs Mekking
601c171a37 Wait for rekey_done log in rollover system tests
Waiting for "keymgr: done" logs caused some manual-mode tests to fail
intermittently. Waiting for "rekey done" logs should be more reliable.

(cherry picked from commit 4141ae1275)
2025-09-02 13:04:24 +00:00
Andoni Duarte
8540cde99c [9.20] new: test: Test another 'stale-answer-client-timeout 0' scenario
Add a test to check serve-stale with the 'stale-answer-client-timeout 0'
configuration option and with a delegation which is a CNAME to a auth
zone.

Closes #5372

Backport of MR !10920

Merge branch 'backport-5372-serve-stale-crash-on-insist-unreachable-test-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!10927
2025-09-02 10:32:11 +00:00
Aram Sargsyan
7a03b59d0f Test another 'stale-answer-client-timeout 0' scenario
Add a test to check serve-stale with the 'stale-answer-client-timeout 0'
configuration option and with a delegation which is a CNAME to a auth
zone.

(cherry picked from commit 04ed44e7d7)
2025-09-02 08:50:52 +00:00
Michał Kępień
9352ae65d7 [9.20] rem: usr: Obsolete the "tkey-domain" statement
Mark the ``tkey-domain`` statement as obsolete, since it has not had any
effect on server behavior since support for TKEY Mode 2 (Diffie-Hellman)
was removed (in BIND 9.20.0).

See #4204

Backport of MR !10798

Merge branch 'backport-4204-obsolete-tkey-domain-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!10926
2025-09-01 22:45:18 +02:00
Michał Kępień
cae623fa69
Obsolete the "tkey-domain" statement
The "tkey-domain" statement has effectively been a no-op since commit
bd4576b3ce, which removed the only bit of
code using it: the logic implementing TKEY Mode 2 (Diffie-Hellman).

A subsequent cleanup commit, 885c132f4a,
also missed the opportunity to remove the "tkey-domain" statement
altogether.

Mark the "tkey-domain" statement as obsolete and remove all code and
documentation related to it.

(cherry picked from commit 805f1c0f65)
2025-09-01 22:34:08 +02:00
Michał Kępień
b239a70cac [9.20] rem: usr: Deprecate the "tkey-gssapi-credential" statement
The :any:`tkey-gssapi-keytab` statement allows GSS-TSIG to be set up in
a simpler and more reliable way than using the
:any:`tkey-gssapi-credential` statement and setting environment
variables (e.g. ``KRB5_KTNAME``). Therefore, the
:any:`tkey-gssapi-credential` statement has been deprecated;
:any:`tkey-gssapi-keytab` should be used instead.

For configurations currently using a combination of both
:any:`tkey-gssapi-keytab` *and* :any:`tkey-gssapi-credential`, the
latter should be dropped and the keytab pointed to by
:any:`tkey-gssapi-keytab` should now only contain the credential
previously specified by :any:`tkey-gssapi-credential`.

See #4204

Backport of MR !10782

Merge branch 'backport-4204-deprecate-tkey-gssapi-credential-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!10924
2025-09-01 22:00:59 +02:00
Michał Kępień
5700c77a6f Deprecate the "tkey-gssapi-credential" statement
The "tkey-gssapi-keytab" statement enables GSS-TSIG to be set up in a
simpler and more reliable way than using the "tkey-gssapi-credential"
statement and setting environment variables (e.g. KRB5_KTNAME).

Mark the "tkey-gssapi-credential" statement as deprecated to eventually
only have one method for setting up GSS-TSIG in named.  Do not mention
"tkey-gssapi-credential" in the section of the ARM on dynamic updates.

(cherry picked from commit 6de435c528)
2025-09-01 19:34:14 +00:00
Michal Nowak
6075f8b649 [9.20] new: ci: Add Debian "trixie"
Backport of MR !10827

Merge branch 'backport-mnowak/add-debian-trixie-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!10921
2025-09-01 19:36:31 +02:00
Michal Nowak
ae802c8ef1
Make "trixie" the base image
(cherry picked from commit bb26409f34)
2025-09-01 18:30:20 +02:00
Michal Nowak
cfc64ecb77
Move CI and QA tools from Debian "sid" to "trixie"
Debian "sid" is not a stable test bed and should be avoided.

(cherry picked from commit 840069856f)
2025-09-01 17:13:00 +02:00
Michal Nowak
a4f910a720
Add Debian "trixie"
(cherry picked from commit 263810e779)
2025-09-01 17:12:43 +02:00
Ondřej Surý
a8eed36d3e [9.20] fix: dev: Add and use __attribute__((nonnull)) in dnssec-signzone.c
Clang 20 was spuriously warning about the possibility of passing a NULL file pointer
to `fprintf()`, which uses the 'nonnull' attribute. To silence the warning, the functions
calling `fprintf()` have been marked with the same attribute to assure that NULL can't be
passed to them in the first place.

Close #5487

Backport of MR !10888

Merge branch 'backport-5487-mark-passed-file-pointer-as-nonnull-in-dnssec-signzone-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!10913
2025-08-28 18:38:05 +02:00
Ondřej Surý
a5d7c8f7db Add and use __attribute__((nonnull)) in dnssec-signzone.c
Clang 20 is complaining about passing NULL to an argument with 'nonnull'
attribute.  Mark these two functions with the same attribute to assure
that these two function also don't accept NULL as an argument.

(cherry picked from commit 9e350c1774)
2025-08-28 14:24:48 +00:00
Ondřej Surý
35dee6eb90 [9.20] fix: dev: Ensure file descriptors 0-2 are in use
libuv expect file descriptors <= STDERR_FILENO are in use. otherwise,
it may abort when closing a file descriptor it opened.

Closes #5226

Backport of MR !10582

Merge branch 'backport-main-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!10908
2025-08-28 12:46:16 +02:00
Petr Špaček
917e91b84e Test command line tools without stdio fds
Testing all combinations seems unnecessary but is cheap.
I was too lazy to run this against all tools we have. nsupdate was
chosen because it is one of few tools which actually use stdin and the
original issue was reproducible even without any network communication,
which was not the case for simple dig invocation.

Sorry for new shell test but doing this in Python seemed very
complicated and fragile.

(cherry picked from commit e415c5c996)
2025-08-28 08:57:12 +00:00
Thomas Abraham
add7cd3640 ensure file descriptors 0-2 are in use before using libuv
libuv expects file descriptors <= STDERR_FILENO are in use. otherwise,
it may abort when closing a file descriptor it opened.

See https://github.com/libuv/libuv/pull/4559

Closes #5226

(cherry picked from commit 5cfdbeba72)
2025-08-28 08:57:12 +00:00
Arаm Sаrgsyаn
293e75af28 [9.20] 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

Backport of MR !10896

Merge branch 'backport-5494-catz-crash-with-unset-default-primaries-and-double-reconfig-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!10905
2025-08-27 17:37:38 +00:00
Aram Sargsyan
f1a2dc10eb 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.

(cherry picked from commit 40d040b7d5)
2025-08-27 16:45:21 +00:00
Aram Sargsyan
9f2b474201 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.

(cherry picked from commit db36ae47d2)
2025-08-27 16:45:21 +00:00
Petr Špaček
a9320fcc85 [9.20] chg: doc: Clarify forward, stub, and static-stub zone usage
Backport of MR !10417

Merge branch 'backport-pspacek/doc-forward-stub-zones-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!10902
2025-08-27 14:44:20 +00:00
Petr Špaček
0dc4aabaff 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.

(cherry picked from commit e84b98a9fc)
2025-08-27 14:17:39 +00:00
Arаm Sаrgsyаn
925af17d21 [9.20] 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.

Note, that enabling this option has no effect when a DNS Response Policy
Service (DNSRPS) interface is used.

Closes #5222

Backport of MR !10839

Merge branch 'backport-5222-stop-sending-responses-until-rpz-is-ready-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!10889
2025-08-27 10:47:43 +00:00
Aram Sargsyan
07d93f176d Add INSISTs in configure_rpz()
The 'scan-build' job in the CI reports a false positive:

                            /*
    2705                     * We are reusing the old rpzs, so it can no longer be its
    2704                     * first time.
    2707                     */
    2708                    pview->rpzs->first_time = false;
    >> Access to field 'first_time' results in a dereference of a null pointer (loaded from field 'rpzs')

Add INSISTs to silence the report.
2025-08-27 10:00:45 +00:00
Aram Sargsyan
1dd4f95d1e 'servfail-until-ready yes' has no effect with DNSRPS
When a DNS Response Policy Service (DNSRPS) interface is used, the
'servfail-until-ready yes' option is ignored, because RPZ zones are
not processed by BIND.
2025-08-27 10:00:45 +00:00
Aram Sargsyan
369a350e04 Resolve false positive compilation warning from some GCC versions
The complier claims that 'qresult_type' may be used uninitialized,
though all the cases inside the switch either set the variable
or return from the function, and the warning is generated on a line
after the switch-case block.

Slightly modify the code to set a default value for the variable when
declaring it.

    In function 'rpz_rewrite',
        inlined from 'query_checkrpz' at query.c:7288:12,
        inlined from 'query_gotanswer' at query.c:7724:12:
    query.c:4693:14: error: 'qresult_type' may be used uninitialized [-Werror=maybe-uninitialized]
     4693 |             !dnsrps_set_p(&emsg, client, st, qtype, &rdataset,
          |              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     4694 |                           qresult_type != qresult_type_recurse))
          |                           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    query.c: In function 'query_gotanswer':
    query.c:4268:24: note: 'qresult_type' was declared here
     4268 |         qresult_type_t qresult_type;
          |                        ^~~~~~~~~~~~
    cc1: all warnings being treated as errors
2025-08-27 10:00:45 +00:00
Aram Sargsyan
58da549b64 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.

(cherry picked from commit 924230f05a)
2025-08-27 10:00:45 +00:00
Aram Sargsyan
ec2c3db702 Implement '-T slowrpz' named testing option
When used, named processes RPZ zones slowly. Useful for system tests.

(cherry picked from commit 5e718dd220)
2025-08-27 10:00:45 +00:00
Aram Sargsyan
ee29e133ac 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.

(cherry picked from commit 41387b8d30)
2025-08-27 10:00:45 +00:00
Aram Sargsyan
a7a5c79d9a 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.

(cherry picked from commit 88ed81e12d)
2025-08-27 10:00:45 +00:00
Matthijs Mekking
1e435b107f [9.20] 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

Backport of MR !10774

Merge branch 'backport-4606-dnssec-policy-dry-run-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!10880
2025-08-27 09:00:04 +00:00
Matthijs Mekking
efa98eb67a 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.

(cherry picked from commit e4529b6308)
2025-08-27 08:16:52 +00:00
Matthijs Mekking
6461bfdc74 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.

(cherry picked from commit 1df76e2c24)
2025-08-27 08:16:52 +00:00
Matthijs Mekking
7de77464d4 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.

(cherry picked from commit 0aa5dee474)
2025-08-27 08:16:52 +00:00
Matthijs Mekking
441e184314 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.

(cherry picked from commit 6904e43510)
2025-08-27 08:16:52 +00:00
Matthijs Mekking
3f869dad3a 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.

(cherry picked from commit e35e103d7f)
2025-08-27 08:16:52 +00:00
Matthijs Mekking
6541faae96 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.

(cherry picked from commit 73ecc7223e)
2025-08-27 08:16:52 +00:00
Matthijs Mekking
9464f05770 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.

(cherry picked from commit 6b5c69d431)
2025-08-27 08:16:52 +00:00
Matthijs Mekking
1eef82b419 Test manual-mode with CSK algorithm rollover
Update check_rollover_step to return the found keys. This can be used
to test that keymgr-manual-mode messages are correctly logged.

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.

(cherry picked from commit c000cf70cb)
2025-08-27 08:16:52 +00:00
Matthijs Mekking
cf5b9c9351 Add manual-mode parameter to isctest.kasp
Key state transitions may be blocked by manual-mode, meaning key
timing metadata may not be respected and can be inaccurate. For these
tests use the state values to determine whether the DNSKEY/CDS/CDNSKEY
RRset must be published or not.

(cherry picked from commit 927c249711)
2025-08-27 08:16:52 +00:00
Matthijs Mekking
162b21d347 Prepare rollover system tests for manual-mode
For the algorithm, CSK, KSK, ZSK rollovers, enabling DNSSEC and going
insecure, add new zones to be tested in manual-mode.

(cherry picked from commit 02460a009f)
2025-08-27 08:16:52 +00:00
Matthijs Mekking
b022a05cad Detect if keymgr made changes
If so we also want to tickle the apex because DNSKEY/CDNSKEY/CDS
RRsets may need to be re-signed.

Note that this may be overzealous, because if state transitions
happen just because of timing events (RUMOURED -> OMNIPRESENT,
UNRETENTIVE -> HIDDEN) this would have to cause changes in the
zone DNSSEC records.

(cherry picked from commit a0dc0434e5)
2025-08-27 08:16:52 +00:00
Matthijs Mekking
c75cab3f96 Implement manual-mode for kasp
When a key retire, key generation/introduction, or a state transition
to RUMOURED/UNRETENTIVE should happen, instead they are logged.
When those logs look good, you can run 'rndc dnssec -step' to run the
keymgr and apply those steps.

(cherry picked from commit aa49850b5e)
2025-08-27 08:16:52 +00:00
Matthijs Mekking
40d2f99852 Add manual-mode config option
Add a new option 'manual-mode' to 'dnssec-policy'. The intended
use is that if it is enabled, it will not automatically move to the
next state transition (RUMOURED, UNRETENTIVE), only after manual
confirmation. The intended state transition should be logged.

(cherry picked from commit 63c5b453e0)
2025-08-27 08:16:52 +00:00
Ondřej Surý
6b266b222c [9.20] 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

Backport of MR !10897

Merge branch 'backport-5294-preserve-ZEROTTL-on-cache-update-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!10898
2025-08-26 21:48:54 +02:00
Ondřej Surý
08328a9cce
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>
(cherry picked from commit 9f7ba584cf)
2025-08-26 21:13:25 +02:00
Ondřej Surý
06e3d996c1
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>
(cherry picked from commit 982ca161c2)
2025-08-26 21:12:21 +02:00
Andoni Duarte Pintado
53cf8e0214 Merge tag 'v9.20.12' into bind-9.20 2025-08-20 18:08:55 +02:00
Matthijs Mekking
f91017fcec [9.20] new: test: Test migrating to dnsec-policy
Various test cases where legacy keys exist and are used to migrate to 'dnssec-policy'. These once existed as shell script but were removed because 'auto-dnssec' was removed. But the test cases are still useful if one wants to migrate to 'dnssec-policy' with such legacy keys, so it would be good to resurrect these tests.
    
Closes #3769

Backport of MR !10787

Merge branch 'backport-3769-migrate-zsk-ksk-plit-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!10868
2025-08-19 15:02:28 +00:00