]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Add test case for GL #4350
authorMatthijs Mekking <matthijs@isc.org>
Fri, 13 Oct 2023 13:17:29 +0000 (15:17 +0200)
committerMatthijs Mekking <matthijs@isc.org>
Mon, 16 Oct 2023 07:26:56 +0000 (09:26 +0200)
Add a test scenario for a dynamic zone that uses inline-signing which
accidentally has signed the raw version of the zone.

This should not trigger resign scheduling on the raw version of the
zone.

bin/tests/system/kasp/clean.sh
bin/tests/system/kasp/ns3/named-fips.conf.in
bin/tests/system/kasp/ns3/setup.sh
bin/tests/system/kasp/setup.sh
bin/tests/system/kasp/tests.sh

index db264c28107395571a385eeffc8e01797c0f431e..d31b53a4646e7926003dc31412e3519287f5c1b0 100644 (file)
@@ -29,6 +29,7 @@ rm -f ns*/*.mkeys
 rm -f ns*/zones ns*/*.db.infile
 rm -f ns*/*.zsk1 ns*/*.zsk2
 rm -f ns3/legacy-keys.*
+rm -rf ns3/keys/
 rm -f *.created published.test* retired.test*
 rm -f rndc.dnssec.*.out.* rndc.zonestatus.out.*
 rm -f python.out.*
index 0f1d2c1e2e536ca74b78d7980e144b2054a621ce..cef81f94d5ac2d151b92f13c249ed78a5e898999 100644 (file)
@@ -134,6 +134,18 @@ zone "dynamic-inline-signing.kasp" {
        allow-update { any; };
 };
 
+/*
+ * A dynamic inline-signed zone with dnssec-policy with DNSSEC records in the
+ * raw version of the zone.
+ */
+zone "dynamic-signed-inline-signing.kasp" {
+       type primary;
+       file "dynamic-signed-inline-signing.kasp.db.signed";
+       key-directory "keys";
+       dnssec-policy "default";
+       allow-update { any; };
+};
+
 /* An inline-signed zone with dnssec-policy. */
 zone "inline-signing.kasp" {
        type primary;
index c198428c2494cdfd1370c4996b31a4db7b8827a1..be8ad8c80f645ecabddb2bdf71e3221e9c0486f5 100644 (file)
@@ -164,6 +164,19 @@ private_type_record $zone $DEFAULT_ALGORITHM_NUMBER "$ZSK" >> "$infile"
 cp $infile $zonefile
 $SIGNER -PS -x -o $zone -O raw -f "${zonefile}.signed" $infile > signer.out.$zone.1 2>&1
 
+# We are signing the raw version of the zone here. This is unusual and not
+# common operation, but want to make sure that in such a case BIND 9 does not
+# schedule a resigning operation on the raw version. Add expired signatures so
+# a resign is imminent.
+setup dynamic-signed-inline-signing.kasp
+T="now-1d"
+csktimes="-P $T -A $T -P sync $T"
+CSK=$($KEYGEN -a $DEFAULT_ALGORITHM -L 3600 -f KSK $ksktimes $zone 2> keygen.out.$zone.1)
+$SETTIME -s -g $O -d $O $T -k $O $T -z $O $T -r $O $T "$CSK" > settime.out.$zone.1 2>&1
+cat template.db.in "${CSK}.key" > "$infile"
+cp $infile $zonefile
+$SIGNER -PS -z -x -s now-2w -e now-1mi -o $zone -f "${zonefile}.signed" $infile > signer.out.$zone.1 2>&1
+
 # These signatures are set to expire long in the past, update immediately.
 setup expired-sigs.autosign
 T="now-6mo"
index 67cfa92e7df33357a3d30bcf7a9ab2905442c178..f733de92d15e61ad2fcdc87d3b0fc3916f5cf6f6 100644 (file)
@@ -19,6 +19,7 @@ set -e
 $SHELL clean.sh
 
 mkdir keys
+mkdir ns3/keys
 
 copy_setports ns2/named.conf.in ns2/named.conf
 if ! $SHELL ../testcrypto.sh -q RSASHA1
index dfc2df3e827d5fb19b0bc56d54e9c6efc879f03e..2f251edb305b89ad7a3d5d85bca92625ea1878b3 100644 (file)
@@ -487,6 +487,23 @@ retry_quiet 10 update_is_signed || ret=1
 test "$ret" -eq 0 || echo_i "failed"
 status=$((status+ret))
 
+#
+# Zone: dynamic-signed-inline-signing.kasp
+#
+set_zone "dynamic-signed-inline-signing.kasp"
+set_dynamic
+set_policy "default" "1" "3600"
+set_server "ns3" "10.53.0.3"
+dnssec_verify
+# Ensure no zone_resigninc for the unsigned version of the zone is triggered.
+n=$((n+1))
+echo_i "check if resigning the raw version of the zone is prevented for zone ${ZONE} ($n)"
+ret=0
+grep "zone_resigninc: zone $ZONE/IN (unsigned): enter" $DIR/named.run && ret=1
+grep "error reading K$ZONE" $DIR/named.run && ret=1
+test "$ret" -eq 0 || echo_i "failed"
+status=$((status+ret))
+
 #
 # Zone: inline-signing.kasp
 #