]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
dnssec: test dnssec-keygen -F switches to FIPS mode
authorMark Andrews <marka@isc.org>
Fri, 26 Aug 2022 02:24:30 +0000 (12:24 +1000)
committerMark Andrews <marka@isc.org>
Mon, 3 Apr 2023 02:44:27 +0000 (12:44 +1000)
bin/tests/system/dnssec/clean.sh
bin/tests/system/dnssec/tests.sh

index 8fcee1ace8c7c6218d3bd32e9f2c1ea1d35ba753..1610bd9504dff101cc639773ff5b147f212c1764 100644 (file)
@@ -21,7 +21,7 @@ rm -f ./*/named.run ./*/named.run.prev
 rm -f ./*/named.secroots
 rm -f ./*/tmp* ./*/*.jnl ./*/*.bk ./*/*.jbk
 rm -f ./*/trusted.conf ./*/managed.conf ./*/revoked.conf
-rm -f ./Kexample.* ./Kkeygen* ./keygen*.err
+rm -f ./Kexample.* ./Kkeygen* ./keygen*.err*
 rm -f ./ans10/query.log ./ans10/ans.run
 rm -f ./canonical?.*
 rm -f ./delv.out*
index 479e40452b3cc8555d47a513bb395384d190084e..5107a6691528228e9f62795f2986c4c928cd0f43 100644 (file)
@@ -3538,6 +3538,47 @@ n=$((n+1))
 test "$ret" -eq 0 || echo_i "failed"
 status=$((status+ret))
 
+echo_i "check that 'dnssec-keygen -F' disables rsasha1 ($n)"
+ret=0
+if $FEATURETEST --have-fips-mode
+then
+    echo_i "skipped: already in FIPS mode"
+elif ! $FEATURETEST --fips-provider
+then
+       echo_i "skipped no FIPS provider available"
+elif ! $SHELL ../testcrypto.sh -q RSASHA1
+then
+    echo_i "skipped: RSASHA1 is not supported"
+else
+    $KEYGEN -F -a rsasha1 example.fips 2> keygen.err$n || true
+    grep "unsupported algorithm: RSASHA1" "keygen.err$n" > /dev/null || ret=1
+fi
+n=$((n+1))
+test "$ret" -eq 0 || echo_i "failed"
+status=$((status+ret))
+
+echo_i "check that 'dnssec-keygen -F' disables nsec3rsasha1 ($n)"
+ret=0
+if $FEATURETEST --have-fips-mode
+then
+    echo_i "skipped: already in FIPS mode"
+elif ! $FEATURETEST --fips-set-mode
+then
+    echo_i "skipped: cannot switch to FIPS mode"
+elif ! $FEATURETEST --fips-set-mode-dst-lib-init
+then
+       echo_i "skipped FIPS mode not properly set up"
+elif ! $SHELL ../testcrypto.sh -q RSASHA1
+then
+    echo_i "skipped: RSASHA1 is not supported"
+else
+    $KEYGEN -F -a nsec3rsasha1 example.fips 2> keygen.err$n || true
+    grep "unsupported algorithm: NSEC3RSASHA1" "keygen.err$n" > /dev/null || ret=1
+fi
+n=$((n+1))
+test "$ret" -eq 0 || echo_i "failed"
+status=$((status+ret))
+
 echo_i "check that CDS records are signed using KSK by dnssec-signzone ($n)"
 ret=0
 dig_with_opts +noall +answer @10.53.0.2 cds cds.secure > dig.out.test$n