Commit graph

5722 commits

Author SHA1 Message Date
Evan Hunt
0b09ee8cdc explicitly set dnssec-validation in system tests
the default value of dnssec-validation is 'auto', which causes
a server to send a key refresh query to the root zone when starting
up. this is undesirable behavior in system tests, so this commit
sets dnssec-validation to either 'yes' or 'no' in all tests where
it had not previously been set.

this change had the mostly-harmless side effect of changing the cached
trust level of unvalidated answer data from 'answer' to 'authanswer',
which caused a few test cases in which dumped cache data was examined in
the serve-stale system test to fail. those test cases have now been
updated to expect 'authanswer'.
2023-06-26 13:41:56 -07:00
Tom Krizek
5f809e50b6
Check for proper file size output in dnstap test
Previously, the first check silently failed, as 454 is apparently (in my
local setup) the minimum output size for the dnstap output, rather than
470 which the test was expecting. Effectively, the check served as a 5
second sleep rather than waiting for the proper file size.

Additionally, check the expected file sizes and fail if expectations
aren't met.
2023-06-22 19:19:08 +02:00
Tom Krizek
1dd4c2b9e2
Check for proper log message in kasp test
The log message is supposed to contain the zone name which was
erroneously omitted, but didn't pop up during tests, since return code
was silently ignored.

Now it actually waits for the proper log message rather than being an
equivalent of 3 second sleep (which was also sufficient to make the test
pass, thus we detected no failure).
2023-06-22 19:19:05 +02:00
Tom Krizek
946d3131fa
Fix echo_i typo in forward test 2023-06-22 19:12:46 +02:00
Michal Nowak
71439d0c3a BIND 9.19.14
-----BEGIN SSH SIGNATURE-----
 U1NIU0lHAAAAAQAAARcAAAAHc3NoLXJzYQAAAAMBAAEAAAEBANamVSTMToLcHCXRu1f52e
 tTJWV3T1GSVrPYXwAGe6EVC7m9CTl06FZ9ZG/ymn1S1++dk4ByVZXf6dODe2Mu0RuqGmyf
 MUEMKXVdj3cEQhgRaMjBXvIZoYAsQlbHO2BEttomq8PhrpLRizDBq4Bv2aThM0XN2QqSGS
 ozwYMcPiGUoMVNcVrC4ZQ+Cptb5C4liqAcpRqrSo8l1vcNg5b1Hk6r7NFPdx542gsGMLae
 wZrnKn3LWz3ZXTGeK2cRmBxm/bydiVSCsc9XjB+tWtIGUpQsfaXqZ7Hs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h/SQ8m3saKxXJLo7/k4sAKn1
 A4W84NkXl3anAwRcZzITwBlKEl48GJcMGWFKLpfwxmOvsy1kBX1kGgnYvQmZnunIfSBYpf
 Xh4MIZz1QIlcJDBSMe6AnYTOvvN1CSrPeWBDbG5za5qu4TdIlTSA6zcqfSw8pOOzDnVMxt
 0hD38e9mkPnpAyS2OOI0eRQ3GMMF6kRY7F7elc6zVbG+PeoJOKBx79IoBe4fUq/632Husi
 OmT32VXIIEEkejnr0gxENA
 -----END SSH SIGNATURE-----

Merge tag 'v9.19.14'

BIND 9.19.14
2023-06-21 19:31:57 +02:00
Michał Kępień
a47dc810f7
Add a tool for reproducing ISC SPNEGO bugs
Extend the "tsiggss" system test with reproducers for CVE-2020-8625 and
CVE-2021-25216.
2023-06-19 09:20:03 +02:00
Tony Finch
e18ca83a3b Improve statschannel HTTP Connection: header protocol conformance
In HTTP/1.0 and HTTP/1.1, RFC 9112 section 9.6 says the last response
in a connection should include a `Connection: close` header, but the
statschannel server omitted it.

In an HTTP/1.0 response, the statschannel server can sometimes send a
`Connection: keep-alive` header when it is about to close the
connection. There are two ways:

If the first request on a connection is keep-alive and the second
request is not, then _both_ responses have `Connection: keep-alive`
but the connection is (correctly) closed after the second response.

If a single request contains

	Connection: close
	Connection: keep-alive

then RFC 9112 section 9.3 says the keep-alive header is ignored, but
the statschannel sends a spurious keep-alive in its response, though
it correctly closes the connection.

To fix these bugs, make it more clear that the `httpd->flags` are part
of the per-request-response state. The Connection: flags are now
described in terms of the effect they have instead of what causes them
to be set.
2023-06-15 17:03:09 +01:00
Matthijs Mekking
e59c6a5adc Update findzonekeys function name in log message
The "dns_dnssec_findzonekeys2" log message is a leftover from when that
was the name of the function. Rename to match the current name of the
function.
2023-06-14 09:08:56 +02:00
Matthijs Mekking
5cf91728d1 Add dynamic update prepub and doubleksk test case
Add two test cases for zones that use auto-dnssec, but not
inline-signing, and make sure that the change for find_zone_keys()
do not affect introducing a new key that is intended for signing.

