Commit graph

4825 commits

Author SHA1 Message Date
Michał Kępień
b9c9ed6197 Increase timeout in the rndc deadlock test
The timeout originally picked for "rndc status" invocations (2 seconds)
in the test attempting to reproduce a deadlock caused by running
multiple "rndc addzone", "rndc modzone", and "rndc delzone" commands
concurrently causes intermittent failures of the "addzone" system test
in GitLab CI.  Increase the timeout to 10 seconds to make such failures
less probable.  Adjust code comments accordingly.

(cherry picked from commit ac4c58e8ce)
2021-06-17 12:41:01 +02:00
Mark Andrews
1281b4f281 make it clear algorithm field is a domain name
(cherry picked from commit 47ca495108)
2021-06-16 16:12:44 +10:00
Michał Kępień
82b7e6ccef Add AUTHORITY tests for CNAME-sourced delegations
Add a set of system tests which check the contents of the AUTHORITY
section for signed, insecure delegation responses constructed from CNAME
records and wildcards, both for zones using NSEC and NSEC3.

(cherry picked from commit 26ec4b9a89)
2021-06-10 10:26:51 +02:00
Matthijs Mekking
22e5666925 Add test for NSEC3PARAM not changed after restart
Add a test case where 'named' is restarted and ensure that an already
signed zone does not change its NSEC3 parameters.

The test case first tests the current zone and saves the used salt
value. Then after restart it checks if the salt (and other parameters)
are the same as before the restart.

This test case changes 'set_nsec3param'. This will now reset the salt
value, and when checking for NSEC3PARAM we will store the salt and
use it when testing the NXDOMAIN response. This does mean that for
every test case we now have to call 'set_nsec3param' explicitly (and
can not omit it because it is the same as the previous zone).

Finally, slightly changed some echo output to make debugging friendlier.

(cherry picked from commit 08a9e7add1)
2021-06-09 09:18:37 +02:00
Mark Andrews
6d84bff565 Address test race condition in serve-stale
the dig.out.test# files could still be being written when the
content greps where being made.

(cherry picked from commit af95cb8ccc)
2021-06-03 18:43:24 +10:00
Mark Andrews
3f20e71430 Add timeout to url get requests
to prevent the system test taking forever on failures.

(cherry picked from commit 02726cb66e)
2021-06-03 08:39:12 +10:00
Mark Andrews
c4410f0f4f Check DNAME resolution via itself
(cherry picked from commit cbdea694e8)
2021-06-02 14:49:30 +02:00
Mark Andrews
2b73101db6 Add a system test checking a malformed IXFR
Make sure an incoming IXFR containing an SOA record which is not placed
at the apex of the transferred zone does not result in a broken version
of the zone being served by named and/or a subsequent crash.

(cherry picked from commit 5547003a3d)
2021-06-02 13:29:05 +02:00
Evan Hunt
de480dcbb6 add a system test for the prefetch bug
Ensure that if prefetch is triggered as a result of a query
restart, it won't have the TRYSTALE_ONTIMEOUT flag set.

(cherry picked from commit 8c047feb3a)
2021-05-30 00:33:42 -07:00
Matthijs Mekking
61214726da Test with stale timeout cache miss, then fetch completes
Add a test case where a client request is received and the stale
timeout occurs, but it is not served stale data because there is no entry
in the cache, then is served an authoritative answer once the background
fetch completes. This ensures that a stale timeout only affects a
subsequent response if the client was answered.

(cherry picked from commit c64589bf46)
2021-05-27 12:09:43 -07:00
Evan Hunt
74766f68cc add a test of DNS64 processing with a stale negative response
- send a query for an AAAA which will be resolved as a mapped A
- disable authoritative responses
- wait for the negative AAAA response to become stale
- send another query, wait for the stale answer
- re-enable authorative responses so that a real answer arrives
- currently, this triggers an assertion in query.c

(cherry picked from commit 453e905d7e)
2021-05-27 12:09:43 -07:00
Matthijs Mekking
8079b0ae8c checkconf tests for inline-signing at options/view
(cherry picked from commit a548a450b3)
2021-05-27 15:27:03 +02:00
Diego Fronza
65f90f2927 Handling NoNameservers exception
In the shutdown system test multiple queries are sent to a resolver
instance, in the meantime we terminate the same resolver process for
which the queries were sent to, either via rndc stop or a SIGTERM
signal, that means the resolver may not be able to answer all those
queries, since it has initiated the shutdown process.

