1#!/bin/sh 2# 3# Copyright (C) 2010 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 27zsk=ns1/`cat ns1/keyname`.key 28zskpat=`awk '/DNSKEY/ { print $8 }' $zsk` 29zskid=`sed 's/^Kexample\.+005+0*//' < ns1/keyname` 30 31echo "I:checking for ZSK not yet published ($n)" 32ret=0 33$DIG $DIGOPTS -t dnskey example. @10.53.0.1 > dig.out.ns1.key$n || ret=1 34# Note - this is looking for failure, hence the && 35tr -d ' ' < dig.out.ns1.key$n | grep $zskpat > /dev/null && ret=1 36$DIG $DIGOPTS -t txt txt.example. @10.53.0.1 > dig.out.ns1.txt$n || ret=1 37# Note - this is looking for failure, hence the && 38grep 'RRSIG.*'" $zskid "'example\. ' dig.out.ns1.txt$n > /dev/null && ret=1 39n=`expr $n + 1` 40if [ $ret != 0 ]; then echo "I:failed"; fi 41status=`expr $status + $ret` 42 43# 5s real, 55s virtual, P +20 44sleep 4 45 46echo "I:checking for ZSK published but not yet active ($n)" 47ret=0 48$DIG $DIGOPTS -t dnskey example. @10.53.0.1 > dig.out.ns1.key$n || ret=1 49tr -d ' ' < dig.out.ns1.key$n | grep $zskpat > /dev/null || ret=1 50# Note - this is looking for failure, hence the && 51$DIG $DIGOPTS -t txt txt.example. @10.53.0.1 > dig.out.ns1.txt$n || ret=1 52grep 'RRSIG.*'" $zskid "'example\. ' dig.out.ns1.txt$n > /dev/null && ret=1 53n=`expr $n + 1` 54if [ $ret != 0 ] ; then echo "I:failed"; fi 55status=`expr $status + $ret` 56 57# 10s real, 2h15mn virtual, A +1h 58sleep 5 59 60echo "I:checking for ZSK active ($n)" 61ret=0 62$DIG $DIGOPTS -t dnskey example. @10.53.0.1 > dig.out.ns1.key$n || ret=1 63tr -d ' ' < dig.out.ns1.key$n | grep $zskpat > /dev/null || ret=1 64$DIG $DIGOPTS -t txt txt.example. @10.53.0.1 > dig.out.ns1.txt$n || ret=1 65grep 'RRSIG.*'" $zskid "'example\. ' dig.out.ns1.txt$n > /dev/null || ret=1 66n=`expr $n + 1` 67if [ $ret != 0 ] ; then echo "I:failed"; fi 68status=`expr $status + $ret` 69 70# 13s real, 45h virtual, I +1d 71sleep 3 72 73echo "I:checking for ZSK retired but not yet deleted ($n)" 74ret=0 75$DIG $DIGOPTS -t dnskey example. @10.53.0.1 > dig.out.ns1.key$n || ret=1 76tr -d ' ' < dig.out.ns1.key$n | grep $zskpat > /dev/null || ret=1 77# Note - this is looking for failure, hence the && 78$DIG $DIGOPTS -t txt txt.example. @10.53.0.1 > dig.out.ns1.txt$n || ret=1 79grep 'RRSIG.*'" $zskid "'example\. ' dig.out.ns1.txt$n > /dev/null && ret=1 80n=`expr $n + 1` 81if [ $ret != 0 ] ; then echo "I:failed"; fi 82status=`expr $status + $ret` 83 84# 17s real, 103d virtual, D +1mo 85sleep 4 86 87echo "I:checking for ZSK deleted ($n)" 88ret=0 89$DIG $DIGOPTS -t dnskey example. @10.53.0.1 > dig.out.ns1.key$n || ret=1 90# Note - this is looking for failure, hence the && 91tr -d ' ' < dig.out.ns1.key$n | grep $zskpat > /dev/null && ret=1 92# Note - this is looking for failure, hence the && 93$DIG $DIGOPTS -t txt txt.example. @10.53.0.1 > dig.out.ns1.txt$n || ret=1 94grep 'RRSIG.*'" $zskid "'example\. ' dig.out.ns1.txt$n > /dev/null && ret=1 95n=`expr $n + 1` 96if [ $ret != 0 ] ; then echo "I:failed"; fi 97status=`expr $status + $ret` 98 99echo "I:exit status: $status" 100exit $status 101