See note https://gitlab.isc.org/isc-projects/bind9/-/merge_requests/7638#note_355944
2023-06-14 09:08:56 +02:00
Matthijs Mekking
cda1ae69ac Add log check in multisigner system test
When we add DNSKEY records via dynamic update, this should no longer
trigger signing the zone with these keys. This currently happens when
'find_zone_keys()' looks up the keys by inspecting the DNSKEY RRset,
then attempting to read the corresponding key files.

Add checks that inspect the logs whether an attempt to read the key
files for the newly added keys was done (and failed because these files
are not available).
2023-06-14 09:08:56 +02:00
Tom Krizek
5893debf46
Remove trailing whitespace from all text files
I've used the following command to remove the trailing whitespace for
all tracked text files:

git grep -Il '' | xargs sed -i 's/[ \t]*$//'
2023-06-13 15:05:40 +02:00
Tom Krizek
dd7bcd2855
Avoid false positive in serve-stale system test check
The purpose of the check is to verify the server has survived the
previous barrage of queries. This is done by sending a query and
checking we get a NOERROR response back.

Previously, that query could've been affected by a servfail cache - the
server would return a SERVFAIL answer, thus failing the check, despite
being up and running. Use version.bind txt ch query to avoid the
interference of servfail cache.
2023-06-13 10:52:01 +02:00
Michał Kępień
eb88490e91
Re-add a code comment to the "hooks" system test
Commit 5a84c7a09b removed a useful code
comment from the "hooks" system test.  Add it back to prevent confusion.
2023-06-09 11:53:33 +02:00
Mark Andrews
783c6a9538
Use dns_view_findzone instead of dns_zt_find
This ensures that rcu locking is properly applied for
view->zonetable.
2023-06-01 16:51:38 +02:00
Mark Andrews
8d86fa7135
Extend dns_view_findzone to take an options argument
This is in preparation to allow the few remaining direct
dns_zt_find(view->zonetable, ...) to use it for rcu mediated
access to view->zonetable.
2023-06-01 16:51:38 +02:00
Aram Sargsyan
3bb2babcd0 Add clients-per-query checks for the fetchlimit system test
Check if clients-per-query quota works as expected with or without
a positive stale-answer-client-timeout value and serve-stale answers
enabled.
2023-06-01 08:13:09 +00:00
Aram Sargsyan
7ebd055c78 Light refactoring of the fetchlimit system test
Prepare the fetchlimit system test for adding a clients-per-query
check. Change some functions and commands to accept a destination
NS IP address instead of using the hardcoded 10.53.0.3.
2023-06-01 08:13:09 +00:00
Aram Sargsyan
101d829b02 Fix fetchlimit system test issues
1. Fix the numbering.
2. Fix an artifacts rewriting issue.
3. Add missing checks of 'ret' after some checks.
2023-06-01 08:13:09 +00:00
Michal Nowak
a13448a769
Look for core files in $TOP_BUILDDIR
The get_core_dumps.sh script couldn't find and process core files of
out-of-tree configurations because it looked for them in the source
instead of the build directory.
2023-05-30 19:41:31 +02:00
Tom Krizek
e8ea6b610b
Fix base_port calculation in pytest runner
The selected base port should be in the range <port_min, port_max), the
formula was incorrect.

Credit for discovering this fault goes to Ondrej Sury.
2023-05-30 14:11:14 +02:00
Matthijs Mekking
c3d4fd3449 Add serve-stale test case for GL #3950
Add a test case where when priming the cache with a slow authoritative
resolver, the stale-answer-client-timeout option should not return
a delegation to the client (it should wait until an applicable answer
is found, if no entry is found in the cache).
2023-05-30 11:58:19 +02:00
Tom Krizek
d8997db5d5
Disable rrl check in slow environments
The check for 'would limit' log message is triggered by sending at least
three messages within one second. However, in extremely slow conditions
(currently when running with clang+TSAN in CI), the individual queries
might take too much time to send enough of them within one second.

Since this is a pretty rare condition, let's just silently skip this
test in environments where a single query takes more than 500 ms, since
there's no way to perform the check under such conditions.

