2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-08-30 14:07:59 +00:00
Commit Graph

43778 Commits

Author SHA1 Message Date
Michal Nowak
baa5ccd795 Use "digit" class instead of character range in rndc_dumpdb()
The tr range did not work on Solaris 11.4. Let's use a class that is
defined in POSIX.
2025-06-02 11:02:52 +00:00
Matthijs Mekking
513f5ad8e0 chg: test: Rewrite kasp system test to pytest (5)
Rollover scenarios.

Merge branch 'matthijs-pytest-rewrite-kasp-system-test-5' into 'main'

See merge request isc-projects/bind9!10292
2025-06-02 09:21:21 +00:00
Nicki Křížek
c00121b4c2 Add dynamic update facility to NamedInstance
Deduplicate the code for dynamic updates and increase code clarity by
using an actual dns.update.UpdateMessage rather than an undefined
intermediary format passed around as a list of arguments.
2025-06-02 09:21:06 +00:00
Matthijs Mekking
fd290f391f Convert csk rollover test cases to pytest
Move the 'csk-roll1' and 'csk-roll2' zones to the rollover test dir and
convert CSK rollover tests to pytest.

The DS swap spans multiple steps. Only the first time we should check
if the "CDS is now published" log is there, and only the first time we
should run 'rndc dnssec -checkds' on the keys. Add a new key to the
step dictionary to disable the DS swap checks.

This made me realize that we need to check for "is not None" in case
the value in the dictionary is False. Update check_rollover_step()
accordingly, and also add a log message which step/zone we are currently
checking.
2025-06-02 09:21:06 +00:00
Matthijs Mekking
46800e407e Convert the 'three is a crowd' test case to pytest
This test shows similarities with the Double KSK rollover method, so
put the test in there.
2025-06-02 09:21:06 +00:00
Matthijs Mekking
9ff7609614 Convert ksk rollover test case to pytest
Move the 'ksk-doubleksk' zones to the rollover test dir and convert KSK
rollover test to pytest.

Since the 'ksk-doubleksk' policy publishes different CDNSKEY/CDS RRsets,
update the 'check_rollover_step' to check which CDNSKEY/CDS RRsets should
be published and which should be prohibited. Update 'isctest.kasp'
accordingly.

We are changing the ZSK lifetime to unlimited in this test case as it
is of no importance (this actually discovered a bug in setting the
next time the keymgr should run).
2025-06-02 09:21:06 +00:00
Matthijs Mekking
bd6c70bd67 Convert zsk rollover test case to pytest
Move the 'zsk-prepub' zones to the rollover test dir and convert ZSK
rollover test to pytest.

We need a way to signal a smooth rollover is going on. Signatures are
being replaced gradually during a ZSK rollover, so the existing
signatures of the predecessor ZSK are still being used. Add a smooth
operator to set the right expectations on what signatures are being
used.

Setting expected key relationships is a bit crude: a list of two
elements where the first element is the index of the expected keys that
is the predecessor, and the second element is the index of the expected
keys that is the successor.

We are changing the KSK lifetime to unlimited in this test case as it
is of no importance.
2025-06-02 09:21:06 +00:00
Matthijs Mekking
233fdb8d52 Convert enable dnssec test case to pytest
Move the 'enable-dnssec' to the rollover test dir and convert to pytest.

This requires new test functionality to check that "CDS is published"
messages are logged (or prohibited).

The setup part is slightly adapted such that it no longer needs to
set the '-P sync' value in most cases (this is then set by 'named'),
and to adjust for the inappropriate safety intervals fix.
2025-06-02 09:21:06 +00:00
Matthijs Mekking
8ee02190a5 Convert kasp multi-signer tests to pytest
Move the multi-signer test scenarios to the rollover directory and
convert tests to pytest.

- If the KeyProperties set the "legacy" to True, don't set expected
  key times, nor check them. Also, when a matching key is found, set
  key.external to True.
- External keys don't show up in the 'rndc dnssec -status' output so
  skip them in the 'check_dnssecstatus' function. External keys never
  sign RRsets, so also skip those keys in the '_check_signatures'
  function.
- Key properties strings now can set expected key tag ranges, and if
  KeyProperties have tag ranges set, they are checked.
