Commit graph

4603 commits

Author SHA1 Message Date
Mark Andrews
f894bf661f 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.
2024-01-03 12:09:11 +11:00
Mark Andrews
c2c59dea60 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.
2024-01-03 09:21:15 +11:00
Michal Nowak
e67d770432
Rewrite spf system test to pytest 2023-12-22 15:02:58 +01:00
Michał Kępień
662a88055c
Add wait_for_zones_loaded fixture
The wait_for_zones_loaded fixture waits for the "all zones loaded"
message in the named log file before the test function can proceed.
2023-12-22 15:02:58 +01:00
Michał Kępień
1770b37095
Ensure wait_for_line() is not called with timeout=0 2023-12-22 15:02:58 +01:00
Michał Kępień
831c5d34f9
Refactor string matching loop for readability 2023-12-22 15:02:58 +01:00
Tom Krizek
05b0ebac0f
Add LogFile helper
LogFile class contains a log path and has means to find a string in the
log file.
2023-12-22 15:02:58 +01:00
Michał Kępień
fdc45c70e8 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?)
2023-12-21 18:10:15 +00:00
Michał Kępień
aa31a872d0 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.
2023-12-21 18:10:15 +00:00
Michał Kępień
cf338a7ca3 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.
2023-12-21 18:10:15 +00:00
Michał Kępień
2c35b839a5 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.
2023-12-21 18:10:15 +00:00
Michał Kępień
bf92f33f94 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>
2023-12-21 18:10:15 +00:00
Michał Kępień
00003e497c 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.
2023-12-21 18:10:15 +00:00
Michał Kępień
c38c29e84d 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>
2023-12-21 18:10:15 +00:00
Matthijs Mekking
1d6b892e04 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.
2023-12-21 20:12:09 +11:00
Mark Andrews
7d90c056b0 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.
2023-12-21 20:12:09 +11:00
Mark Andrews
80a4dff986 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.
2023-12-19 22:05:59 +00:00
Mark Andrews
bdb42d3838 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.
2023-12-19 11:21:46 +11:00
Tom Krizek
66d6394057 Turn off dnssec validation in inline test
DNSSEC validation isn't required by the inline test and would send
queries to root name servers.
2023-12-18 23:46:03 +00:00
Mark Andrews
15a433cb9d Stop sending queries to the internet's root servers
Disable automatic dnssec validation.
2023-12-18 23:46:03 +00:00
Mark Andrews
4e16bbce15 Use custom bindkeys-file in tests
Ensure the test doesn't use the system's bind.keys file by using the
bindkeys-file statement.
2023-12-18 23:46:03 +00:00
Aram Sargsyan
4e94ff2541 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.
2023-12-18 08:46:31 +00:00
Evan Hunt
c8f43b9160 remove some long-deprecated arguments from dig
certain dig options which were deprecated and became nonoperational
several releases ago still had documentation in the dig man page and
warnings printed when they were used: these included +mapped,
+sigchase, +topdown, +unexpected, +trusted-key, and the -i and -n
options. these are now all fatal errors.

another option was described as deprecated in the man page, but
the code to print a warning was never added. it has been added now.
2023-12-06 17:32:09 -08:00
Evan Hunt
90a16b3e65 fix unnecessary capitalization
there was a typo in the copyright header.
2023-12-06 17:31:38 -08:00
Artem Boldariev
10e626111f doth test: add a secondary NS instance that reuses a 'tls' entry
This commit extends the 'doth' system tests with additional secondary
NS instance that reuses the same 'tls' entry for connecting the the
primary to download zones. This configurations were known to crash
secondaries in some cases.
2023-12-06 16:01:20 +02:00
Artem Boldariev
019555fb1d System test for PROXYv2
This commit adds a system test suite for PROXYv2. The idea on which it
is based is simple:

1. Firstly we check that 'allow-proxy' and 'allow-proxy-on' (whatever
is using the new 'isc_nmhandle_real_localaddr/peeraddr()') do what
they intended to do.

2. Anything else that needs an interface or peer address (ACL
functionality, for example) is using the old
'isc_nmhandle_localaddr/peeraddr()' - which are now returning
addresses received via PROXY (if any) instead of the real connection
addresses. The beauty of it that we DO NOT need to verify every bit of
the code relying on these functions: whatever works in one place will
work everywhere else, as these were the only functions that allowed
any higher level code to get peer and interface addresses.

This way it is relatively easy to see if PROXYv2 works as intended.
2023-12-06 15:15:25 +02:00
Artem Boldariev
0e8d5c9c6b Add checkonf tests for the PROXYv2 related options
This commit adds necessary PROXYv2 configuration options checks.
2023-12-06 15:15:25 +02:00
Matthijs Mekking
abdaa77303 Change max NSEC3 iterations in system tests to 50
The dnssec and nsupdate system tests need to be adjusted to accept
a lower maximum value for NSEC3 iterations.
2023-12-05 14:58:58 +00:00
Matthijs Mekking
3c08fbc79f Change NSEC3 iterations to 0 in system tests
The system tests need to be updated because non-zero iterations are no
longer accepted.

The autosign system test changes its iterations from 1 to 0 in one
test case. This requires the hash to be updated.

The checkconf system test needs to change the iterations in the good
configuration files to 0, and in the bad ones to 1 (any non-zero value
would suffice, but we test the corner case here). Also, the expected
failure message is change, so needs to be adjusted.

