Commit graph

3822 commits

Author SHA1 Message Date
Matthijs Mekking
80a20c9643 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:30:53 +02:00
Matthijs Mekking
83dd0c85a2 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:28:41 +02:00
Tom Krizek
4efef8cb54
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 14:40:09 +02:00
Tom Krizek
2020ce2010
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:19:47 +02:00
Tom Krizek
bd9dabc0c3
Only use delv if available in mkeys test
Check that $DELV is an executable before using it in a test.

(cherry picked from commit 384339dbba)
2023-06-29 13:16:50 +02:00
Tom Krizek
a904cd9a0e
Disable delv tests under TSAN
Since delv can occasionally hang in system tests when running with TSAN
(see GL#4119), disable these tests as a workaround. Otherwise, the hung
delv process will just waste CI resources and prevent any meaningful
output from the rest of the test suite.

(cherry picked from commit fbcf37f914)
2023-06-29 13:16:46 +02:00
Tom Krizek
0374c27fc5
Check for proper file size output in dnstap test
Previously, the first check silently failed, as 450 is apparently (in
the CI) 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.

(manually picked from commit 5f809e50b6)

On main, the minimum file size seems to 454 bytes, while on some
platforms in our CI setup for the 9.16 branch, it appears to be 450
instead.
2023-06-26 14:33:43 +02:00
Tom Krizek
9cfc8da487
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).

(cherry picked from commit 1dd4c2b9e2)
2023-06-26 13:08:09 +02:00
Michał Kępień
731a736a91
Add a tool for reproducing ISC SPNEGO bugs
Extend the "tsiggss" system test with reproducers for CVE-2020-8625 and
CVE-2021-25216.

(cherry picked from commit a47dc810f7)
2023-06-19 10:36:25 +02:00
Tom Krizek
328d0a1d0a
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.

(cherry picked from commit dd7bcd2855)
2023-06-13 14:16:44 +02:00
Michal Nowak
ca57ddf53e
Disable minimal update check with no keys on Windows
The $t1 value equals $t2 due to the time elapsed between "rndc
managed-keys status" calls being equal to the normal active refresh
period (as calculated per rules listed in RFC 5011 section 2.3) minus an
"hour" (as set using -T mkeytimers). This value equality is expected to
happen on really slow machines. On our Windows CI runner, it happens
very often.
2023-05-31 14:25:02 +02:00
Matthijs Mekking
2d5b975f3a 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).

(cherry picked from commit c3d4fd3449)
2023-05-30 15:32:24 +02:00
Michal Nowak
f00a212cb8
TSAN summarising line was misplaced in run.sh
The line summarising TSAN reports was misplaced in the ASAN territory
and thus never used.

I also made core dumps, assertion failures, and TSAN reports detection
independent of each other.

(cherry picked from commit 0c4c7ddec4)
2023-05-19 14:55:23 +02:00
Michal Nowak
4078347d80
Disable exceeded quota check on Windows
This check is too unstable on Windows. Given the bind-9.16 branch is in
security fixes-only mode, something unlikely to be investigated before
the branch goes EOL.
2023-05-18 16:57:55 +02:00
Michal Nowak
8cdfde8b35
Drop set_key_default_values function
The set_key_default_values function hasn't been backported to bind-9.16
and produces a warning in the nsec3 system test:

    tests.sh: line 234: set_key_default_values: command not found
2023-05-12 10:55:08 +02:00
Michal Nowak
4cc7feee24
Rewrite the ttl system test to pytest
(cherry picked from commit 0c05c3d97b)
2023-05-11 16:53:04 +02:00
Tom Krizek
fd1d359965
Ensure named always terminates in the shutdown test
Previously, if an exception would happen inside the `with` block, the
error handler would wait indefinitely for the process to end. That would
never happen, since the termination signal was never sent to named and
the test would get stuck.

Using the try-finally block ensures that the named process is always
killed and any exception or errors will be handled gracefully.

(cherry picked from commit 836e6ed284)
2023-05-10 13:32:55 +02:00
Tom Krizek
7bbc38da95
Refactor shutdown test into more helper functions
Improve code readability by splitting the test into more functions. Some
could be re-used later on for more general-purpose subprocess handling
or named checks.

