1#!/bin/sh 2# 3# Copyright (C) 2010, 2012 Internet Systems Consortium, Inc. ("ISC") 4# 5# Permission to use, copy, modify, and/or distribute this software for any 6# purpose with or without fee is hereby granted, provided that the above 7# copyright notice and this permission notice appear in all copies. 8# 9# THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH 10# REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY 11# AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, 12# INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM 13# LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE 14# OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR 15# PERFORMANCE OF THIS SOFTWARE. 16 17# Id: tests.sh,v 1.2 2010/06/21 02:31:45 marka Exp 18 19SYSTEMTESTTOP=.. 20. $SYSTEMTESTTOP/conf.sh 21 22status=0 23n=0 24 25DIGOPTS="+noadd +nosea +nostat +nocmd +noauth +dnssec -p 5300" 26 27ksk=ns1/`cat ns1/keyname`.key 28kskpat=`awk '/DNSKEY/ { print $8 }' $ksk` 29kskid=`sed 's/^Kexample\.+005+0*//' < ns1/keyname` 30rkskid=`expr \( $kskid + 128 \) \% 65536` 31 32echo "I:checking for KSK not yet published ($n)" 33ret=0 34$DIG $DIGOPTS -t dnskey example. @10.53.0.1 > dig.out.ns1.test$n || ret=1 35# Note - this is looking for failure, hence the && 36tr -d ' ' < dig.out.ns1.test$n | grep $kskpat > /dev/null && ret=1 37n=`expr $n + 1` 38if [ $ret != 0 ]; then echo "I:failed"; fi 39status=`expr $status + $ret` 40 41# 5s real, 55s virtual, P +20 42sleep 4 43 44echo "I:checking for KSK published but not yet active ($n)" 45ret=0 46$DIG $DIGOPTS -t dnskey example. @10.53.0.1 > dig.out.ns1.test$n || ret=1 47tr -d ' ' < dig.out.ns1.test$n | grep $kskpat > /dev/null || ret=1 48# Note - this is looking for failure, hence the && 49grep 'RRSIG.*'" $kskid "'example\. ' dig.out.ns1.test$n > /dev/null && ret=1 50n=`expr $n + 1` 51if [ $ret != 0 ] ; then echo "I:failed"; fi 52status=`expr $status + $ret` 53 54# 10s real, 2h15mn virtual, A +1h 55sleep 5 56 57echo "I:checking for KSK active ($n)" 58ret=0 59$DIG $DIGOPTS -t dnskey example. @10.53.0.1 > dig.out.ns1.test$n || ret=1 60tr -d ' ' < dig.out.ns1.test$n | grep $kskpat > /dev/null || ret=1 61grep 'RRSIG.*'" $kskid "'example\. ' dig.out.ns1.test$n > /dev/null || ret=1 62n=`expr $n + 1` 63if [ $ret != 0 ] ; then echo "I:failed"; fi 64status=`expr $status + $ret` 65 66# 11s real, 6h7,m virtual, R +6h 67sleep 1 68 69echo "I:checking for KSK revoked ($n)" 70ret=0 71$DIG $DIGOPTS -t dnskey example. @10.53.0.1 > dig.out.ns1.test$n || ret=1 72tr -d ' ' < dig.out.ns1.test$n | grep $kskpat > /dev/null || ret=1 73awk 'BEGIN { $noksk=1 } \ 74/DNSKEY/ { $5==385 && $noksk=0 } \ 75END { exit $noksk }' < dig.out.ns1.test$n > /dev/null || ret=1 76# Note - this is looking for failure, hence the && 77grep 'RRSIG.*'" $kskid "'example\. ' dig.out.ns1.test$n > /dev/null && ret=1 78grep 'RRSIG.*'" $rkskid "'example\. ' dig.out.ns1.test$n > /dev/null || ret=1 79n=`expr $n + 1` 80if [ $ret != 0 ] ; then echo "I:failed"; fi 81status=`expr $status + $ret` 82 83# 13s real, 45h virtual, I +1d 84sleep 2 85 86echo "I:checking for KSK retired but not yet deleted ($n)" 87ret=0 88$DIG $DIGOPTS -t dnskey example. @10.53.0.1 > dig.out.ns1.test$n || ret=1 89tr -d ' ' < dig.out.ns1.test$n | grep $kskpat > /dev/null || ret=1 90n=`expr $n + 1` 91if [ $ret != 0 ] ; then echo "I:failed"; fi 92status=`expr $status + $ret` 93 94# 17s real, 103d virtual, D +1mo 95sleep 4 96 97echo "I:checking for KSK deleted ($n)" 98ret=0 99$DIG $DIGOPTS -t dnskey example. @10.53.0.1 > dig.out.ns1.test$n || ret=1 100# Note - this is looking for failure, hence the && 101tr -d ' ' < dig.out.ns1.test$n | grep $kskpat > /dev/null && ret=1 102# Note - this is looking for failure, hence the && 103grep 'RRSIG.*'" $rkskid "'example\. ' dig.out.ns1.test$n > /dev/null && ret=1 104n=`expr $n + 1` 105if [ $ret != 0 ] ; then echo "I:failed"; fi 106status=`expr $status + $ret` 107 108echo "I:exit status: $status" 109exit $status 110