Commit Graph

12266 Commits

Author SHA1 Message Date
Mark Andrews
c77032caf5 Removing now unneeded priming queries
Now that fctx_try is being called when adb returns DNS_ADB_NOMOREADDRESSES
we don't need these priming queries for the dual-stack-servers test
to succeed.

(cherry picked from commit 14ab1629b7)
2025-02-26 01:04:59 +00:00
Mark Andrews
da9fbf72e4 Check if key is NULL before dereferencing it
(cherry picked from commit 1784e4a9ae)
2025-02-25 22:25:55 +00:00
Mark Andrews
9bb9f0f21b Handle example3.db being modified in upforwd system test
The zone file for example3 (ns1/example3.db) can be modified in the
upforwd test as example3 is updated as part of the test.  Whether
the zone is written out or not by the end of the test is timing
dependent.  Rename ns1/example3.db to ns1/example3.db.in and copy
it to ns1/example3.db in setup so we don't trigger post test changes
checks.

(cherry picked from commit afc4413862)
2025-02-25 21:39:55 +00:00
Mark Andrews
3279aa7381 Check insecure response with missing RRSIG in authority
This scenario should succeed but wasn't due rejection of the
message at the message parsing stage.

(cherry picked from commit 4271d93f00)
2025-02-21 03:00:29 +00:00
Aram Sargsyan
5d69aab92d Implement sig0key-checks-limit and sig0message-checks-limit
Previously a hard-coded limitation of maximum two key or message
verification checks were introduced when checking the message's
SIG(0) signature. It was done in order to protect against possible
DoS attacks. The logic behind choosing the number two was that more
than one key should only be required only during key rotations, and
in that case two keys are enough. But later it became apparent that
there are other use cases too where even more keys are required, see
issue number #5050 in GitLab.

This change introduces two new configuration options for the views,
sig0key-checks-limit and sig0message-checks-limit, which define how
many keys are allowed to be checked to find a matching key, and how
many message verifications are allowed to take place once a matching
key has been found. The latter protects against expensive cryptographic
operations when there are keys with colliding tags and algorithm
numbers, with default being 2, and the former protects against a bit
less expensive key parsing operations and defaults to 16.

(cherry picked from commit 716b936045)
2025-02-20 14:48:01 +00:00
Aram Sargsyan
0bd251a496 Expose the incoming transfers' rates in the statistics channel
Expose the average transfer rate (in bytes-per-second) during the
last full 'min-transfer-rate-in <bytes> <minutes>' minutes interval.
If no such interval has passed yet, then the overall average rate is
reported instead.

