Commit graph

42900 commits

Author SHA1 Message Date
Nicki Křížek
4cb75dead9 Isolate rollover-ksk-3crowd test case
(cherry picked from commit bc7be041e1)
2025-07-18 14:48:16 +02:00
Nicki Křížek
3d5c90aa44 Use common test functions for three-is-a-crowd test
Previously, a lot of the checking was re-implemented and duplicated from
check_rollover_step(). Use that function where possible and only
override the needed checks.

(cherry picked from commit d6dffe6603)
2025-07-18 14:48:00 +02:00
Nicki Křížek
ead775e2a9 Isolate rollover-ksk-doubleksk test case
(cherry picked from commit bd5a55c5b7)
2025-07-18 14:47:58 +02:00
Nicki Křížek
89c2afda43 Isolate rollover-csk-roll1 test case
(cherry picked from commit 296cfc8363)
2025-07-18 14:47:38 +02:00
Nicki Křížek
05d143e5f0 Isolate rollover-csk-roll2 test case
(cherry picked from commit 9d2bd1b646)
2025-07-18 14:47:22 +02:00
Nicki Křížek
a0afdbd668 Isolate rollover-algo-csk test
(cherry picked from commit fdecef5378)
2025-07-18 14:47:04 +02:00
Nicki Křížek
6dc96a18b8 Isolate rollover-algo-ksk-zsk test
(cherry picked from commit 8be9a8b52a)
2025-07-18 14:46:46 +02:00
Nicki Křížek
0e75a38201 Isolate rollover-straight2none test
(cherry picked from commit 519f9082df)
2025-07-18 14:46:27 +02:00
Nicki Křížek
a225f35b95 Isolate rollover-lifetime test
(cherry picked from commit a9c70c3e26)
2025-07-18 14:46:07 +02:00
Nicki Křížek
cd78c5ed51 Isolate rollover-going-insecure test case
(cherry picked from commit 7001056eab)
2025-07-18 14:45:45 +02:00
Nicki Křížek
5d315d94fe Isolate rollover-dynamic2inline test
(cherry picked from commit 8503a218c3)
2025-07-18 14:45:19 +02:00
Nicki Křížek
a38f0b5cde Separate common templates and test code for rollover tests
This is a preparation to split up and further isolate the various
rollover tests in a subsequent commits.

(cherry picked from commit 44dd5b3240)
2025-07-18 12:39:39 +00:00
Nicki Křížek
48762ffab7 Move shared test code into isctest.kasp module
Move key calculations and rollover step checks into the shared
isctest.kasp module. Deduplicate the key interval calculations.

(cherry picked from commit b410710354)
2025-07-18 12:39:39 +00:00
Nicki Křížek
e89df7b69f Use a single named.conf template in rollover test
Rather than using multiple slightly modified named.conf files, use a
single template which can be rendered differently based on an input
argument -- in this case, csk_roll.

(cherry picked from commit 784a252425)
2025-07-18 12:39:39 +00:00
Nicki Křížek
fc58c00464 [9.20] chg: test: Improve WatchLog API for pytest
- Refactor and extend the `WatchLog.wait_for_line()` API:
    1. To allow for usage of one or more FlexPatterns, i.e. either plain
       strings to be matched verbatim, or regular expressions. Both can be
       used interchangeably to provide the caller to write simple and
       readable test code, while allowing for increased complexity to allow
       special cases.
    2. Always return the regex match, which allows the caller to identify
       which line was matched, as well as to extract any additional
       information, such as individual regex groups.
- Add `WatchLog.wait_for_sequence()` and `WatchLog.wait_for_all()` helper functions

Backport of MR !10618

Merge branch 'backport-nicki/watchlog-improvements-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!10749
2025-07-18 14:36:22 +02:00
Nicki Křížek
1abc6bd3fc Turn on doctest in CI
Run doctests for the isctest module in a dedicated CI job.

(cherry picked from commit d737986ea2)
2025-07-18 13:09:21 +02:00
Nicki Křížek
0a2d539f6f Change NamedInstance.rndc() doctest into doc example
The test is troublesome, because NamedInstance(identifier) expects that
a directory with such a name exists. While it'd be possible to mock
those directories as well, it'd make the doctest overly long and
complex, which isn't justified, given that it's only testing a couple of
options. Turn it into regular documentation instead.

