2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-08-29 21:47:59 +00:00

41111 Commits

Author SHA1 Message Date
Matthijs Mekking
9081426313 Refactor findmatchingkeys and keylistfromrdataset
Refactor dns_dnssec_findmatchingkeys and dns_dnssec_keylistfromrdataset
to take into account the key store directories in case the zone is using
dnssec-policy (kasp). Add 'kasp' and 'keystores' parameters.

This requires the keystorelist to be stored inside the zone structure.

The calls to these functions in the DNSSEC tools can use NULL as the
kasp value, as dnssec-signzone does not (yet) support dnssec-policy,
and key collision is checked inside the directory where it is created.
2024-01-25 14:41:25 +01:00
Matthijs Mekking
91f18c98b3 Add tests for key-store with engine_pkcs11
Add cases for each algorithm to test the interaction between
dnssec-policy and engine_pkcs11. Ensure that named creates keys on
startup.

Also test dnssec-keygen when using a dnssec-policy with a PKCS#11
based key-store.
2024-01-25 14:41:25 +01:00
Matthijs Mekking
f096472eb4 Create private keys with PKCS#11 object
If there is a keystore configured with a PKCS#11 URI, zones that
are using a dnssec-policy that uses such a keystore should create keys
via the PKCS#11 interface. Those keys are generally stored inside an
HSM.

Some changes to the code are required, to store the engine reference
into the keystore.
2024-01-25 14:41:25 +01:00
Matthijs Mekking
d795710541 Add object parameter to dst_key_generate()
Add a parameter to store a possible PKCS#11 object that can later be used to
identify a key with a PKCS#11 URI string (RFC 7512).
2024-01-25 14:41:25 +01:00
Matthijs Mekking
ffc41d1b14 Store key store reference instead of name
When creating the kasp structure, instead of storing the name of the
key store on keys, store a reference to the key store object instead.

This requires to build the keystore list prior to creating the kasp
structures, in the dnssec tools, the check code and the server code.

We will create a builtin keystore called "key-directory" which means
use the zone's key-directory as the key store.

The check code changes, because now the keystore is looked up before
creating the kasp structure (and if the keystore is not found, this
is an error). Instead of looking up the keystore after all
'dnssec-policy' clauses have been read.
2024-01-25 14:41:25 +01:00
Matthijs Mekking
155aba5bd5 Fix a checkconf bug
The check for printing zone list failed because of these additional
lines in the output:

good.conf:22: dnssec-policy: key algorithm 13 has predefined length; \
  ignoring length value 256

I am not sure why this failure hasn't happened before already.
2024-01-25 14:41:25 +01:00
Matthijs Mekking
792670c991 Check if key-store directory is not reused
Similar to key-directory, check for zones in different views and
different key and signing policies. Zones must be using different key
directories to store key files on disk.

Now that a key directory can be linked with a dnssec-policy key, the
'keydirexist' checking needs to be reshuffled.

Add tests for bad configuration examples, named-checkconf should catch
those. Also add test cases for a mix of key-directory and key-store
directory.
2024-01-25 14:41:24 +01:00
Matthijs Mekking
22d1fde1a5 Check if key-store directory exists
Similar to key-directory, check if the key-store directory exists and
if it is an actual directory.

This commit fixes an accidental test bug in checkconf where if
the "warn key-dir" test failed, the result was ignored.
2024-01-25 14:38:12 +01:00
Matthijs Mekking
594d4a81f1 Check if key-store exists
Add checkconf check to ensure that the used key-store in the keys
section exists. Error if that is not the case. We also don't allow
the special keyword 'key-directory' as that is internally used to
signal that the zone's key-directory should be used.
2024-01-25 14:38:12 +01:00
Matthijs Mekking
f837bb2af8 Parse key-store config
Add the code that actually stores the key-store configuration into
structures, also store the reference into the kasp key.
2024-01-25 14:38:11 +01:00
Matthijs Mekking
3a86c07422 Add code for creating keystore from config
Add code for configuring keystore objects. Add this to the "kaspconf"
code, as it is related to 'dnssec-policy' and it is too small to create
a separate file for it.
2024-01-25 14:38:11 +01:00
Matthijs Mekking
0284482687 Add code to store key-stores
New files to define a structure and functions for dealing with
key-stores.
2024-01-25 14:38:11 +01:00
Matthijs Mekking
a035f3b10e Add configuration for key-store
Add new configuration for setting key stores. The new 'key-store'
statement allows users to configure key store backends. These can be
of type 'file' (that works the same as 'key-directory') or of type
'pkcs11'. In the latter case, keys should be stored in a HSM that is
accessible through a PKCS#11 interface.

Keys configured within 'dnssec-policy' can now also use the 'key-store'
option to set a specific key store.

Update the checkconf test to accomodate for the new configuration.
2024-01-25 14:38:11 +01:00
Matthijs Mekking
e598fb465f Merge branch '4510-doc-key-lifetime-too-short' into 'main'
Fix ZSK lifetime minimum constraints documentation

