]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Check dnssec-signzone behaviour with revoked keys
authorMark Andrews <marka@isc.org>
Mon, 2 Dec 2024 07:30:41 +0000 (18:30 +1100)
committerMark Andrews <marka@isc.org>
Fri, 6 Dec 2024 00:25:09 +0000 (11:25 +1100)
Only DNSKEY records should be signed with a revoked key.

bin/tests/system/dnssec/tests.sh
bin/tests/system/dnssec/tests_sh_dnssec.py

index 839384217b1020dbbaa570fa31ff92154f652dd3..d94c2670740cd78ff0945df17ff8bd46feaf622d 100644 (file)
@@ -4517,5 +4517,34 @@ n=$((n + 1))
 if [ "$ret" -ne 0 ]; then echo_i "failed"; fi
 status=$((status + ret))
 
+echo_i "checking that records other than DNSKEY are not signed by a revoked key by dnssec-signzone ($n)"
+ret=0
+(
+  cd signer || exit 0
+  key1=$(${KEYGEN} -a "${DEFAULT_ALGORITHM}" -f KSK revoke.example)
+  key2=$(${KEYGEN} -a "${DEFAULT_ALGORITHM}" -f KSK revoke.example)
+  key3=$(${KEYGEN} -a "${DEFAULT_ALGORITHM}" revoke.example)
+  rkey=$(${REVOKE} "$key2")
+  cat >>revoke.example.db <<EOF
+\$TTL 3600
+@ SOA . . 0 0 0 0 3600
+@ NS .
+\$INCLUDE "${key1}.key"
+\$INCLUDE "${rkey}.key"
+\$INCLUDE "${key3}.key"
+EOF
+  "${DSFROMKEY}" -C "$key1" >>revoke.example.db
+  "${SIGNER}" -o revoke.example revoke.example.db >signer.out.$n
+) || ret=1
+keycount=$(grep -c "RRSIG.DNSKEY ${DEFAULT_ALGORITHM_NUMBER} " signer/revoke.example.db.signed)
+cdscount=$(grep -c "RRSIG.CDS ${DEFAULT_ALGORITHM_NUMBER} " signer/revoke.example.db.signed)
+soacount=$(grep -c "RRSIG.SOA ${DEFAULT_ALGORITHM_NUMBER} " signer/revoke.example.db.signed)
+[ $keycount -eq 3 ] || ret=1
+[ $cdscount -eq 2 ] || ret=1
+[ $soacount -eq 1 ] || 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
index bc2dd05ed30d19a9eaf21c45693febf0aae1324f..b0e9a5587122a3250e9162654d4697bf3435c13b 100644 (file)
@@ -151,6 +151,7 @@ pytestmark = pytest.mark.extra_artifacts(
         "signer/general/signer.out.*",
         "signer/nsec3param.out",
         "signer/prepub.db",
+        "signer/revoke.example.db",
         "signer/signer.err.*",
         "signer/signer.out.*",
     ]