The dnspython library raises a dns.resolver.NoNameservers exception when
a resolver object fails to receive an answer from the specified list
of nameservers (resolver.nameservers list), we need to handle this
exception as this is something that may happen since we asked the
resolver to terminate, as a result it may not answer clients even if
an answer is available, as the operation will be canceled.

(cherry picked from commit b19cd2d83b)
2021-05-27 12:58:55 +10:00
Mark Andrews
264b31e786 Check that IXFR delta size is correct
(cherry picked from commit 68d203ff1c)
2021-05-26 08:49:30 +10:00
Evan Hunt
dccdb492ef use a fixedname buffer in dns_message_gettempname()
dns_message_gettempname() now returns a pointer to an initialized
name associated with a dns_fixedname_t object. it is no longer
necessary to allocate a buffer for temporary names associated with
the message object.

(cherry picked from commit e31cc1eeb4)
2021-05-22 07:13:57 +02:00
Michal Nowak
c0d4a11484
Make views system test ShellCheck-clean
Also, add "set -e" to all shell scripts of the views test to exit when
any command fails or is unknown, e.g., this on OpenBSD:

    tests.sh[174]: seq: not found

(cherry picked from commit a4b7eb7188)
2021-05-19 16:01:03 +02:00
Michal Nowak
8cb24ae7a9
Replace seq command with POSIX-compliant shell code
The seq command is not defined in the POSIX standard and is missing on
OpenBSD. Given that the system test code is meant to be POSIX-compliant
replace it with a shell construct.

