Commit graph

5359 commits

Author SHA1 Message Date
Aram Sargsyan
baa9698c9d Fix RRL responses-per-second bypass using wildcard names
It is possible to bypass Response Rate Limiting (RRL)
`responses-per-second` limitation using specially crafted wildcard
names, because the current implementation, when encountering a found
DNS name generated from a wildcard record, just strips the leftmost
label of the name before making a key for the bucket.

While that technique helps with limiting random requests like
<random>.example.com (because all those requests will be accounted
as belonging to a bucket constructed from "example.com" name), it does
not help with random names like subdomain.<random>.example.com.

The best solution would have been to strip not just the leftmost
label, but as many labels as necessary until reaching the suffix part
of the wildcard record from which the found name is generated, however,
we do not have that information readily available in the context of RRL
processing code.

Fix the issue by interpreting all valid wildcard domain names as
the zone's origin name concatenated to the "*" name, so they all will
be put into the same bucket.
2022-09-08 09:15:30 +02:00
Matthijs Mekking
8b71cbd09c Update inline system test, zone 'retransfer3.'
The zone 'retransfer3.' tests whether zones that 'rndc signing
-nsec3param' requests are queued even if the zone is not loaded.

The test assumes that if 'rndc signing -list' shows that the zone is
done signing with two keys, and there are no NSEC3 chains pending, the
zone is done handling the '-nsec3param' queued requests. However, it
is possible that the 'rndc signing -list' command is received before
the corresponding privatetype records are added to the zone (the records
that are used to retrieve the signing status with 'rndc signing').

This is what happens in test failure
https://gitlab.isc.org/isc-projects/bind9/-/jobs/2722752.

The 'rndc signing -list retransfer3' is thus an unreliable check.
It is simpler to just remove the check and wait for a certain amount
of time and check whether ns3 has re-signed the zone using NSEC3.
2022-09-07 16:24:14 +02:00
Ondřej Surý
87de726f5c Enable the IDNA2003 domain names in the idna system test
Allow the IDNA2003 tests to succeed after the fallback to IDNA2003 was
implemented.
2022-09-05 10:34:49 +02:00
Aram Sargsyan
5e4e303ffa Add system tests for RPZ EDE codes
Check the new configuration option's syntax using the 'checkconf' system
test.

Check if the new option works by parsing DiG's output in the 'rpz'
system test.
2022-08-31 08:56:03 +00:00
Ondřej Surý
b69e783164
Update netmgr, tasks, and applications to use isc_loopmgr
Previously:

* applications were using isc_app as the base unit for running the
  application and signal handling.

* networking was handled in the netmgr layer, which would start a
  number of threads, each with a uv_loop event loop.

* task/event handling was done in the isc_task unit, which used
  netmgr event loops to run the isc_event calls.

In this refactoring:

* the network manager now uses isc_loop instead of maintaining its
  own worker threads and event loops.

* the taskmgr that manages isc_task instances now also uses isc_loopmgr,
  and every isc_task runs on a specific isc_loop bound to the specific
  thread.

* applications have been updated as necessary to use the new API.

* new ISC_LOOP_TEST macros have been added to enable unit tests to
  run isc_loop event loops. unit tests have been updated to use this
  where needed.
2022-08-26 09:09:24 +02:00
Ondřej Surý
49b149f5fd
Update isc_timer to use isc_loopmgr
* isc_timer was rewritten using the uv_timer, and isc_timermgr_t was
  completely removed; isc_timer objects are now directly created on the
  isc_loop event loops.

* the isc_timer API has been simplified. the "inactive" timer type has
  been removed; timers are now stopped by calling isc_timer_stop()
  instead of resetting to inactive.

* isc_manager now creates a loop manager rather than a timer manager.

* modules and applications using isc_timer have been updated to use the
  new API.
2022-08-25 17:17:07 +02:00
Matthijs Mekking
1c5bbac508 Fix nsec3 system test issues
The wait_for_zone_is_signed function was never called, which could lead
to test failures due to timing issues (where a zone was not fully signed
yet, but the test was trying to verify the zone).