2025-06-02 09:21:06 +00:00
Matthijs Mekking
4d08ec50d1 Move rollover test cases to separate test dir
In order to keep the kasp system test somewhat approachable, let's
move all rollover scenarios to its own test directory. Starting with
the manual rollover test cases.

A new test function is added to 'isctest.kasp', to verify that the
relationship metadata (Predecessor, Successor) is set correctly.

The configuration and setup for the zone 'manual-rollover.kasp' are
almost copied verbatim, the only exception is the keytimes. Similar
to the test kasp cases, we no longer set "SyncPublish/PublishCDS" in
the setup script. In addition to that, the offset is changed from one
day ago to one week ago, so that the key states match the timing
metadata (one day is too short to move a key from "hidden" to
"omnipresent").
2025-06-02 09:21:06 +00:00
Michal Nowak
ead7b48003 fix: dev: Allow commandline.c to compile on Solaris
commandline.c failed to compile on Solaris because NAME_MAX was
undefined.  Include 'isc/dir.h' which defines NAME_MAX for platforms
that don't define it.

    In file included from commandline.c:54:
    ./include/isc/commandline.h:31:38: error: 'NAME_MAX' undeclared here (not in a function)
       31 | extern char isc_commandline_progname[NAME_MAX];
          |                                      ^~~~~~~~

Merge branch 'mnowak/fix-solaris-commandline-h' into 'main'

See merge request isc-projects/bind9!10524
2025-06-02 09:01:09 +00:00
Michal Nowak
b5e7d96f0a Allow commandline.c to compile on Solaris
commandline.c failed to compile on Solaris because NAME_MAX was
undefined.  Include 'isc/dir.h' which defines NAME_MAX for platforms
that don't define it.

    In file included from commandline.c:54:
    ./include/isc/commandline.h:31:38: error: 'NAME_MAX' undeclared here (not in a function)
       31 | extern char isc_commandline_progname[NAME_MAX];
          |                                      ^~~~~~~~
2025-06-02 09:00:48 +00:00
Petr Špaček
d8b8db6b97 chg: doc: Add text about no bug bounties
Vicky and Ondrej have agreed that we should add text to explain that we do not give bug bounties.

Merge branch 'sgoldlust-main-bug-bounty' into 'main'

See merge request isc-projects/bind9!10246
2025-06-02 07:02:59 +00:00
Suzanne Goldlust
67cd4f9743 Update URL for bug reports 2025-05-30 17:32:36 -07:00
Suzanne Goldlust
11269e1a18 Add text about no bug bounties 2025-05-30 17:31:52 -07:00
Michał Kępień
fec62266cb chg: test: Use isctest.asyncserver in the "chain" test
Replace the custom DNS servers used in the "chain" system test with
new code based on the isctest.asyncserver module.

For ans3, replace the sequence of logical conditions present in Perl
code with zone files and a limited amount of custom logic applied on top
of them where necessary.

For ans4, replace the ctl_channel() and create_response() functions with
a custom control command handler coupled with a dynamically instantiated
response handler, making the code more robust and readable.

Migrate sendcmd() and its uses to the new way of sending control queries
to custom servers used in system tests.

Depends on !10409

Merge branch 'michal/chain-asyncserver' into 'main'

See merge request isc-projects/bind9!10410
2025-05-30 17:37:53 +00:00
Michał Kępień
c3d3c9955d Use isctest.asyncserver in the "chain" test
Replace the custom DNS servers used in the "chain" system test with
new code based on the isctest.asyncserver module.

For ans3, replace the sequence of logical conditions present in Perl
code with zone files and a limited amount of custom logic applied on top
of them where necessary.

For ans4, replace the ctl_channel() and create_response() functions with
a custom control command handler coupled with a dynamically instantiated
response handler, making the code more robust and readable.

Migrate sendcmd() and its uses to the new way of sending control queries
to custom servers used in system tests.
2025-05-30 18:23:21 +02:00
Michał Kępień
9a230c16ff Improve readability of sendcmd() calls
To improve readability of sendcmd() calls used for controlling
isctest.asyncserver-based custom DNS servers, pass the command's name
and arguments as separate parameters.
2025-05-30 18:23:21 +02:00
Michał Kępień
ea2bef720d new: test: Handle alias records in zone files loaded by AsyncDnsServer
dnspython does not treat CNAME records in zone files in any special way;
they are just RRsets belonging to zone nodes.  Process CNAMEs when
preparing zone-based responses just like a normal authoritative DNS
server would.