(cherry picked from commit dcfb6c23da)
2025-07-18 13:09:21 +02:00
Nicki Křížek
275e7520b2 Separate LineReader functionality from WatchLog
The buffered reading of finished lines deserves its own class to make
its function clearer, rather than bundling it within the WatchLog class.

Co-Authored-By: Michał Kępień <michal@isc.org>
(cherry picked from commit ee782fb4b1)
2025-07-18 13:09:21 +02:00
Nicki Křížek
df50dcc300 Refactor WatchLog for better readability
Various improvements for typing, naming, code deduplication and better
code organization to make the code easier to read.

(cherry picked from commit 3c8432d196)
2025-07-18 13:09:21 +02:00
Nicki Křížek
dda6c1fbd8 Use custom WatchLog timeout exception
The TimeoutError is raised when system functions time out. Define a
custom WatchLogTimeout to improve clarity.

(cherry picked from commit 628b47dd30)
2025-07-18 13:09:20 +02:00
Nicki Křížek
c978abc61d Add wait_for_all() and wait_for_sequence() to WatchLog
Extend the WatchLog API with a couple of new matching options.

wait_for_sequence() can be used to check a specific sequence of lines
appears in the log file in the given order.

wait_for_all() ensure that all the provided patterns appear in the log
at least once.

Co-authored-by: Colin Vidal <colin@isc.org>
(cherry picked from commit 0a839cd0bd)
2025-07-18 13:09:20 +02:00
Nicki Křížek
75bf69fea0 Split up waiting for match to a separate WatchLog method
To allow re-use in upcoming functions, isolate the line matching logic
into a separate function. Use an instance-wide deadline attribute, which
is set by the calling function.

(cherry picked from commit 365f8b6af6)
2025-07-18 13:09:20 +02:00
Nicki Křížek
180d182d5f Allow WatchLog.wait_for_line() to be called more than once
In some cases, it can be useful to be able to re-use the same WatchLog
to wait for another line.

(cherry picked from commit 2afb3755b2)
2025-07-18 13:09:20 +02:00
Nicki Křížek
d6c27c4606 Unify the WatchLog.wait_for_line/s() API
Rather than using two distinct functions for matching either one pattern
(wait_for_line()), or any of multiple patterns (wait_for_lines()), use a
single function that handles both in the same way.

Extend the wait_for_line() API:
1. To allow for usage of one or more FlexPatterns, i.e. either plain
   strings to be matched verbatim, or regular expressions. Both can be
   used interchangeably to provide the caller to write simple and
   readable test code, while allowing for increased complexity to allow
   special cases.
2. Always return the regex match, which allows the caller to identify
   which line was matched, as well as to extract any additional
   information, such as individual regex groups.

(cherry picked from commit 5840908ead)
2025-07-18 13:09:20 +02:00
Nicki Křížek
652e8ac4d3 Set timeout for WatchLog per-instance rather than per-call
To simplify usage of multiple wait_for_*() calls, configure the timeout
value for the WatchLog instance, rather than specifying it for each
call.

This is a preparation/cleanup for implementing multiple wait_for_*()
calls in subsequent commits.

(cherry picked from commit f2679bff19)
2025-07-18 13:09:20 +02:00
Nicki Křížek
644ab9d28c Abstract WatchLog line buffering to a separate function
Move the line buffering functionality into _readline() to improve the
readability of code. This also allows reading the file contents from
other functions, since the line buffer is now an attribute of the class.

(cherry picked from commit 67896ddde2)
2025-07-18 10:16:06 +00:00
Colin Vidal
944863c2f7 fix watchlog.py doctest
Fix some broken doctest in watchlog.py (no semantic error, but API
slightly changed and broke some output messags). Also add a test for a
missing failure case.

(cherry picked from commit 9778068253)
2025-07-18 10:16:06 +00:00
Mark Andrews
66ebede266 [9.20] fix: test: Fix ifconfig.sh script
Add missing test for the variable 'a' being empty on linux.

Closes #5423

Backport of MR !10740

Merge branch 'backport-5423-fix-ifconfig-sh-script-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!10744
2025-07-17 08:50:45 +10:00
Mark Andrews
b6df481f3f Fix ifconfig.sh script
Add missing test for the variable 'a' being empty on linux.

