Commit Graph

40481 Commits

Author SHA1 Message Date
Mark Andrews
2fbafc2675 Add release note for [GL #4281] 2024-01-05 12:01:28 +01:00
Mark Andrews
0748965b7c Add CHANGES note for [GL #4281] 2024-01-05 12:01:28 +01:00
Mark Andrews
9d0fa07c5e Save the correct result value to resume with nxdomain-redirect
The wrong result value was being saved for resumption with
nxdomain-redirect when performing the fetch.  This lead to an assert
when checking that RFC 1918 reverse queries where not leaking to
the global internet.
2024-01-05 12:01:28 +01:00
Michał Kępień
720e737de4 Merge branch '4234-confidential-use-hashmap-when-parsing' into 'v9.19.20-release'
[CVE-2023-4408] Use hashmap when parsing DNS messages

See merge request isc-private/bind9!560
2024-01-05 10:43:31 +00:00
Ondřej Surý
30d27928cf Add CHANGES and release note for [GL #4234] 2024-01-05 11:35:25 +01:00
Ondřej Surý
b8a9631754 Use hashmap when parsing a message
When parsing messages use a hashmap instead of a linear search to reduce
the amount of work done in findname when there's more than one name in
the section.

There are two hashmaps:

1) hashmap for owner names - that's constructed for each section when we
hit the second name in the section and destroyed right after parsing
that section;

2) per-name hashmap - for each name in the section, we construct a new
hashmap for that name if there are more than one rdataset for that
particular name.
2024-01-05 11:35:25 +01:00
Michał Kępień
e087391a96 Merge branch '4182-confidential-fix-races-in-dns-tsigkey-find' into 'v9.19.20-release'
Address races in dns_tsigkey_find()

See merge request isc-private/bind9!548
2024-01-05 10:18:28 +00:00
Mark Andrews
a62cda787f Add CHANGES note for [GL #4182] 2024-01-05 11:16:12 +01:00
Mark Andrews
d2ba96488e Address races in dns_tsigkey_find()
1) Restart the process with a write lock if we discover an expired key
while holding the read lock.

2) Move incrementing the key reference inside the lock block of code.
2024-01-05 11:16:12 +01:00
Michał Kępień
9074bfa38d Merge branch 'michal/add-placeholder-entries-to-CHANGES' into 'main'
Add placeholder entries to CHANGES