(cherry picked from commit 9d64f1c1ed)
2023-05-10 13:32:51 +02:00
Mark Andrews
aa73fda9bf Check removal of ENT when subdomains are removed
Empty-non-terminal NSEC records where not always removed when the
delegations generating them where removed via update. Check that
they now are.

(cherry picked from commit ad91a70d15)
2023-04-25 06:51:11 +01:00
Michal Nowak
6d5249c50c
Do not retry in resolution_fails() on timeout
At the time of test number (19), there were 10 "sending packet to
10.53.0.7" lines in the "legacy/ns1/named.run" file; usually, only seven
are present:

    I:legacy:checking recursive lookup to edns 512 + no tcp server does not cause query loops (19)
    I:legacy:ns1 sent 10 queries to ns7, expected less than 10
    I:legacy:failed

Those three can be attributed to tests "8", "10", and "18", where the
dig of "resolution_fails()" retried after a timeout to succeed with
"status: SERVFAIL" subsequently, as seen in each of
dig.out.test{8,10,18} files.

    ;; communications error to 10.53.0.1#13093: timed out

    ; <<>> DiG 9.19.12-dev <<>> -p 13093 +tcp @10.53.0.1 edns512-notcp. TXT
    ; (1 server found)
    ;; global options: +cmd
    ;; Got answer:
    ;; ->>HEADER<<- opcode: QUERY, status: SERVFAIL, id: 5368
    ;; flags: qr rd ra; QUERY: 1, ANSWER: 0, AUTHORITY: 0, ADDITIONAL: 1

This retry is unnecessary because "resolution_fails()" considers timeout
a positive result.

(cherry picked from commit e05460c813)
2023-04-06 11:46:57 +02:00
Matthijs Mekking
9e702807cb Fix kasp system test bug
This test was succeeding for the wrong reason (policy not found, rather
than bad key length).

(cherry picked from commit 106497b011)
2023-03-31 10:34:49 +02:00
Mark Andrews
c3f5ef24b2 Accept either 2 or 3 old versions of log file
Depending upon when the directory is sampled there may be 2
(oldest version removed and rename / reopen is in progresss) or
3 old versions of the log file.

(cherry picked from commit f485bb19c0)
2023-03-28 10:03:33 +00:00
Evan Hunt
6e422ae3ae fixed a bug in rolling timestamp logfiles
due to comparing logfile suffixes as 32 bit rather than 64 bit
integers, logfiles with timestamp suffixes that should have been
removed when rolling could be left in place. this has been fixed.

(cherry picked from commit 9a9e906306)
2023-03-28 10:03:33 +00:00
Evan Hunt
e2f7f63448 rewrite logfileconfig system test
the logfileconfig system test did not conform to the style of
other tests, and was difficult to read and maintain. it has
been cleaned up and simplifeid in several ways:

- named.args used when appropriate so that named can be started with
  specified command line arguments, instead of having it launched
  directly from tests.sh
- unused root zone removed from named configuration
- an existing directory used instead of using 'mkdir' to create one
- dnssec-validation disabled to stop the server sending unnecessary
  queries

incidental fix: removed leftover debugging printfs from logconf.c.

(manually picked from commit 76baed3343)
2023-03-28 10:03:33 +00:00
Matthijs Mekking
6a97848791 Update serve-stale system test
The serve-stale system test was intermittently failing due to a timing
issue:

    I:serve-stale:check stale data.example TXT was refreshed...
    I:serve-stale:failed

The RRset is refreshed, however, it first checks for an expected log
line, prior checking that the stale data.example TXT was refreshed
(using dig). This log line is there to ensure the record is actually
refreshed before we start querying again. Alternatively we could just
retry_quiet 10 <wait for dig output matches expectations>. It would
lower the chances for intermittent test failures, since there is no
longer a "check for log line, sleep one second if check fails, check
for log line, ...", prior to the check.

(cherry picked from commit 0bf36da305)
2023-03-27 08:21:54 +00:00
Tom Krizek
d631ecdde7
testcrypto.sh: run in TMPDIR if possible
Avoid creating any temporary files in the current workdir.