Closes #4510

See merge request isc-projects/bind9!8621
2024-01-25 13:30:45 +00:00
Matthijs Mekking
7e903c52be Add CHANGES for #4510 2024-01-25 13:47:45 +01:00
Matthijs Mekking
53f0541db6 Fix ZSK lifetime minimum constraints documentation
The ARM failed to mention that the ZSK lifetime minimum also depends
on the signing delay.
2024-01-25 13:47:27 +01:00
Michal Nowak
c92b6fc5b0 Merge branch 'mnowak/pytest_rewrite_dialup' into 'main'
Rewrite dialup system test to pytest

See merge request isc-projects/bind9!8668
2024-01-24 12:54:38 +00:00
Michal Nowak
bc4c29888b
Rewrite dialup system test to pytest 2024-01-24 13:41:53 +01:00
Michal Nowak
6c6580ea83
Speed up test by lowering "heartbeat-interval" to 1 2024-01-23 19:47:23 +01:00
Mark Andrews
5ce1ff5214 Merge branch '4419-add-the-ability-to-add-the-ul-edns-option-to-update-messages' into 'main'
Resolve "Add the ability to add the UL EDNS option to UPDATE messages"

Closes #4419

See merge request isc-projects/bind9!8469
2024-01-23 01:17:02 +00:00
Mark Andrews
11f2b01f3f Add CHANGES note for [GL #4419] 2024-01-23 10:48:07 +11:00
Mark Andrews
ac0cec1338 Add support to set the UL EDNS option in nsupdate
This adds a 'lease' command to nsupdate which sets the UL EDNS
option to the desired values.  The values are visible via show.
2024-01-23 10:47:31 +11:00
Mark Andrews
1b6f70076a Extend dns_message_setopt to clear the opt record
Use NULL to signal that the opt record, if any, set on the
message be removed.
2024-01-23 10:47:31 +11:00
Mark Andrews
a8390e8ded check ednsopt UL prints as expected 2024-01-23 10:47:31 +11:00
Mark Andrews
8f0f6d05e9 Add minimal EDNS UL option support
This is defined in draft-ietf-dnssd-update-lease.  This adds the
ability to display the option and teaches dig about the name 'UL'.
2024-01-23 10:47:31 +11:00
Michal Nowak
b54bdf8d78 Merge branch 'mnowak/rpz-drop-queryperf-support' into 'main'
Drop queryperf support from rpz system test

See merge request isc-projects/bind9!8649
2024-01-19 11:04:13 +00:00
Michal Nowak
eaab796310
Drop queryperf support from rpz system test
The queryperf support in the rpz system test is not utilized in the CI,
is likely not unused at all, and should be dropped.
2024-01-19 11:55:09 +01:00
Mark Andrews
a60a259180 Merge branch '4541-values-of-ruletype-field-for-update-policy-statement' into 'main'
Resolve "values of ruletype field for update-policy statement"

Closes #4541

See merge request isc-projects/bind9!8663
2024-01-19 05:18:33 +00:00
Mark Andrews
81f9bcefaf Fix rule count, should be 18 2024-01-19 15:35:54 +11:00
Tom Krizek
64b8ab0845 Merge branch '4445-stop-leaking-queries-to-root-in-tests' into 'main'
Ensure no test queries leak to root server

Closes #4445

See merge request isc-projects/bind9!8521
2024-01-18 16:21:08 +00:00
Tom Krizek
f69df830c6
Delete unused config file in dnssec system test 2024-01-18 17:19:39 +01:00
Tom Krizek
088fcf9a61
Ensure tests use mock root server if configured
These tests have ns1 configured as a mock root server. Make sure it is
used in all config files of those tests, otherwise some queries could
leak to root nameservers.
2024-01-18 17:19:39 +01:00
Tom Krizek
8434e5abfc
Blackhole queries to root servers in tests
Some tests don't have a mock root server configured, because they don't
need one. However, these tests might still leak queries to actual name
servers. Add a shared root hints file which can serve as a blackhole for
these queries.
2024-01-18 17:19:39 +01:00
Tom Krizek
7037eb96d4
Don't use root server in addzone test 2024-01-18 17:19:37 +01:00
Tom Krizek
19ccf59eeb Merge branch 'tkrizek/split-up-dnsrps-test-cases' into 'main'
Split up the dnsrps and native variants of rpz system tests

See merge request isc-projects/bind9!8420
2024-01-18 15:09:06 +00:00
Tom Krizek
b1d71c4d26
Remove obsolete ckdnsrps.sh script
As dnsrps and native test cases have been properly split up, the
ckdnsrps.sh script is no longer used anywhere, as the logic for
selecting these test cases is handled by pytest.
2024-01-18 15:28:28 +01:00
Tom Krizek
cb55fb2cae
Split up the dnsrps and native variants of rpz system tests
Previously, dnsrps test was executed as an optional part of the rpz and
rpzrecurse system tests. This was conceptually problematic, as the test
took the responsibility of running parts of the test framework -
cleaning files and setting up servers again.

Instead, allow these tests to execute either the native variant, or the
dnsrps one. To ensure the same test coverage, trigger both of these
variants as separate test cases from pytest.
2024-01-18 15:28:28 +01:00
Ondřej Surý
1fb6e5cb97 Merge branch '4404-add-workaround-to-force-jemalloc-linking-order' into 'main'
Add workaround for jemalloc linking order

Closes #4404

See merge request isc-projects/bind9!8609
2024-01-18 09:20:21 +00:00
Ondřej Surý
ec12682933
Add CHANGES note for [GL #4404] 2024-01-18 09:35:10 +01:00
Aydın Mercan
6215206801
Link jemalloc again for testing unit build order 2024-01-18 09:34:36 +01:00
Aydın Mercan
197de93bdc
Forward declare mallocx in isc/mem.h
cmocka.h and jemalloc.h/malloc_np.h has conflicting macro definitions.
While fixing them with push_macro for only malloc is done below, we only
need the non-standard mallocx interface which is easy to just define by
ourselves.
2024-01-18 09:34:36 +01:00
Ondřej Surý
41a0ee1071
Add workaround for jemalloc linking order
Because we don't use jemalloc functions directly, but only via the
libisc library, the dynamic linker might pull the jemalloc library
too late when memory has been already allocated via standard libc
allocator.

Add a workaround round isc_mem_create() that makes the dynamic linker
to pull jemalloc earlier than libc.
2024-01-18 09:34:36 +01:00
Artem Boldariev
2ff908026d Merge branch '4527-improve-tls-framing-for-dot' into 'main'
TLS: improve framing by assembling DNS message in one buffer

Closes #4527

See merge request isc-projects/bind9!8646
2024-01-17 16:32:34 +00:00
Artem Boldariev
20d5a805e2
TLS: improve framing by assembling DNS message in one buffer
This commit improves TLS messages framing by avoiding an extra call to
SSL_write_ex(). Before that we would use an extra SSL_write_ex() call
to pass DNS message length to OpenSSL. That could create an extra TLS
frame, increasing number of bytes sent due to frame header and
padding.

This commit fixes that by making the code pass both DNS message length
and data at once, just like old TLS code did.

It should improve compatibility with some buggy clients that expect
both DNS message length and data to be in one TLS frame.

Older TLS DNS code worked like this, too.
2024-01-17 17:09:41 +02:00
Aydın Mercan
5670d8e11c Merge branch '4425-current-level-of-tcp-clients-missing-from-statistics-channel' into 'main'
Expose the TCP client count in statistics channel

Closes #4425

See merge request isc-projects/bind9!8616
2024-01-17 08:45:11 +00:00
Aydın Mercan
cc2713700a
Add CHANGES and release note for [GL #4425] 2024-01-17 11:11:12 +03:00
Aydın Mercan
2690dc48d3
Expose the TCP client count in statistics channel
The statistics channel does not expose the current number of TCP clients
connected, only the highwater. Therefore, users did not have an easy
means to collect statistics about TCP clients served over time. This
information could only be measured as a seperate mechanism via rndc by
looking at the TCP quota filled.

In order to expose the exact current count of connected TCP clients
(tracked by the "tcp-clients" quota) as a statistics counter, an
extra, dedicated Network Manager callback would need to be
implemented for that purpose (a counterpart of ns__client_tcpconn()
that would be run when a TCP connection is torn down), which is
inefficient. Instead, track the number of currently-connected TCP
clients separately for IPv4 and IPv6, as Network Manager statistics.
2024-01-17 11:11:12 +03:00
Artem Boldariev
8ce0956117 Merge branch '4536-remove-wrong-INSIST-fix-cipher-suites-test' into 'main'
TCP: remove wrong INSIST(csock->recv_cb != NULL), disable the "cipher-suites" test in FIPS mode

Closes #4536

See merge request isc-projects/bind9!8655
2024-01-16 13:44:00 +00:00
Artem Boldariev
dbcdd868f9
Skipping portions of cipher-suites test in FIPS mode
We need to skip some portions the system test in FIPS mode as some of
the algorithms used in the test are not available when using the FIPS
mode (e.g. TLS_CHACHA20_POLY1305_SHA256)
2024-01-16 15:01:39 +02:00
Artem Boldariev
dffb11f2c0 TCP: remove wrong INSIST(csock->recv_cb != NULL)
This commit removes wrong INSIST() condition as the assumption that if
'csock->recv_cb != NULL' iff 'csock->statichandle != NULL' is wrong.

There is no direct relation between 'csock->statichandle' and
'csock->recv_cb', as 'csock->statichandle' gets set when allocating a
handle regardless of 'csock->recv_cb' not being NULL, as it is
possible to attach to the handle without starting a read operation (at
the very least, it is correct to start writing before reading).

That condition made `cipher-suites` system test fail with crash on
some platforms in FIPS mode (namely, Oracle Linux 9) despite not being
related to FIPS at all.
2024-01-16 15:01:26 +02:00