Commit Graph

38502 Commits

Author SHA1 Message Date
Matthijs Mekking
0daae0bdcf Fix CDS/CDNSKEY is published logging
The logs were misplaced, it was logging "CDS is published" when the
CDNSKEY is being published and vice versa.
2024-01-17 10:05:20 +01:00
Michal Nowak
db65a582fa Merge branch 'mnowak/pytest_rewrite_spf-9.18' into 'bind-9.18'
[9.18] Rewrite spf system test to pytest

See merge request isc-projects/bind9!8613
2024-01-15 17:36:12 +00:00
Michal Nowak
dfe31f7395 Rewrite spf system test to pytest
(cherry picked from commit e67d770432)
2024-01-15 17:14:06 +01:00
Michał Kępień
24fd30f7eb 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.

(cherry picked from commit 662a88055c)
2024-01-15 17:14:06 +01:00
Michał Kępień
b09835a5d1 Ensure wait_for_line() is not called with timeout=0
(cherry picked from commit 1770b37095)
2024-01-15 17:14:06 +01:00
Michał Kępień
93b4b110a7 Refactor string matching loop for readability
(cherry picked from commit 831c5d34f9)
2024-01-15 17:14:06 +01:00
Tom Krizek
f45e777b9f Add LogFile helper
LogFile class contains a log path and has means to find a string in the
log file.

(cherry picked from commit 05b0ebac0f)
2024-01-15 17:14:06 +01:00
Michał Kępień
93d9c61464 Merge branch 'michal/set-up-version-and-release-notes-for-bind-9.18.24' into 'bind-9.18'
Set up version and release notes for BIND 9.18.24

See merge request isc-projects/bind9!8653
2024-01-15 14:53:32 +00:00
Michał Kępień
695b9394d1 Account for February 2024 releases in CHANGES 2024-01-15 15:46:01 +01:00
Michał Kępień
6e0dc71a12 Set up release notes for BIND 9.18.24 2024-01-15 15:46:01 +01:00
Michał Kępień
301ac411fb Update BIND version to 9.18.24-dev 2024-01-15 15:46:01 +01:00
Artem Boldariev
7fb5d5b9e7 Merge branch '4528-honor-listen-on-changes-v9.18' into 'bind-9.18'
[9.18] Recreate listeners on DNS transport change