Adding proper DNAME support to AsyncDnsServer would add complexity to
its code for little gain: DNAME use in custom system test servers is
limited to crafting responses that attempt to trigger bugs in named.

This fact will not be obvious to AsyncDnsServer users as it
automatically loads all zone files it finds and handles CNAME records
like a normal authoritative DNS server would.

Therefore, to prevent surprises:

- raise an exception whenever DNAME records are found in any of the
zone files loaded by AsyncDnsServer,

- add a new optional argument to the AsyncDnsServer constructor that
enables suppressing this new behavior, enabling zones with DNAME
records to be loaded anyway.

This enables response handlers to use the DNAME records present in zone
files in arbitrary ways without complicating the "base" code.

Merge branch 'michal/asyncserver-alias-records' into 'main'

See merge request isc-projects/bind9!10409
2025-05-30 16:18:07 +00:00
Michał Kępień
8a562526f6 Force manual DNAME handling to be acknowledged
Adding proper DNAME support to AsyncDnsServer would add complexity to
its code for little gain: DNAME use in custom system test servers is
limited to crafting responses that attempt to trigger bugs in named.

This fact will not be obvious to AsyncDnsServer users as it
automatically loads all zone files it finds and handles CNAME records
like a normal authoritative DNS server would.

Therefore, to prevent surprises:

  - raise an exception whenever DNAME records are found in any of the
    zone files loaded by AsyncDnsServer,

  - add a new optional argument to the AsyncDnsServer constructor that
    enables suppressing this new behavior, enabling zones with DNAME
    records to be loaded anyway.

This enables response handlers to use the DNAME records present in zone
files in arbitrary ways without complicating the "base" code.
2025-05-30 18:08:54 +02:00
Michał Kępień
5110278008 Drop unused AsyncDnsServer constructor argument
The constructor for the AsyncDnsServer class takes a 'load_zones'
argument that is not used anywhere and is not expected to be useful in
the future: zone files are not required for an AsyncDnsServer instance
to start and, if necessary, zone-based answers can be suppressed or
modified by installing a custom response handler.
2025-05-30 18:08:54 +02:00
Michał Kępień
1b8ceec580 Properly handle CNAMEs when preparing responses
dnspython does not treat CNAME records in zone files in any special way;
they are just RRsets belonging to zone nodes.  Process CNAMEs when
preparing zone-based responses just like a normal authoritative DNS
server would.
2025-05-30 18:08:54 +02:00
Michał Kępień
2a9c74546d Add debug logs for outgoing DNS messages
Since AsyncDnsServer logs incoming DNS messages as seen on the wire, do
the same for the responses sent by the server.
2025-05-30 18:08:54 +02:00
Aydın Mercan
e8f3ce70aa fix: dev: use proper flexible arrays in rrl
The single-element array hack can trip newer sanitizers or fortification levels.

Found with UBSAN triggering the RRL system test with meson.

Merge branch 'aydin/rrl-flex-array' into 'main'

See merge request isc-projects/bind9!10509
2025-05-30 11:18:08 +00:00
Aydın Mercan
408190fd3b use proper flexible arrays in rrl
The single-element array hack can trip newer sanitizers or fortification
levels.
2025-05-30 10:44:49 +00:00
Aydın Mercan
23d70bde6c add attribute macro for counted_by
Using C23 attributes for `counted_by` is broken with clang.

`__has_attribute` is used since `__has_c_attribute` only works with C23
attributes, (`gnu::counted_by`/`clang::counted_by`)
2025-05-30 08:04:49 +00:00
Mark Andrews
9b7c19a340 fix: dev: Allow keystore.c to compile on Solaris
keystore.c failed to compile on Solaris because NAME_MAX was 
undefined.  Include 'isc/dir.h' which defines NAME_MAX for platforms
that don't define it.

Closes #5327

Merge branch '5327-fix-solaris-keystore-build' into 'main'

