Commit graph

44663 commits

Author SHA1 Message Date
Matthijs Mekking
e344fe18bc Test sending NOTIFY(CDS) messages
When starting up the services, send notifies for the existing CDS RRset.
This requires setting up a chain of trust for the test, so the DSYNC
records can be retrieved and validated.

This feature requires enabling 'notify-cds' and 'dnssec-validation'.

In this test, the scanner is pointed to ns2. Since there is no code
for receiving NOTIFY(CDS) messages for delegations, this is treated
as "not authoritative". Checking for this log message ensures us that
the NOTIFY(CDS) message was actually sent.
2025-12-19 15:01:36 +01:00
Matthijs Mekking
c8253a0a7a Implement NOTIFY(CDS) logic
When the CDS/CDNSKEY RRset gets updated, schedule a NOTIFY(CDS) to be
sent to the parental agent. The parental agent is published in the
parent zone as a DSYNC RRset, so first we need to figure out the
parent owner name. This is done by finding the zonecut (querying for
NS RRset until we find a postive answer).

In nsfetch_dsync, we then schedule a zone fetch for the DSYNC record
at <child-labels>._dsync.<parent-labels>. Then we queue the notify
for each target in the DSYNC records that matches the NOTIFY scheme
and CDS RRtype.
2025-12-19 14:08:15 +01:00
Matthijs Mekking
fa5f67fffe Add a function to set NOTIFY(CDS) endpoints
This is similar to setting remote endpoints for primaries, secondaries
(NOTIFY(SOA)), and parental agents.
2025-12-19 14:08:15 +01:00
Matthijs Mekking
9fa0493a94 Adjust tests to new notify logs
Now that we log the type of the notify, some expected log messages
in the system tests need to be adjusted accordingly.

The bin/tests/system/nsec3/tests_nsec3_retransfer.py log is changed
to zone_needdump because it is more reliable.  Other tests were
adjusted similar in MR !11265, but !11226 introduced a new
"sending notify" log line.
2025-12-19 14:08:15 +01:00
Matthijs Mekking
97b245c24c Use notify type in logging and for getting context
Add the notify type to the log messages for clarity, and use it to
retrieve the right notify context.
2025-12-19 14:08:15 +01:00
Matthijs Mekking
dc0437e518 Add type parameter to dns_notify_create()
With Generalized DNS Notifications, a zone may need to send different
type of NOTIFY messages for different reasons. When creating a new
notify, allow for specifying the type.
2025-12-19 14:08:15 +01:00
Matthijs Mekking
121d372236 Add port parameter to dns_notify_create()
The DSYNC record has a Port rdata field, so NOTIFY(CDS) messages may be
configured at different ports. When creating a new notify, allow for
specifying the port.
2025-12-19 14:08:15 +01:00
Matthijs Mekking
dda2e99c36 Document 'notify-cds' configuration option
Add text about the 'notify-cds' option in the ARM reference.
2025-12-19 14:08:15 +01:00
Matthijs Mekking
6554a5f9f7 Add new 'notify-cds' configuration option
Add a new configuration option to enable/disable sending NOTIFY(CDS)
messages.
2025-12-19 14:08:15 +01:00
Matthijs Mekking
8d83fbaf85 Maintain separate notify contexts for SOA and CDS
With Generalized DNS Notifications, a zone may need to send different
NOTIFY messages for different reasons. Introduce a method to
initialize a notify context and maintain a notify contexts per RRtype.
2025-12-19 14:08:15 +01:00
Matthijs Mekking
f1b2646f2b Update dns_dnssec_sync(update|delete) return code
Update the functions 'dns_dnssec_syncupdate()' and
'dns_dnssec_syncdelete()' to make a distinction between a changed RRset
and no changes made.

The return code will be used later to determine if we need to send a
NOTIFY(CDS) to DSYNC endpoints.
2025-12-19 14:08:15 +01:00
Matthijs Mekking
f3cb582b30 chg: test: Update rollover system tests with chain of trust
Merge branch 'matthijs-trust-chain-rollover-system-tests' into 'main'