See merge request isc-projects/bind9!8652
2024-01-15 13:07:55 +00:00
Artem Boldariev
6fe3abc1ba Update release notes [GL #4518] [GL #4528]
Mentioned that all changes to listen-on statements are now applied on
reconfiguration.

(cherry picked from commit ad5378fad7)
2024-01-15 14:31:20 +02:00
Artem Boldariev
4d5320c540 Update CHANGES [GL #4518] [GL #4528]
Mentioned that all changes to listen-on statements are now applied on
reconfiguration.

(cherry picked from commit d1a2ad0f44)
2024-01-15 14:31:06 +02:00
Artem Boldariev
a76e304f5e Add a system test to verify listener transport change functionality
This commit adds a system test that helps to verify that changing a
listener transport by editing "listen-on" statements before
reconfiguration works as expected.

(cherry picked from commit 211f12ff85)
2024-01-15 14:31:06 +02:00
Artem Boldariev
cff69c65b5 Fix flawed logic when detecting same listener type
The older version of the code was reporting that listeners are going
to be of the same type after reconfiguration when switching from DoT
to HTTPS listener, making BIND abort its executions.

That was happening due to the flaw in logic due to which the code
could consider a current listener and a configuration for the new one
to be of the same type (DoT) even when the new listener entry is
explicitly marked as HTTP.

The checks for PROXY in between the configuration were masking that
behaviour, but when porting it to 9.18 (when there is no PROXY
support), the behaviour was exposed.

Now the code mirrors the logic in 'interface_setup()' closely (as it
was meant to).

(cherry picked from commit 8ae661048d)
2024-01-15 14:31:06 +02:00
Artem Boldariev
2be0acf3f3 Recreate listeners on DNS transport change
This commit ensures that listeners are recreated on reconfiguration in
the case when their type changes (or when PROXY protocol type changes,
too).

Previously, if a "listen-on" statement was modified to represent a
different transport, BIND would not pick-up the change on
reconfiguration if listener type changes (e.g. DoH -> DoT) for a given
interface address and port combination. This commit fixes that by
recreating the listener.

Initially, that worked for most of the new transports as we would
recreate listeners on each reconfiguration for DoH and DoT. But at
some point we changed that in such a way that listeners were not
recreated to avoid rebinding a port as on some platforms only root can
do that for port numbers <1000, making some ports binding possible
only on start-up. We chose to asynchronously update listener socket
settings (like TLS contexts, HTTP settings) instead.

Now, we both avoid recreating the sockets if unnecessary and recreate
listeners when listener type changes.

(cherry picked from commit d59cf5e0ce)
2024-01-15 14:31:06 +02:00
Štěpán Balážik
d12ff65491 Merge branch 'stepan/rndc-fixtures-for-pytest-9.18' into 'bind-9.18'
[9.18] Implement Python helpers for using RNDC in tests

See merge request isc-projects/bind9!8611
2024-01-15 12:15:13 +00:00
Michał Kępień
77b611be7c 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?)

(cherry picked from commit fdc45c70e8)
2024-01-13 11:31:51 +01:00
Michał Kępień
3bfead4f5d Run mypy checks on Python helpers in GitLab CI
Ensure the type hints provided in helper code for Python-based system
tests are correct by continuously checking them using mypy in GitLab CI.
Check bin/tests/system/isctest.py exclusively for the time being because
it is the only Python file in the source tree which uses static typing
at the moment and working around the issues reported by mypy for other
(non-statically-typed) Python files present in the source tree would be
cumbersome.

(cherry picked from commit 989d22473d)
2024-01-13 11:31:51 +01:00
Michał Kępień
c56b8136a0 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.

(cherry picked from commit aa31a872d0)
2024-01-13 11:31:51 +01:00
Michał Kępień
ab058db54c 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.

(cherry picked from commit cf338a7ca3)
2024-01-13 11:31:51 +01:00
Michał Kępień
2d297fc8b3 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.

(cherry picked from commit 2c35b839a5)
2024-01-13 11:31:51 +01:00
Michał Kępień
b8b0686222 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>
(cherry picked from commit bf92f33f94)
2024-01-13 11:31:51 +01:00
Michał Kępień
4cba5c1a02 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.

(cherry picked from commit 00003e497c)
2024-01-13 11:31:51 +01:00
Michał Kępień
4eadaca4b0 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>
(cherry picked from commit c38c29e84d)
2024-01-13 11:31:51 +01:00
Mark Andrews
150778cfb0 Merge branch '4520-log-message-in-lib-ns-update-c-needs-updating-bind-9.18' into 'bind-9.18'
[9.18] Resolve "Log message in lib/ns/update.c needs updating"

See merge request isc-projects/bind9!8647
2024-01-12 15:51:58 +00:00
Mark Andrews
9999eebbf7 Report the type being filtered from an UPDATE
When processing UPDATE request DNSKEY, CDNSKEY and CDS record that
are managed by named are filtered out.  The log message has been
updated to report the actual type rather that just DNSKEY.

(cherry picked from commit 2cf6cf967d)
2024-01-13 01:58:57 +11:00
Mark Andrews
26fdc0fb80 Merge branch '4466-cds-is-stuck-on-an-old-key-bind-9.18' into 'bind-9.18'
[9.18] Resolve "CDS is stuck on an old key." !8565

See merge request isc-projects/bind9!8620
2024-01-12 09:34:06 +00:00
Mark Andrews
ecd5459a4d Silence potential unreachable message 2024-01-12 19:56:54 +11:00
Mark Andrews
4efcfa8f1c Apply filters to CDS and CDNSKEY records 2024-01-12 19:56:54 +11:00
Matthijs Mekking
88734ac7cf Add function to check if a DNSKEY record is in use
Add a function that checks whether a DNSKEY, CDNSKEY, or CDS record
belongs to a key that is being used for signing.

(cherry picked from commit 3b6e9a5fa7)
2024-01-12 19:56:54 +11:00
Matthijs Mekking
0d36d98791 Add new dns_rdatatype_iskeymaterial() function
The following code block repeats quite often:

    if (rdata.type == dns_rdatatype_dnskey ||
        rdata.type == dns_rdatatype_cdnskey ||
        rdata.type == dns_rdatatype_cds)

Introduce a new function to reduce the repetition.

(cherry picked from commit ef58f2444f)
2024-01-12 19:56:54 +11:00
Matthijs Mekking
74109dfea6 Make make_dnskey() a public funcion
It can be used to compare DNSKEY, CDNSKEY, and CDS records with
signing keys.

(cherry picked from commit 81cb18b8a2)
2024-01-12 19:56:54 +11:00
Mark Andrews
2268ee2955 Update expected DNSKEY TTL to match dnssec-policy
csk.kasp and csk-nosep.kasp use the default policy which has a 3600
second dnskey-ttl.
2024-01-12 19:56:54 +11:00
Mark Andrews
e51f317622 Add CHANGES note for [GL #4466]
(cherry picked from commit 531420bac0)
2024-01-12 19:56:53 +11:00
Mark Andrews
e5bfe1e540 Set the DNSKEY TTLs to match the dnssec policy
This prevents the DNSKEY records being updated and the statistics
not matching as a consequence

(cherry picked from commit 882b1a4449)
2024-01-12 19:56:19 +11:00
Mark Andrews
e30652e33a Make $TTL match dnskey-ttl
(cherry picked from commit 16a720357b)
2024-01-12 19:56:19 +11:00
Matthijs Mekking
2a6ee4a9a0 Write new DNSKEY TTL to key file
When the current DNSKEY TTL does not match the one from the policy,
write the new TTL to disk.

(cherry picked from commit b770740b44)
2024-01-12 19:56:19 +11:00
Mark Andrews
59067fc568 Only create private records for DNSKEYs that have changed
We don't need to create private records for DNSKEY records that
have only had their TTL's changed.

(cherry picked from commit 27e74b2e4b)
2024-01-12 19:56:19 +11:00
Mark Andrews
c1d1f35f13 sync_secure_db failed to handle some TTL changes
If the DNSKEY, CDNSKEY or CDS RRset had different TTLs then the
filtering of these RRset resulted in dns_diff_apply failing with
"not exact". Identify tuple pairs that are just TTL changes and
allow them through the filter.

(cherry picked from commit d601a90ea3)
2024-01-12 19:56:19 +11:00
Mark Andrews
5bea0d3588 Use the current CDS and CDNSKEY TTLs
When adding new CDS and CDNSKEY records use the existing RRset
TTL if they already exist.

(cherry picked from commit 21be35c54e)
2024-01-12 19:56:19 +11:00
Mark Andrews
3a0b3e92bd Update the DNSKEY, CDNSKEY and CDS TTLs to match dnskey-ttl
If the TTLs of the DNSKEY, CDNSKEY and CDS do not match the
dnskey-ttl update them by removing all records and re-adding
them with the correct TTL.

(cherry picked from commit dcb7799061)
2024-01-12 19:56:19 +11:00
Mark Andrews
9cab1eafee 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.

(cherry picked from commit f894bf661f)
2024-01-12 19:56:19 +11:00
Arаm Sаrgsyаn
59c0e44d30 Merge branch '4508-crash-in-host-9.18' into 'bind-9.18'
[9.18] Fix a possible dig/host crash in "NS search" mode

See merge request isc-projects/bind9!8643
2024-01-11 11:31:11 +00:00
Aram Sargsyan
55cc5fea67 Add a CHANGES note for [GL #4508]
(cherry picked from commit 1246d982a2)
2024-01-11 10:31:37 +00:00
Aram Sargsyan
086f569f52 Print a dig comment about the failed query consistently
Dig failed to print a comment about the reason of the unacceptable
query reply got from a server when there was no other query to
start in the lookup's chain.

Add an "else" block to print out the comment even when not starting
up the next query.

(cherry picked from commit 913b20abf8)
2024-01-11 10:30:40 +00:00
Aram Sargsyan
11e85d15f9 Fix a possible dig/host crash in "NS search" mode
When getting a SERVFAIL reply from a query, 'host' tries to start
the next query in the lookup's list (also true for 'dig  +nofail').
However, when running with the '-C' switch (or +nssearch for 'dig'),
all the queries in the lookup start from the beginning, so that logic
brings to a crash because of the attempted start of the query which
was already started.

Don't start the next query in the affected code path when in +nssearch
mode.

(cherry picked from commit f6658b333e)
2024-01-11 10:28:22 +00:00
Tom Krizek
5274bba746 Merge branch 'tkrizek/nsupdate-test-flaky-on-freebsd-9.18' into 'bind-9.18'
[9.18] Allow nsupdate test rerun on FreeBSD

See merge request isc-projects/bind9!8640
2024-01-10 14:27:42 +00:00
Tom Krizek
7dff007ccd Allow nsupdate test rerun on FreeBSD
The "exceeded time limit waiting for literal 'too many DNS UPDATEs
queued' in ns1/named.run" is prone to fail due to a timing issue.
Despite out efforts to stabilize it, the check still often fails on
FreeBSD in our CI. Allow the test to be re-run on this platform.

(cherry picked from commit 124882476b)
2024-01-10 14:52:40 +01:00