Commit graph

12590 commits

Author SHA1 Message Date
Ondřej Surý
dd37fd6a49 Add ISC_TID_MAX with default being 512 threads
The ISC_TID_MAX variable allows other units to declare static arrays
with this as size for per-thread/per-loop variables.
2025-06-28 13:32:12 +02:00
Štěpán Balážik
d5874d5df9 Move root zone mirror system test to a separate directory
This test doesn't require artifact checking but when bundled in the same
directory with the shell based tests, the `system:clang:tsan` job was
failing non-deterministically.
2025-06-27 15:19:45 +00:00
Nicki Křížek
fcf31417dd Log assertion failures right after test result
The extra messages are typically traceback from assertion failures.
Previously, they'd be printed only after all individual test case
results have been printed. That made it difficult to pair the traceback
to the failing test in some cases, as the node information (aka test
name) might not always be present.

Instead, log any extra messages related to a particular test failure
directly after reporting its result, making the failure details more
readily available and easy to connect with a particular test case.
2025-06-27 16:31:49 +02:00
Nicki Křížek
9f3f6ec38e Log command stdout when using isctest.run.cmd()
The command's stdout may provide useful debug info, so make sure we log
it by default. It doesn't seem to have a significant impact on the log
size.
2025-06-27 16:31:49 +02:00
Nicki Křížek
56fec9ba04 Log query and response when using isctest.query.*
Make sure the queries and responses are logged at the DEBUG level, which
may provide useful information in case of failing tests.

This doesn't seem to significantly increase the overall artifacts size.
Previously, pytest.log.txt files from all system tests would take around
3 MB, with this change, it's around 8 MB).
2025-06-27 16:31:49 +02:00
Nicki Křížek
51ac5bdd14 Use proper logging in SPNEGO tests
Avoid using print() and use proper logging facility instead.
2025-06-27 16:31:49 +02:00
Nicki Křížek
1e87b5ffc6 Add options for query&response logging to pytest
In some cases, it's useful to log the sent and received DNS messages.
Add options to enable this on demand. Query is only logged the first
time it's sent, since it doesn't change. If response logging is turned
on, then each response is logged, since it might be different every
time.
2025-06-27 16:31:49 +02:00
Nicki Křížek
23e6b49cc5 Indent multiline output in pytest logging
When multiline message is logged, indent all but the first line (which
will be preceeded by the LOG_FORMAT). This improves the clarity of logs,
as it's immediately clear which lines are regular log output, and which
ones are multiline debug output.

Adjust the isctest.run.cmd() stdout/stderr logging to this new format.
2025-06-27 16:31:49 +02:00
Nicki Křížek
0a6b0cf68c Don't log empty test result messages
The messages obtained from test results may contain stuff like detailed
failure/error information, tracebacks etc. In many cases, the message
will be empty, in which case it doesn't need to be logged.

For an example, run test with many test cases, e.g.
verify/test_verify.py, and inspect the tail of the pytest.log.txt before
and after this commit.
2025-06-27 16:31:49 +02:00
Nicki Křížek
4b8998e4ad Replace print statements in checkds test
Use isctest.log logging facility for consistent and predictable logging
output rather than using print(). Remove writes of stderr, as that
output will be logged in the debug log in case the commands called with
isctest.run.cmd() fails.
2025-06-27 16:31:49 +02:00
Štěpán Balážik
a69efc678c Add a system test that ensures root zone mirroring works out of the box
This is a test for #5380.
2025-06-27 13:05:43 +02:00
Štěpán Balážik
3a8ffc74df Add a pytest mark for system tests that require Internet connection
We skip those by default as:

a) we don't want to stress the upstream servers in every CI pipeline
b) system tests need to be runnable in a isolated environment by default
2025-06-27 07:24:48 +00:00
Štěpán Balážik
c7a8f61055 Rename CI_ENABLE_ALL_TESTS to CI_ENABLE_LONG_TESTS
New name is more descriptive and allows us to created more optional
test sets.
2025-06-27 07:24:48 +00:00
Štěpán Balážik
a62fdee97f Remove scripts related to the automake test driver
These were left in in the Meson migration.
2025-06-26 13:24:33 +00:00
Michał Kępień
12829660fc
Fix version description in a startup log message
Commit 5cd6c173ff changed the contents of
the PACKAGE_DESCRIPTION preprocessor macro from " (<description>)" to
just "<description>" and missed a spot while adjusting all uses of this
macro in the code base.  Fix formatting for that malformed log message,
emitted upon named startup.
2025-06-26 12:05:53 +02:00
Petr Menšík
8e789ea62f Do not expect fail in cpu test default configuration
Previous CPU test relied on either missing default named.conf or the
missing permissions to write into its default directory. In short that
default configuration would be unusable with current user. It would hang
indefinitely at cpu test if the named user could write into directory
specified in default configuration.