See merge request isc-projects/bind9!11309
2025-12-19 12:02:16 +00:00
Matthijs Mekking
594ff0816a Drop and replace CmdHelper with EnvCmd
A generic helper that calls environment-specified binaries has been added,
drop and replace the introduced CmdHelper for the more generic method.
2025-12-19 11:49:00 +01:00
Matthijs Mekking
e172b4ff1a rollover-zsk-prepub: From setup.sh to pytest bootstrap
Symlink ns1 and ns2 to rollover/ns1 and rollover/ns2.
Symlink ns3/template.db.j2.manual to rollover/ns3/template.db.j2.manual.

Since the bootstrapping is done before the templates are rendered
automatically, replace @DEFAULT_ALGORITHM@ in ns3/kasp.conf.j2 to
ecdsa256 and rename to ns3/kasp.conf.
2025-12-19 11:47:50 +01:00
Matthijs Mekking
da04c75cec rollover-straight2none: From setup.sh to pytest bootstrap
Similar to rollover-going-insecure.
2025-12-19 11:47:50 +01:00
Matthijs Mekking
0016791c91 rollover-lifetime: Update templates
This test does not require a trust chain. Merely update the template
zone files to not point to the common template.
2025-12-19 11:47:50 +01:00
Matthijs Mekking
b6c091d113 rollover-multisigner: Update templates
This test does not require a trust chain. However, it does have a setup
script. Rewrite the setup shell script to a pytest bootstrap method.
2025-12-19 11:47:50 +01:00
Matthijs Mekking
4ed35f02b1 rollover-ksk-3crowd: From setup.sh to pytest bootstrap
Similar to rollover-ksk-doubleksk.
2025-12-19 11:47:50 +01:00
Matthijs Mekking
08236f4bd6 rollover-ksk-doubleksk: From setup.sh to pytest bootstrap
Symlink ns1 and ns2 to rollover/ns1 and rollover/ns2.
Symlink ns3/template.db.j2.manual to rollover/ns3/template.db.j2.manual.

Since the bootstrapping is done before the templates are rendered
automatically, replace @DEFAULT_ALGORITHM@ in ns3/kasp.conf.j2 to
ecdsa256 and rename to ns3/kasp.conf.
2025-12-19 11:47:50 +01:00
Matthijs Mekking
cc4244f384 rollover-going-insecure: From setup.sh to pytest bootstrap
Symlink ns1 and ns2 to rollover/ns1 and rollover/ns2.
Symlink ns3/template.db.j2.manual to rollover/ns3/template.db.j2.manual.

Since the bootstrapping is done before the templates are rendered
automatically, replace @DEFAULT_ALGORITHM@ in ns3/kasp.conf.j2 to
ecdsa256 and rename to ns3/kasp.conf.

Now we have to fake different lifetimes, so adjust fake_lifetime
to update a single key.

Note that we have changed the setup slightly: We also sign the
step2 zones, but with post validation disabled. This is more
accurate because we need to test that the public keys and signatures
are being removed from the zone.
2025-12-19 11:47:50 +01:00
Matthijs Mekking
ef2a824df6 rollover-enable-dnssec: From setup.sh to pytest bootstrap
Symlink ns1 and ns2 to rollover/ns1 and rollover/ns2.
Symlink ns3/template.db.j2.manual to rollover/ns3/template.db.j2.manual.

Since the bootstrapping is done before the templates are rendered
automatically, replace @DEFAULT_ALGORITHM_NUMBER@ in ns3/kasp.conf.j2 to
13 and rename to ns3/kasp.conf.

This test introduces an unsigned delegation, adjust render_and_sign_zone
and configure_tld accordingly.
2025-12-19 11:47:50 +01:00
Matthijs Mekking
281f71be60 rollover-dynamic2inline: Update templates
This test does not require a trust chain. Merely update the template
zonefile to not point to the common template.
2025-12-19 11:47:50 +01:00
Matthijs Mekking
ef7d617e3f rollover-csk-roll2: From setup.sh to pytest bootstrap
Similar to rollover-csk-roll1.
2025-12-19 11:47:50 +01:00
Matthijs Mekking
1635bcf1ef rollover-csk-roll1: From setup.sh to pytest bootstrap
Symlink ns1 and ns2 to rollover/ns1 and rollover/ns2.
Symlink ns3/template.db.j2.manual to rollover/ns3/template.db.j2.manual.