Closes #4082
2023-05-26 12:25:36 +02:00
Matthijs Mekking
7ab3bfd596 Fix dnssec system test
The 'update-nsec3.example' requires to be DNSSEC maintained via
dynamic update. Commit 03b22983cd20cec51ad8b9f25f2e7d0e472dc79c adds
checks to make sure the raw zone is not signed. So the test case neesd
to be updated to allow for DNSSEC maintenance.
2023-05-23 08:53:23 +02:00
Matthijs Mekking
f636aceb50 Add more multisigner tests, removing records
A zone in multisigner model 2 should also be possible to remove
previously added DNSKEY, CDS and CDNSKEY records from the zone operated
by the other provider.
2023-05-23 08:53:23 +02:00
Matthijs Mekking
70e10b3c50 Add bump in the wire multisigner test
Add a test case where updates are being made against a hidden primary
and two bump in the wire signers (the providers in the multisigner
model) serve the zone.

The test covers the same cases as for two primary providers that is:
- Add DNSKEY
- Remove (previously added) DNSKEY
- Add CDNSKEY
- Remove (previously added) CDNSKEY
- Add CDS
- Remove (previously added) CDS
2023-05-23 08:53:23 +02:00
Matthijs Mekking
508c60ad90 Ensure no DNSSEC records are in the raw journal
Add checks to the multisigner test to make sure no DNSSEC related
records (NSEC, NSEC3, NSEC3PARAM, RRSIG) end up in the raw journal.
2023-05-23 08:53:23 +02:00
Matthijs Mekking
a565cb9c31 Add more multisigner tests
A zone in multisigner model 2 should also be possible to publish the
CDS and CDNSKEY records from their KSK into the zone operated by the
other provider.
2023-05-23 08:52:01 +02:00
Matthijs Mekking
4e18991fed Add multisigner system test
Add a new system test to test multisigner model use cases. This
initial test just tests a small part of the model 2, and uses two
providers for the same zone, ns3 and ns4, each with their own unique
key set. This commit tests that each provider can import their ZSK
of the other provider into their DNSKEY RRset, using dynamic update.

Both providers use dnssec-policy, ns3 applies the DNSSEC records
directly, while ns4 uses inline-signing.
2023-05-23 08:52:01 +02:00
Tom Krizek
edaa5f5d2a
Reorder dead primary checks in upforwd test
The check which attempts to forward dynamic update to a dead primary may
trigger a timing issue #4080. For some reason, this has manifested under
the pytest runner, while the test still passes with the legacy runner.

Move the dead primary check closer to the end of the test to avoid
hitting this issue before we have a proper fix.
2023-05-22 14:24:33 +02:00
Tom Krizek
0f8a2b07a4
Tear down module logger handler in system tests
The module-level logger has a handler that writes into a temporary
directory. Ensure the logging output is flushed and the handler is
closed before attempting to remove this temporary directory.
2023-05-22 14:11:41 +02:00
Tom Krizek
1aaefc9cf4
Rewrite run.sh to invoke pytest in a system test directory
Previously, run.sh tried to use pytest's -k option for test selection.
The downside was that this filter expression matched any test case with
the given substring, rather than executing a system test suite with the
given name.

The run.sh has been rewritten to invoke pytest from a system test
directory instead. This behaves more consistently with the run.sh from
legacy system test framework.

run.sh is now also a shell script to avoid confusion regarding its
file extension.
2023-05-22 14:11:41 +02:00
Tom Krizek
68b1c6877b
Remove "which" declaration from env vars in EL8+ tests
EL8+ systems declare "which" function using environment variables in the
/etc/profile.d/which2.sh file. Because of our suboptimal environment
variable detection, which is required in order to support the legacy
runner, these variables are picked up by the pytest runner.

If subprocesses are spawned with these environment variables set, it
will cause the following issue when they spawn yet another subprocess:

