Commit Graph

11322 Commits

Author SHA1 Message Date
Artem Boldariev
a76e304f5e Add a system test to verify listener transport change functionality
This commit adds a system test that helps to verify that changing a
listener transport by editing "listen-on" statements before
reconfiguration works as expected.

(cherry picked from commit 211f12ff85)
2024-01-15 14:31:06 +02:00
Michał Kępień
77b611be7c Add reconfiguration support to NamedInstance
Reconfiguring named using RNDC is a common action in BIND 9 system
tests.  It involves sending the "reconfig" RNDC command to a named
instance and waiting until it is fully processed.  Add a reconfigure()
method to the NamedInstance class in order to simplify and standardize
named reconfiguration using RNDC in Python-based system tests.

TODO:

  - full reconfiguration support (w/templating *.in files)

  - add an "rndc null" before every reconfiguration to show which file
    is used (NamedInstance.add_mark_to_log() as it may be generically
    useful?)

(cherry picked from commit fdc45c70e8)
2024-01-13 11:31:51 +01:00
Michał Kępień
c56b8136a0 Clean up the "checkds" system test
The "checkds" system test contains a lot of duplicated code despite
carrying out the same set of actions for every tested scenario
(zone_check() → wait for logs to appear → keystate_check()).  Extract
the parts of the code shared between all tests into a new function,
test_checkds(), and use pytest's test parametrization capabilities to
pass distinct sets of test parameters to this new function, in an
attempt to cleanly separate the fixed parts of this system test from the
variable ones.  Replace format() calls with f-strings.

(cherry picked from commit aa31a872d0)
2024-01-13 11:31:51 +01:00
Michał Kępień
ab058db54c Drop use of dns.resolver.Resolver from "checkds"
The "checkds" system test only uses dns.resolver.Resolver objects to
access their 'nameservers' and 'port' attributes.  Instances of the
NamedInstance class also expose that information via their attributes,
so only pass NamedInstance objects around instead of needlessly
depending on dns.resolver.Resolver.

(cherry picked from commit cf338a7ca3)
2024-01-13 11:31:51 +01:00
Michał Kępień
2d297fc8b3 Use helper Python classes for watching log files
Make log file watching in Python-based system tests consistent by
employing the helper Python classes designed for that purpose.  Drop the
custom code currently used.

(cherry picked from commit 2c35b839a5)
2024-01-13 11:31:51 +01:00
Michał Kępień
b8b0686222 Add helper Python classes for watching log files
Waiting for a specific log line to appear in a named.run file is a
common action in BIND 9 system tests.  Implement a set of Python classes
which intend to simplify and standardize this task in Python-based
system tests.

Co-authored-by: Štěpán Balážik <stepan@isc.org>
(cherry picked from commit bf92f33f94)
2024-01-13 11:31:51 +01:00
Michał Kępień
4cba5c1a02 Simplify use of RNDC in Python-based tests
The "addzone" and "shutdown" system tests currently invoke rndc using
test-specific helper code.  Rework the relevant bits of those tests so
that they use the helper classes from bin/tests/system/isctest.py.

(cherry picked from commit 00003e497c)
2024-01-13 11:31:51 +01:00
Michał Kępień
4eadaca4b0 Implement Python helpers for using RNDC in tests
Controlling named instances using RNDC is a common action in BIND 9
system tests.  However, there is currently no standardized way of doing
that from Python-based system tests, which leads to code duplication.
Add a set of Python classes and pytest fixtures which intend to simplify
and standardize use of RNDC in Python-based system tests.

For now, RNDC commands are sent to servers by invoking the rndc binary.
However, a switch to a native Python module able to send RNDC commands
without executing external binaries is expected to happen soon.  Even
when that happens, though, having the capability to invoke the rndc
binary (in order to test it) will remain useful.  Define a common Python
interface that such "RNDC executors" should implement (RNDCExecutor), in
order to make switching between them convenient.

Co-authored-by: Štěpán Balážik <stepan@isc.org>
(cherry picked from commit c38c29e84d)
2024-01-13 11:31:51 +01:00
Mark Andrews
2268ee2955 Update expected DNSKEY TTL to match dnssec-policy
csk.kasp and csk-nosep.kasp use the default policy which has a 3600
second dnskey-ttl.
2024-01-12 19:56:54 +11:00
Mark Andrews
e5bfe1e540 Set the DNSKEY TTLs to match the dnssec policy
This prevents the DNSKEY records being updated and the statistics
not matching as a consequence

(cherry picked from commit 882b1a4449)
2024-01-12 19:56:19 +11:00
Mark Andrews
e30652e33a Make $TTL match dnskey-ttl
(cherry picked from commit 16a720357b)
2024-01-12 19:56:19 +11:00
Matthijs Mekking
2a6ee4a9a0 Write new DNSKEY TTL to key file
When the current DNSKEY TTL does not match the one from the policy,
write the new TTL to disk.

