Commit Graph

5605 Commits

Author SHA1 Message Date
Štěpán Balážik
ffe0cb4bb0 Fix ecdsa256 check in ecdsa system test setup
Probably by copy-paste mistake, ecdsa384 was checked twice.

(cherry picked from commit 10194baa07)
2023-07-28 09:15:06 +02:00
Tom Krizek
774b9bc629 Disable resolve checks under TSAN
The resolve binary is affected by GL#4119 which occassionally makes it
hand during system tests when running with TSAN. This is a workaround to
avoid wasting resources caused by a CI timeout for the system test tsan
jobs.
2023-07-25 14:05:28 +02:00
Tom Krizek
0d88cd444b Reproducer for CVE-2023-2911
The conditions that trigger the crash:
- a stale record is in cache
- stale-answer-client-timeout is 0
- multiple clients query for the stale record, enough of them to exceed
  the recursive-clients quota
- the response from the authoritative is sufficiently delayed so that
  recursive-clients quota is exceeded first

The reproducer attempts to simulate this situation. However, it hasn't
proven to be 100 % reproducible, especially in CI. When reproducing
locally, the priming query also seems to sometimes interfere and prevent
the crash. When the reproducer is ran twice, it appears to be more
reliable in reproducing the issue.

(cherry picked from commit f617512d37)
2023-07-25 10:34:33 +02:00
Tom Krizek
744185f524 Clean up keys directory in checkconf test
The keys directory should be cleaned up in clean.sh. Doing that in the
test itself isn't reliable which may lead to failing mkdir which causes
the test to fail with set -e.

(cherry picked from commit 062dfac28e)
2023-07-25 09:21:50 +02:00
Aram Sargsyan
67f4b9d2a6 Fix a bug in an utility script for the statschannel system test
Because of a typo, the fetch.pl script tries to extract the server
address from the input parameter 'a' instead of 's'. Fix the typo.

(cherry picked from commit aa7538fd38)
2023-07-19 13:25:17 +00:00
Tom Krizek
42d7c0e92a Merge tag 'v9.18.17' into bind-9.18 2023-07-19 14:36:57 +02:00
Mark Andrews
d865ca788f Use absolute path to locate run.gdb
(cherry picked from commit 3f7723cdff)
2023-07-19 12:37:48 +10:00
Michal Nowak
add15bd083 Remove remnants of Windows support in system test
The "uname -o" command is harmful on OpenBSD because this platform does
not know about the "-o" option. It is a permanent failure since system
tests are started with "set -e".

(cherry picked from commit ad3efede4d)
2023-07-18 17:45:35 +02:00
Tom Krizek
915e633a5d Handle curl without HTTP/2 support in doth test 2023-07-17 16:28:49 +02:00
Tom Krizek
854b50db32 Check return codes from commands in inline test
To improve the compatibility of the inline test with the `set -e`
option, ensure all commands which are expected to pass are explicitly
checked for return code and non-zero return codes are handled.

(cherry picked from commit e5f2addcaa)
2023-07-17 15:37:18 +02:00
Tom Krizek
bca32c0c30 Handle non-zero return codes in autosign test 2023-07-17 15:30:14 +02:00
Tom Krizek
59e5fa4217 Use $(...) notation for subshells in system tests
The changes were mostly done with sed:

find . -name '*.sh' | xargs sed -i 's/`\([^`]*\)`/$(\1)/g'

There have been a few manual changes where the regex wasn't sufficient
(e.g. backslashes inside the `...`) or wrong (`...` referring to docs or
in comments).