Since the bootstrapping is done before the templates are rendered
automatically, replace @DEFAULT_ALGORITHM@ in ns3/kasp.conf.j2 to
ecdsa256 and rename to ns3/kasp.conf.

Write a python method to set the key predecessor/successor relationship
into the key state files.
2025-12-19 11:47:50 +01:00
Matthijs Mekking
72d3551355 rollover-algo-ksk-zsk: From setup.sh to pytest bootstrap
Symlink ns1 and ns2 to rollover/ns1 and rollover/ns2.
Symlink ns3/template.db.j2.manual to rollover/ns3/template.db.j2.manual.

The RSASHA256 keys are generated with dnssec-keygen, without a policy
provided. Thus we have to fake the lifetime for these keys.

Signing has to be done without the -z option, because the KSK should
not sign all records in case of a KSK/ZSK split. Update the signing
code to allow for extra options when signing with CSK only.
2025-12-19 11:47:50 +01:00
Matthijs Mekking
3a6ed195fa rollover-algo-csk: From setup.sh to pytest bootstrap
Symlink ns1 and ns2 to rollover/ns1 and rollover/ns2.
Symlink ns3/template.db.j2.manual to rollover/ns3/template.db.j2.manual.

Since the bootstrapping is done before the templates are rendered
automatically, replace @DEFAULT_ALGORITHM@ in ns3/csk2.conf.j2 to
ecdsa256 and rename to ns3/csk2.conf.
2025-12-19 11:47:50 +01:00
Matthijs Mekking
f31514e658 rollover: From setup.sh to pytest bootstrap
Introduce rollover/setup.py for all setup related test code.

Introduce rollover/ns1 and rollover/ns2 to create a chain of trust to
all rollover related test zones. The tld zones in rollover/ns2 contain
a DSYNC record that at a later time will be used for testing Generalized
DNS Notifications.

Write a python version of private_type_record so we can put such
records in the zone via jinja2 templating.
2025-12-19 11:47:49 +01:00
Matthijs Mekking
e620b29e35 Move ns6 to ns3 in rollover tests
There is no difference, so we are going to make it consistent. This will
make it easier to add a chain of trust for these zones (to be done in
a future commit).
2025-12-19 11:41:07 +01:00
Andoni Duarte
9c0a657a6f chg: ci: Drop "allow_failure: true" from respdiff:recent-named
After the 9.21.16 release, this is not needed anymore.

Merge branch 'andoni/drop-allow_failure-true-from-cross-version-config-tests' into 'main'

See merge request isc-projects/bind9!11387
2025-12-18 17:55:35 +00:00
Andoni Duarte Pintado
ea7eecb247 Drop "allow_failure: true" from respdiff:recent-named
After the 9.21.16 release, this is not needed anymore.
2025-12-18 17:00:01 +00:00
Michal Nowak
dde377f870 fix: test: Add ans6 blackhole server to notify system test
Closes #5618

Merge branch '5618-add-blackhole-server' into 'main'

See merge request isc-projects/bind9!11353
2025-12-18 16:04:20 +01:00
Michal Nowak
21295bc188
Add ans6 blackhole server to notify system test 2025-12-18 15:27:17 +01:00
Štěpán Balážik
fd2b6adaad chg: test: Various isctest.asyncserver refactors
Several changes to the interface of isctest.asyncserver has been made
during the development of the rewrites, propagate these to all the others.

Others have become clear as well but have been deferred as multiple
rewrites have been in review at once.

Introduce all of these in this MR.

Merge branch 'stepan/asyncserver-improvements' into 'main'

See merge request isc-projects/bind9!11179
2025-12-18 12:48:48 +00:00
Štěpán Balážik
db212153d9 Use new AsyncDnsServer features in xfer system test
Use `prepare_new_response()`, `default_aa` and `default_rcode`.
2025-12-18 13:13:59 +01:00
Štěpán Balážik
f5f84a649b Use new AsyncDnsServer features in cookie system test
Take advantage of `default_aa`, `default_rcode` and `keyring` arguments.
2025-12-18 13:13:59 +01:00
Štěpán Balážik
5384998ccd Allow ResponseHandlers to roll back changes made to a response
Previously, this was only possible by making a new response by calling
make_response on qctx.query. This however ignored the `default_aa` and
`default_rcode` parameters of AsyncDnsServer.

