]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Check insecure response with missing RRSIG in authority
authorMark Andrews <marka@isc.org>
Wed, 19 Feb 2025 01:31:16 +0000 (12:31 +1100)
committerMark Andrews <marka@isc.org>
Fri, 21 Feb 2025 03:20:56 +0000 (14:20 +1100)
This scenario should succeed but wasn't due rejection of the
message at the message parsing stage.

(cherry picked from commit 4271d93f00909fad74d694121da970b1a633c495)

bin/tests/system/dnssec/ans10/ans.py
bin/tests/system/dnssec/ns1/root.db.in
bin/tests/system/dnssec/tests.sh

index dbe49e5e5ab4c43d56dc46fa61de39b268fae107..84bf0a2642bc11bfc3b5c8dd5412f5b3bee775dc 100644 (file)
@@ -38,6 +38,7 @@ def logquery(type, qname):
 # NS gets a unsigned response.
 # DNSKEY get a unsigned NODATA response.
 # A gets a signed response.
+# TXT gets a signed NODATA response without RRSIG.
 # All other types get a unsigned NODATA response.
 ############################################################################
 def create_response(msg):
@@ -72,6 +73,11 @@ def create_response(msg):
         r.answer.append(dns.rrset.from_text(qname, 1, IN, NS, "."))
     elif rrtype == SOA:
         r.answer.append(dns.rrset.from_text(qname, 1, IN, SOA, ". . 0 0 0 0 0"))
+    elif rrtype == TXT:
+        r.authority.append(dns.rrset.from_text(qname, 1, IN, SOA, ". . 0 0 0 0 0"))
+        r.authority.append(
+            dns.rrset.from_text(qname, 1, IN, NSEC, qname + " A NS SOA RRSIG NSEC")
+        )
     else:
         r.authority.append(dns.rrset.from_text(qname, 1, IN, SOA, ". . 0 0 0 0 0"))
     r.flags |= dns.flags.AA
index 52d88ab50034231687fd21b3d53ba14809c48756..1e7a5c79cf02c04c38f68bb51292fd4b683380ad 100644 (file)
@@ -43,3 +43,5 @@ ds-rrsigs-stripped.   NS      ns2.ds-rrsigs-stripped.
 ns2.ds-rrsigs-stripped.        A       10.53.0.2
 inconsistent.          NS      ns2.inconsistent.
 ns2.inconsistent.      A       10.53.0.2
+nsec-rrsigs-stripped.  NS      ns10.nsec-rrsigs-stripped.
+ns10.nsec-rrsigs-stripped.     A       10.53.0.10
index c022e8afca91b0bd7fee02e0cb9f9e1ab99e6911..2b2ff2fbb687b8310fe2c343b114878c9935e4f1 100644 (file)
@@ -4553,5 +4553,21 @@ n=$((n + 1))
 if [ "$ret" -ne 0 ]; then echo_i "failed"; fi
 status=$((status + ret))
 
+echo_i "checking that a insecure negative response where there is a NSEC without a RRSIG succeeds ($n)"
+ret=0
+# check server preconditions
+dig_with_opts +notcp @10.53.0.10 nsec-rrsigs-stripped. TXT +dnssec >dig.out.ns10.test$n
+grep "status: NOERROR" dig.out.ns10.test$n >/dev/null || ret=1
+grep "QUERY: 1, ANSWER: 0, AUTHORITY: 2, ADDITIONAL: 1" dig.out.ns10.test$n >/dev/null || ret=1
+grep "IN.RRSIG.NSEC" dig.out.ns10.test$n >/dev/null && ret=1
+# check resolver succeeds
+dig_with_opts @10.53.0.4 nsec-rrsigs-stripped. TXT +dnssec >dig.out.ns4.test$n
+grep "status: NOERROR" dig.out.ns4.test$n >/dev/null || ret=1
+grep "QUERY: 1, ANSWER: 0, AUTHORITY: 2, ADDITIONAL: 1" dig.out.ns4.test$n >/dev/null || ret=1
+grep "IN.RRSIG.NSEC" dig.out.ns4.test$n >/dev/null && ret=1
+n=$((n + 1))
+if [ "$ret" -ne 0 ]; then echo_i "failed"; fi
+status=$((status + ret))
+
 echo_i "exit status: $status"
 [ $status -eq 0 ] || exit 1