(manually picked from commit 05baf7206b)
2023-07-17 15:30:14 +02:00
Tom Krizek
02edc985cf Handle non-zero return codes in rootkeysentinel tests
(cherry picked from commit d203681a75)
2023-07-17 15:30:14 +02:00
Tom Krizek
17f6a849ab Handle non-zero return codes in resolver test
(cherry picked from commit 2b8e5e1155)
2023-07-17 15:30:14 +02:00
Tom Krizek
28e39b567c Handle non-zero return codes in statschannel test
(cherry picked from commit cde02fdb6a)
2023-07-17 15:30:13 +02:00
Tom Krizek
db589ad1e5 Handle non-zero return codes in checkconf test
(cherry picked from commit 4a87b44196)
2023-07-17 15:30:13 +02:00
Tom Krizek
c1de0c9788 Handle non-zero return codes in dnstap test
(cherry picked from commit 9d383dce40)
2023-07-17 15:30:13 +02:00
Tom Krizek
e302ee1cc7 Handle non-zero return codes in kasp test
(cherry picked from commit ede8ea889b)
2023-07-17 15:30:13 +02:00
Tom Krizek
b7ef365cff Handle non-zero return codes in serve-stale test
(cherry picked from commit 4e8802a22d)
2023-07-17 15:30:13 +02:00
Tom Krizek
94a6fd2ad0 Handle non-zero return codes in doth test
(cherry picked from commit fae6808b9c)
2023-07-17 15:30:13 +02:00
Tom Krizek
523bbe906d Handle non-zero return codes in acl test
(cherry picked from commit 1e64749ed3)
2023-07-17 15:30:13 +02:00
Tom Krizek
716d8f43e0 Handle non-zero return codes in statistics test
(cherry picked from commit 3a36ff506d)
2023-07-17 15:30:13 +02:00
Tom Krizek
a460982af7 Handle non-zero return codes in rrsetorder test
(cherry picked from commit 9fdf537f52)
2023-07-17 15:30:13 +02:00
Tom Krizek
e7ec2cea48 Handle non-zero return codes in redirect test
(cherry picked from commit 45fc4cc465)
2023-07-17 15:30:12 +02:00
Tom Krizek
be033cf794 Handle non-zero return codes in rndc test
(cherry picked from commit c50a9e158d)
2023-07-17 15:30:12 +02:00
Tom Krizek
aca0cbe902 Handle non-zero return codes in inline test
(cherry picked from commit 36d74bd2e3)
2023-07-17 15:30:12 +02:00
Tom Krizek
c6fa52c31e Handle non-zero return codes unknown test
(cherry picked from commit f3310e1731)
2023-07-17 15:30:12 +02:00
Tom Krizek
245730cf78 Handle non-zero return codes in nsupdate test
(cherry picked from commit 86765ad1d3)
2023-07-17 15:30:12 +02:00
Tom Krizek
fcb72ad748 Handle non-zero return codes in zonechecks test
(cherry picked from commit e5933f65d6)
2023-07-17 15:30:12 +02:00
Tom Krizek
45c3163083 Handle non-zero return codes in wildcard test
(cherry picked from commit e8c61f8da4)
2023-07-17 15:30:12 +02:00
Tom Krizek
2ee1e36308 Handle non-zero return codes in zero test
(cherry picked from commit 69e8876966)
2023-07-17 15:30:12 +02:00
Tom Krizek
05247d365f Handle non-zero return codes in legacy test
(cherry picked from commit 3ce200ead8)
2023-07-17 15:30:11 +02:00
Tom Krizek
32ccdddcda Handle non-zero return codes in forward test
(cherry picked from commit 2823d0b469)
2023-07-17 15:30:11 +02:00
Tom Krizek
09cc0a03f5 Handle non-zero return codes in upforwd test
(cherry picked from commit 855f5b143a)
2023-07-17 15:30:11 +02:00
Tom Krizek
ffa70cad1a Handle non-zero return codes in addzone test
(cherry picked from commit 146cb978c5)
2023-07-17 15:30:11 +02:00
Tom Krizek
d34f1aac27 Handle non-zero return codes in rpzrecurse test
(cherry picked from commit 247b608f62)
2023-07-17 15:30:11 +02:00
Tom Krizek
881e4af8ed Handle non-zero return codes in rpz test
(cherry picked from commit 1d5caafa9e)
2023-07-17 15:30:11 +02:00
Tom Krizek
b04181224f Make $? compatible with set -e in system tests
Ensure handling of return code from previous command doesn't cause the
script to halt if that code is non-zero when running with `set -e`.

(cherry picked from commit 837c190d9e)
2023-07-17 15:30:11 +02:00
Tom Krizek
e577b1eca7 Use arithmetic expansion in system tests (followup)
These are manual edits in addition of the automated changes from the
previous commit.