Also add two missing set_nsec3param calls to ensure the ITERATIONS
value is set for these test cases.
2022-08-22 16:36:17 +02:00
Matthijs Mekking
6e534c1cd1 Add test case for #3486
Add two scenarios where we change the dnssec-policy from using RSASHA1
to something with NSEC3.

The first case should work, as the DS is still in hidden state and we
can basically do anything with DNSSEC.

The second case should fail, because the DS of the predecessor is
published and we can't immediately remove the predecessor DNSKEY. So
in this case we should keep the NSEC chain for a bit longer.

Add two more scenarios where we change the dnssec-policy from using
NSEC3 to something NSEC only. Both should work because there are no
restrictions on using NSEC when it comes to algorithms, but in the
cases where the DS is published we can't bluntly remove the predecessor.

Extend the nsec3 system test by also checking the DNSKEY RRset for the
expected DNSKEY records. This requires some "kasp system"-style setup
for each test (setting key properties and key states). Also move the
dnssec-verify check inside the check_nsec/check_nsec3 functions because
we will have to do that every time.
2022-08-22 15:55:47 +02:00
Matthijs Mekking
856c0e78a9 Test checkconf NSEC3 and incompatible algorithm
The check code for this already exists, but was untested.
2022-08-19 17:00:10 +02:00
Aram Sargsyan
dc9b0ea6a6 Add pipelined POST requests check in the statschannel system test
Use `nc` to check that multiple POST requests with non-empty HTTP
body are serviced normally by the statistics channel.
2022-08-19 08:11:44 +00:00
Aram Sargsyan
3e28d364f6 Replace expr commands with $((expression)) shell constucts
Update the "statschannel" system test to use the $((expression))
shell constucts instead of executing the `expr` program.
2022-08-19 08:11:44 +00:00
Artem Boldariev
0c6b1f8e8f Modify the doth system test to verify HTTP method usage
Before the commit some checks in the system test would try to verify
that different HTTP methods can be used and are functional. However,
until recently, it was not possible to tell from the output which
method was in fact used, so it turned out that +http-plain-get option
is broken.

This commit add the additional checks to prevent that from happening
in the future.
2022-08-18 13:34:22 +03:00
Mark Andrews
8fe2876297 Improve awk tests to prevent false negatives
The old code could incorrectly match "INSOA" in the RRSIG rdata
when looking for the SOA record.
2022-08-18 02:56:57 +00:00
Matthijs Mekking
d62439e2ec Update system tests
Update checkconf and kasp related system tests after requiring
inline-signing.
2022-08-15 11:44:20 +02:00
Mark Andrews
286061fc54 Fix mkeys to work with DEFAULT_ALGORITHM properly
Stop using a RSASHA1 fixed key in ns3's named.conf as the
trusted key and instead compute a broken digest from the
real digest to use in trusted-keys.
2022-08-10 12:46:06 +02:00
Mark Andrews
5830aa9dc6 kasp: stop using RSASHA1 unless necessary for the test
Moves tests from being RSASHA1 based to RSASHA256 based where possible
and split out the remaining RSASHA1 based tests so that they are not
run on OS's that don't support RSASHA1.
2022-08-09 16:22:19 +02:00
Mark Andrews
4fd6d09330 keymgr2kasp: use FIPS compliant algorithms and key sizes
migrate-nomatch-alglen: switched to RSASHA256 instead of RSASHA1
and the key size now changes from 2048 bits to 3072 bits instead
of 1024 bits to 2048 bits.

migrate-nomatch-algnum: switched to RSASHA256 instead of RSASHA1
as initial algorithm and adjusted mininum key size to 2048 bits.

rsasha256: adjusted minimum key size to 2048 bits.
2022-08-09 16:22:19 +02:00
Mark Andrews
591c087cbf dnssec/signer/general: Replace RSASHA1 keys with RSASHA512 keys
RSASHA1 is verify only in FIPS mode. Use RSASHA256 instead.
2022-08-09 16:22:19 +02:00
Mark Andrews
19dda1fb93 autosign: use FIPS compatible algorithms and key sizes
The nsec-only.example zone was not converted as we use it to
test nsec-only DNSSEC algorithms to nsec3 conversion failure.
The subtest is skipped in fips mode.

