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

42258 Commits

Author SHA1 Message Date
Matthijs Mekking
7bb6d82505 Adjust kasp system test to get keys which signed
If there is a keytag conflict between keys with different algorithms,
we need to supply what key algorithm is used so we can get the right
public key.

For clarity, print the algorithm on the found keys after 'check_keys'.
2024-08-22 11:29:43 +02:00
Michal Nowak
b9bb0528f6 chg: ci: Update Clang to version 19
These Clang 19-identified issues need to be addressed first:
- [x] isc-projects/bind9!9313
- [x] isc-projects/bind9!9317
- [x] isc-projects/bind9!9316
- [x] isc-projects/bind9!9315

Validation pipelines for backports:
- [x] ~"v9.21" - https://gitlab.isc.org/isc-projects/bind9/-/pipelines/191211
- [x] ~"v9.20" - https://gitlab.isc.org/isc-projects/bind9/-/pipelines/191512
- [x] ~"v9.18" - https://gitlab.isc.org/isc-projects/bind9/-/pipelines/191904

Prereq: isc-projects/images!328

Merge branch 'mnowak/llvm-19' into 'main'

See merge request isc-projects/bind9!9296
2024-08-22 08:06:56 +00:00
Ondřej Surý
7b756350f5
Use clang-format-19 to update formatting
This is purely result of running:

    git-clang-format-19 --binary clang-format-19 origin/main
2024-08-22 09:21:55 +02:00
Michal Nowak
ec62fc1399
Update Clang to version 19 2024-08-22 09:21:55 +02:00
Matthijs Mekking
bfa206beec new: usr: Support for Offline KSK implemented
Add a new configuration option `offline-ksk` to enable Offline KSK key management. Signed Key Response (SKR) files created with `dnssec-ksr` (or other program) can now be imported into `named` with the new `rndc skr -import` command. Rather than creating new DNSKEY, CDS and CDNSKEY records and generating signatures covering these types, these records are loaded from the currently active bundle from the imported SKR. 

The implementation is loosely based on: https://www.iana.org/dnssec/archive/files/draft-icann-dnssec-keymgmt-01.txt

Closes #1128

Merge branch '1128-offline-ksk-rndc-import-skr' into 'main'

Closes #1128

See merge request isc-projects/bind9!9119
2024-08-22 07:15:00 +00:00
Matthijs Mekking
d504f4f20b Add a section for Offline KSK to the DNSSEC Guide
This will describe in more detail the operational practices of
Offline KSK.
2024-08-22 08:21:53 +02:00
Matthijs Mekking
1ce163795e Add skr unit test
Add a test file for testing the skr related code.
2024-08-22 08:21:52 +02:00
Matthijs Mekking
2e3068ed60 Disable some behavior in offline-ksk mode
Some things we no longer want to do when we are in offline-ksk mode.

1. Don't check for inactive and private keys if the key is a KSK.
2. Don't update the TTL of DNSKEY, CDS and CDNSKEY RRset, these come
   from the SKR.
2024-08-22 08:21:52 +02:00
Matthijs Mekking
61cf599fbf Retrieve RRSIG from SKR
When it is time to generate a new signature (dns_dnssec_sign), rather
than create a new one, retrieve it from the SKR.
2024-08-22 08:21:52 +02:00
Matthijs Mekking
30d20b110e Don't read private key files for offline KSKs
When we are appending contents of a DNSKEY rdataset to a keylist,
don't attempt to read the private key file of a KSK when we are in
offline-ksk mode.
2024-08-22 08:21:52 +02:00
Matthijs Mekking
2190aa904f Update key states in offline-ksk mode
With offline-ksk enabled, we don't run the keymgr because the key
timings are determined by the SKR. We do update the key states but
we derive them from the timing metadata.

Then, we can skip a other tasks in offline-ksk mode, like DS checking
at the parent and CDS synchronization, because the CDS and CDNSKEY
RRsets also come from the SKR.
2024-08-22 08:21:52 +02:00
Matthijs Mekking
63e058c29e Apply SKR bundle on rekey
When a zone has a skr structure, lookup the currently active bundle
that contains the right key and signature material.
2024-08-22 08:21:52 +02:00
Matthijs Mekking
037382c4a5 Implement SKR import
When 'rndc skr import' is called, read the file contents and store the
data in the zone's skr structure.
2024-08-22 08:21:52 +02:00
Matthijs Mekking
445722d2bf Add code to store SKR
This added source code stores SKR data. It is loosely based on:
https://www.iana.org/dnssec/archive/files/draft-icann-dnssec-keymgmt-01.txt