Add prepare_new_response and save_initialized_response methods to
QueryContext.
2025-12-18 13:13:59 +01:00
Štěpán Balážik
de266fff4c Add TSIG keyring support to AsyncDnsServer
Previously, ResponseHandlers had to reparse the queries themselves if
they wanted to use TSIG. This led to `default_aa` and `default_rcode`
information being lost from the newly created messages.

Add support for TSIG keyrings to the AsyncDnsServer class directly.
2025-12-18 13:13:59 +01:00
Štěpán Balážik
8c2a72143c Remove dnspython<2.0.0 compatibility hacks from custom servers
isctest.asyncserver requires dnspython 2+ now.
2025-12-18 13:03:14 +01:00
Štěpán Balážik
5761de5531 Import dnspython modules explicitly in custom servers
Previously, the server relied on the modules being imported by the
isctest.asyncserver module. This is fragile and confuses tooling.

Clean up stray imports in the process.
2025-12-18 13:03:14 +01:00
Štěpán Balážik
d593af3a5f Allow adding multiple ResponseHandlers at once
Change this at call sites as well.
2025-12-18 13:03:14 +01:00
Štěpán Balážik
e4de7eb4f9 Use default_rcode for AsyncDnsServer where applicable
Rule of thumb: If a RCode is set unconditionally in all
ResponseHandlers, set it in the server constructor.
2025-12-18 13:03:14 +01:00
Štěpán Balážik
c7d84dc86a Set default_aa for AsyncDnsServer instances where suitable
Rule of thumb: If all ResponseHandlers said authoritative=True, it
should be default_aa=True instead.
2025-12-18 13:03:14 +01:00
Štěpán Balážik
6e684d44e0 Allow users of AsyncDnsServer to set AA bit for all responses
Previously, all responses had to be set as authoritative explicitly
using DnsResponseSend(..., authoritative=True). After using this,
it became obvious that this is obnoxious.

Add an optional keyword-only parameter to AsyncDnsServer that sets the
default value of the AA bit on outgoing responses.

Make all the other parameters keyword-only as well.
2025-12-18 13:03:14 +01:00
Štěpán Balážik
a0970f3d04 Refactor ControllableAsyncDnsServer setup
When this class was introduced, the constructor of its base class had no
parameters. This was changed in the meantime and these parameters were
not accessible by users of the subclass.

Don't override the constructor.
Move command setup to methods.
Move subclass-specific storage to cached properties.
Take instances of Command instead of the classes themselves for
symmetry with install_response_handler.
2025-12-18 13:03:14 +01:00
Michal Nowak
a413071470 chg: ci: Drop "allow_failure: true" from cross-version-config-tests
After the 9.21.16 release, this is not needed anymore.

Merge branch 'mnowak/drop-allow_failure-true-from-cross-version-config-tests' into 'main'

See merge request isc-projects/bind9!11257
2025-12-17 23:43:39 +01:00
Michal Nowak
aa3b1f0053 Drop "allow_failure: true" from cross-version-config-tests
After the 9.21.16 release, this is not needed anymore.
2025-12-17 17:52:36 +01:00
Andoni Duarte
4eaeb79173 Merge tag 'v9.21.16' 2025-12-17 15:33:14 +00:00
Arаm Sаrgsyаn
9e806bd81f fix: usr: Fix a possible catalog zone issue during reconfiguration
The :iscman:`named` process could terminate unexpectedly during
reconfiguration when a catalog zone update was taking place at
the same time. This has been fixed.

Merge branch 'aram/catz-reconfig-crash-fix' into 'main'

See merge request isc-projects/bind9!11366
2025-12-17 14:55:43 +00:00
Aram Sargsyan
aed9cafd5c Lock the catalog zone when reconfiguring it
A catalog zone is updated in an offloaded thread, which is not
stopped during a reconfiguration in an exclusive mode, and so
can cause a race condition with it.