See merge request isc-projects/bind9!10522
2025-05-30 06:34:57 +00:00
Mark Andrews
521bf1d50f Allow keystore.c to compile on Solaris
keystore.c failed to compile on Solaris because NAME_MAX was
undefined.  Include 'isc/dir.h' which defines NAME_MAX for platforms
that don't define it.
2025-05-30 15:14:38 +10:00
Michal Nowak
afcb56cf21 chg: ci: Use AlmaLinux for FIPS testing in AWS
Merge branch 'mnowak/alma-linux-with-fips' into 'main'

See merge request isc-projects/bind9!10433
2025-05-29 17:15:58 +00:00
Michal Nowak
fbcdbca65f Check system is FIPS-aware when BIND 9 FIPS mode is enabled 2025-05-29 18:36:25 +02:00
Michal Nowak
5553256427 Use AlmaLinux for FIPS testing in AWS 2025-05-29 18:36:25 +02:00
Michal Nowak
20ba24a2f8 chg: ci: Replace Oracle Linux Docker images with AlmaLinux ones
To be consistent with the replacing of Oracle Linux QCOW2 images with
AlmaLinux AWS AMIs, also replace Docker images.

Merge branch 'mnowak/replace-oracle-linux-with-almalinux' into 'main'

See merge request isc-projects/bind9!10434
2025-05-29 15:11:10 +00:00
Michal Nowak
63947a2062 Replace Oracle Linux Docker images with AlmaLinux ones
To be consistent with the replacing of Oracle Linux QCOW2 images with
AlmaLinux AWS AMIs, also replace Docker images.
2025-05-29 16:54:57 +02:00
Nicki Křížek
1291bbf74a fix: test: Fix intermittent kasp pytest failures
The `pytest` cases checks if a zone is signed by looking at the `NSEC` record at the apex. If that has an RRSIG record, it is considered signed. But `named` signs zones incrementally (in batches) and so the zone may still lack some signatures. In other words, the tests may consider a zone signed while in fact signing is not yet complete, then performs additional checks such as is a subdomain signed with the right key. If this check happens before the zone is actually fully
signed, the check will fail.

Fix this by using `check_dnssec_verify` instead of `check_is_zone_signed`. We were already doing this check, but we now move it up. This will transfer the zone and then run `dnssec-verify` on the response. If the zone is partially signed, the check will fail, and it will retry for up to ten times.

Closes #5303

Merge branch '5303-kasp-pytest-intermittent-test-failures' into 'main'

See merge request isc-projects/bind9!10445
2025-05-29 12:34:15 +00:00
Matthijs Mekking
7a31fd57e2 Fix intermittent kasp pytest failures
The pytest cases checks if a zone is signed by looking at the NSEC
record at the apex. If that has an RRSIG record, it is considered
signed. But 'named' signs zones incrementally (in batches) and so
the zone may still lack some signatures. In other words, the tests
may consider a zone signed while in fact signing is not yet complete,
then performs additional checks such as is a subdomain signed with the
right key. If this check happens before the zone is actually fully
signed, the check will fail.

Fix this by using 'check_dnssec_verify' instead of
'check_is_zone_signed'. We were already doing this check, but we now
move it up. This will transfer the zone and then run 'dnssec-verify'
on the response. If the zone is partially signed, the check will fail,
and it will retry for up to ten times.
2025-05-29 11:44:56 +00:00
Nicki Křížek
e29d87a29b chg: test: Add utility module to import correct version of hypothesis
On FIPS-enabled platforms, we need to ensure a minimal version of
hypothesis which no longer uses MD5. This doesn't need to be enforced
for other platforms.

Move the import magic to a utility module to avoid copy-pasting the
boilerplate code around.

Merge branch 'nicki/pytest-import-hypothesis' into 'main'

See merge request isc-projects/bind9!10442
2025-05-29 09:04:04 +00:00
Nicki Křížek
0aff715f40 Ensure supported version of hypothesis is available
On FIPS-enabled platforms, we need to ensure a minimal version of
hypothesis which no longer uses MD5. This doesn't need to be enforced
for other platforms.

Move the import magic to a utility module to avoid copy-pasting the
boilerplate code around.
2025-05-29 10:29:13 +02:00
Mark Andrews
d8bc3a36e1 fix: nil: silence tainted scalar in client.c
Coverity detected that 'optlen' was not being checked in 'process_opt'.  
This is actually already done when the OPT record was initially  
parsed.  Add an INSIST to silence Coverity as is done in message.c.

Closes #5330