A SKR contains a list of signed DNSKEY RRsets. Each change in data
should be stored in a separate bundle. So if the RRSIG is refreshed that
means it is stored in the next bundle. Likewise, if there is a new ZSK
pre-published, it is in the next bundle.

In addition (not mentioned in the draft), each bundle may contain
signed CDS and CDNSKEY RRsets.

Each bundle has an inception time. These will determine when we need
to re-sign or re-key the zone.
2024-08-22 08:21:52 +02:00
Matthijs Mekking
afe093258c Test rndc skr import
Test importing a Signed Key Response. Files should be loaded and once
loaded the correct bundle should be used. Alsoe test cases where the
bundle is not the first bundle in the SKR.
2024-08-22 08:21:52 +02:00
Matthijs Mekking
ecd2b79106 Add option to kasp.sh check_keys to retain found keys
This will come in handy when we are testing offline-ksk where first
we check for ZSKs and then the KSK.
2024-08-22 08:21:52 +02:00
Matthijs Mekking
edbb219fda Implement dummy 'rndc skr -import' command
Add the code and documentation required to provide KSR import using
rndc.  This is just the command, and the feature is at this point in
time still not implemented.
2024-08-22 08:21:52 +02:00
Matthijs Mekking
748d98e387 Add a common setup script for ksr
The previous setup.sh has been moved to ns1/setup.sh, we need a common
setup script to invoke ns1/setup.sh.
2024-08-22 08:21:52 +02:00
Matthijs Mekking
367154c1de Update ksr system test to include server
Prepare the system test for tests that require a server to import
created SKR files. This means the test script needs adjustments to
take into account the directory test files are located.

In addition, the check_keys function is renamed to ksr_check_keys
because the name clashes with check_keys from kasp.sh. It also has an
extra parameter added, offset, that can be used to check ksr files that
are created in the past or future.
2024-08-22 08:21:52 +02:00
Matthijs Mekking
0598381236 Add offline-ksk option
Add a new configuration option to enable Offline KSK key management.

Offline KSK cannot work with CSK because it splits how keys with the
KSK and ZSK role operate. Therefore, one key cannot have both roles.
Add a configuration check to ensure this.
2024-08-22 08:21:52 +02:00
Mark Andrews
2299aba5c2 chg: dev: Restore the ability to select individual unit tests
This add the command line arguments: `-d` (debug), `-l` (list tests) and `-t test` (run this test) to the unit tests.

Closes #4579

Merge branch '4579-restore-the-ability-to-select-individual-unit-tests' into 'main'

Closes #4579

See merge request isc-projects/bind9!9384
2024-08-22 00:54:13 +00:00
Mark Andrews
d8a6ff5c3e Extend ISC_TEST_MAIN for debugging
ISC_TEST_MAIN now supports turning on/off debugging and
running individual tests.
2024-08-22 09:54:39 +10:00
Michal Nowak
8d6b0bcc6b chg: ci: Add FreeBSD 14.1
Prereq: https://gitlab.isc.org/isc-projects/images/-/merge_requests/323

Merge branch 'mnowak/freebsd-14.1' into 'main'

See merge request isc-projects/bind9!9116
2024-08-21 16:28:48 +00:00
Michal Nowak
bca3d09354 Add FreeBSD 14.1 2024-08-21 16:28:18 +00:00
Nicki Křížek
51d7c2973c chg: Merge 9.21.0 release branch
Merge branch 'main-merge-v9.21.0' into 'main'

Closes #4733

See merge request isc-projects/bind9!9378
2024-08-21 15:10:37 +00:00
Nicki Křížek
779de4ec34
Merge tag 'v9.21.0' 2024-08-21 16:23:09 +02:00
Ondřej Surý
14d2040934 fix: usr: Fix rare assertion failure when shutting down incoming transfer
A very rare assertion failure can be triggered when the incoming transfer is either forcefully shut down or it is finished during printing the details about the statistics channel.  This has been fixed.

Closes #4860

Merge branch '4860-destroy-xfrin-timers-on-the-loop' into 'main'

Closes #4860