Change it instead to explicitly try non-existent configuration file.
It will still fail immediately, but will not rely on running user or
presence of file at default configuration file path.
2025-06-25 11:35:27 +00:00
Mark Andrews
422b9118e8 Use clang-format-20 to update formatting 2025-06-25 12:44:22 +10:00
Nicki Křížek
c06dc71cd5 Make extra_artifacts check optional
There is an ongoing debate about the usefulness of the extra artifacts
check. While it might be useful to detect unexpected behaviour in some
tests, it feels extraneous in many cases. This change provides a middle
ground by making the artifact checking optional. This might be
especially useful for writing new tests, since the author gets to decide
whether the check is useful -- and can utilize it, or can skip it for
sake of brevity.
2025-06-24 16:56:53 +02:00
Michal Nowak
b890ff46cc Drop empty directory bin/rndc/include/
It should have been removed as part of
9088052225.
2025-06-24 12:38:37 +00:00
Colin Vidal
349cc060f4 wait for reload completed in emptyzones system test
The emptyzones system test ran two consecutive "rndc reload" commands
without waiting for the first one to complete. It used to work because
the commands were serialized, but now an rndc reconfig/reload command is
ignored if another one is already running, so the emptyzones test is
more likely to fail.

Fix this problem by waiting for the log message indicating that all the
zones are loaded before attempting the next reload.
2025-06-23 23:20:30 -07:00
Colin Vidal
209b30d563 log-based test for load/apply config
Add a new system test which checks named output when starting,
reconfiguring and reloading the server. It checks that the steps where
configuration is loaded, when named enters exclusive mode, and when the
configuration is applied are all logged, and that they occur in the
correct order. This adds a guard/warning to keep the parsing of the
named.conf outside of the exclusive mode.
2025-06-23 10:45:31 -07:00
Colin Vidal
d7416bb472 ignore reload request if in a reload process
Ignore an 'rndc reload' or 'rndc reconfig' command if received by named
while the server is currently reloading itself.
2025-06-23 10:45:14 -07:00
Colin Vidal
d7de2ba084 parse user configuration before exclusive mode
The configuration file was parsed when named was in exclusive
(i.e. single-threaded) mode and unable to answer queries. Because
the parsing is a self-contained operation, it is now done before
named enters exclusive mode.

This reduces the amount of time named can't answer queries when
reloading the configuration when the configuration file is large.
Note that exclusive mode is still used for applying the
configuration changes to the server.

Also, simplify the configuration logic by parsing the built-in
configuration only once at server start time.
2025-06-23 10:35:31 -07:00
Colin Vidal
8685ebdb99 renamed named_g_config/defaults
For better clarity, the global variables named_g_config and
named_g_defaults have been changed to named_g_defaultconfig
and named_g_defaultoptions.
2025-06-23 10:35:17 -07:00
Aydın Mercan
3bb88f847a
Remove the configblock sphinx extension
The `configblock` extension doesn't work with RHEL 8. However, this
extension isn't needed anymore after the RTD fix and can be safely
removed.
2025-06-23 13:45:09 +03:00
Mark Andrews
c19956b3cb verify-axfr.db gets updated too fast in mirror test
Add a 1 second wait before updating verify-axfr.db so that the
modification time of the file changes.
2025-06-19 15:49:29 +00:00
Nicki Křížek
e786a2e950 Ignore softhsm2 errors when deleting token in keyfromlabel test
In some rare cases, the softhsm2 utility reports failure to delete the
token directory, despite the token being found. Subsequent attempts to
delete the token again indicate that the token was deleted.