Additional/changing files in the bin/tests/system directory are
problematic for pytest/xdist collection phase, which assumes the list of
files doesn't change between the collection phase of the main pytest
thread and the subsequent collection phase of the xdist worker threads.

Since the testcrypto.sh is also called during pytest initialization
through conf.sh.common (to detect feature support), this could
occasionally cause a race condition when the list of files would be
different for the main pytest thread and the xdist worker.

(cherry picked from commit 61330a7863)
2023-03-23 17:17:59 +01:00
Tom Krizek
4d31ebf088
Lighten the CI load during the dupsigs test
Previously, an AXFR request would be issued every second while waiting
for the zone to be signed. This might've been the cause of issues in CI
where many tests are running in parallel and any extra load may increase
test instability.

Instead, check for the last NSEC record to have a signature before
commencing the AXFR request to check the zone has been fully signed.

Also increase the time for the zone signing to a total of 60+10 seconds
up from the previous 30.

(cherry picked from commit 3291c891f6)
2023-03-22 14:26:10 +01:00
Tom Krizek
3f0f2a3324
End dupsigs test early if it fails
There's no point in continuing the dupsigs test if a failure is
detected. End the test early to avoid wasting time and resources.

(cherry picked from commit ad647dca13)
2023-03-22 14:26:10 +01:00
Tom Krizek
de5e04fd0d
Store dupsigs axfr to a file for easier debugging
(cherry picked from commit fad2eee631)
2023-03-22 14:26:10 +01:00
Tom Krizek
42987fd2d4
Redirect dupsigs test output to proper logger
Ensure messages from dupsigs system test end up in its log rather than
stdout. Previously, the output was hard to debug when running the tests
in parallel and messages wouldn't end up in the dupsigs.log.

(cherry picked from commit cbe2559f37)
2023-03-22 14:26:08 +01:00
Tom Krizek
303f16e16d
Fix the fully signed zone check in dupsigs test
In v9.16, the number of expected signatures for the fully signed dupsigs
zone is 1009 rather than 1008, since there is one extra DNSKEY
signature. The test itself checks for the correct number, but the
barrier which waits for the zone to be fully signed doesn't.

In practice, this had the effect of always waiting the full 30 seconds
for the zone to be signed. Afterwards, the wait barrier would fail.
However, the return code isn't handled, so the test would proceed and
succeed anyway, since 30 seconds was enough time for the zone to get
fully signed.

This issue was introduced during a backport in commit
4840d6f9c9.
2023-03-22 11:56:12 +01:00
Aram Sargsyan
299c023024 Improve dnstap system test reliability
The dnstap system test fails intermittently, and it appears to be
a timing issue - adding a short delay after running 'fstrm_capture',
and before running 'dnstap -reopen' improves the situation from
50% failures (5 out of 10 times) to 0% failures (0 out of 20 times),
tested locally.

The reason is that 'fstrm_capture' is executed in the background,
and due to OS scheduling and other factors, the listener socket
may not be ready when the following command runs and tells 'named'
to (re)open it.