See merge request isc-projects/bind9!8625
2024-01-05 09:05:44 +00:00
Michał Kępień
82ecaabb12 Add placeholder entries to CHANGES
Add placeholders for the following issues:

  - [GL #4182]
  - [GL #4234]
  - [GL #4281]
  - [GL #4334]
  - [GL #4356]
  - [GL #4383]
2024-01-05 09:22:39 +01:00
Aydın Mercan
e112d0775e Merge branch 'aydin/isc_header_atomic_fix' into 'main'
Use and check for <isc/atomic.h> instead of <stdatomic.h> directly

See merge request isc-projects/bind9!8582
2024-01-03 17:47:53 +00:00
Aydın Mercan
ca9a05f9ce Check for atomic operations consistency in checklibs.sh
isc/atomic.h and its defined macros should be preferred over
stdatomic.h and explicit atomic operations.

Fix the redundant stdatomic.h header in histo.c found by the introduced
check.
2024-01-03 17:04:31 +00:00
Aydın Mercan
294329da3a Use <isc/atomic.h> instead of <stdatomic.h> directly in <isc/types.h> 2024-01-03 17:04:31 +00:00
Mark Andrews
7d170900bf Merge branch '4466-cds-is-stuck-on-an-old-key' into 'main'
Resolve "CDS is stuck on an old key."

Closes #4466

See merge request isc-projects/bind9!8565
2024-01-03 01:47:52 +00:00
Mark Andrews
531420bac0 Add CHANGES note for [GL #4466] 2024-01-03 12:09:12 +11:00
Mark Andrews
882b1a4449 Set the DNSKEY TTLs to match the dnssec policy
This prevents the DNSKEY records being updated and the statistics
not matching as a consequence
2024-01-03 12:09:12 +11:00
Mark Andrews
7a6570a911 Create keys with TTLs that match the policies TTL 2024-01-03 12:09:12 +11:00
Mark Andrews
16a720357b Make $TTL match dnskey-ttl 2024-01-03 12:09:11 +11:00
Matthijs Mekking
b770740b44 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.
2024-01-03 12:09:11 +11:00
Mark Andrews
27e74b2e4b 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.
2024-01-03 12:09:11 +11:00
Mark Andrews
d601a90ea3 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.
2024-01-03 12:09:11 +11:00
Mark Andrews
21be35c54e Use the current CDS and CDNSKEY TTLs
When adding new CDS and CDNSKEY records use the existing RRset
TTL if they already exist.
2024-01-03 12:09:11 +11:00
Mark Andrews
dcb7799061 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.
2024-01-03 12:09:11 +11:00
Mark Andrews
f894bf661f 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.
2024-01-03 12:09:11 +11:00
Mark Andrews
3fdf35bb2a Merge branch '4513-system-tests-fail-with-net-dns-1-42' into 'main'
Resolve "System tests fail with Net::DNS 1.42"

Closes #4513

See merge request isc-projects/bind9!8615
2024-01-03 00:07:07 +00:00
Mark Andrews
c2c59dea60 Support Net::DNS::Nameserver 1.42
In Net::DNS 1.42 $ns->main_loop no longer loops.  Use current methods
for starting the server, wait for SIGTERM then cleanup child processes
using $ns->stop_server(), then remove the pid file.
2024-01-03 09:21:15 +11:00
Michał Kępień
f0e17a92a3 Merge branch 'michal/silence-a-scan-build-warning-in-dns_rbt_addname' into 'main'
Silence a scan-build warning in dns_rbt_addname()

See merge request isc-projects/bind9!8614
2024-01-02 13:51:18 +00:00
Michał Kępień
9cf1f39b54 Silence a scan-build warning in dns_rbt_addname()
Clang Static Analyzer is unable to grasp that when dns_rbt_addnode()
returns ISC_R_EXISTS, it always sets the pointer passed to it via its
'nodep' parameter to a non-NULL value.  Add an extra safety check in the
conditional expression used in dns_rbt_addname() to silence that
warning.
2023-12-22 19:27:37 +01:00
Michal Nowak
1f78f3a586 Merge branch 'mnowak/pytest_rewrite_spf' into 'main'
Rewrite spf system test to pytest

See merge request isc-projects/bind9!8572
2023-12-22 15:07:13 +00:00
Michal Nowak
e67d770432 Rewrite spf system test to pytest 2023-12-22 15:02:58 +01:00
Michał Kępień
662a88055c 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.
2023-12-22 15:02:58 +01:00
Michał Kępień
1770b37095 Ensure wait_for_line() is not called with timeout=0 2023-12-22 15:02:58 +01:00
Michał Kępień
831c5d34f9 Refactor string matching loop for readability 2023-12-22 15:02:58 +01:00
Tom Krizek
05b0ebac0f Add LogFile helper
LogFile class contains a log path and has means to find a string in the
log file.
2023-12-22 15:02:58 +01:00
Štěpán Balážik
46b7cc2ed2 Merge branch 'stepan/rndc-fixtures-for-pytest' into 'main'
Implement Python helpers for using RNDC in tests

See merge request isc-projects/bind9!8357
2023-12-21 19:33:43 +00:00
Michał Kępień
fdc45c70e8 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?)
2023-12-21 18:10:15 +00:00
Michał Kępień
989d22473d 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.
2023-12-21 18:10:15 +00:00
Michał Kępień
aa31a872d0 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.
2023-12-21 18:10:15 +00:00
Michał Kępień
cf338a7ca3 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.
2023-12-21 18:10:15 +00:00
Michał Kępień
2c35b839a5 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.
2023-12-21 18:10:15 +00:00
Michał Kępień
bf92f33f94 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>
2023-12-21 18:10:15 +00:00
Michał Kępień
00003e497c 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.
2023-12-21 18:10:15 +00:00
Michał Kępień
c38c29e84d 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>
2023-12-21 18:10:15 +00:00
Evan Hunt
e997a738d6 Merge branch 'each-broken-qpiter' into 'main'
more fix_iterator() bugs

See merge request isc-projects/bind9!8606
2023-12-21 17:57:47 +00:00
Evan Hunt
ea9a8cb392 prevent an infinite loop in fix_iterator()
it was possible for fix_iterator() to get stuck in a loop while
trying to find the predecessor of a missing node. this has been
fixed and a regression test has been added.
2023-12-21 09:18:30 -08:00
Evan Hunt
84f79cd164 fix_iterator() could produce incoherent iterator stacks
the fix_iterator() function moves an iterator so that it points
to the predecessor of the searched-for name when that name doesn't
exist in the database. the tests only checked the correctness of
the top of the stack, however, and missed some cases where interior
branches in the stack could be missing or duplicated. in these
cases, the iterator would produce inconsistent results when walked.

the predecessors test case in qp_test has been updated to walk
each iterator to the end and ensure that the expected number of
nodes are found.
2023-12-21 09:18:30 -08:00
Mark Andrews
93cc89e4d3 Merge branch '4495-conversion-from-nsec3-to-nsec-removes-the-nsec3param-too-early' into 'main'
Resolve "Conversion from NSEC3 to NSEC removes the NSEC3PARAM too early"

Closes #4495 and #1794

See merge request isc-projects/bind9!8578
2023-12-21 10:00:15 +00:00
Mark Andrews
9b5ed853d0 Add CHANGES for [GL #1794] and [GL #4459] 2023-12-21 20:12:51 +11:00
Matthijs Mekking
1d6b892e04 Regression check for NSEC3 to NSEC3 conversion
When changing the NSEC3 chain, the new NSEC3 chain must be built before
the old NSEC3PARAM is removed.  Check each delta in the conversion to
ensure this ordering is met.
2023-12-21 20:12:09 +11:00