/bin/sh: which: line 1: syntax error: unexpected end of file
/bin/sh: error importing function definition for `which'
2023-05-22 14:11:41 +02:00
Tom Krizek
12c724ee07
Capture log output during pytest runner setup
Instantiate a new logger that is used during pytest initialization /
configuration. This logging isn't handled by pytest itself, since it
happens outside of any tests or fixtures.

Root logger can't be reused for this purpose, because that would
duplicate the logs. Instead, create a conftest-specific logger for this
purpose.

Unfortunately, this introduces another log file,
pytest.conftest.log.txt, which contains only the logging from pytest
initialization. However, unless one is debugging the runner /
environment, there should be no need to investigate this file.
2023-05-22 14:11:40 +02:00
Tom Krizek
99e2e50c0e
Execute long running system tests first
In order to take the most advantage of parallel execution of tests,
ensure certain long running tests are scheduled first.

The list of tests considered long-running was created empirically. In
addition to the test run time, its position in the default
(alphabetical) ordering was also taken into account.
2023-05-22 14:11:40 +02:00
Tom Krizek
952776b61f
Add test specific logger for pytests
The logger fixture is provided as a test-level logging facility which
can be easily passed to tests to enable capturing and/or displaying
messages from tests written in Python.

While this works optimally with the pytest runner, messages on INFO
level or above will also be visible when using the legacy runner.
2023-05-22 14:11:40 +02:00
Tom Krizek
087a9b3c97
Mark selected statschannel tests as xfail
The test_zone_timers_secondary_json() and
test_zone_timers_secondary_xml() tests are affected by issue #3983. Due
to the way tests are run, they are only affected when executing them
with the pytest runner.

Strict mode is set for pytest runner, as it always fails there. The
strict mode ensures we'll catch the change when the it starts passing
once the underlying issue is fixed. It can't be set for the legacy
runner, since the test (incorrectly) passes there.

Related #3983
2023-05-22 14:11:40 +02:00
Tom Krizek
3a20e8d990
Ensure assertions and exceptions end up in system test log
If a test fails with an assertion failure or exception, its content
along with traceback is displayed in pytest output. This information
should be preserved in the test-specific logger for a given system test
to make it easier to debug test failures.
2023-05-22 14:11:40 +02:00
Petr Špaček
37ed9ad2f8
Use raw byte format of env variables in pytest
In order to avoid issues with decoding/encoding env variables due to
different encodings on different systems, deal with the environment
variables directly as bytes.
2023-05-22 14:11:40 +02:00
Tom Krizek
0a063f51d3
Handle missing test_results due to pytest runner interrupt
If pytest execution is interrupted, the hook that exposes test_results
to the pytest session is never called so the results can't be
interpreted.
2023-05-22 14:11:40 +02:00
Tom Krizek
1cc55d01c7
Run system tests sequentially if xdist is not available 2023-05-22 14:11:39 +02:00
Petr Špaček
8952618262
Include logs from failing tests in JUnit output 2023-05-22 14:11:39 +02:00
Petr Špaček
d0619c7a18
Enable live logging for non-parallel pytest runs
This provides incremental output when test is running _without xdist_,
just like the old runner did.

With xdist the live output is not available, I believe because of
https://github.com/pytest-dev/pytest-xdist/issues/402
https://github.com/pytest-dev/pytest-xdist/pull/883 might help with
that, but I'm not going to hold my breath until it is available on
distros we use.
2023-05-22 14:11:39 +02:00
Tom Krizek
8f57bce7af
Ensure --dist=loadscope is used when running pytest in parallel
The loadscope setting is required for parallel execution of our system
tests using pytest. The option ensure that all tests within a single
(module) scope will be assigned to the same worker.

This is neccessary because the worker sets up the nameservers for all
the tests within a module scope. If tests from the same module would be
assigned to different workers, then the setup could happen multiple
times, causing a race condition. This happens because each module uses
deterministic port numbers for the nameservers.
2023-05-22 14:11:39 +02:00
Tom Krizek
4dbe8e5347
Invoke pytest runner from run.sh
Utilize developers' muscle memory to incentivize using the pytest runner
instead of the legacy one. The script also serves as basic examples of
how to run the pyest command to achieve the same results as the legacy
runner.

Invoking pytest directly should be the end goal, since it offers many
potentially useful options (refer to pytest --help).
2023-05-22 14:11:39 +02:00
Tom Krizek
d1ef51f589
Add developer docs for pytest system test runner 2023-05-22 14:11:39 +02:00
Tom Krizek
dc84121004
Update user docs with pytest system test runner 2023-05-22 14:11:39 +02:00
Tom Krizek
2f5bf6d971
Add pytest functions for shell system tests
In order to run the shell system tests, the pytest runner has to pick
them up somehow. Adding an extra python file with a single function
for the shell tests for each system test proved to be the most
compatible way of running the shell tests across older pytest/xdist
versions.

Modify the legacy run.sh script to ignore these pytest-runner specific
glue files when executing tests written in pytest.
2023-05-22 14:11:39 +02:00
Tom Krizek
8a406b73c9
Ignore tempdirs during pytest collection phase 2023-05-22 14:11:38 +02:00
Tom Krizek
527ac6ad26
Ensure compatiblity with older pytest
Special care needs to be taken to support older pytest / xdist versions.
The target versions are what is available in EL8, since that seems to
have the oldest versions that can be reasonably supported.
2023-05-22 14:11:38 +02:00
Tom Krizek
247e90c382
Keep the tempdir in case test setup/teardown fails
When an issue occurs inside a fixture (e.g. servers fail to start/stop),
the test result won't be detected as failed, but rather an error will be
thrown.

To ensure the tempdir is kept even if the test itself passes but the
system_test() fixture throws an error, a different mechanism is needed.
At the start of the critical test setup section, note that the fixture
hasn't finished yet. When this is detected in the system_test_dir()
fixture, it is recognized as error in test setup/teardown and the temp
directory is kept.

This may seem cumbersome, because it is. It's basically a workaround for
the way pytest handles fixtures and test errors in general.
2023-05-22 14:11:38 +02:00