(cherry picked from commit c701b590e4)
2025-02-20 11:05:09 +00:00
Aram Sargsyan
0f5295af40 Test the new min-transfer-rate-in configuration option
Add a new big zone, run a zone transfer in slow mode, and check
whether the zone transfer gets canceled because 100000 bytes are
not transferred in 5 seconds (as it's running in slow mode).

(cherry picked from commit b9c6aa24f8)
2025-02-20 11:05:09 +00:00
Aram Sargsyan
e6b14365ad Implement the min-transfer-rate-in configuration option
This new option sets a minimum amount of transfer rate for
an incoming zone transfer that will abort a transfer, which
for some network related reasons run very slowly.

(cherry picked from commit 91ea156203)
2025-02-20 11:05:09 +00:00
Evan Hunt
a6a75f8262 add a test with an inconsistent NS RRset
add a zone with different NS RRsets in the parent and child,
and test resolver and forwarder behavior with and without +CD.

(cherry picked from commit e4652a0444)
2025-02-19 18:29:47 -08:00
Petr Menšík
92ec19add9 Do HTTPS record query from host in addition
Unless explicitly specified type from host command, do fourth query for
type HTTPS RR. It is expected it will become more common and some
systems already query that record for every name.

(cherry picked from commit 82069a5700)
2025-02-18 14:58:14 +00:00
Michal Nowak
5d615b4797 Rewrite keyfromlabel system test to pytest
(cherry picked from commit 409f394d6e)
2025-02-17 20:17:45 +00:00
Michal Nowak
6354130bc7 Rewrite keepalive system test to pytest
(cherry picked from commit b804a70fac)
2025-02-17 20:24:36 +01:00
Michal Nowak
10bb9727c6 Add Dig interface
(cherry picked from commit 7347abd01f)
2025-02-17 19:19:04 +00:00
Mark Andrews
89122c3fde Re-fetch pending records that failed validation
If a deferred validation on data that was originally queried with
CD=1 fails, we now repeat the query, since the zone data may have
changed in the meantime.

(cherry picked from commit 04b1484ed8)
2025-02-17 11:04:19 +11:00
Mark Andrews
77417f8fc6 Add stripped DS RRSIG senario
(cherry picked from commit 66f293a952)
2025-02-17 11:00:40 +11:00
Mark Andrews
18c1295fdc Add stripped DNSKEY RRSIG senario
(cherry picked from commit a71b617566)
2025-02-17 11:00:39 +11:00
Mark Andrews
1661e7a407 Move SVCB and HTTPS to be in type code order
(cherry picked from commit 559fac329a)
2025-02-14 13:41:11 +11:00
Mark Andrews
3adf4f7d72 Test cname-and-other-data against various types
(cherry picked from commit dfc367f52c)
2025-02-14 13:41:11 +11:00
Michal Nowak
47d64f944f Rename assert_custom_named_is_alive to named_alive
(cherry picked from commit 38e751d9ac)
2025-02-13 18:47:42 +00:00
Michal Nowak
0d75e15d4d Rewrite nzd2nzf system test to pytest
(cherry picked from commit 7c499d1689)
2025-02-13 18:47:42 +00:00
Michal Nowak
b04d28f1ef Rewrite names system test to pytest
dnspython 2.7.0 or newer is needed because of wire().

(cherry picked from commit 5250ad8720)
2025-02-13 17:49:26 +00:00
Aydın Mercan
dde251b773 add a rndc command to toggle jemalloc profiling
The new command is `rndc memprof`. The memory profiling status is also
reported inside `rndc status`. The status also shows whether named can
toggle memory profiling or not and if the server is built with jemalloc.

(cherry picked from commit b495e9918e)
2025-02-05 10:40:05 +01:00
Ondřej Surý
8229d9cdfa Print the expiration time of the stale records (not ancient)
In #1870, the expiration time of ANCIENT records were printed, but
actually the ancient records are very short lived, and the information
carries a little value.

Instead of printing the expiration of ANCIENT records, print the
expiration time of STALE records.

(cherry picked from commit 355fc48472)
2025-02-04 18:07:59 +01:00
Michal Nowak
fb7d78a258 Rewrite stub system test to pytest
(cherry picked from commit 1069eb1969)
2025-02-04 13:24:54 +00:00
Michal Nowak
1047797100 Add isctest.check.notauth()
(cherry picked from commit b19fb37080)
2025-02-04 13:24:54 +00:00
Nicki Křížek
b5ecd7416c Allow to use an arbitrary numeric identifier for NamedInstance
In some cases, the numeric identifier doesn't correspond to the
directory name (i.e. `resolver` server in `shutdown` test, which is
supposed to be 10.53.0.3). These are typically servers that shouldn't be
auto-started by the runner, thus avoiding the typical `*ns<X>` name.

Support these server by allowing a fallback initialization with custom
numeric identifier in case it can't be parsed from the directory name.

(cherry picked from commit a24f71bae4)
2025-02-04 13:24:54 +00:00
Nicki Křížek
0e412834e9 Add start/stop wrappers to control NamedInstance
The start()/stop() functions can be used in the pytests in the same way
as start_server and stop_server functions were used in shell tests. Note
that the servers obtained through the servers fixture are still started
and stopped by the test runner at the start and end of the test. This
makes these functions mostly useful for restarting the server(s)
mid-test.

(cherry picked from commit 37699ad84b)
2025-02-04 13:24:54 +00:00
Nicki Křížek
184160ac36 Move shell and perl util functions to isctest.run
Previously, these functions have been provided as fixtures. This was
limiting re-use, because it wasn't possible to call these outside of
tests / other fixtures without passing these utility functions around.
Move them into isctest.run package instead.

(cherry picked from commit b6d645410c)
2025-02-04 13:24:54 +00:00
Mark Andrews
2a8bf4f6bb Fix gratuitious DNS protocol errors in the ANS servers
The ANS servers were not to written to handle NS queries at the
QNAME resulting in gratuitious protocol errors that will break tests
when NS requests are made for the QNAME.

(cherry picked from commit 0680eb6f64)
2025-02-04 02:37:34 +00:00
Ondřej Surý
b32512a232 In cache, set rdataset TTL to 0 when the header is not active
When the header has been marked as ANCIENT, but the ttl hasn't been
reset (this happens in couple of places), the rdataset TTL would be
set to the header timestamp instead to a reasonable TTL value.

Since this header has been already expired (ANCIENT is set), set the
rdataset TTL to 0 and don't reuse this field to print the expiration
time when dumping the cache.  Instead of printing the time, we now
just print 'expired (awaiting cleanup'.

(cherry picked from commit 1bbb57f81b)
2025-02-03 15:53:34 +01:00
Evan Hunt
1e818d368f fix the cache findzonecut implementation
the search for the deepest known zone cut in the cache could
improperly reject a node containing stale data, even if the
NS rdataset wasn't the data that was stale.

this change also improves the efficiency of the search by
stopping it when both NS and RRSIG(NS) have been found.

(cherry picked from commit 1f095b902c)
2025-02-02 20:01:52 +01:00
Colin Vidal
588924bbb5 update serve-stale test to support EDE 22
When EDE 3 (stale answer) was added the serve-stale tests were checking
for those exclusively, i.e. grepping for no "EDE" in the dig output when
no stale answer was expected.

However, some stale tests disable stale answers and make the
authoritative server unresponsive, effectively triggering a timed out
request thus an EDE 22. Update those tests so they still tests the
absence of EDE 3 error, but also the presence of EDE 22.

(cherry picked from commit 27f3b8950a)
2025-01-30 14:43:25 +00:00
Colin Vidal
edd6f0eb35 add new EDE 22 system tests
This re-do a previously existing EDE 22 system test as well as add
another one making sure the timed out flow detection works also on UDP
when the resolver is contacting the authoritative server. (the existing
test was using TCP to contact the authoritative servers).

(cherry picked from commit 7cb8a028fe)
2025-01-30 14:43:25 +00:00
Colin Vidal
b03cedc754 fix DNSSEC EDE system tests on FIPS platform
Changes !9948 introducing the support of extended DNS error code 1 and 2
uses SHA-1 digest for some tests which break FIPS platform. The digest
itself was irrelevant, another digest is used.

(cherry picked from commit d82262d293)
2025-01-30 13:32:38 +00:00
Ondřej Surý
1ffb67a135 Split and simplify the use of EDE list implementation
Instead of mixing the dns_resolver and dns_validator units directly with
the EDE code, split-out the dns_ede functionality into own separate
compilation unit and hide the implementation details behind abstraction.

Additionally, the EDE codes are directly copied into the ns_client
buffers by passing the EDE context to dns_resolver_createfetch().

This makes the dns_ede implementation simpler to use, although sligtly
more complicated on the inside.

Co-authored-by: Colin Vidal <colin@isc.org>
Co-authored-by: Ondřej Surý <ondrej@isc.org>
(cherry picked from commit 2f8e0edf3b)
2025-01-30 12:37:55 +00:00
Andoni Duarte Pintado
2d0323e006 Merge tag 'v9.20.5' into bind-9.20 2025-01-29 17:21:44 +01:00
Michal Nowak
10aed4344c Fix broken links in documentation
Some detected links are not to be verified (127.*, dnssec-or-not.com)
and some I can't fix (flaticon, godaddy, icann), but they are not
crucial.

(cherry picked from commit 8302469507)
2025-01-27 09:42:47 +00:00
Colin Vidal
b61e1a5bcf add DNSSEC EDE test for unsupported digest and alg
A DNSSEC validation can fail in the case where multiple DNSKEY are
available for a zone and none of them are supported, but for different
reasons: one has a DS record in the parent zone using an unsupported
digest while the other one uses an unsupported encryption algorithm.

Add a specific test case covering this flow and making sure that two
extended DNS error are provided: code 1 and 2, each of them highlighting
unsupported algorithm and digest.

(cherry picked from commit 244923b9dc)
2025-01-24 14:27:17 +01:00
Colin Vidal
e133411451 tests for support for EDE 1 & 2
(cherry picked from commit 8b50d63fe1)
2025-01-24 14:27:17 +01:00
Michal Nowak
d2c8694930 Rename have_* marks to with_*
Marks starting with "with" or "without" make more sense linguistically
than those starting with "have" or "have_not".

(cherry picked from commit df7e9f4ac3)
2025-01-24 08:56:36 +00:00
Nicki Křížek
e7a469133c Test cipher-suites after zone transfers complete
Ensure the zone transfers have completed (successfully or not) before
running the test cases, because they assume zone transfers have been
done.

(cherry picked from commit 23fb615963)
2025-01-24 08:56:36 +00:00
Nicki Křížek
2eb5ce24fb Make servers fixture in pytest module-wide
The servers are setup and torn down once per each test module. All the
logs and server state persists between individual tests within the same
module. The servers fixture representing these servers should be
module-wide as well.

(cherry picked from commit a72ff9fd57)
2025-01-24 08:56:36 +00:00
Michal Nowak
f3f7667fc7 Rewrite cipher-suites system test to pytest
The minimal required dnspython version is 2.5.0 because of the need for
the "verify" argument in dns.query.tls().

(cherry picked from commit 100b759863)
2025-01-24 08:56:36 +00:00
Michal Nowak
9f356962ec Add isctest.query.tls() function
When explicitly set to True, the "verify" argument lets dnspython verify
certificates used for the connection. As most certificates in the system
test will inevitably be self-signed, the "verify" argument defaults to
False.

The "verify" argument is present in dnspython since the version 2.5.0.

(cherry picked from commit df8c419058)
2025-01-24 08:56:36 +00:00
Michal Nowak
1a4fb0550b Add "without_fips" mark
The "without_fips" mark disables test function when BIND 9 was built
with the FIPS mode enabled as not everything works in FIPS-enabled
builds.

(cherry picked from commit feecbd8e77)
2025-01-24 08:56:36 +00:00
Matthijs Mekking
9d6302b32c dnssec-signzone retain signature if key is offline
Track inside the dns_dnsseckey structure whether we have seen the
private key, or if this key only has a public key file.

If the key only has a public key file, or a DNSKEY reference in the
zone, mark the key 'pubkey'. In dnssec-signzone, if the key only
has a public key available, consider the key to be offline. Any
signatures that should be refreshed for which the key is not available,
retain the signature.

So in the code, 'expired' becomes 'refresh', and the new 'expired'
is only used to determine whether we need to keep the signature if
the corresponding key is not available (retaining the signature if
it is not expired).

In the 'keysthatsigned' function, we can remove:
  -	key->force_publish = false;
  -	key->force_sign = false;

because they are redundant ('dns_dnsseckey_create' already sets these
values to false).

(cherry picked from commit 5e3aef364f)
2025-01-23 14:04:03 +00:00
Matthijs Mekking
cf73c9b1a9 Test dnssec-signzone with private key file missing
Add a test case for the scenario below.

There is a case when signing a zone with dnssec-signzone where the
private key file is moved outside the key directory (for offline
ksk purposes), and then the zone is resigned. The signature of the
DNSKEY needs refreshing, but is not expired.

Rather than removing the signature without having a valid replacement,
leave the signature in the zone (despite it needs to be refreshed).

(cherry picked from commit 0a91321d78)
2025-01-23 14:04:03 +00:00
Matthijs Mekking
e36f4b66a3 Clarify dnssec-signzone interval option
There was confusion about whether the interval was calculated from
the validity period provided on the command line (with -s and -e),
or from the signature being replaced.

Add text to clarify that the interval is calculated from the new
validity period.

(cherry picked from commit ae42fa69fa)
2025-01-23 12:08:11 +00:00
Matthijs Mekking
87518b618b Fix possible truncation in dns_keymgr_status()
If the generated status output exceeds 4096 it was silently truncated,
now we output that the status was truncated.

(cherry picked from commit 7ae7851173)
2025-01-23 09:40:39 +00:00
Mark Andrews
2225f96251 Check delv +yaml negative response output
(cherry picked from commit 9c04640def)
2025-01-22 23:58:49 +00:00