Commit graph

39925 commits

Author SHA1 Message Date
Mark Andrews
fbc8365395 Add support for parsing and displaying DSYNC rdata type
(cherry picked from commit c47615094e)
2025-08-06 13:51:43 +10:00
Mark Andrews
976b19e00c Add support for parsing DSYNC scheme mnemonics
Adds dns_dsyncscheme_fromtext, dns_dsyncscheme_totext and
dns_dsyncscheme_format.  Adds type dns_dsyncscheme_t.

(cherry picked from commit 6e1311c624)
2025-08-06 13:08:11 +10:00
Petr Špaček
02834baf74 [9.18] fix: test: Require explicit import of isctest.name in system tests
Since the isctest.name module uses `pytest.importorskip()` to check for
dnspython version, it can't be imported automatically on `import
isctest`, because that is used in conftest.py, causing an error during
test setup.

Note that this behavior only manifested on AlmaLinux 8, so perhaps newer
pytest versions are able to handle this edge case more gracefully.

This doesn't affect 9.20+, as this issue was introduced as an erroneous
conflict resolution during a 9.18 backport.

Merge branch 'nicki/fix-isctest-name-import-9.18' into 'bind-9.18'

See merge request isc-projects/bind9!10822
2025-08-05 12:56:36 +00:00
Nicki Křížek
78c0af6de1 Require explicit import of isctest.name in system tests
Since the isctest.name module uses `pytest.importorskip()` to check for
dnspython version, it can't be imported automatically on `import
isctest`, because that is used in conftest.py, causing an error during
test setup.

Note that this behavior only manifested on AlmaLinux 8, so perhaps newer
pytest versions are able to handle this edge case more gracefully.

This doesn't affect 9.20+, as this issue was introduced as an erroneous
conflict resolution during a 9.18 backport.
2025-08-05 11:10:24 +02:00
Ondřej Surý
c9f05d750a fix: usr: Rescan the interfaces again when reconfiguring the server
On FreeBSD, the server would not listen on the configured 'localhost'
interfaces immediately, but only after the 'interface-interval' period
has passed.  After the fix for default interface-interval was merged in
!10281, this means the server would listen on the localhost after 60
minutes.

Rescan the interfaces immediately after configuring the
interface-interval value to start listening on the 'localhost' interface
immediately.

Merge branch 'ondrej/rescan-the-interface-on-time-0' into 'bind-9.18'

See merge request isc-projects/bind9!10758
2025-08-04 11:24:44 +02:00
Ondřej Surý
e86eed54f5
Rescan the interfaces again when reconfiguring the server
On FreeBSD, the server would not listen on the configured 'localhost'
interfaces immediately, but only after the 'interface-interval' period
has passed.  After the fix for default interface-interval was merged in
!10281, this means the server would listen on the localhost after 60
minutes.

Rescan the interfaces immediately after configuring the
interface-interval value to start listening on the 'localhost' interface
immediately.
2025-08-04 11:24:23 +02:00
Mark Andrews
4d24dabc25 [9.18] fix: usr: Prevent spurious validation failures
Under rare circumstances, validation could fail if multiple clients simultaneously iterated the same set of signatures.

References #3014

Backport of MR !5578

Merge branch 'backport-3014-validator-c-check_signer-fails-to-call-dns_rdataset_clone-9.18' into 'bind-9.18'

See merge request isc-projects/bind9!10816
2025-08-02 00:29:52 +10:00
Mark Andrews
74fab1887c validator.c:check_signer now clones val->event->sigrdataset
Spurious validation failures were traced back to check_signer looping
over val->event->sigrdataset directly.  Cloning val->event->sigrdataset
prevents check_signer from interacting with callers that are also
looping over val->event->sigrdataset.

(cherry picked from commit 8aa130f253)
2025-08-01 23:55:38 +10:00
Petr Špaček
f0574ed0d1 [9.18] chg: ci: Log packages, test AlmaLinux 9
Backport of MR !10799

Merge branch 'backport-pspacek/ci-platforms-and-logging-9.18' into 'bind-9.18'

See merge request isc-projects/bind9!10807
2025-07-31 12:22:24 +00:00
Petr Špaček
1a16a131d7 Log all installed system packages and Python libraries before build
(cherry picked from commit e702e09143)
2025-07-31 12:22:08 +00:00
Petr Špaček
1bae223a63 Run MR pipelines also on AlmaLinux 9
Turns out Python version there is older than elsewhere.

(cherry picked from commit 8c71989a45)
2025-07-31 12:22:08 +00:00
Michal Nowak
a8f82ded6b [9.18] fix: ci: Revert "Capture scripts for Coverity Scan analysis"
This reverts commit b4a2674d98.

The --fs-capture-search option is no more. The ability to analyse Python
scripts in Coverity turned out to be questionable anyways.

Closes #5456

Backport of MR !10808

Merge branch 'backport-5456-coverity-scan-drop-fs-capture-search-option-9.18' into 'bind-9.18'

See merge request isc-projects/bind9!10811
2025-07-31 13:23:39 +02:00
Michal Nowak
adf35a3293
Revert "Capture scripts for Coverity Scan analysis"
This reverts commit e1a463e98d.

The --fs-capture-search option is no more. The ability to analyse Python
scripts in Coverity turned out to be questionable anyways.

(cherry picked from commit 310884c259)
2025-07-31 12:55:01 +02:00
Petr Špaček
2e3afea920 [9.18] Fix system test compatibility with old Python
Backport of MR !10797

Merge branch 'backport-pspacek/test-compatibility-9.18' into 'bind-9.18'

See merge request isc-projects/bind9!10803
2025-07-30 14:39:27 +00:00
Petr Špaček
a2daff3cb6 Fix compatibility with Python < 3.10
Dataclass kw_only argument was added only in Python 3.10 but EL9 image
has only 3.9.21.

(cherry picked from commit b0c7f8b598)
2025-07-30 14:36:46 +00:00
Petr Špaček
fd71407c49 Fix minimal dnspython version test
Wrong version number was uncovered by Ubuntu 22.04 Jammy which actually
has dnspython 2.1.0.

(cherry picked from commit 6ae224fc9c)
2025-07-30 14:36:46 +00:00
Evan Hunt
a47f46612e [9.18] new: test: add helper functions to isctest
added some helper functions in isctest to reduce code repetition
in dnssec-related tests:

- isctest.check.adflag() - checks that a response contains AD=1
- isctest.check.noadflag() - checks that a response contains AD=0

- isctest.check.rdflag() - checks that a response contains RD=1
- isctest.check.nordflag() - checks that a response contains RD=0

- isctest.check.raflag() - checks that a response contains RA=1
- isctest.check.noraflag() - checks that a response contains RA=0

- isctest.check.rr_count_eq() - checks the number of RRsset in a section

- isctest.check.same_data() - checks that two message have the
                              same rcode and data
- isctest.check.same_answer() - checks that two message have the same
                                rcode and answer

- isctest.query.create() - a wrapper for dns.message.make_query() that
                           creates a query message similar to dig +dnssec

Backport of MR !10760

Merge branch 'backport-each-isctest-helpers-9.18' into 'bind-9.18'

See merge request isc-projects/bind9!10794
2025-07-30 00:03:00 +00:00
Evan Hunt
2588b2a23c Use isctest.query.create across system tests
Rather than using the dnspython's facilities and defaults to create the
queries, use the isctest.query.create function in all the cases that
don't require special handling to have consistent defaults.

(cherry picked from commit 64143ea077)
2025-07-29 16:08:44 -07:00
Evan Hunt
ad7414de43 Add RA flag checks to isctest.check
(cherry picked from commit f2a4c5dcb0)
2025-07-29 16:04:02 -07:00
Evan Hunt
01ec550099 Refactor and move query helper to isctest.query.create
Make the query helper function more universal and reusable across our
system tests -- default to using EDNS and sending AD=1.

(cherry picked from commit 989e64b9b0)
2025-07-29 16:03:55 -07:00
Nicki Křížek
c92a6b85fe Unify RR counting in isctest.check helper
Use a common function to count the number of RRs in any section of the
DNS message. For the ADDITIONAL section, stick with the dnspython
convention of not including OPT and TSIG.

(cherry picked from commit efd60348b9)
2025-07-29 22:58:12 +00:00
Nicki Křížek
eeace11202 Refactor isctest.check.section_equal comparison
Use the same logic as dnspython uses in dns.message.Message.

(cherry picked from commit b24dd20e5a)
2025-07-29 22:58:12 +00:00
Evan Hunt
2a51b24cb7 add helper functions to isctest
added some helper functions in isctest to reduce code repetition
in dnssec-related tests:

- isctest.check.adflag() - checks that a response contains AD=1
- isctest.check.noadflag() - checks that a response contains AD=0

- isctest.check.rdflag() - checks that a response contains RD=1
- isctest.check.nordflag() - checks that a response contains RD=0

- isctest.check.answer_count_eq() - checks the answer count is correct
- isctest.check.additional_count_eq() - same for authority count
- isctest.check.authority_count_eq() - same for additional count

- isctest.check.same_data() - check that two message have the
                              same rcode and data
- isctest.check.same_answer() - check that two message have the same
                                rcode and answer

- isctest.dnssec.msg() - a wrapper for dns.message.make_query() that
                         creates a query message similar to dig +dnssec:
                         use_edns=True, want_dnssec=True,
                         and flags are set to (RD|AD) by default, but
                         options exist to disable AD or enable CD.
                         (to generate non-DNSSEC queries, use
                         message.make_query() directly.)

(cherry picked from commit b69097f139)
2025-07-29 22:58:11 +00:00
Petr Špaček
448223b391 [9.18] new: test: Robust tests for NSEC3 nonexistent QNAME proof
Related to #5292

Backport of MR !10416

Merge branch 'backport-5292-wrong-9.18' into 'bind-9.18'

See merge request isc-projects/bind9!10789
2025-07-29 12:25:20 +00:00
Michał Kępień
f79c638118 Adjust type hints for the "nsec3-answer" test
Add missing type hints in the tests_nsec3.py module.  Tweak the syntax
used for type hints for better consistency with other Python code in
bin/tests/system/.

(cherry picked from commit adb931f700)
2025-07-29 13:19:23 +02:00
Petr Špaček
d5cc05db49 Add more empty non-terminals to test zone
I don't know exactly why, I just have a feeling there might be
interesting corner cases somewhere.

(cherry picked from commit fc3d5e5918)
2025-07-29 13:19:23 +02:00
Petr Špaček
0adaa4a244 Randomize NSEC3 salt
This should prevent the case where are are unlucky enough that static
values hash 'just right' for the test to pass, but only accidentally.

(cherry picked from commit 46781845ea)
2025-07-29 13:19:23 +02:00
Petr Špaček
548d1a81f9 Test proof of nonexistance of DS in insecure referrals
Currently this test is limited only to auth because currently BIND
resolver does not send DS proof of nonexistence for RD=0 queries.

(cherry picked from commit 548632b18a)
2025-07-29 13:19:23 +02:00
Petr Špaček
cce3fe0683 Test dangling DNAME answers come with NXDOMAIN proofs
Simplistic test. Ignores the possibility of DNAME chain going through
multiple zones and/or wildcard expansions.

(cherry picked from commit 73e4201331)
2025-07-29 13:19:23 +02:00
Petr Špaček
0d3d1d0442 Test dangling CNAMEs come with NXDOMAIN proofs
Simplistic test. Ignores the possibility of CNAME chain going through
multiple zones and/or wildcard expansions.

(cherry picked from commit d0e413dd57)
2025-07-29 13:19:23 +02:00
Petr Špaček
e866ffd9c1 Move query outside of check_() functions
This allows better check() code reuse.

(cherry picked from commit cc6544b417)
2025-07-29 13:19:23 +02:00
Petr Špaček
1dfd384fd2 Separate test into a new directory
The test actually needs just two servers - auth and resolver. The rest
was not needed and made test setup only slower and harder to debug.

(cherry picked from commit ac58b58002)
2025-07-29 13:19:23 +02:00
Petr Špaček
65c488d1d3 Test simple NODATA answers with NSEC3
(cherry picked from commit a92391f60f)
2025-07-29 12:59:12 +02:00
Petr Špaček
8607e334be Detect extraneous NSEC3 RRs in responses
We expect minimal possible answers which prove what they have to
according to DNSSEC protocol.

(cherry picked from commit b854d5a3f5)
2025-07-29 12:59:12 +02:00
Petr Špaček
de4357bc93 Move proof checking into a NSEC3Checker class
(cherry picked from commit c45ad51860)
2025-07-29 12:59:12 +02:00
Petr Špaček
dc3f349e9d Add consistency checks to responses with NSEC3
Basic sanity checks - limited to responses from a single zone:
- NSEC3 type cannot be present in type bitmap:
  By definition, the type bitmap describes state of the unhashed name
  but NSEC3 RR is present at a different owner name. RFC 7129 section 5
- NSEC3 owner names cannot be duplicated:
  Unless the response crosses zone boundary, parent zone has insecure
  delegation for child, but child is signed ... don't do that.
- All parameters are consistent across all RRs present in answer:
  RFC 5155 section 7.2, last paragraph - at least when we don't cross
  zone boundary.

(cherry picked from commit cfaf5c997f)
2025-07-29 12:59:12 +02:00
Petr Špaček
87974b62d5 Split NXDOMAIN/NOERROR/NODATA test cases
Untangling individual cases allows for clearer documentation and makes
it easier to build similar but slightly different test cases.  Wildcard
NODATA answer was added.

(cherry picked from commit 9ca2077274)
2025-07-29 12:59:12 +02:00
Petr Špaček
da51bfed8c Extract closest encloser and source of synthesis logic into ZoneAnalyzer
As a side-effect, we now have set of all existing names in a zone with a
test, too. These parts should be shared with new NSEC tests.

(cherry picked from commit f0592de608)
2025-07-29 12:59:12 +02:00
Petr Špaček
2cf035b87d Use isctest library to check hypothesis version
Side-effect of importing from isctest.hypothesis first is a version
check and clean Pytest skip if version is too old.

(cherry picked from commit 9cea2af25c)
2025-07-29 12:59:12 +02:00
Petr Špaček
c6ad43f6ba Generate comprehensive tests for ZoneAnalyzer utility class
Test all combinations of wildcard, ENT, DNAME, NS, and ordinary
TXT records.

Test zone and expected outputs are generated by another script which
encodes node content into node name. This encoding removes 'node
content' level of indirection and thus enables simpler implementation of
same logic which needs to be in ZoneAnalyzer itself.

For humans the generated zone file also lists expected 'categories' a
name belongs to as dot-separated list on right hand side of a generated
RR.

(cherry picked from commit 42b60a3819)
2025-07-29 12:59:12 +02:00
Petr Špaček
0f12ee14f5 Test ZoneAnalyzer utility class
I've considered writing hypothesis test for this but I would have to
reimplement the same thing, which would probably have the same logic
bugs, so I will leave it as an exercise for someone else.

(cherry picked from commit cad48e56ab)
2025-07-29 12:59:12 +02:00
Petr Špaček
54b39c0db1 Separate zone analyzer from NSEC3 test
Code to generate ENTs, detect wildcards, occlusion etc. is generic
enough to be in an utility module.

(cherry picked from commit dbba59f48b)
2025-07-29 12:59:12 +02:00
Petr Špaček
aaaaad7dd2 Shorten syntax to access Name object
dns.name all over the place does not make it easier to read the code at
all, and I'm going to add lot more code here.

(cherry picked from commit 3fb6b990af)
2025-07-29 12:59:12 +02:00
Petr Špaček
a6c94a3f79 Move multi-subdomain name generator into shared utilities
(cherry picked from commit bd8be10329)
2025-07-29 12:59:12 +02:00
Evan Hunt
a074b2acbb Add property based test for nsec3hash utility
Check the correctness of NSEC3 hash generation by generating random
combinations of name, salt, and iterations and comparing the outputs
of the nsec3hash tool against the dnspython nsec3_hash function
for the same inputs.

(cherry picked from commit e263df8848)
2025-07-29 12:59:12 +02:00
Petr Špaček
2f97258d35 Test also with subdomains of existing names
Composite strategy makes sure we always test with a subdomain of an
existing name.

(cherry picked from commit 84ad35e7af)
2025-07-29 12:59:12 +02:00
Petr Špaček
8d7d1a76dc Dedup NSEC3 get_next_name function
(cherry picked from commit f9e12a840d)
2025-07-29 12:59:12 +02:00
Matthijs Mekking
3ae778a3f2 Add a property based test for NSEC3 proofs for non-existent QNAMEs
For any given NSEC3 signed zone, when doing queries for non-existent
names, the response must contain:
- NSEC3 RR that matches the closest encloser,
- NSEC3 RR that covers the next closer name,
- NSEC3 RR that covers the wildcard.

(cherry picked from commit 955e3ccf3e)
2025-07-29 12:59:12 +02:00
Mark Andrews
76dda22ec4 Check that correct NSEC3 proofs are returned
(cherry picked from commit 132e68fddb)
2025-07-29 12:59:12 +02:00
Ondřej Surý
4f9012ffd8 [9.18] fix: nil: Disable clang-format for Local IPv6 Unicast Addresses strings
The LSP server (using clangd) was always complaining about:

    Suspicious string literal, probably missing a comma

for the two Local IPv6 Unicast Addresses strings that spanned
across multiple lines.  Disable clang-format for these two lines.

Backport of MR !10764

Merge branch 'backport-ondrej/fix-suspicious-string-literal-probably-missing-comma-9.18' into 'bind-9.18'

See merge request isc-projects/bind9!10766
2025-07-23 09:09:44 +02:00