Ignore this cleanup error, as it doesn't prevent our tests from working
properly. There is also an attempt to delete the token before the test
starts which ensures a clean state before the test is executed, in case
there's actually a leftover token.
2025-06-19 13:49:34 +00:00
Nicki Křížek
069e4ef0f7 Use time.monotonic() for time measumeremts in pytest
For duration measurements, i.e. deadlines and timeouts, it's more
suitable to use monotonic time as it's guaranteed to only go forward,
unlike time.time() which can be affected by local clock settings.
2025-06-19 14:11:28 +02:00
Nicki Křížek
481b46ffcc Move param to isctest.util 2025-06-19 14:11:28 +02:00
Nicki Křížek
620c884133 Improve logging from isctest.run.retry_with_timeout
Allow use of exception (and by extension, assert statements) in the
called function in order to extract essential debug information about
the type of failure that was encountered.

In case the called function fails to succeed on the last retry and
raised an exception, log it as error and set it as the assert message to
propagate it through the pytest framework.
2025-06-19 14:11:27 +02:00
Matthijs Mekking
752d8617f5 Test purge-keys with views
Create a test scenario where a signed zone is in multiple views and
then a key may be purged. This is a bug case where the key files are
removed by one view and then the other view starts complaining.
2025-06-19 08:13:07 +02:00
Mark Andrews
38ef960fd0 Test extended DS digest type support
Add a zone using DS records that embed the private algorithm
identifier in the digest field.  There are 2 DS record for an
unsupported DNSSEC algorithm one of which that doesn't have a
matching DNSKEY.  This zone should validate as insecure as the
validator can establish that both DS records are for unsupported
DNSSEC algorithms.
2025-06-19 07:15:20 +10:00
Mark Andrews
8d554c0c03 Add tests using PRIVATEOID algorithms
There are 4 tests:

1) a zone using a known private OID.  Validations should succeed
and return AD=1.

2) a zone using an unknown private OID.  Validation should succeed
and return AD=0 as the DS to DNSKEY has provably unsupported
algorithm.

3) a zone using a known private OID and an extra DS record. Validation
should succeed as there is DS to DNSKEY with a known algorithm
linkage.

4) a zone using an unknown private OID and an extra DS record.
Validation should fail as only one of the DS records can be matched
to a provable unknown algorithm.  The algorithm of the second DS
is indeterminate.
2025-06-19 07:15:20 +10:00
Mark Andrews
e687710dc7 Add PRIVATEOIDs for RSASHA256 and RSASHA512
Use the existing RSASHA256 and RSASHA512 implementation to provide
working PRIVATEOID example implementations.  We are using the OID
values normally associated with RSASHA256 (1.2.840.113549.1.1.11)
and RSASHA512 (1.2.840.113549.1.1.13).
2025-06-19 07:15:20 +10:00
Mark Andrews
10d094a289 Future: DS private algorithm support
Add support for proposed DS digest types that encode the private
algorithm identifier at the start of the DS digest as is done for
DNSKEY and RRSIG.  This allows a DS record to identify the specific
DNSSEC algorithm, rather than a set of algorithms, when the algorithm
field is set to PRIVATEDNS or PRIVATEOID.
2025-06-19 07:15:20 +10:00
Mark Andrews
c428af5e7a Support PRIVATEOID/PRIVATEDNS in zone.c
- dns_zone_cdscheck() has been extended to extract the key algorithms
  from DNSKEY data when the CDS algorithm is PRIVATEOID or PRIVATEDNS.

- dns_zone_signwithkey() has been extended to support signing with
  PRIVATEDNS and PRIVATEOID algorithms.  The signing record (type 65534)
  added at the zone apex to indicate the current state of automatic zone
  signing can now contain an additional two-byte field for the DST
  algorithm value, when the DNS secalg value isn't enough information.