Update "checking revoked key with duplicate key ID" test
to use FIPS compatible algorithm.
2022-08-09 16:22:19 +02:00
Mark Andrews
a2597319b0 rsabigexponent: convert the test from RSASHA1 to RSASHA256
RSASHA1 is not supported on some platforms.
2022-08-09 16:22:19 +02:00
Mark Andrews
7c9d4e99d4 notify: remove duplicate test number 2022-08-09 15:45:12 +02:00
Mark Andrews
3e9a2c8a7f mkeys: use $() instead of back quotes 2022-08-09 15:45:11 +02:00
Aram Sargsyan
c51b052827 dns_rdatalist_tordataset() and dns_rdatalist_fromrdataset() can not fail
Clean up dns_rdatalist_tordataset() and dns_rdatalist_fromrdataset()
functions by making them return void, because they cannot fail.

Clean up other functions that subsequently cannot fail.
2022-08-09 08:19:51 +00:00
Mark Andrews
8a15577334 Ensure suffix is always valid in bin/tests/system/qmin/ans4/ans.py
initalise suffix to ""

    170        r.answer.append(
    171            dns.rrset.from_text(
    172                lqname + suffix, 1, IN, NS, "a.bit.longer.ns.name." + suffix
    173            )
    174        )
    175        r.flags |= dns.flags.AA
           15. Condition endswith(lqname, "icky.ptang.zoop.boing."), taking true branch.
    176    elif endswith(lqname, "icky.ptang.zoop.boing."):
           CID 350722 (#7 of 7): Bad use of null-like value (FORWARD_NULL)
           16. invalid_operation: Invalid operation on null-like value suffix.
    177        r.authority.append(
    178            dns.rrset.from_text(
    179                "icky.ptang.zoop.boing." + suffix,
    180                1,
    181                IN,
    182                SOA,
    183                "ns2." + suffix + " hostmaster.arpa. 2018050100 1 1 1 1",
    184            )
    185        )
2022-07-27 15:55:25 +00:00
Aram Sargsyan
65d9d90b55 Suppress warning/error comments in dig outputs for "rrsetorder" test
In the CI dig sometimes produces warning/error comments when
communicating with the server, which produces problems when comparing
the outputs.

Here is an example of a dig output with a warning message which
is benign, because dig, after a retry, managed to query the server.

;; communications error to 10.53.0.3#7529: timed out
1.2.3.1
1.2.3.2
1.2.3.3
1.2.3.4

When comparing this to the expected output, which doesn't contain
the comment line (starting with double ';'), the outputs don't match.

Use grep inverse logic to strip the comments from the dig outputs.
2022-07-22 08:35:35 +00:00
Aram Sargsyan
c1eaf16293 Add "digdelv" test to simulate DiG network unreachable error
There are existing tests for simulating timeouts, read errors, and
refused connecion errors. Implement also "network unreachable"
simulation.

Use "fixed" string search mode `-F` for `grep` in more places where
it is appropriate to do so.
2022-07-22 08:35:35 +00:00
Aram Sargsyan
8611aa759f DiG: use the same retry and fail-over logic for different failure types
DiG implements different logic in the `recv_done()` callback function
when processing a failure:

1. For a timed-out query it applies the "retries" logic first, then,
   when it fails, fail-overs to the next server.

2. For an EOF (end-of-file, or unexpected disconnect) error it tries to
   make a single retry attempt (even if the user has requested more
   retries), then, when it fails, fail-overs to the next server.

3. For other types of failures, DiG does not apply the "retries" logic,
   and tries to fail-over to the next servers (again, even if the user
   has requested to make retries).

Simplify the logic and apply the same logic (1) of first retries, and
then fail-over, for different types of failures in `recv_done()`.
2022-07-22 08:35:35 +00:00
Evan Hunt
b1d0cac280 Forbid zones with both dnssec-policy and max-zone-ttl
Since max-zone-ttl in zone/view/options is a no-op if dnssec-policy
is in use, let's make that a fatal error.
2022-07-20 11:57:37 -07:00
Matthijs Mekking
21930c70c6 Test dnssec-policy max-zone-ttl rejects zone with too high TTL
Similar to the 'max-zone-ttl' zone option, the 'dnssec-policy' option
should reject zones with TTLs that are out of range.
2022-07-20 11:55:07 -07:00
Evan Hunt
19352dd187 mark max-zone-ttl deprecated in options and zone
The "max-zone-ttl" option should now be configured as part of
"dnssec-policy". The option with the same name in "zone" and
"options" is hereby flagged as deprecated, and its functionality
will be removed in a future release.
2022-07-20 11:55:03 -07:00
Ondřej Surý
b35861f1eb Increase the BUFSIZ-long buffers
The BUFSIZ value varies between platforms, it could be 8K on Linux and
512 bytes on mingw.  Make sure the buffers are always big enough for the
output data to prevent truncation of the output by appropriately
enlarging or sizing the buffers.
2022-07-15 10:33:46 +00:00
Ondřej Surý
d1433da524 Wait for TCP connection refused in the statistics system test
The statistics system test makes a query to foo.info to check for the
pending connections because the ans4 doesn't respond to the query.

This might or might not (depending on exact timing) increment the failed
TCP connection counter when the query is retried over TCP because ans4
doesn't listen on the TCP.

Wait for the 'connection refused' in the ns3 log file to be able to
count the exactly 1 failed TCP connection.
2022-07-14 13:08:29 -07:00
Mark Andrews
eb5e5edf82 kasp: add missing logging during setup
Some zones where not being logged when just DNSSEC keys where being
generated in system test setup phase.  Add logging for these zones.
2022-07-13 23:19:39 +00:00
Mark Andrews
513cb24b55 Make "checking revoked key with duplicate key ID" work
There should be 2 keys with the same key id after the numerically
lower one is revoked (serial space arithmetic).  The DS points
at the non-revoked key so validation should still succeed.
2022-07-13 00:47:49 +00:00
Matthijs Mekking
efa8a4e88d Test setting of inline-signing with dnssec-policy
When dnssec-policy is used, and the zone is not dynamic, BIND will
assume that the zone is inline-signed. Add test cases to verify this.
2022-07-12 11:29:03 +02:00
Matthijs Mekking
ff65f07779 Fix kasp system test bugs
Fix a comment, ensuring the right parameters are used (zone is
parameter $3, not $2) and add view and policy parameters to the comment.

Fix the view tests and test the correct view (example3 instead of
example2).

Fix placement of "n=$((n+1)" for two test cases.
2022-07-12 11:29:03 +02:00
Mark Andrews
459e6980e5 zonechecks: use $DEFAULT_ALGORITHM 2022-07-12 13:29:07 +10:00
Mark Andrews
3f65c9cf85 wildcard: use $DEFAULT_ALGORITHM 2022-07-12 13:29:07 +10:00
Mark Andrews
86b29606c3 views: use $DEFAULT_ALGORITHM 2022-07-12 13:29:07 +10:00
Mark Andrews
93f7c7cdcd verify: use $DEFAULT_ALGORITHM 2022-07-12 13:29:07 +10:00
Mark Andrews
5585909904 upforwd: use $DEFAULT_ALGORITHM 2022-07-12 13:29:07 +10:00
Mark Andrews
9970d4317d unknown: use $DEFAULT_ALGORITHM 2022-07-12 13:29:07 +10:00
Mark Andrews
73fd49f8bb synthfromdnssec: use $DEFAULT_ALGORITHM 2022-07-12 13:29:07 +10:00
Mark Andrews
32337b9dbf staticstub: use $DEFAULT_ALGORITHM 2022-07-12 13:29:07 +10:00
Mark Andrews
941b95edb0 smartsign: use $DEFAULT_ALGORITHM 2022-07-12 13:29:07 +10:00
Mark Andrews
1861c3e503 rpz: use $DEFAULT_ALGORITHM 2022-07-12 13:29:07 +10:00
Mark Andrews
b0e1d9b1b3 rootkeysentinel: use $DEFAULT_ALGORITHM 2022-07-12 13:29:07 +10:00
Mark Andrews
05ef8c81dd resolver: use $DEFAULT_ALGORITHM 2022-07-12 10:40:30 +10:00
Mark Andrews
e0e03602ba redirect: use $DEFAULT_ALGORITHM 2022-07-12 10:40:30 +10:00
Mark Andrews
6fd50b9fda pending: use $DEFAULT_ALGORITHM 2022-07-12 10:40:30 +10:00