(manually picked from commit 1436025e20)
2023-07-17 15:30:09 +02:00
Tom Krizek
6f07ba6b7d Use arithmetic expansion in system tests
Change the way arithmetic operations are performed in system test shell
scripts from using `expr` to `$(())`. This ensures that updating the
variable won't end up with a non-zero exit code, which would case the
script to exit prematurely when `set -e` is in effect.

The following replacements were performed using sed in all text files
(git grep -Il '' | xargs sed -i):

s/status=`expr $status + $ret`/status=$((status + ret))/g
s/n=`expr $n + 1`/n=$((n + 1))/g
s/t=`expr $t + 1`/t=$((t + 1))/g
s/status=`expr $status + 1`/status=$((status + 1))/g
s/try=`expr $try + 1`/try=$((try + 1))/g

(manually picked from commit 4d42bdc245)
2023-07-17 14:12:59 +02:00
Tom Krizek
d715bae429 Run system tests with set -e
Ensure all shell system tests are executed with the errexit option set.
This prevents unchecked return codes from commands in the test from
interfering with the tests, since any failures need to be handled
explicitly.

(cherry picked from commit 01bc805f89)
2023-07-17 13:46:19 +02:00
Michal Nowak
577f0723e0 Detect core dumps after BIND failed to stop cleanly
With the pytest runner, when BIND crashed during test runtime, the
get_core_dumps.sh script hasn't been run, and core dumps were not
detected.

(cherry picked from commit 89c77daddb)
2023-07-13 15:14:47 +02:00
Michał Kępień
ebab8b7705 Fix typo in tests_shutdown.py 2023-07-06 15:46:16 +02:00
Matthijs Mekking
9cb0a2731d Add test for "three is a crowd" bug (GL #2375)
Add this test scenario for a bug fixed a while ago. When a third key is
introduced while the previous rollover hasn't finished yet, the keymgr
could decide to remove the first two keys, because it was not checking
for an indirect dependency on the keys.

In other words, the previous bug behavior was that the first two keys
were removed from the zone too soon.

This test case checks that all three keys stay in the zone, and no keys
are removed premature after another new key has been introduced.

(cherry picked from commit 9c40cf0566)
2023-07-06 10:57:54 +02:00
Matthijs Mekking
6859294c26 Check all keys despite early failure
In the kasp script, if one expected key is not found, continue checking
the other key ids, even if there is no match for the first one.  This
provides a bit more information which keys mismatch and makes for
easier debugging test failures.

(cherry picked from commit 674249f66a)
2023-07-06 10:57:09 +02:00
Tony Finch
1ddf2b87f5 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.

(manually picked from commit e18ca83a3b)
2023-07-04 14:53:08 +02:00
Tom Krizek
184eddb595 Use timeout for rndc status in shutdown test
Pass 5 second timeout to the rndc status command(s) to avoid hitting the
hard 10 second timeout from subprocess.call, which would result in an
unwanted exception that would only mask the real issue: if the rndc
status times out in this test, it is likely due to the server not
stopping as it should.

(cherry picked from commit ceed694659)
2023-07-04 14:36:05 +02:00
Tom Krizek
c7b0ac0367 Split shutdown test into separate test cases
The shutdown test attempts to shut down the server using two different
methods - rndc and sigterm. Use pytest.mark.parametrize to run these as
separate test cases for easier identification of failures.

(cherry picked from commit 603c58ee28)
2023-07-04 14:36:03 +02:00
Tom Krizek
4dcb0c67d3 Check for unset variables only after conf.sh is loaded
Make the cds/setup.sh compatible with the workaround which relies on
testing the TSAN_OPTIONS variable which may not be set.

(cherry picked from commit 76d9873ef6)
2023-06-29 13:14:33 +02:00
Tom Krizek
b94f5146a1 Fix checking for executables in shell conditions in tests
Surround the variables which are checked whether they're executable in
double quotes. Without them, empty paths won't be properly interpreted
as not executable.

(manually picked from commit 06056c44a7)
2023-06-29 13:14:26 +02:00