#!/bin/sh # Copyright (C) Internet Systems Consortium, Inc. ("ISC") # # SPDX-License-Identifier: MPL-2.0 # # This Source Code Form is subject to the terms of the Mozilla Public # License, v. 2.0. If a copy of the MPL was not distributed with this # file, you can obtain one at https://mozilla.org/MPL/2.0/. # # See the COPYRIGHT file distributed with this work for additional # information regarding copyright ownership. SYSTEMTESTTOP=.. . $SYSTEMTESTTOP/conf.sh DIGOPTS="+tcp +dnssec -p ${PORT}" RNDCCMD="$RNDC -c $SYSTEMTESTTOP/common/rndc.conf -p ${CONTROLPORT} -s" dig_with_opts() { $DIG $DIGOPTS "$@" } rndccmd() { $RNDCCMD "$@" } wait_for_serial() ( $DIG $DIGOPTS "@$1" "$2" SOA >"$4" serial=$(awk '$4 == "SOA" { print $7 }' "$4") [ "$3" -eq "${serial:--1}" ] ) status=0 n=0 $RNDCCMD 10.53.0.3 signing -nsec3param 1 0 0 - nsec3 >/dev/null 2>&1 for i in 1 2 3 4 5 6 7 8 9 0; do nsec3param=$($DIG $DIGOPTS +nodnssec +short @10.53.0.3 nsec3param nsec3.) test "$nsec3param" = "1 0 0 -" && break sleep 1 done n=$((n + 1)) echo_i "checking that an unsupported algorithm is not used for signing ($n)" ret=0 grep -q "algorithm is unsupported" ns3/named.run || ret=1 if [ $ret != 0 ]; then echo_i "failed"; fi status=$((status + ret)) n=$((n + 1)) echo_i "checking that rrsigs are replaced with ksk only ($n)" ret=0 $DIG $DIGOPTS @10.53.0.3 axfr nsec3. \ | awk '/RRSIG NSEC3/ {a[$1]++} END { for (i in a) {if (a[i] != 1) exit (1)}}' || ret=1 if [ $ret != 0 ]; then echo_i "failed"; fi status=$((status + ret)) n=$((n + 1)) echo_i "checking that the zone is signed on initial transfer ($n)" ret=0 for i in 1 2 3 4 5 6 7 8 9 10 1 2 3 4 5 6 7 8 9 10; do ret=0 $RNDCCMD 10.53.0.3 signing -list bits >signing.out.test$n 2>&1 keys=$(grep '^Done signing' signing.out.test$n | wc -l) [ $keys = 2 ] || ret=1 if [ $ret = 0 ]; then break; fi sleep 1 done if [ $ret != 0 ]; then echo_i "failed"; fi status=$((status + ret)) n=$((n + 1)) echo_i "checking expired signatures are updated on load ($n)" ret=0 $DIG $DIGOPTS @10.53.0.3 +noall +answer +dnssec expired SOA >dig.out.ns3.test$n expiry=$(awk '$4 == "RRSIG" { print $9 }' dig.out.ns3.test$n) [ "$expiry" = "20110101000000" ] && ret=1 if [ $ret != 0 ]; then echo_i "failed"; fi status=$((status + ret)) n=$((n + 1)) echo_i "checking removal of private type record via 'rndc signing -clear' ($n)" ret=0 $RNDCCMD 10.53.0.3 signing -list bits >signing.out.test$n 2>&1 keys=$(sed -n -e 's/Done signing with key \(.*\)$/\1/p' signing.out.test$n) for key in $keys; do $RNDCCMD 10.53.0.3 signing -clear ${key} bits >/dev/null || ret=1 break # We only want to remove 1 record for now. done 2>&1 | sed 's/^/ns3 /' | cat_i for i in 1 2 3 4 5 6 7 8 9 10; do ans=0 $RNDCCMD 10.53.0.3 signing -list bits >signing.out.test$n 2>&1 num=$(grep "Done signing with" signing.out.test$n | wc -l) [ $num = 1 ] && break sleep 1 done [ $ans = 0 ] || ret=1 if [ $ret != 0 ]; then echo_i "failed"; fi status=$((status + ret)) n=$((n + 1)) echo_i "checking private type was properly signed ($n)" ret=0 $DIG $DIGOPTS @10.53.0.6 bits TYPE65534 >dig.out.ns6.test$n grep "ANSWER: 2," dig.out.ns6.test$n >/dev/null || ret=1 grep "flags:.* ad[ ;]" dig.out.ns6.test$n >/dev/null || ret=1 if [ $ret != 0 ]; then echo_i "failed"; fi status=$((status + ret)) n=$((n + 1)) echo_i "checking removal of remaining private type record via 'rndc signing -clear all' ($n)" ret=0 $RNDCCMD 10.53.0.3 signing -clear all bits >/dev/null || ret=1 for i in 1 2 3 4 5 6 7 8 9 10; do ans=0 $RNDCCMD 10.53.0.3 signing -list bits >signing.out.test$n 2>&1 grep "No signing records found" signing.out.test$n >/dev/null || ans=1 [ $ans = 1 ] || break sleep 1 done [ $ans = 0 ] || ret=1 if [ $ret != 0 ]; then echo_i "failed"; fi status=$((status + ret)) n=$((n + 1)) echo_i "checking negative private type response was properly signed ($n)" ret=0 sleep 1 $DIG $DIGOPTS @10.53.0.6 bits TYPE65534 >dig.out.ns6.test$n grep "status: NOERROR" dig.out.ns6.test$n >/dev/null || ret=1 grep "ANSWER: 0," dig.out.ns6.test$n >/dev/null || ret=1 grep "flags:.* ad[ ;]" dig.out.ns6.test$n >/dev/null || ret=1 if [ $ret != 0 ]; then echo_i "failed"; fi status=$((status + ret)) $NSUPDATE <