tests.sh revision 75b8de87879ad017c9cd2ffc328e5d2391d16e99
0c27b3fe77ac1d5094ba3521e8142d9e7973133fMark Andrews#!/bin/sh
0c27b3fe77ac1d5094ba3521e8142d9e7973133fMark Andrews#
0c27b3fe77ac1d5094ba3521e8142d9e7973133fMark Andrews# Copyright (C) 2004-2009 Internet Systems Consortium, Inc. ("ISC")
0c27b3fe77ac1d5094ba3521e8142d9e7973133fMark Andrews# Copyright (C) 2000-2002 Internet Software Consortium.
0c27b3fe77ac1d5094ba3521e8142d9e7973133fMark Andrews#
8e15d5eb3a000f1341e6bea0ddbc28d6dd2a0591Mark Andrews# Permission to use, copy, modify, and/or distribute this software for any
8e15d5eb3a000f1341e6bea0ddbc28d6dd2a0591Mark Andrews# purpose with or without fee is hereby granted, provided that the above
8e15d5eb3a000f1341e6bea0ddbc28d6dd2a0591Mark Andrews# copyright notice and this permission notice appear in all copies.
8e15d5eb3a000f1341e6bea0ddbc28d6dd2a0591Mark Andrews#
8e15d5eb3a000f1341e6bea0ddbc28d6dd2a0591Mark Andrews# THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
8e15d5eb3a000f1341e6bea0ddbc28d6dd2a0591Mark Andrews# REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
8e15d5eb3a000f1341e6bea0ddbc28d6dd2a0591Mark Andrews# AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
8e15d5eb3a000f1341e6bea0ddbc28d6dd2a0591Mark Andrews# INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
8e15d5eb3a000f1341e6bea0ddbc28d6dd2a0591Mark Andrews# LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
8e15d5eb3a000f1341e6bea0ddbc28d6dd2a0591Mark Andrews# OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
8e15d5eb3a000f1341e6bea0ddbc28d6dd2a0591Mark Andrews# PERFORMANCE OF THIS SOFTWARE.
8e15d5eb3a000f1341e6bea0ddbc28d6dd2a0591Mark Andrews
8e15d5eb3a000f1341e6bea0ddbc28d6dd2a0591Mark Andrews# $Id: tests.sh,v 1.2 2009/11/30 21:00:48 each Exp $
8e15d5eb3a000f1341e6bea0ddbc28d6dd2a0591Mark Andrews
8e15d5eb3a000f1341e6bea0ddbc28d6dd2a0591Mark AndrewsSYSTEMTESTTOP=..
. $SYSTEMTESTTOP/conf.sh
RANDFILE=./random.data
pzone=parent.nil pfile=parent.db
czone=child.parent.nil cfile=child.db
status=0
n=0
inact=`sed s/^K${czone}.+005+0*// < inact.key`
ksk=`sed s/^K${czone}.+005+0*// < ksk.key`
pending=`sed s/^K${czone}.+005+0*// < pending.key`
postrev=`sed s/^K${czone}.+005+0*// < postrev.key`
prerev=`sed s/^K${czone}.+005+0*// < prerev.key`
rolling=`sed s/^K${czone}.+005+0*// < rolling.key`
standby=`sed s/^K${czone}.+005+0*// < standby.key`
zsk=`sed s/^K${czone}.+005+0*// < zsk.key`
../../../tools/genrandom 400 $RANDFILE
echo "I:signing zones"
$SIGNER -Sg -o $czone $cfile > /dev/null 2>&1
$SIGNER -Sg -o $pzone $pfile > /dev/null 2>&1
awk -v CZ="${czone}." '$2 ~ /RRSIG/ {
type = $3;
getline;
id = $2;
if ($3 ~ CZ) {
print type, id
}
}' < ${cfile}.signed > sigs
awk '$2 ~ /DNSKEY/ {
flags = $3;
while ($0 !~ "key id =")
getline;
id = $6;
print flags, id;
}' < ${cfile}.signed > keys
echo "I:checking that KSK signed DNSKEY only ($n)"
ret=0
grep "DNSKEY $ksk"'$' sigs > /dev/null || ret=1
grep "SOA $ksk"'$' sigs > /dev/null && ret=1
n=`expr $n + 1`
if [ $ret != 0 ]; then echo "I:failed"; fi
status=`expr $status + $ret`
echo "I:checking that ZSK signed ($n)"
ret=0
grep "SOA $zsk"'$' sigs > /dev/null || ret=1
n=`expr $n + 1`
if [ $ret != 0 ]; then echo "I:failed"; fi
status=`expr $status + $ret`
echo "I:checking that standby ZSK did not sign ($n)"
ret=0
grep " $standby"'$' sigs > /dev/null && ret=1
n=`expr $n + 1`
if [ $ret != 0 ]; then echo "I:failed"; fi
status=`expr $status + $ret`
echo "I:checking that inactive key did not sign ($n)"
ret=0
grep " $inact"'$' sigs > /dev/null && ret=1
n=`expr $n + 1`
if [ $ret != 0 ]; then echo "I:failed"; fi
status=`expr $status + $ret`
echo "I:checking that pending key was not published ($n)"
ret=0
grep " $pending"'$' keys > /dev/null && ret=1
n=`expr $n + 1`
if [ $ret != 0 ]; then echo "I:failed"; fi
status=`expr $status + $ret`
echo "I:checking that standby KSK did not sign but is delegated ($n)"
ret=0
grep " $rolling"'$' sigs > /dev/null && ret=1
grep " $rolling"'$' keys > /dev/null || ret=1
egrep "DS[ ]*$rolling[ ]" ${pfile}.signed > /dev/null || ret=1
n=`expr $n + 1`
if [ $ret != 0 ]; then echo "I:failed"; fi
status=`expr $status + $ret`
echo "I:checking that key was revoked ($n)"
ret=0
grep " $prerev"'$' keys > /dev/null && ret=1
grep " $postrev"'$' keys > /dev/null || ret=1
n=`expr $n + 1`
if [ $ret != 0 ]; then echo "I:failed"; fi
status=`expr $status + $ret`
echo "I:checking that revoked key self-signed ($n)"
ret=0
grep "DNSKEY $postrev"'$' sigs > /dev/null || ret=1
grep "SOA $postrev"'$' sigs > /dev/null && ret=1
n=`expr $n + 1`
if [ $ret != 0 ]; then echo "I:failed"; fi
status=`expr $status + $ret`
echo "I:waiting 20 seconds for key changes to occur"
sleep 20
echo "I:re-signing zone"
$SIGNER -Sg -o $czone -f ${cfile}.new ${cfile}.signed > /dev/null 2>&1
echo "I:checking that standby KSK is now active ($n)"
ret=0
grep "DNSKEY $rolling"'$' sigs > /dev/null && ret=1
n=`expr $n + 1`
if [ $ret != 0 ]; then echo "I:failed"; fi
status=`expr $status + $ret`
echo "I:exit status: $status"
exit $status