(cherry picked from commit a08487ec3d)
2021-05-19 15:56:43 +02:00
Matthijs Mekking
4e8dc72717 Add checkconf tests for [#2463]
Add two tests to make sure named-checkconf catches key-directory issues
where a zone in multiple views uses the same directory but has
different dnssec-policies. One test sets the key-directory specifically,
the other inherits the default key-directory (NULL, aka the working
directory).

Also update the good.conf test to allow zones in different views
with the same key-directory if they use the same dnssec-policy.

Also allow zones in different views with different key-directories if
they use different dnssec-policies.

Also allow zones in different views with the same key-directories if
only one view uses a dnssec-policy (the other is set to "none").

Also allow zones in different views with the same key-directories if
no views uses a dnssec-policy (zone in both views has the dnssec-policy
set to "none").

(cherry picked from commit df1aecd5ff)
2021-05-19 00:44:32 +00:00
Michał Kępień
e8af7528e1 Use context managers as suggested by PyLint 2.8.2
PyLint 2.8.2 reports the following suggestions for two Python scripts
used in the system test suite:

    ************* Module tests_rndc_deadlock
    bin/tests/system/addzone/tests_rndc_deadlock.py:71:4: R1732: Consider using 'with' for resource-allocating operations (consider-using-with)
    ************* Module tests-shutdown
    bin/tests/system/shutdown/tests-shutdown.py:68:4: R1732: Consider using 'with' for resource-allocating operations (consider-using-with)
    bin/tests/system/shutdown/tests-shutdown.py:157:8: R1732: Consider using 'with' for resource-allocating operations (consider-using-with)

Implement the above suggestions by using
concurrent.futures.ThreadPoolExecutor() and subprocess.Popen() as
context managers.

(cherry picked from commit a8163551ed)
2021-05-18 11:02:45 +02:00
Michal Nowak
253ae96bf1
Do not use escape codes for matching with grep
FreeBSD 13.0 replaced GNU grep with BSD grep and removed support for
"redundant escapes for most ordinary characters" from regex(3) library,
therefore the matching sequence in digdelv/tests.sh needs to be
rewritten otherwise it fails with:

    grep: trailing backslash (\)
2021-05-17 13:10:28 +02:00
Evan Hunt
e4c9652382 hacks to get dyndb working without libtool
- memory tracing failed if the driver didn't have access
  to the isc_mem_debugging variable.
- remove RTLD_DEEPBIND from dlopen() flags as it causes
  shared libraries to be unable to access thread-local storage,
  which is needed when enqueuing tasks.
2021-05-14 12:52:48 +02:00
Evan Hunt
ef1d909fa9 backport of netmgr/taskmgr to 9.16
this rolls up numerous changes that have been applied to the
main branch, including moving isc_task operations into the
netmgr event loops, and other general stabilization.
2021-05-14 12:52:48 +02:00
Evan Hunt
6f6ac57cb5 system test
Attempt a zone transfer with mismatched SOA records.

(cherry picked from commit 4d94f82232)
2021-05-13 23:17:06 +10:00
Matthijs Mekking
861b2a14bb Check for filename clashes /w dnssec-policy zones
Just like with dynamic and/or inline-signing zones, check if no two
or more zone configurations set the same filename. In these cases,
the zone files are not read-only and named-checkconf should catch
a configuration where multiple zone statements write to the same file.

Add some bad configuration tests where KASP zones reference the same
zone file.

Update the good-kasp test to allow for two zones configure the same
file name, dnssec-policy none.

(cherry picked from commit 0b5fc0afcfd1a0bb7c1f16b63872b7ee26fb2777)
2021-05-05 18:22:42 +02:00
Matthijs Mekking
f42234fef0 Check zonefile is untouched if dnssec-policy none
Make sure no DNSSEC contents are added to the zonefile if dnssec-policy
is set to "none" (and no .state files exist for the zone).

(cherry picked from commit 5246c16f43e6fda7587193a4dd801951cf87db14)
2021-05-05 18:22:32 +02:00
Mark Andrews
966bcfb89d Check journal compaction
(cherry picked from commit ae1ae07b03)
2021-05-05 23:36:06 +10:00
Matthijs Mekking
bc641fc965 Add kasp tests for offline keys
Add a test for default.kasp that if we remove the private key file,
no successor key is created for it. We need to update the kasp script
to deal with a missing private key. If this is the case, skip checks
for private key files.

Add a test with a zone for which the private key of the ZSK is missing.

Add a test with a zone for which the private key of the KSK is missing.

(cherry picked from commit 4a8ad0a77f)
2021-05-05 12:50:07 +02:00
Mark Andrews
cb77a8efed named-checkconf now detects redefinition of dnssec-policy 'insecure'
(cherry picked from commit dba13d280a)
2021-05-05 17:05:17 +10:00
Ondřej Surý
82c9e477a1
Use SIGABRT instead of SIGKILL to produce cores on failed start
When the `named` would hang on startup it would be killed with SIGKILL
leaving us with no information about the state the process was in.
This commit changes the start.pl script to send SIGABRT instead, so we
can properly collect and process the coredump from the hung named
process.

(cherry picked from commit 861a236937)
2021-05-04 17:18:45 +02:00
Matthijs Mekking
cced7fdaf4 Fix intermittent kasp test failure
The kasp system test performs for each zone a couple of checks to make
sure the zone is signed correctly. To avoid test failures caused by
timing issues, there is first a check to ensure the zone is done
signing, 'wait_for_done_signing'. This function waits with the DNSSEC
checks until a "zone_rekey done" log message is seen for a specific
key.

Unfortunately this is not sufficient to avoid test failures due to
timing issues, because there is a small amount of time in between this
log message and the newly signed zone actually being served.

Therefore, in 'check_apex', retry for three seconds the DNSKEY query
check. After that, additional checks should pass without retries,
because at that point we know for sure the zone has been resigned with
the expected keys.

Also reduce the number of redundant 'check_signatures'

(cherry picked from commit 572f421df4)
2021-05-04 10:25:25 +02:00
Matthijs Mekking
fd01889b8a Update nsupdate test
The nsupdate system test did not record failures from the
'update_test.pl' Perl script. This was because the 'ret' value was
not being saved outside the '{ $PERL ... || ret=1 } cat_i' scope.

Change this piece to store the output in a separate file and then
cat its contents. Now the 'ret' value is being saved.

Also record failures in 'update_test.pl' if sending the update
failed.

Add missing 'n' incrementals to 'nsupdate/test.sh' to keep track of
test numbers.

(cherry picked from commit 5b31811b5f)
2021-04-30 14:28:30 +02:00
Matthijs Mekking
8db61e976a Add kasp test policy goes straight to "none"
Add a test case when a dnssec-policy is reconfigured to "none",
without setting it to "insecure" first. This is unsupported behavior,
but we want to make sure the behavior is somewhat expected. The
zone should remain signed (but will go bogus once the signatures
expire).

(cherry picked from commit 287428e0aa)
2021-04-30 13:58:22 +02:00
Matthijs Mekking
9f8af9a0e1 Add test for "insecure" policy
While it is meant to be used for transitioning a zone to insecure,
add a test case where a zone uses the "insecure" policy immediately.

The zone will go through DNSSEC maintenance, but the outcome should
be the same as 'dnssec-policy none;', that is the zone should be
unsigned.

(cherry picked from commit 9c6ff463fd)
2021-04-30 13:58:22 +02:00
Matthijs Mekking
e5ae856c6c Update kasp tests to "insecure" policy
The tests for going insecure should be changed to use the built-in
"insecure" policy.

The function that checks dnssec status output should again check
for the special case "none".

(cherry picked from commit 17e3b056c8)
2021-04-30 13:58:22 +02:00
Mark Andrews
15111ab0db Check insecure responses returned with too many NSEC3 iterations
(cherry picked from commit e6e0e29fbb)
2021-04-30 11:16:45 +02:00
Mark Andrews
f9425a9ae6 NSEC3PARAM support was added to Net::DNS in 1.00_06
Require 1.01 or later to when adding a NSEC3PARAM records.

(cherry picked from commit 044933756a)
2021-04-30 16:29:41 +10:00
Mark Andrews
53d755966e Update ZONEMD to match RFC 8976
* The location of the digest type field has changed to where the
  reserved field was.
* The reserved field is now called scheme and is where the digest
  type field was.
* Digest type 2 has been defined (SHA256).

(cherry picked from commit 8510ccaa54)
2021-04-30 11:21:19 +10:00
Michal Nowak
a4ef2de0c7
Disable pytest cacheprovider plugin in CI
The pytest "cacheprovider" plugin produces a .cache/v/cache/lastfailed
file, which holds a Python dictionary structure with failed tests.
However, on Ubuntu 16.04 (Xenial) the file is created even though the
test passed and the file contains just an empty dictionary ("{}").

Given that we are not interested in this feature, disabling the
"cacheprovider" plugin globally and removing per-test removals of the
.cache directory seems like the best course of action.

(cherry picked from commit e1c3034107)
2021-04-29 15:49:44 +02:00
Matthijs Mekking
c2225cde3e dnssec-policy: reduce NSEC3 iterations to 150
When reducing the number of NSEC3 iterations to 150, commit
aa26cde2ae added tests for dnssec-policy
to check that a too high iteration count is a configuration failure.

The test is not sufficient because 151 was always too high for
ECDSAP256SHA256. The test should check for a different algorithm.

There was an existing test case that checks for NSEC3 iterations.
Update the test with the new maximum values.

Update the code in 'kaspconf.c' to allow at most 150 iterations.

(cherry picked from commit efa5d84dcf)
2021-04-29 14:31:16 +02:00
Mark Andrews
e87748a909 Check that excessive iterations in logged by named when
loading an existing zone or transfering from the primary.

(cherry picked from commit 46eb21c546)
2021-04-29 17:55:40 +10:00
Mark Andrews
a7c8c1cde0 Check NSEC3 iterations with dnssec-signzone
(cherry picked from commit 8ec16c378d)
2021-04-29 17:55:40 +10:00
Mark Andrews
5546c7959c Check that named rejects excessive iterations via UPDATE
(cherry picked from commit 4ce8437a6e)
2021-04-29 17:55:39 +10:00
Mark Andrews
b8708ebfa1 nsupdate: reject attempts to add NSEC3PARAM with excessive iterations
(cherry picked from commit 3fe75d9809)
2021-04-29 17:55:35 +10:00
Mark Andrews
8e3c963172 Check dnssec-policy nsec3param iterations limit
(cherry picked from commit aa26cde2ae)
2021-04-29 17:44:46 +10:00
Matthijs Mekking
4615cbb597 Serve-stale nit fixes
While working on the serve-stale backports, I noticed the following
oddities:

1. In the serve-stale system test, in one case we keep track of the
   time how long it took for dig to complete. In commit
   aaed7f9d8c, the code removed the
   exception to check for result == ISC_R_SUCCESS on stale found
   answers, and adjusted the test accordingly. This failed to update
   the time tracking accordingly. Move the t1/t2 time track variables
   back around the two dig commands to ensure the lookups resolved
   faster than the resolver-query-timeout.

2. We can remove the setting of NS_QUERYATTR_STALEOK and
   DNS_RDATASETATTR_STALE_ADDED on the "else if (stale_timeout)"
   code path, because they are added later when we know we have
   actually found a stale answer on a stale timeout lookup.

3. We should clear the NS_QUERYATTR_STALEOK flag from the client
   query attributes instead of DNS_RDATASETATTR_STALE_ADDED (that
   flag is set on the rdataset attributes).

4. In 'bin/named/config.c' we should set the configuration options
   in alpabetical order.

5. In the ARM, in the backports we have added "(stale)" between
   "cached" and "RRset" to make more clear a stale RRset may be
   returned in this scenario.

(cherry picked from commit 104b676235)
2021-04-28 13:53:52 +02:00
Michał Kępień
c0b15db6da Warn when log files grow too big in system tests
Exerting excessive I/O load on the host running system tests should be
avoided in order to limit the number of false positives reported by the
system test suite.  In some cases, running named with "-d 99" (which is
the default for system tests) results in a massive amount of logs being
generated, most of which are useless.  Implement a log file size check
to draw developers' attention to overly verbose named instances used in
system tests.  The warning threshold of 200,000 lines was chosen
arbitrarily.

(cherry picked from commit 241e85ef0c)
2021-04-28 08:36:56 +02:00
Michał Kępień
13e97eb3c4 Prevent useless logging in the "tcp" system test
The regression test for CVE-2020-8620 causes a lot of useless messages
to be logged.  However, globally decreasing the log level for the
affected named instance would be a step too far as debugging information
may be useful for troubleshooting other checks in the "tcp" system test.
Starting a separate named instance for a single check should be avoided
when possible and thus is also not a good solution.  As a compromise,
run "rndc trace 1" for the affected named instance before starting the
regression test for CVE-2020-8620.

(cherry picked from commit 17e5c2a50e)
2021-04-28 08:36:56 +02:00
Michał Kępień
966ab29e32 Limit logging for verbose system tests
The system test framework starts all named instances with the "-d 99"
command line option (unless it is overridden by a named.args file in a
given instance's working directory).  This causes a lot of log messages
to be written to named.run files - currently over 5 million lines for a
single test suite run.  While debugging information preserved in the log
files is essential for troubleshooting intermittent test failures, some
system tests involve sending hundreds or even thousands of queries,
which causes the relevant log files to explode in size.  When multiple
tests (or even multiple test suites) are run in parallel, excessive
logging contributes considerably to the I/O load on the test host,
increasing the odds of intermittent test failures getting triggered.

Decrease the debug level for the seven most verbose named instances:

  - use "-d 3" for ns2 in the "cacheclean" system test (it is the lowest
    logging level at which the test still passes without the need to
    apply any changes to tests.sh),

  - use "-d 1" for the other six named instances.

This roughly halves the number of lines logged by each test suite run
while still leaving enough information in the logs to allow at least
basic troubleshooting in case of test failures.

This approach was chosen as it results in a greater decrease in the
number of lines logged than running all named instances with "-d 3",
without causing any test failures.

(cherry picked from commit 4a8d404876)
2021-04-28 08:36:56 +02:00
Diego Fronza
6b37d3ac53 Add system test for the deadlock fix
The test spawns 4 parallel workers that keep adding, modifying and
deleting zones, the main thread repeatedly checks wheter rndc
status responds within a reasonable period.

While environment and timing issues may affect the test, in most
test cases the deadlock that was taking place before the fix used to
trigger in less than 7 seconds in a machine with at least 2 cores.
2021-04-26 11:35:48 -03:00
Michał Kępień
82a5b915de Test handling of non-apex RRSIG(SOA) RRsets
Add a check to the "dnssec" system test which ensures that RRSIG(SOA)
RRsets present anywhere else than at the zone apex are automatically
removed after a zone containing such RRsets is loaded.

(cherry picked from commit 24bf4b946a)
2021-04-26 12:45:28 +02:00