]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Check DNS COOKIE, NSID and BADVERS
authorMark Andrews <marka@isc.org>
Fri, 28 Mar 2025 01:08:37 +0000 (12:08 +1100)
committerMark Andrews <marka@isc.org>
Tue, 15 Apr 2025 02:38:37 +0000 (02:38 +0000)
DNS COOKIE and NSID should also be being processed when returning
BADVERS.  Check that this has actually occured by looking for the
cookie and nsid in the response.

bin/tests/system/ednscompliance/ns1/named.conf.in
bin/tests/system/ednscompliance/tests.sh

index 1334c85cf270fb47589068b12fbb399cbfc38faa..3a640fff221f64cae018aa0e05cb898ceaf61f37 100644 (file)
@@ -21,6 +21,7 @@ options {
        listen-on-v6 { none; };
        recursion no;
        dnssec-validation no;
+       server-id "ns1";
 };
 
 zone "." {
index 515951adcff43c23fee765ae2093d875a655a3ec..3fae21142eff6ce76046e2ae30355a25ff4a8ffe 100644 (file)
@@ -57,7 +57,7 @@ status=$((status + ret))
 n=$((n + 1))
 echo_i "Unknown EDNS version ($n)"
 ret=0 reason=
-$DIG $DIGOPTS @10.53.0.1 +edns=100 +noednsnegotiation soa $zone >dig.out$n || ret=1
+$DIG $DIGOPTS @10.53.0.1 +edns=100 +nsid +noednsnegotiation soa $zone >dig.out$n || ret=1
 grep "status: BADVERS," dig.out$n >/dev/null || {
   ret=1
   reason="status"
@@ -66,6 +66,14 @@ grep "EDNS: version: 0," dig.out$n >/dev/null || {
   ret=1
   reason="version"
 }
+grep "; COOKIE: .* (good)" dig.out$n >/dev/null || {
+  ret=1
+  reason="cookie missing"
+}
+grep '; NSID: 6e 73 31 ("ns1")' dig.out$n >/dev/null || {
+  ret=1
+  reason="nsid missing"
+}
 grep "IN.SOA." dig.out$n >/dev/null && {
   ret=1
   reason="soa"