(cherry picked from commit b770740b44)
2024-01-12 19:56:19 +11:00
Mark Andrews
9cab1eafee Test dnssec-policy dnskey-ttl behaviour
If the dnskey-ttl in the dnssec-policy doesn't match the DNSKEY's
ttl then the DNSKEY, CDNSKEY and CDS rrset should be updated by
named to reflect the expressed policy.  Check that named does this
by creating a zone with a TTL that does not match the policy's TTL
and check that it is correctly updated.

(cherry picked from commit f894bf661f)
2024-01-12 19:56:19 +11:00
Aram Sargsyan
086f569f52 Print a dig comment about the failed query consistently
Dig failed to print a comment about the reason of the unacceptable
query reply got from a server when there was no other query to
start in the lookup's chain.

Add an "else" block to print out the comment even when not starting
up the next query.

(cherry picked from commit 913b20abf8)
2024-01-11 10:30:40 +00:00
Aram Sargsyan
11e85d15f9 Fix a possible dig/host crash in "NS search" mode
When getting a SERVFAIL reply from a query, 'host' tries to start
the next query in the lookup's list (also true for 'dig  +nofail').
However, when running with the '-C' switch (or +nssearch for 'dig'),
all the queries in the lookup start from the beginning, so that logic
brings to a crash because of the attempted start of the query which
was already started.

Don't start the next query in the affected code path when in +nssearch
mode.

(cherry picked from commit f6658b333e)
2024-01-11 10:28:22 +00:00
Tom Krizek
7dff007ccd Allow nsupdate test rerun on FreeBSD
The "exceeded time limit waiting for literal 'too many DNS UPDATEs
queued' in ns1/named.run" is prone to fail due to a timing issue.
Despite out efforts to stabilize it, the check still often fails on
FreeBSD in our CI. Allow the test to be re-run on this platform.

(cherry picked from commit 124882476b)
2024-01-10 14:52:40 +01:00
Tom Krizek
7132f6b998 Allow statistics test rerun
This test has been unstable for a long while, especially the check
"statistics:verifying active sockets output in named.stats". Allow the
statistics test to be re-run to avoid frequent false positives.
2024-01-10 11:02:55 +01:00
Aram Sargsyan
cdb16a737e Make digdelv test work in different network envs (continued)
This commit complements the 1e7d832342
commit.

(cherry picked from commit 96f63a9f0b)
2024-01-09 14:53:21 +00:00
Tom Krizek
339143e3fc Handle dig timing out gracefully in upforwd
(cherry picked from commit 7b77574b6d)
2024-01-09 10:17:49 +01:00
Tom Krizek
a1b67ff038 Handle dig timing out gracefully in staticstub
(cherry picked from commit cc7c4760aa)
2024-01-09 10:17:49 +01:00
Tom Krizek
d061e2d6ba Handle dig timing out gracefully in sortlist
(cherry picked from commit 2341934f7d)
2024-01-09 10:17:48 +01:00
Tom Krizek
b690a44e55 Handle dig timing out gracefully in rpz
(cherry picked from commit 99799fba60)
2024-01-09 10:17:48 +01:00
Tom Krizek
b51c74f0bb Handle dig timing out gracefully in rootkeysentinel
(cherry picked from commit de569ad97a)
2024-01-09 10:17:48 +01:00
Tom Krizek
9a803cc227 Handle dig timing out gracefully in qmin
(cherry picked from commit 606985d775)
2024-01-09 10:17:48 +01:00
Tom Krizek
db064f3a69 Handle dig timing out gracefully in padding
(cherry picked from commit c983449e5e)
2024-01-09 10:17:47 +01:00
Tom Krizek
dd146c6915 Handle dig timing out gracefully in nsupdate
(cherry picked from commit 3c7291248c)
2024-01-09 10:17:47 +01:00
Tom Krizek
19c1660028 Handle dig timing out gracefully in names
(cherry picked from commit 410aa5aeab)
2024-01-09 10:17:47 +01:00
Tom Krizek
8fcf12ed2a Handle dig timing out gracefully in masterfile
(cherry picked from commit 0bf25138b6)
2024-01-09 10:17:47 +01:00
Tom Krizek
abdce0c8df Handle dig timing out gracefully in logfileconfig
(cherry picked from commit 8ece026848)
2024-01-09 10:17:47 +01:00
Tom Krizek
a0399f1548 Handle dig timing out gracefully in legacy
(cherry picked from commit 2cc90a815e)
2024-01-09 10:17:46 +01:00
Tom Krizek
554992ec59 Handle dig timing out gracefully in keepalive
(cherry picked from commit c6b267ce4d)
2024-01-09 10:17:46 +01:00
Tom Krizek
a2e96ec130 Handle dig timing out gracefully in dnstap
(cherry picked from commit fcce010045)
2024-01-09 10:17:46 +01:00
Tom Krizek
c57798d341 Handle dig timing out gracefully in cookie
(cherry picked from commit 343b3f0f84)
2024-01-09 10:17:46 +01:00
Tom Krizek
b1eab3ca7e Handle dig timing out gracefully in autosign
(cherry picked from commit 445ec7cc0f)
2024-01-09 10:17:44 +01:00
Tom Krizek
c84e34dbbc Handle dig timing out gracefully in auth
(cherry picked from commit ddb41798d5)
2024-01-09 10:06:52 +01:00
Tom Krizek
6dc3ebe494 Handle dig timing out gracefully in allow-query
(cherry picked from commit 0d5df1fc02)
2024-01-09 10:06:52 +01:00
Mark Andrews
db00e1e913 Handle dig timing out gracefully in serve-stale
(cherry picked from commit 4351076d48)
2024-01-09 10:06:49 +01:00
Mark Andrews
3b01b47ac3 Handle dig timing out gracefully in rndc
(cherry picked from commit 02d9f2eeb9)
2024-01-09 10:04:46 +01:00
Tom Krizek
863055767d Add missing dnssec-validation to ns4 in xfer test
This file was missing explicit dnssec-validation. Seems like it was
missed in our previous efforts, probably because of the different
filename / extension. Rename it to end with *.in to reflect that it is a
template file used by copy_setports.