See merge request isc-projects/bind9!9336
2024-08-21 11:56:10 +00:00
Ondřej Surý
3bca3cb5cf
Destroy the dns_xfrin isc_timers on the correct loop
There are few places where we attach/detach from the dns_xfrin object
while running on a different thread than the zone's assigned thread -
xfrin_xmlrender() in the statschannel and dns_zone_stopxfr() to name the
two places where it happens now.  In the rare case, when the incoming
transfer completes (or shuts down) in the brief period between the other
thread attaches and detaches from the dns_xfrin, the isc_timer_destroy()
calls would be called by the last thread calling the xfrin_detach().
In the worst case, it would be this other thread causing assertion
failure.  Move the isc_timer_destroy() call to xfrin_end() function
which is always called on the right thread and to match this move
isc_timer_create() to xfrin_start() - although this other change makes
no difference.
2024-08-21 13:54:40 +02:00
Arаm Sаrgsyаn
cf53eac46e new: usr: Print the full path of the working directory in startup log messages
named now prints its initial working directory during startup and the
changed working directory when loading or reloading its configuration
file if it has a valid 'directory' option defined.

Closes #4731

Merge branch '4731-log-workdir-full-path' into 'main'

Closes #4731

See merge request isc-projects/bind9!9362
2024-08-20 17:30:26 +00:00
Aram Sargsyan
fd8e1d161f Print the full path of the working directory in startup log messages
named now prints its initial working directory during startup and the
changed working directory when loading or reloading its configuration
file if it has a valid 'directory' option defined.
2024-08-20 16:28:53 +00:00
Ondřej Surý
558ec133ea chg: dev: Use seteuid()/setegid() instead of setreseuid()/setresgid()
It looks like that all supported systems now have support for
_POSIX_SAVED_IDS, so it's safe to use setegid() and setegid() because
those will not change saved used/group IDs.

Closes #4862

Merge branch '4862-just-use-seteuid-and-setegid' into 'main'

Closes #4862

See merge request isc-projects/bind9!9363
2024-08-20 14:58:39 +00:00
Ondřej Surý
ab517fc6e4 Use seteuid()/setegid() instead of setreseuid()/setresgid()
It looks like that all supported systems now have support for
_POSIX_SAVED_IDS, so it's safe to use setegid() and setegid() because
those will not change saved used/group IDs.
2024-08-20 14:58:27 +00:00
Ondřej Surý
e44652a173 fix: test: Allow TTL skew in the badcache print unit test
If the machine running the job is extra loaded (or extra slow), the
print test in the badcache unit test would fail because the TTL would be
59 (possibly even lower) and the test expects the badcache.out to only
have TTL 60.  Refactor the test to check for the expected strings and
check whether the TTL is in the expected range.

Closes #4861

Merge branch '4861-allow-TTL-skew-in-badcache_test' into 'main'

Closes #4861

See merge request isc-projects/bind9!9338
2024-08-20 13:57:57 +00:00
Ondřej Surý
7860b6519d
Allow TTL skew in the badcache print unit test
If the machine running the job is extra loaded (or extra slow), the
print test in the badcache unit test would fail because the TTL would be
59 (possibly even lower) and the test expects the badcache.out to only
have TTL 60.  Refactor the test to check for the expected strings and
check whether the TTL is in the expected range.
2024-08-20 15:55:35 +02:00
Ondřej Surý
aa408051d6 chg: dev: Use single logging context for everything
Instead of juggling different logging context, use one single logging
context that gets initialized in the libisc constructor and destroyed in
the libisc destructor.

Closes #4848

Merge branch '4848-refactor-isc_log-api-to-use-single-global-logging-context' into 'main'

Closes #4848

See merge request isc-projects/bind9!9301
2024-08-20 12:56:04 +00:00
Evan Hunt
520500d1b3 pause to let reloading complete
the rpz test frequently failed in DNSRPS mode and sometimes in native
mode as well because of an 'rndc reload' not being complete.
2024-08-20 12:50:39 +00:00
Ondřej Surý
679e90a57d Add isc_log_createandusechannel() function to simplify usage
The new
isc_log_createandusechannel() function combines following calls:

    isc_log_createchannel()
    isc_log_usechannel()