(cherry picked from commit 7ba91e3820)
2025-07-16 22:13:25 +00:00
Andoni Duarte Pintado
4255d6d80a Merge tag 'v9.20.11' into bind-9.20 2025-07-16 17:20:09 +02:00
Mark Andrews
5aefaa4b97 [9.20] chg: usr: Add deprecation warnings for RSASHA1, RSASHA1-NSEC3SHA1 and DS digest type 1
RSASHA1 and RSASHA1-NSEC-SHA1 DNSKEY algorithms have been deprecated
by the IETF and should no longer be used for DNSSEC. DS digest type
1 (SHA1) has also been deprecated. Validators are now expected
to treat these algorithms and digest as unknown, resulting in
some zones being treated as insecure when they were previously treated
as secure. Warnings have been added to named and tools when these
algorithms and this digest are being used for signing.

Zones signed with RSASHA1 or RSASHA1-NSEC-SHA1 should be migrated
to a different DNSKEY algorithm. 

Zones with DS or CDS records with digest type 1 (SHA1) should be
updated to use a different digest type (e.g. SHA256) and the digest
type 1 records should be removed.

Related to #5358

Backport of MR !10559

Merge branch 'backport-5358-add-sha1-deprecation-warnings-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!10738
2025-07-16 09:31:28 +10:00
Mark Andrews
f702cb85ab Remove leftover test development echo
(cherry picked from commit 1a82a1999b)
2025-07-16 01:42:17 +10:00
Mark Andrews
ae47f5732e Redirect named-checkzone output to file
(cherry picked from commit 370d28de97)
2025-07-16 01:42:17 +10:00
Mark Andrews
77e6b07fae Digest type GOST is also deprecated
(cherry picked from commit 125a232bfb)
2025-07-16 01:42:17 +10:00
Mark Andrews
13afcc8af4 Check deprecated algorithms in dnssec-policy
(cherry picked from commit 86fb638085)
2025-07-16 01:42:17 +10:00
Mark Andrews
05062b6f66 Check that named-checkzone reports deprecated digests
(cherry picked from commit 95a82d0893)
2025-07-16 01:42:17 +10:00
Mark Andrews
2ee06d5b9d Check that named-checkzone reports deprecated algorithms
(cherry picked from commit 5d406677f1)
2025-07-16 01:42:15 +10:00
Mark Andrews
6d8281b913 Update man pages for deprecated algorithms
(cherry picked from commit 1e3e61ba53)
2025-07-16 01:40:00 +10:00
Mark Andrews
d03d58a10f Warn about deprecated DNSKEY and DS algorithms / digest types
DNSKEY algorithms RSASHA1 and RSASHA-NSEC3-SHA1 and DS digest type
SHA1 are deprecated.  Log when these are present in primary zone
files and when generating new DNSKEYs, DS and CDS records.

(cherry picked from commit cb6903c55e)
2025-07-16 01:39:58 +10:00
Štěpán Balážik
00239110f6 [9.20] chg: test: Use isctest.asyncserver in the "tsig" test
Replace the custom DNS server used in the "tsig" system test with
new code based on the isctest.asyncserver module.

