Commit 6cb025e86f for bind
commit 6cb025e86f271b85842c55f70b8cc312cc289872
Author: Michal Nowak <mnowak@isc.org>
Date: Fri Oct 9 15:42:56 2026 +0000
Add the verify test's extra NSEC3 record in a zone transaction
Since dnspython 2.1.0, zones are updated through transactions, which
the test already uses to sign the zone. Adding the apex NSEC3 record
and its RRSIG the same way replaces creating the node and its
rdatasets by hand. The generated zone files are unchanged.
Assisted-by: Claude:claude-opus-5-5
diff --git a/bin/tests/system/verify/tests_verify.py b/bin/tests/system/verify/tests_verify.py
index 4ea2bee643..61264ed5bb 100644
--- a/bin/tests/system/verify/tests_verify.py
+++ b/bin/tests/system/verify/tests_verify.py
@@ -24,6 +24,7 @@ import dns.name
import dns.rdata
import dns.rdataclass
import dns.rdatatype
+import dns.rrset
import dns.zone
import pytest
@@ -92,44 +93,32 @@ def bootstrap():
add_dnskey=True,
deterministic=False, # for OpenSSL<3.2.0 compat
)
-
- # This generates an NSEC3 record for the apex, so that we can
- # verify a zone with both a valid and invalid NSEC3PARAM record.
- if nsec3:
- origin = dns.name.from_text(f"{name}.")
- hashname = dns.dnssec.nsec3_hash(
- origin, salt=b"", iterations=0, algorithm=NSEC3Hash.SHA1
- )
- nsec3rdata = dns.rdata.from_text(
- rdclass=dns.rdataclass.IN,
- rdtype=dns.rdatatype.NSEC3,
- tok=f"1 0 0 - {hashname} SOA NS A NSEC3PARAM DNSKEY RRSIG",
- )
- nsec3_owner = dns.name.from_text(f"{hashname}.{name}.")
- node = zoneobj.find_node(nsec3_owner, create=True)
- nsec3_rrset = node.find_rdataset(
- rdclass=dns.rdataclass.IN, rdtype=dns.rdatatype.NSEC3, create=True
- )
- nsec3_rrset.ttl = 300
- nsec3_rrset.add(nsec3rdata)
-
- inception = int(time.time()) - 30
- nsec3_sigdata = dns.dnssec.sign(
- rrset=(nsec3_owner, nsec3_rrset),
- private_key=ksk_private_key,
- signer=origin,
- dnskey=ksk_dnskey,
- inception=inception,
- lifetime=lifetime,
- )
- nsec3_rrsig = node.find_rdataset(
- rdclass=dns.rdataclass.IN,
- rdtype=dns.rdatatype.RRSIG,
- covers=dns.rdatatype.NSEC3,
- create=True,
- )
- nsec3_rrsig.ttl = 300
- nsec3_rrsig.add(nsec3_sigdata)
+ # This generates an NSEC3 record for the apex, so that we can
+ # verify a zone with both a valid and invalid NSEC3PARAM record.
+ if nsec3:
+ origin = dns.name.from_text(f"{name}.")
+ hashname = dns.dnssec.nsec3_hash(
+ origin, salt=b"", iterations=0, algorithm=NSEC3Hash.SHA1
+ )
+ nsec3rdata = dns.rdata.from_text(
+ rdclass=dns.rdataclass.IN,
+ rdtype=dns.rdatatype.NSEC3,
+ tok=f"1 0 0 - {hashname} SOA NS A NSEC3PARAM DNSKEY RRSIG",
+ )
+ nsec3_owner = dns.name.from_text(f"{hashname}.{name}.")
+ nsec3_rrset = dns.rrset.from_rdata(nsec3_owner, 300, nsec3rdata)
+
+ inception = int(time.time()) - 30
+ nsec3_sigdata = dns.dnssec.sign(
+ rrset=nsec3_rrset,
+ private_key=ksk_private_key,
+ signer=origin,
+ dnskey=ksk_dnskey,
+ inception=inception,
+ lifetime=lifetime,
+ )
+ txn.add(nsec3_rrset)
+ txn.add(nsec3_owner, 300, nsec3_sigdata)
zoneobj.to_file(str(zone.path_signed))