2025-06-19 07:15:20 +10:00
Mark Andrews
eb184b864c Support PRIVATEOID/PRIVATEDNS in the resolver
dns_resolver_algorithm_supported() has been extended so in addition to
an algorithm number, it can also take a pointer to an RRSIG signature
field in which key information is encoded.
2025-06-19 07:00:53 +10:00
Mark Andrews
62f3c0b501 Extend the trust anchor supported algorithm checks
When a DNSKEY based trust anchor is used extract the algorithm from
the key's data to determine if the private algorithm is supported.
2025-06-19 07:00:53 +10:00
Mark Andrews
71801ab123 Use DST algorithm values instead of dns_secalg where needed
DST algorithm and DNSSEC algorithm values are not necessarily the same
anymore: if the DNSSEC algorithm value is PRIVATEOID or PRIVATEDNS, then
the DST algorithm will be mapped to something else. The conversion is
now done correctly where necessary.
2025-06-19 07:00:53 +10:00
Mark Andrews
e6f1363964 Make system test changes needed for PRIVATEOID/PRIVATEDNS
- When the algorithm value for a DNSSEC key is set to PRIVATEOID
  or PRIVATEDNS, that's a placeholder value indicating that the
  real algorithm identifier is encoded into the key or signature
  data.  That means the DNSKEY algorithm value and the DST algorithm
  value may not be identical, so we must now add environment variables
  DEFAULT_ALGORITHM_DST_NUMBER, ALTERNATIVE_ALGORITHM_DST_NUMBER
  and DISABLED_ALGORITHM_DST_NUMBER to the test suite, with support
  for mapping from DST algorithm value to PRIVATEDNS or PRIVATEOID.

- Some test cases use RRSIGs that have been modified to force
  validation to fail. When making those modifications, we now
  preserve the first part of the signature, so that PRIVATEDNS and
  PRIVATEOID algorithm identifier values will still work.  (This
  assumes that the identifiers are short and fit into the first
  base64 block.)
2025-06-19 07:00:53 +10:00
Mark Andrews
215bde91c6 Check the DS trust anchor algorithm is supported
This make DS based trust anchors consistent with DNSKEY based
trust anchors.
2025-06-19 07:00:53 +10:00
Mark Andrews
dfee0e64ed Check that the specified DS digest is supported
dnssec-dsfromkey and dnssec-cds failed to properly check if the
specified DS digest type is supported or not.
2025-06-19 07:00:53 +10:00
Matthijs Mekking
6994a604a7 Remove kasp shell script remainders
Now that all tests have been converted, we can remove 'kasp/tests.sh'
and 'kasp/tests_sh_kasp.py'.
2025-06-18 10:01:24 +02:00
Matthijs Mekking
80992c7b96 Convert algorithm rollover tests to pytest
Roll the algorithm rollover test cases over to the rollover directory
and rewrite using pytest.
2025-06-18 10:01:24 +02:00
Matthijs Mekking
b1d8217d1a Convert going insecure kasp test to pytest
When going insecure, we publish CDS and CDNSKEY DELETE records. Update
the check_apex function to test this.

Also, skip some tests in the 'check_rollover_step()' function. If
we change the DNSSEC Policy, keys that no longer match the policy will
be retired. When this exactly happens is hard to determine, as it
happens on the reconfigure. So for these tests, we skip the key timing
metadata checks.

Also, the zone becomes unsigned, so don't call 'check_zone_is_signed'
in those cases.
2025-06-18 10:01:24 +02:00
Matthijs Mekking
de3c0970eb Convert policy changes tests to pytest
These test cases involve a reconfiguration. The first one is a zone
that changes from dynamic to inline-signing. The others are tests that
key lifetimes are updated correctly after changing them.
2025-06-18 10:01:24 +02:00
Mark Andrews
80fedf7fcf unstable rollover/tests_rollover.py::test_rollover_manual
The state files need to be written before trying to identify zsk/ksk
keys.  Wait for "keymgr: manual-rollover.kasp done" to appear in
named.run first.
2025-06-17 14:32:49 +10:00
Mark Andrews
4367106d2f Fix "sending packet from" test
The specific address is not always available.
2025-06-14 17:10:15 +10:00
Evan Hunt
27a34fdac1 exercise named-makejournal with multiple transactions
the journal system test now checks that named-makejournal is
able to create journal files with multiple transactions.
2025-06-13 21:20:13 -07:00
Evan Hunt
365e4de077 load the journal file if it already exists
apply the existing journal file, if any, to the old version of the
database before diffing it against the new version. then, append
the diff to the end of the journal. this allows easy creation of
a journal file with multiple deltas, by running named-makejournal
successively.
2025-06-13 21:20:13 -07:00