]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Test setting of inline-signing with dnssec-policy
authorMatthijs Mekking <matthijs@isc.org>
Mon, 11 Jul 2022 08:25:47 +0000 (10:25 +0200)
committerMatthijs Mekking <matthijs@isc.org>
Tue, 12 Jul 2022 09:29:03 +0000 (11:29 +0200)
When dnssec-policy is used, and the zone is not dynamic, BIND will
assume that the zone is inline-signed. Add test cases to verify this.

bin/tests/system/kasp.sh
bin/tests/system/kasp/clean.sh
bin/tests/system/kasp/ns4/named.conf.in
bin/tests/system/kasp/tests.sh

index f4058f6400556945e798e758a5d698be34644328..03ff93c4c4a6e398ef68f0b28145f2efad619f5c 100644 (file)
@@ -864,6 +864,28 @@ check_dnssecstatus() {
        status=$((status+ret))
 }
 
+# Call rndc zonestatus on server $1 for zone $2 in view $3 and check output if
+# inline-signing is enabled.
+check_inlinesigning() {
+       _server=$1
+       _zone=$2
+       _view=$3
+
+       _rndccmd $_server zonestatus $_zone in $_view > rndc.zonestatus.out.$_zone.$n || return 1
+       grep "inline signing: yes" rndc.zonestatus.out.$_zone.$n > /dev/null || return 1
+}
+
+# Call rndc zonestatus on server $1 for zone $2 in view $3 and check output if
+# the zone is dynamic.
+check_isdynamic() {
+       _server=$1
+       _zone=$2
+       _view=$3
+
+       _rndccmd $_server zonestatus $_zone in $_view > rndc.zonestatus.out.$_zone.$n || return 1
+       grep "dynamic: yes" rndc.zonestatus.out.$_zone.$n > /dev/null || return 1
+}
+
 # Check if RRset of type $1 in file $2 is signed with the right keys.
 # The right keys are the ones that expect a signature and matches the role $3.
 _check_signatures() {
index 174bed21e4ab07e3e94676cf70ec19f8675117b0..637e5e0ce78a60086078ce24d49615d4a6b5700d 100644 (file)
@@ -29,7 +29,7 @@ rm -f ns*/zones ns*/*.db.infile
 rm -f ns*/*.zsk1 ns*/*.zsk2
 rm -f ns3/legacy-keys.*
 rm -f *.created published.test* retired.test*
-rm -f rndc.dnssec.*.out.*
+rm -f rndc.dnssec.*.out.* rndc.zonestatus.out.*
 rm -f python.out.*
 rm -f *-supported.file
 rm -f created.key-* unused.key-*
index c3f19a93962e81c3da8e658ac572969e43bfb7ca..568587e09bbab4f1ca78d17fab541a07f78aaf72 100644 (file)
@@ -145,9 +145,12 @@ view "none" {
 view "example1" {
        match-clients { key "keyforview1"; };
 
+       allow-update { any; };
+
        zone "example.net" {
                type primary;
                file "example1.db";
+               // Dynamic zone, inline-signing disabled, policy inerhited.
        };
 };
 
@@ -157,6 +160,7 @@ view "example2" {
        zone "example.net" {
                type primary;
                file "example2.db";
+               // Static zone, inline-signing, policy inherited.
        };
 };
 
index 52007245bbfcd5530960e929336464e0fbed99e0..9c6cea20c841baa60e7a45ed882cccdf720710b5 100644 (file)
@@ -1880,8 +1880,16 @@ set_keytimes_csk_policy
 check_keytimes
 check_apex
 dnssec_verify
+# check zonestatus
 n=$((n+1))
+echo_i "check $ZONE (view example1) zonestatus ($n)"
+ret=0
+check_isdynamic "$SERVER" "$ZONE" "example1" || log_error "zone not dynamic"
+check_inlinesigning "$SERVER" "$ZONE" "example1" && log_error "inline-signing enabled, expected disabled"
+test "$ret" -eq 0 || echo_i "failed"
+status=$((status+ret))
 # check subdomain
+n=$((n+1))
 echo_i "check TXT example.net (view example1) rrset is signed correctly ($n)"
 ret=0
 dig_with_opts "view.${ZONE}" "@${SERVER}" TXT > "dig.out.$DIR.test$n.txt" || log_error "dig view.${ZONE} TXT failed"
@@ -1897,8 +1905,16 @@ check_keys
 check_dnssecstatus "$SERVER" "$POLICY" "$ZONE" "example2"
 check_apex
 dnssec_verify
+# check zonestatus
 n=$((n+1))
+echo_i "check $ZONE (view example2) zonestatus ($n)"
+ret=0
+check_isdynamic "$SERVER" "$ZONE" "example2" && log_error "zone dynamic, but not expected"
+check_inlinesigning "$SERVER" "$ZONE" "example2" || log_error "inline-signing disabled, expected enabled"
+test "$ret" -eq 0 || echo_i "failed"
+status=$((status+ret))
 # check subdomain
+n=$((n+1))
 echo_i "check TXT example.net (view example2) rrset is signed correctly ($n)"
 ret=0
 dig_with_opts "view.${ZONE}" "@${SERVER}" TXT > "dig.out.$DIR.test$n.txt" || log_error "dig view.${ZONE} TXT failed"
@@ -1914,8 +1930,16 @@ check_keys
 check_dnssecstatus "$SERVER" "$POLICY" "$ZONE" "example3"
 check_apex
 dnssec_verify
+# check zonestatus
 n=$((n+1))
+echo_i "check $ZONE (view example3) zonestatus ($n)"
+ret=0
+check_isdynamic "$SERVER" "$ZONE" "example3" && log_error "zone dynamic, but not expected"
+check_inlinesigning "$SERVER" "$ZONE" "example3" || log_error "inline-signing disabled, expected enabled"
+test "$ret" -eq 0 || echo_i "failed"
+status=$((status+ret))
 # check subdomain
+n=$((n+1))
 echo_i "check TXT example.net (view example3) rrset is signed correctly ($n)"
 ret=0
 dig_with_opts "view.${ZONE}" "@${SERVER}" TXT > "dig.out.$DIR.test$n.txt" || log_error "dig view.${ZONE} TXT failed"