Waiting for the offloaded threads to complete their work before
entering into the exclusive mode can potentially cause unwanted
delays, because offloaded threads are generally "allowed" to take
a longer amount of time before they complete.

Add a dns_catz_zone_prereconfig()/dns_catz_zone_postreconfig() pair
of functions which currently just lock the catalog zone when
reconfiguring it. The change should eliminate the race.

As a side note, there was already a similar pair of functions,
dns_catz_prereconfig() and dns_catz_postreconfig() which are called
before and after reconfiguring a 'dns_catz_zones_t' object.

Below are the stack traces of the reconfiguration thread which has
asserted, and a catalog zone update thread which was caught in the
middle of its work despite the fact that the exclusive mode is
turned on.

                Stack trace of thread 23859:
                #0  0x00007f80e7b8e52f raise (libc.so.6)
                #1  0x00007f80e7b61e65 abort (libc.so.6)
                #2  0x0000000000422558 assertion_failed (named)
                #3  0x00007f80eaa6799e isc_assertion_failed (libisc-9.18.41.so)
                #4  0x00007f80ea5bc788 dns_catz_entry_getname (libdns-9.18.41.so)
                #5  0x000000000042ce0e catz_reconfigure (named)
                #6  0x000000000042d3c5 configure_catz_zone (named)
                #7  0x000000000042d7a4 configure_catz (named)
                #8  0x0000000000430645 configure_view (named)
                #9  0x000000000043d998 load_configuration (named)
                #10 0x000000000044184f loadconfig (named)
                #11 0x0000000000442525 named_server_reconfigcommand (named)
                #12 0x000000000041b277 named_control_docommand (named)
                #13 0x000000000041c74a control_command (named)
                #14 0x00007f80eaa912ae task_run (libisc-9.18.41.so)
                #15 0x00007f80eaa914cd isc_task_run (libisc-9.18.41.so)
                #16 0x00007f80eaa46435 isc__nm_async_task (libisc-9.18.41.so)
                #17 0x00007f80eaa467aa process_netievent (libisc-9.18.41.so)
                #18 0x00007f80eaa475a6 process_queue (libisc-9.18.41.so)
                #19 0x00007f80eaa46227 process_all_queues (libisc-9.18.41.so)
                #20 0x00007f80eaa462a1 async_cb (libisc-9.18.41.so)
                #21 0x00007f80e8d01893 uv__async_io.part.3 (libuv.so.1)
                #22 0x00007f80e8d13ac4 uv__io_poll (libuv.so.1)
                #23 0x00007f80e8d023fb uv_run (libuv.so.1)
                #24 0x00007f80eaa45ced nm_thread (libisc-9.18.41.so)
                #25 0x00007f80eaa9bda3 isc__trampoline_run (libisc-9.18.41.so)
                #26 0x00007f80e7f1e1ca start_thread (libpthread.so.0)
                #27 0x00007f80e7b798d3 __clone (libc.so.6)
    ...
    ...
                Stack trace of thread 23912:
                #0  0x00007f80ea5bc2da dns_catz_options_setdefault (libdns-9.18.41.so)
                #1  0x00007f80ea5bd411 dns__catz_zones_merge (libdns-9.18.41.so)
                #2  0x00007f80ea5c3c2f dns__catz_update_cb (libdns-9.18.41.so)
                #3  0x00007f80eaa4fee9 isc__nm_work_run (libisc-9.18.41.so)
                #4  0x00007f80eaa9bda3 isc__trampoline_run (libisc-9.18.41.so)
                #5  0x00007f80eaa4ff48 isc__nm_work_cb (libisc-9.18.41.so)
                #6  0x00007f80e8cfc75e worker (libuv.so.1)
                #7  0x00007f80e7f1e1ca start_thread (libpthread.so.0)
                #8  0x00007f80e7b798d3 __clone (libc.so.6)
2025-12-17 14:54:49 +00:00
Ondřej Surý
e18af82f3c chg: nil: Add dns_rdataset_cleanup() function to conditionally cleanup rdatasets
Merge branch 'ondrej/add-dns_rdataset_cleanup' into 'main'

See merge request isc-projects/bind9!11382
2025-12-17 15:20:14 +01:00