The nsec3 system test also needs iteration configuration adjustments.
In addition, the test script no longer needs the ITERATIONS environment
variable.

In the process of updating the system tests, I noticed an error
in the dnssec-policy "nsec3-other", where the salt length in one
configuration file is different than in the other (they need to be
the same). Furthermore, the 'rndc signing -nsec3param' test case
is operated on the zone 'nsec-change.kasp', so is moved so that the
tests on the same zone are grouped together.
2023-12-05 14:58:58 +00:00
Tom Krizek
5de2b07daa
Refactor statschannel test to use isctest
Use common utility functions in favor of duplicating the code in a
test-specific file.
2023-12-05 13:26:49 +01:00
Tom Krizek
cba5a1d62c
Add system test utility package isctest
Create a utility package for code shared by the python tests. The
utility functions should use reasonable defaults and be split up into
modules according to their functionality.

Ensure assert rewriting is enabled for the modules to get the most
useful output from pytest.
2023-12-05 13:26:49 +01:00
Tom Krizek
f0481c8600
Simplify statsport fixture in statschannel test
The ports fixture provides the required port numbers already and there's
no need to get the port number from environment.
2023-12-05 13:26:49 +01:00
Tom Krizek
a57af8163a
Allow assertion message rewrite in statschannel test
By default, the useful assertion message rewrite is used by pytest for
test modules only. Since another module is imported with shared
functionality, ensure it has pytest's assertion message rewriting
enabled to obtain more debug information in case it fails.
2023-12-05 13:26:49 +01:00
Tom Krizek
fc295b2b5d
Move helper functions in statchannel into single file
Since dnspython is now a required dependency, there's no need to keep
these two helper files separate.
2023-12-05 13:26:49 +01:00
Tom Krizek
767f4670c6
Add assert message to test doth/stress_http_quota.py
This file is executed outside of pytest with pure python, which doesn't
do any AssertionError message rewriting like pytest. Ensure the assert
messages in this file provide a useful debug message.
2023-12-05 13:26:43 +01:00
Michał Kępień
422286e9c2
Do not daemonize named instances with custom args
This enables the "logfileconfig" and "rpzextra" system tests to pass
when named is started under the supervision of rr (USE_RR=1).
2023-12-04 18:40:52 +01:00
Michal Nowak
920af590d1
Fix process listing string of rpzextra ns3 server 2023-12-04 18:39:28 +01:00
Michal Nowak
e088e8a992
Add support for recording named runtime with rr
The traces of the named process are stored in the directory
$system_test/nsX/named-Y/.
2023-12-04 18:38:29 +01:00
Ondřej Surý
658d62a6f4
Remove support for running system tests under Valgrind
Valgrind support has been scarcely used.
2023-12-04 18:27:51 +01:00
Tom Krizek
1e181cf61d
Remove -U 4 from system tests
This option doesn't appear to be needed for any of the tests, so remove
it to keep things simple.
2023-12-01 14:03:35 +01:00
Tom Krizek
fba295600b
Update system test documentation
Rewrite and reorganize the test documentation to focus on the pytest
runner, omit any mentions of the legacy runner which are no longer
relevant, and mention a few pytest tricks.
2023-12-01 14:03:33 +01:00
Tom Krizek
3e26d99c3c
Remove obsolete system test lists
These were used by deleted legacy runner utility scripts.
2023-12-01 13:47:29 +01:00
Tom Krizek
910440d9b6
Remove legacy runner control scripts
These scripts have been used exclusively by the legacy test runner and
they're no longer needed.
2023-12-01 13:47:27 +01:00
Matthijs Mekking
00fa7483b9
Renumber the ns2/named-alt*.conf.in files
Now that some configuration input files have been removed, rename
the filenames.
2023-11-28 17:03:08 +01:00
Matthijs Mekking
3119164e29
Drop ns2/named-alt1.conf.in and ns2/named-alt2.conf.in
These files were not being used in the system test.
2023-11-28 17:03:08 +01:00
Michal Nowak
236e5bf519
Drop the last remnant of ns2/named-alt3.conf.in
The ns2/named-alt3.conf.in config file was removed in
f8e264ba6d. From then on, system test
reports:

    sed: can't read ns2/named-alt3.conf.in: No such file or directory"

Drop the last remnant of ns2/named-alt3.conf.in.
2023-11-28 17:03:08 +01:00
Matthijs Mekking
6a4f3ec242 Add a DNSSEC policy test case for a special zone
Try to create a key for a zone, and then sign it, that has some special
characters in the name.
2023-11-20 08:31:39 +01:00
Evan Hunt
9643281453 set loadtime during initial transfer of a secondary zone
when transferring in a non-inline-signing secondary for the first time,
we previously never set the value of zone->loadtime, so it remained
zero. this caused a test failure in the statschannel system test,
and that test case was temporarily disabled.  the value is now set
correctly and the test case has been reinstated.
2023-11-15 17:23:25 -08:00
Ondřej Surý
17da9fed58
Remove AES algorithm for DNS cookies
The AES algorithm for DNS cookies was being kept for legacy reasons, and
it can be safely removed in the next major release.  Remove both the AES
usage for DNS cookies and the AES implementation itself.
2023-11-15 10:31:16 +01:00
Tony Finch
61b245e318 Fix missing newlines in output of rndc nta -dump
There were no newlines between each view in the list of negative trust
anchors.
2023-11-02 21:31:09 +11:00