calls into a single call that cannot fail and therefore can be used in
places where we know this cannot fail thus simplifying the error
handling.
2024-08-20 12:50:39 +00:00
Ondřej Surý
091d738c72 Convert all categories and modules into static lists
Remove the complicated mechanism that could be (in theory) used by
external libraries to register new categories and modules with
statically defined lists in <isc/log.h>.  This is similar to what we
have done for <isc/result.h> result codes.  All the libraries are now
internal to BIND 9, so we don't need to provide a mechanism to register
extra categories and modules.
2024-08-20 12:50:39 +00:00
Ondřej Surý
8506102216 Remove logging context (isc_log_t) from the public namespace
Now that the logging uses single global context, remove the isc_log_t
from the public namespace.
2024-08-20 12:50:39 +00:00
Ondřej Surý
043f11de3f Remove isc_log_write1() and isc_log_vwrite1() functions
The isc_log_write1() and isc_log_vwrite1() functions were meant to
de-duplicate the messages sent to the isc_log subsystem.  However, they
were never used in an entire code base and the whole mechanism around it
was complicated and very inefficient.  Just remove those, there are
better ways to deduplicate syslog messages inside syslog daemons now.
2024-08-20 12:50:39 +00:00
Ondřej Surý
b2dda86254 Replace isc_log_create/destroy with isc_logconfig_get()
Add isc_logconfig_get() function to get the current logconfig and use
the getter to replace most of the little dancing around setting up
logging in the tools. Thus:

    isc_log_create(mctx, &lctx, &logconfig);
    isc_log_setcontext(lctx);
    dns_log_setcontext(lctx);
    ...
    ...use lcfg...
    ...
    isc_log_destroy();

is now only:

    logconfig = isc_logconfig_get(lctx);
    ...use lcfg...

For thread-safety, isc_logconfig_get() should be surrounded by RCU read
lock, but since we never use isc_logconfig_get() in threaded context,
the only place where it is actually used (but not really needed) is
named_log_init().
2024-08-20 12:50:39 +00:00
Ondřej Surý
a8a689531f Use single logging context for everything
Instead of juggling different logging context, use one single logging
context that gets initialized in the libisc constructor and destroyed in
the libisc destructor.

The application is still responsible for creating the logging
configuration before using the isc_log API.

This patch is first in the series in a way that it is transparent for
the users of the isc_log API as the isc_log_create() and
isc_log_destroy() are now thin shims that emulate the previous
functionality, but it isc_log_create() will always return internal
isc__lctx pointer and isc_log_destroy() will actually not destroy the
internal isc__lctx context.

Signed-off-by: Ondřej Surý <ondrej@isc.org>
2024-08-20 12:50:39 +00:00
Ondřej Surý
957af59cf8 fix: test: Ignore ISC_R_CONNECTIONRESET in the TCP tests
On FreeBSD, the TCP connection callback could spuriously receive
ISC_R_CONNECTIONRESET even when connection to the loopback interface.
Skip the other checks in such case and graciously shutdown the TCP
connection.

Closes #4849

Merge branch '4849-dispatch_test-fails-in-connected_shutdown-on-freebsd' into 'main'

Closes #4849

See merge request isc-projects/bind9!9303
2024-08-20 12:46:09 +00:00
Ondřej Surý
e53cb61cf7 Ignore ISC_R_CONNECTIONRESET in the TCP tests
On FreeBSD, the TCP connection callback could spuriously receive
ISC_R_CONNECTIONRESET even when connection to the loopback interface.
Skip the other checks in such case and graciously shutdown the TCP
connection.
2024-08-20 12:45:54 +00:00
Petr Špaček
db9d3b8207 chg: Update Internal_use_only-CVE.md checklist changing some tasks
Update Internal_use_only-CVE.md checklist changing some tasks and responsibilities reflecting the new ASN process with RT vs SF. Support will now be sending ASNs to customers, although Marketing will announce the new releases (both publicly and to support customers).

Merge branch 'vicky-main-patch-57381' into 'main'

See merge request isc-projects/bind9!9307
2024-08-20 12:36:36 +00:00
Vicky Risk
019f3ca185 Apply 1 suggestion(s) to 1 file(s)
Co-authored-by: Darren Ankney <dankney@isc.org>
2024-08-20 12:36:17 +00:00
Vicky Risk
5714164f6f Apply 1 suggestion(s) to 1 file(s)
Co-authored-by: Darren Ankney <dankney@isc.org>
2024-08-20 12:36:17 +00:00
Vicky Risk
411e78d92d Apply 1 suggestion(s) to 1 file(s)
Co-authored-by: Darren Ankney <dankney@isc.org>
2024-08-20 12:36:17 +00:00
Vicky Risk
0e17d40843 Apply 1 suggestion(s) to 1 file(s)
Co-authored-by: Darren Ankney <dankney@isc.org>
2024-08-20 12:36:17 +00:00
Vicky Risk
7e429463f5 Update Internal_use_only-CVE.md checklist changing some tasks and responsibilities reflecting the new ASN process with RT vs SF 2024-08-20 12:36:17 +00:00