Changes to isctest.asyncserver are required, previously it did not
handle TSIG signed queries at all. Now, with some hacking around
a [dnspython bug](https://github.com/rthalley/dnspython/issues/1205) it does.

Backport of MR !10566

Merge branch 'backport-stepan/tsig-asyncserver-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!10732
2025-07-13 10:07:25 +00:00
Štěpán Balážik
cbee7c6c52 Use isctest.asyncserver in the "tsig" test
Replace the custom DNS server used in the "tsig" system test with
new code based on the isctest.asyncserver module.

(cherry picked from commit e34e831cab)
2025-07-13 09:34:22 +00:00
Štěpán Balážik
58571d588f Let queries with TSIG parse in isctest.asyncserver.AsyncDnsServer
Previously, upon receiving a query with TSIG, the server would log
an error and timeout. As there is no way to set up the keyring in the
class anyway (and I believe we don't need it), this commit lets such
queries parse but logs the fact that the query has TSIG.

However, there is a bug [1] in dnspython, which causes `make_response`
and `to_wire` to crash on messages constructed by `from_wire` with
`keyring=False`, so the hack with `message.__class__` is needed to work
around this.

This makes just enough changes for the tsig system test to work with
dnspython >= 2.0.0. On older version the server gives up.

[1] https://github.com/rthalley/dnspython/issues/1205

(cherry picked from commit 72ac1fe234)
2025-07-13 09:34:22 +00:00
Ondřej Surý
b7e7923daa [9.20] fix: usr: Clean enough memory when adding new ADB names/entries under memory pressure
The ADB memory cleaning is opportunistic even when we are under
memory pressure (in the overmem condition).  Split the opportunistic
LRU cleaning and overmem cleaning and make the overmem cleaning
always cleanup double of the newly allocated adbname/adbentry to
ensure we never allocate more memory than the assigned limit.

Backport of MR !10637

Merge branch 'backport-ondrej/enforce-memory-cleanup-in-ADB-when-overmem-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!10707
2025-07-11 14:31:26 +02:00
Ondřej Surý
822ada5db1 When overmem, clean enough memory when adding new ADB names/entries
The purge_stale_names()/purge_stale_entries() is opportunistic even when
we are under memory pressure (overmem).  Split the opportunistic LRU
cleaning and overmem cleaning.  This makes the stale purging much
simpler as we don't have to try that hard and makes the overmem cleaning
always cleanup double the amount of the newly allocated ADB name/entry.

(cherry picked from commit eb0ffa0d5f)
2025-07-11 13:58:11 +02:00
Michal Nowak
20312d23e9 [9.20] chg: ci: Add "fips" tags to AlmaLinux FIPS machines
Backport of MR !10724

Merge branch 'backport-mnowak/add-fips-tags-to-fips-machines-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!10729
2025-07-10 15:24:54 +02:00
Michal Nowak
99c23041ea Add "fips" tags to AlmaLinux FIPS machines
(cherry picked from commit 75dda37aa8)
2025-07-10 15:24:31 +02:00
Arаm Sаrgsyаn
8c50819aa8 [9.20] fix: usr: Fix dig issues
When used with the ``+keepopen`` option with a TCP connection, iscman:`dig`
could terminate unexpectedly in rare situations. Additionally, iscman:`dig`
could hang and fail to shutdown properly when interrupted during a query.
These have been fixed.

Closes #5381

Backport of MR !10681

Merge branch 'backport-5381-dig-keepalive-crash-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!10727
2025-07-10 13:16:23 +00:00
Aram Sargsyan
33e37f7030 Fix a possible hang in dig if a send is interrupted/canceled
When send_done() is called with a ISC_R_CANCELED status (e.g. because
of a signal from ctrl+c), dig can fail to shutdown because
check_if_done() is not called in the branch. Add a check_if_done()
call.

(cherry picked from commit 5d1a8fe755)
2025-07-10 11:59:26 +00:00
Aram Sargsyan
b52d2e0392 Fix a query reference counting issue in dig
When reusing a TCP connection (because of the '+keepopen' option),
dig detaches from the query after launching it. This can cause a
crash in dig in rare cases when the "receive" callback is called
earlier than the "send" callback.

The '_cancel_lookup()' function detaches a query only if it's
found in the 'lookup->q' list. Before this commit, with one
additional detach happening before recv_done() -> _cancel_lookup()
is called, it didn't cause problems because an earlier _query_detach()
was unlinking the query from 'lookup->q' (because it was the last
reference), so the additional detach and the skipped detach were
undoing each other.

That is unless the "receive" callback was called earlier than the
"send" callback, in which case the additional detach wasn't destroying
the query (and wasn't unlinking it from 'lookup->q') because the "send"
callback's attachment was still there, and so _cancel_lookup() was
trying to "steal" the "send" callback's attachment and causing an
assertion on 'INSIST(query->sendhandle == NULL);'.

Delete the detachment which caused the described situation.

(cherry picked from commit a2685696aa)
2025-07-10 11:59:26 +00:00
Arаm Sаrgsyаn
47470b586d [9.20] fix: usr: Log dropped or slipped responses in the query-errors category
Responses which were dropped or slipped because of RRL (Response Rate
Limiting) were logged in the ``rate-limit`` category instead of the
``query-errors`` category, as documented in ARM. This has been fixed.

Closes #5388

Backport of MR !10676

Merge branch 'backport-5388-rrl-log-category-fix-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!10725
2025-07-10 11:15:59 +00:00