(cherry picked from commit 68234372a5)
2024-01-09 10:02:12 +01:00
Tom Krizek
d2c5a11ae8 Turn off dnssec-validation in nsec&tsig system tests
This is a followup for !8063, which backported !7999. The configuration
file layout for these files have changed (main branch has
named-fips.conf), which is probably why these bits were missed during a
backport.
2024-01-08 18:13:47 +01:00
Tom Krizek
ec3a47fc68 Turn off dnssec validation in inline test
DNSSEC validation isn't required by the inline test and would send
queries to root name servers.

(cherry picked from commit 66d6394057)
2024-01-08 17:30:50 +01:00
Mark Andrews
2c1c7ec639 Stop sending queries to the internet's root servers
Disable automatic dnssec validation.

(cherry picked from commit 15a433cb9d)
2024-01-08 17:30:42 +01:00
Mark Andrews
b831223b3e Support Net::DNS::Nameserver 1.42
In Net::DNS 1.42 $ns->main_loop no longer loops.  Use current methods
for starting the server, wait for SIGTERM then cleanup child processes
using $ns->stop_server(), then remove the pid file.

(cherry picked from commit c2c59dea60)
2024-01-03 11:57:59 +11:00
Mark Andrews
1a52dccd32 Handle multiple NSEC3PARAM records in tests
When transitioning from one NSEC3 chain to another it is legal for
there to be multiple complete chains in the zone with multiple
NSEC3PARAM records.  Handle this intermediate state by checking
for the expected length in the loop.
2024-01-03 09:25:43 +11:00
Matthijs Mekking
b9fc29cb95 Regression check for NSEC3 to NSEC3 conversion
When changing the NSEC3 chain, the new NSEC3 chain must be built before
the old NSEC3PARAM is removed.  Check each delta in the conversion to
ensure this ordering is met.

(cherry picked from commit 1d6b892e04)
2024-01-03 09:25:43 +11:00
Mark Andrews
7e24befc2a Regression check for NSEC3 to NSEC conversion
When transitioning from NSEC3 to NSEC the NSEC3 must be built before
the NSEC3PARAM is removed.  Check each delta in the conversion to
ensure this ordering is met.

(cherry picked from commit 7d90c056b0)
2024-01-03 09:25:43 +11:00
Mark Andrews
38babba214 The NSEC3 -> NSEC private record may be added later
Check each delta for the NSEC3 -> NSEC private record addition
as it may be added in the second delta.

(cherry picked from commit 80a4dff986)
2023-12-20 11:11:12 +11:00
Mark Andrews
15601cca43 Regression check for missing RRSIGs
When transitioning from NSEC3 to NSEC the added records where not
being signed because the wrong time was being used to determine if
a key should be used or not.  Check that these records are actually
signed.

(cherry picked from commit bdb42d3838)
2023-12-19 12:44:27 +11:00
Aram Sargsyan
ba923834b2 Fix a statschannel system test zone loadtime issue
The check_loaded() function compares the zone's loadtime value and
an expected loadtime value, which is based on the zone file's mtime
extracted from the filesystem.

For the secondary zones there may be cases, when the zone file isn't
ready yet before the zone transfer is complete and the zone file is
dumped to the disk, so a so zero value mtime is retrieved.

In such cases wait one second and retry until timeout. Also modify
the affected check to allow a possible difference of the same amount
of seconds as the chosen timeout value.

(cherry picked from commit 4e94ff2541)
2023-12-18 09:34:31 +00:00
Mark Andrews
adfb365602 NetBSD has added 'hmac' to libc so rename our uses of hmac
(cherry picked from commit fd077c2661)
2023-12-14 11:14:04 +11:00