(cherry picked from commit fa686fcea5)
2023-03-13 11:57:43 +00:00
Aram Sargsyan
3ac0f6ee50 Add a catz system test check for [GL #3911]
The trick is to configure a duplicate zone, which comes after the
catalog zone, where the duplicate zone is an existing member zone.

In that scenario, all the zones which come before the "faulty" zone
in the configuration file will fail to be reverted to the previous
version of the view after a reconfiguration error, and in this
particular case that will result in an assertion failure when the
catalog zone update is initiated, because it will be still tied to
the new version of the view, which was dismissed.

(cherry picked from commit 93c4f382f4)
2023-03-01 15:49:21 +00:00
Aram Sargsyan
561289909b Add a system test for [GL #3777]
Add the 'ixfr-from-differences yes;' option to trigger a failed
zone postload operation when a zone is updated but the serial
number is not updated, then issue two successive 'rndc reload'
commands to trigger the bug, which causes an assertion failure.

(cherry picked from commit a73b67456e)
2023-02-28 14:40:17 +00:00
Aram Sargsyan
eeaa830ecd Add an "rpz" system test check for a failed reconfiguration
The faulty "DLZ" configuration triggers a reconfiguration failure
in such a place where view reverting code is covered.

(cherry picked from commit 95f4bac002)
2023-02-27 08:42:34 +00:00
Michal Nowak
e8918b1304
Stop logfileconfig/ns1 server with TERM signal
stop.pl tries to stop ns1 via rndc but fails to find rndc.conf because
the logfileconfig test code is unexpectedly executed from the
logfileconfig/ns1/ directory. Instead of stopping ns1 with rndc, it
waits for 30 seconds and then terminates ns1 with the TERM signal.

    I:logfileconfig:testing default logfile using named -L file (9)
    rndc: ../common/rndc.conf does not exist

Stopping ns1 with rndc was recently inadvertently introduced in
172826bfa8. Stop ns1 with the TERM signal
directly, as we did before.
2023-02-23 16:52:59 +01:00
Mark Andrews
f0cbe3ab1f
Test RRSIG queries with serve-stale enabled
Make RRSIG queries where the existing tests trigger a DNS_EVENT_TRYSTALE
event.

(cherry picked from commit add40273df)
2023-02-22 14:01:56 +01:00
Aram Sargsyan
d6568bea7c
Add tests for CVE-2022-3924
Reproduce the assertion by configuring a 'named' resolver with
'recursive-clients 10;' configuration option and running 20
queries is parallel.

Also tweak the 'ans2/ans.pl' to simulate a 50ms network latency
when qname starts with "latency". This makes sure that queries
running in parallel don't get served immediately, thus allowing
the configured recursive clients quota limitation to be activated.

(cherry picked from commit 4b52b0b4a9)
2023-02-22 10:59:31 +01:00
Mark Andrews
552b5152a0 Source conf.sh the v9_16 way 2023-02-19 10:59:08 +00:00
Michal Nowak
e0158ab2b5
Adapt to Python scripts to black 23.1.0
(cherry picked from commit 3cd2cc6254)
2023-02-17 16:55:47 +01:00
Michal Nowak
596918c57a
Fix unnecessary "else" after "raise" with pylint 2.16.2
bin/tests/system/get_algorithms.py:225:4: R1720: Unnecessary "else" after "raise", remove the "else" and de-indent the code inside it (no-else-raise)

(cherry picked from commit 8064ac6bec)
2023-02-17 16:55:24 +01:00
Petr Menšík
3f81fbed12 FIPS tests changes for RHEL
Include MD5 feature detection in featuretest tool and use it in some
places. When RHEL distribution or Fedora ELN is in FIPS mode, then MD5
algorithm is unavailable completely and even hmac-md5 algorithm usage
will always fail. Work that around by checking MD5 works and if not,
skipping its usage.

Those changes were dragged as downstream patch bind-9.11-fips-tests.patch
in Fedora and RHEL.

(cherry picked from commit 6ad794a8cd)
2023-02-16 08:48:39 +11:00
Mark Andrews
9109f38ece Add islands of trust to mkeys test
This adds an island of trust that is reachable from the root
where the trust anchors are added to island.conf.

This add an island of trust that is not reachable from the root
where the trust anchors are added to private.conf.

(cherry picked from commit 41bdb5b9fe)
2023-02-14 22:09:52 +00:00
Tom Krizek
208777b74e
Increase named startup wait time for runtime test
Occasionally, the allotted 10 seconds for the "running" line to appear
in log after named is started proved insufficient in CI, especially
during increased load. Give named up to 60 seconds to start up to
mitigate this issue.

(cherry picked from commit b8bb4233e8)
2023-02-13 16:11:04 +01:00
Evan Hunt
5d0a8996ce
increase simultaneous updates for quota test
the nsupdate system test was intermittently failing due to the update
quota not being exceeded when it should have been.  this is most likely
a timing issue: the client is sending updates too slowly, or the server
is processing them too quickly, for the quota to fill. this commit
attempts to make that the failure less likely by increasing the number
of update transactions from 10 to 20.

(cherry picked from commit 06b1faf068)
2023-02-13 13:36:11 +01:00
Mark Andrews
539f29d412 Allow some time to the root trust anchor to appear
Following deleting the root trust anchor and reconfiguring the
server it takes some time to for trust anchor to appear in 'rndc
managed-keys status' output.  Retry several times.

(cherry picked from commit 71dbd09796)
2023-02-08 00:46:41 +11:00
Matthijs Mekking
3ffb63e9bb Force set DS state after 'rndc dnssec -checkds'
Set the DS state after issuing 'rndc dnssec -checkds'. If the DS
was published, it should go in RUMOURED state, regardless whether it
is already safe to do so according to the state machine.

Leaving it in HIDDEN (or if it was magically already in OMNIPRESENT or
UNRETENTIVE) would allow for easy shoot in the foot situations.

Similar, if the DS was withdrawn, the state should be set to
UNRETENTIVE. Leaving it in OMNIPRESENT (or RUMOURED/HIDDEN)
would also allow for easy shoot in the foot situations.

(cherry picked from commit ee42f66fbe)
2023-01-27 16:09:06 +01:00
Michał Kępień
7b0e57095a BIND 9.16.37
-----BEGIN PGP SIGNATURE-----
 
 iQJDBAABCgAtFiEENKwGS3ftSQfs1TU17QVz/8hFYQUFAmPAjacPHG1pY2hhbEBp
 c2Mub3JnAAoJEO0Fc//IRWEFK/8QAIwzV2AXifS4FpuPG+AUDYDkWISambW62ZYx
 KVMxJquSRv3ZeBc7JZ0OFcqP6RcZKlj8X55aJlehusmEBTCOS3pXJUyBIJ8O//4P
 lqGUPaNrQd1Y0YsBfKLP0Eoljfopj9aplUGZMBz35LejkDSwbj4E6oO0R29ZtLKZ
 8qA2V5TgY1X28fkPlzZyEKtg2+MDZ8WebSjn/J3usJmTlmfyPT/II0aWSS/bhSz2
 M3IZdECPS0n11M4a/9pbgsGUHVfLMTrVkxVyNlJK6yRs2SWWlb0ylrRjZbxY4jyK
 hp8bOnQuLwQ/dtMW90Od7oLxbGzhW7fUmpRxA/UbycaDUiXHTFL6lgG1ZIcVBMHy
 pbg6B+RSGgAIb3SUyCcff83ya8HKyX456AxhfdbitHlioGi4sZUehVV8NUZOzrgE
 9xLbSWIkvVLzZGT42O81kHL225CkteZwc2NaIIrGCIXS+s58MqGIP/tNAmTbty5s
 40xyoYjaPc2g8DHw+Lw2ykJqA5O14vkJR+ERFdc6N5rgBIQWbuMG6AV4mH9cgixU
 ANyVytQF792O9Y2HHFmLcGTDHOjyUfpxVxWc7hy9jJ8ejgzaGQbY3UXeVRuJ6ZAW
 lsdfP0Nh9b371sGcgxkmQZaNDj1wUp5eYXDkCuk27t9iOHsqvWzM38iTvRZqpDZQ
 WE+64/IG
 =8rdy
 -----END PGP SIGNATURE-----

Merge tag 'v9_16_37' into v9_16

BIND 9.16.37
2023-01-25 21:34:55 +01:00
Tom Krizek
7139e297b2
Fix feature detection for pytest markers in tests
The condition was accidentally reversed during refactoring in
9730ac4c56 . It would result in skipped
tests on builds with proper support and false negatives on builds
without proper feature support.

Credit for reporting the issue and the fix goes to Stanislav Levin.

(cherry picked from commit 473cb530f4)
2023-01-17 14:49:38 +01:00
Evan Hunt
8c78511e9a test failure conditions
verify that updates are refused when the client is disallowed by
allow-query, and update forwarding is refused when the client is
is disallowed by update-forwarding.

verify that "too many DNS UPDATEs" appears in the log file when too
many simultaneous updates are processing.

(cherry picked from commit b91339b80e)
2023-01-12 12:21:36 +01:00