Merge branch '5330-tainted-scalar-in-client-c' into 'main'

See merge request isc-projects/bind9!10500
2025-05-29 06:59:00 +00:00
Mark Andrews
72cd6e8591 Silence tainted scalar in client.c
Coverity detected that 'optlen' was not being checked in 'process_opt'.
This is actually already done when the OPT record was initially
parsed.  Add an INSIST to silence Coverity as is done in message.c.
2025-05-29 06:26:37 +00:00
Ondřej Surý
992be6598f fix: nil: Remove spurious zconf.h include
The #include <zconf.h> got spuriously included into isc_commandline
unit.  The #include <limits.h> needs to be used instead.

Merge branch 'ondrej/unify-handling-of-the-program-name-fix' into 'main'

See merge request isc-projects/bind9!10503
2025-05-29 04:35:08 +00:00
Ondřej Surý
15ddacbf17 Remove spurious zconf.h include
The #include <zconf.h> got spuriously included into isc_commandline
unit.  The #include <limits.h> needs to be used instead.
2025-05-29 06:34:08 +02:00
Ondřej Surý
33f17c2384 chg: dev: Unify handling of the program name in all the utilities
There were several methods how we used 'argv[0]'.  Some programs had a
static value, some programs did use isc_file_progname(), some programs
stripped 'lt-' from the beginning of the name.  And some used argv[0]
directly.

Unify the handling and all the variables into isc_commandline_progname
that gets populated by the new isc_commandline_init(argc, argv) call.

Merge branch 'ondrej/unify-handling-of-the-program-name' into 'main'

See merge request isc-projects/bind9!10502
2025-05-29 04:24:26 +00:00
Ondřej Surý
a676551395 Unify handling of the program name in all the utilities
There were several methods how we used 'argv[0]'.  Some programs had a
static value, some programs did use isc_file_progname(), some programs
stripped 'lt-' from the beginning of the name.  And some used argv[0]
directly.

Unify the handling and all the variables into isc_commandline_progname
that gets populated by the new isc_commandline_init(argc, argv) call.
2025-05-29 06:17:32 +02:00
Ondřej Surý
ccf7a7dd7e chg: dev: Set name for all the isc_mem context from isc_mem_create()
Instead of giving the memory context names with an explicit call to
isc_mem_setname(), add the name to isc_mem_create() call to have all the
memory contexts an unconditional name.

Merge branch 'ondrej/ondrej-isc_mem_create-with-name' into 'main'

See merge request isc-projects/bind9!10426
2025-05-29 03:50:44 +00:00
Ondřej Surý
7f498cc60d Give every memory pool a name
Instead of giving the memory pools names with an explicit call to
isc_mempool_setname(), add the name to isc_mempool_create() call to have
all the memory pools an unconditional name.
2025-05-29 05:46:46 +02:00
Ondřej Surý
4e79e9baae Give every memory context a name
Instead of giving the memory context names with an explicit call to
isc_mem_setname(), add the name to isc_mem_create() call to have all the
memory contexts an unconditional name.
2025-05-29 05:46:46 +02:00
Evan Hunt
f2f2e5bc76 fix: nil: simplify code around isc_mem_put() and isc_mem_free()
it isn't necessary to set a pointer to NULL after calling
isc_mem_put() or isc_mem_free(), because those macros take
care of it automatically.

Merge branch 'each-memfree-null' into 'main'

See merge request isc-projects/bind9!10485
2025-05-29 00:51:17 +00:00
Colin Vidal
19fefc23cc coccinelle patch for isc_mem_free()/isc_mem_put()
add a Coccinelle patch to ensure the pointer being used by
isc_mem_free() and isc_mem_put() is not explicitly set to NULL (those
mecros are taking care of it).
2025-05-28 17:22:32 -07:00
Evan Hunt
dd9a685f4a simplify code around isc_mem_put() and isc_mem_free()
it isn't necessary to set a pointer to NULL after calling
isc_mem_put() or isc_mem_free(), because those macros take
care of it automatically.
2025-05-28 17:22:32 -07:00
Ondřej Surý
87ad162463 fix: dev: Set name for all the isc_mem contexts
Merge branch 'ondrej/fix-isc_mem_setname-usage' into 'main'

See merge request isc-projects/bind9!10425
2025-05-28 20:46:14 +00:00