]> 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 01:25:54 +0000 (12:25 +1100)
Only DNSKEY records should be signed with a revoked key.

(cherry picked from commit 30ef6dde059a4c7d0cb8b12a572af7e1dfc450df)

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

index c7b1c3aab8fcbe02e56ef54b23c99440262b41a0..b58b11a5c7ad478b5ba41b6b4750056b5af447c2 100644 (file)
@@ -4468,5 +4468,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 db7962a51285f8ec6b3729ef07496aea8689aadb..529a4a0e101797fe0eac620d2750863a157e66e4 100644 (file)
@@ -158,6 +158,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.*",
     ]