718c4becc5711be71e23202a87f3aaea1aedde79Mark Andrews#!/bin/sh
718c4becc5711be71e23202a87f3aaea1aedde79Mark Andrews#
0c27b3fe77ac1d5094ba3521e8142d9e7973133fMark Andrews# Copyright (C) 2010, 2012, 2016 Internet Systems Consortium, Inc. ("ISC")
bf8267aa453e5d2a735ed732a043b77a0b355b20Mark Andrews#
0c27b3fe77ac1d5094ba3521e8142d9e7973133fMark Andrews# This Source Code Form is subject to the terms of the Mozilla Public
0c27b3fe77ac1d5094ba3521e8142d9e7973133fMark Andrews# License, v. 2.0. If a copy of the MPL was not distributed with this
0c27b3fe77ac1d5094ba3521e8142d9e7973133fMark Andrews# file, You can obtain one at http://mozilla.org/MPL/2.0/.
718c4becc5711be71e23202a87f3aaea1aedde79Mark Andrews
718c4becc5711be71e23202a87f3aaea1aedde79Mark Andrews# $Id: tests.sh,v 1.2 2010/06/21 02:31:45 marka Exp $
718c4becc5711be71e23202a87f3aaea1aedde79Mark Andrews
718c4becc5711be71e23202a87f3aaea1aedde79Mark AndrewsSYSTEMTESTTOP=..
718c4becc5711be71e23202a87f3aaea1aedde79Mark Andrews. $SYSTEMTESTTOP/conf.sh
718c4becc5711be71e23202a87f3aaea1aedde79Mark Andrews
718c4becc5711be71e23202a87f3aaea1aedde79Mark Andrewsstatus=0
718c4becc5711be71e23202a87f3aaea1aedde79Mark Andrewsn=0
718c4becc5711be71e23202a87f3aaea1aedde79Mark Andrews
718c4becc5711be71e23202a87f3aaea1aedde79Mark AndrewsDIGOPTS="+noadd +nosea +nostat +nocmd +noauth +dnssec -p 5300"
718c4becc5711be71e23202a87f3aaea1aedde79Mark Andrews
718c4becc5711be71e23202a87f3aaea1aedde79Mark Andrewsksk=ns1/`cat ns1/keyname`.key
718c4becc5711be71e23202a87f3aaea1aedde79Mark Andrewskskpat=`awk '/DNSKEY/ { print $8 }' $ksk`
718c4becc5711be71e23202a87f3aaea1aedde79Mark Andrewskskid=`sed 's/^Kexample\.+005+0*//' < ns1/keyname`
718c4becc5711be71e23202a87f3aaea1aedde79Mark Andrewsrkskid=`expr \( $kskid + 128 \) \% 65536`
718c4becc5711be71e23202a87f3aaea1aedde79Mark Andrews
718c4becc5711be71e23202a87f3aaea1aedde79Mark Andrewsecho "I:checking for KSK not yet published ($n)"
718c4becc5711be71e23202a87f3aaea1aedde79Mark Andrewsret=0
718c4becc5711be71e23202a87f3aaea1aedde79Mark Andrews$DIG $DIGOPTS -t dnskey example. @10.53.0.1 > dig.out.ns1.test$n || ret=1
718c4becc5711be71e23202a87f3aaea1aedde79Mark Andrews# Note - this is looking for failure, hence the &&
718c4becc5711be71e23202a87f3aaea1aedde79Mark Andrewstr -d ' ' < dig.out.ns1.test$n | grep $kskpat > /dev/null && ret=1
718c4becc5711be71e23202a87f3aaea1aedde79Mark Andrewsn=`expr $n + 1`
718c4becc5711be71e23202a87f3aaea1aedde79Mark Andrewsif [ $ret != 0 ]; then echo "I:failed"; fi
718c4becc5711be71e23202a87f3aaea1aedde79Mark Andrewsstatus=`expr $status + $ret`
718c4becc5711be71e23202a87f3aaea1aedde79Mark Andrews
718c4becc5711be71e23202a87f3aaea1aedde79Mark Andrews# 5s real, 55s virtual, P +20
718c4becc5711be71e23202a87f3aaea1aedde79Mark Andrewssleep 4
718c4becc5711be71e23202a87f3aaea1aedde79Mark Andrews
718c4becc5711be71e23202a87f3aaea1aedde79Mark Andrewsecho "I:checking for KSK published but not yet active ($n)"
718c4becc5711be71e23202a87f3aaea1aedde79Mark Andrewsret=0
718c4becc5711be71e23202a87f3aaea1aedde79Mark Andrews$DIG $DIGOPTS -t dnskey example. @10.53.0.1 > dig.out.ns1.test$n || ret=1
718c4becc5711be71e23202a87f3aaea1aedde79Mark Andrewstr -d ' ' < dig.out.ns1.test$n | grep $kskpat > /dev/null || ret=1
718c4becc5711be71e23202a87f3aaea1aedde79Mark Andrews# Note - this is looking for failure, hence the &&
718c4becc5711be71e23202a87f3aaea1aedde79Mark Andrewsgrep 'RRSIG.*'" $kskid "'example\. ' dig.out.ns1.test$n > /dev/null && ret=1
718c4becc5711be71e23202a87f3aaea1aedde79Mark Andrewsn=`expr $n + 1`
718c4becc5711be71e23202a87f3aaea1aedde79Mark Andrewsif [ $ret != 0 ] ; then echo "I:failed"; fi
718c4becc5711be71e23202a87f3aaea1aedde79Mark Andrewsstatus=`expr $status + $ret`
718c4becc5711be71e23202a87f3aaea1aedde79Mark Andrews
718c4becc5711be71e23202a87f3aaea1aedde79Mark Andrews# 10s real, 2h15mn virtual, A +1h
718c4becc5711be71e23202a87f3aaea1aedde79Mark Andrewssleep 5
718c4becc5711be71e23202a87f3aaea1aedde79Mark Andrews
718c4becc5711be71e23202a87f3aaea1aedde79Mark Andrewsecho "I:checking for KSK active ($n)"
718c4becc5711be71e23202a87f3aaea1aedde79Mark Andrewsret=0
718c4becc5711be71e23202a87f3aaea1aedde79Mark Andrews$DIG $DIGOPTS -t dnskey example. @10.53.0.1 > dig.out.ns1.test$n || ret=1
718c4becc5711be71e23202a87f3aaea1aedde79Mark Andrewstr -d ' ' < dig.out.ns1.test$n | grep $kskpat > /dev/null || ret=1
718c4becc5711be71e23202a87f3aaea1aedde79Mark Andrewsgrep 'RRSIG.*'" $kskid "'example\. ' dig.out.ns1.test$n > /dev/null || ret=1
718c4becc5711be71e23202a87f3aaea1aedde79Mark Andrewsn=`expr $n + 1`
718c4becc5711be71e23202a87f3aaea1aedde79Mark Andrewsif [ $ret != 0 ] ; then echo "I:failed"; fi
718c4becc5711be71e23202a87f3aaea1aedde79Mark Andrewsstatus=`expr $status + $ret`
718c4becc5711be71e23202a87f3aaea1aedde79Mark Andrews
718c4becc5711be71e23202a87f3aaea1aedde79Mark Andrews# 11s real, 6h7,m virtual, R +6h
718c4becc5711be71e23202a87f3aaea1aedde79Mark Andrewssleep 1
718c4becc5711be71e23202a87f3aaea1aedde79Mark Andrews
718c4becc5711be71e23202a87f3aaea1aedde79Mark Andrewsecho "I:checking for KSK revoked ($n)"
718c4becc5711be71e23202a87f3aaea1aedde79Mark Andrewsret=0
718c4becc5711be71e23202a87f3aaea1aedde79Mark Andrews$DIG $DIGOPTS -t dnskey example. @10.53.0.1 > dig.out.ns1.test$n || ret=1
718c4becc5711be71e23202a87f3aaea1aedde79Mark Andrewstr -d ' ' < dig.out.ns1.test$n | grep $kskpat > /dev/null || ret=1
718c4becc5711be71e23202a87f3aaea1aedde79Mark Andrewsawk 'BEGIN { $noksk=1 } \
718c4becc5711be71e23202a87f3aaea1aedde79Mark Andrews/DNSKEY/ { $5==385 && $noksk=0 } \
718c4becc5711be71e23202a87f3aaea1aedde79Mark AndrewsEND { exit $noksk }' < dig.out.ns1.test$n > /dev/null || ret=1
718c4becc5711be71e23202a87f3aaea1aedde79Mark Andrews# Note - this is looking for failure, hence the &&
718c4becc5711be71e23202a87f3aaea1aedde79Mark Andrewsgrep 'RRSIG.*'" $kskid "'example\. ' dig.out.ns1.test$n > /dev/null && ret=1
718c4becc5711be71e23202a87f3aaea1aedde79Mark Andrewsgrep 'RRSIG.*'" $rkskid "'example\. ' dig.out.ns1.test$n > /dev/null || ret=1
718c4becc5711be71e23202a87f3aaea1aedde79Mark Andrewsn=`expr $n + 1`
718c4becc5711be71e23202a87f3aaea1aedde79Mark Andrewsif [ $ret != 0 ] ; then echo "I:failed"; fi
718c4becc5711be71e23202a87f3aaea1aedde79Mark Andrewsstatus=`expr $status + $ret`
718c4becc5711be71e23202a87f3aaea1aedde79Mark Andrews
718c4becc5711be71e23202a87f3aaea1aedde79Mark Andrews# 13s real, 45h virtual, I +1d
718c4becc5711be71e23202a87f3aaea1aedde79Mark Andrewssleep 2
718c4becc5711be71e23202a87f3aaea1aedde79Mark Andrews
718c4becc5711be71e23202a87f3aaea1aedde79Mark Andrewsecho "I:checking for KSK retired but not yet deleted ($n)"
718c4becc5711be71e23202a87f3aaea1aedde79Mark Andrewsret=0
718c4becc5711be71e23202a87f3aaea1aedde79Mark Andrews$DIG $DIGOPTS -t dnskey example. @10.53.0.1 > dig.out.ns1.test$n || ret=1
718c4becc5711be71e23202a87f3aaea1aedde79Mark Andrewstr -d ' ' < dig.out.ns1.test$n | grep $kskpat > /dev/null || ret=1
718c4becc5711be71e23202a87f3aaea1aedde79Mark Andrewsn=`expr $n + 1`
718c4becc5711be71e23202a87f3aaea1aedde79Mark Andrewsif [ $ret != 0 ] ; then echo "I:failed"; fi
718c4becc5711be71e23202a87f3aaea1aedde79Mark Andrewsstatus=`expr $status + $ret`
718c4becc5711be71e23202a87f3aaea1aedde79Mark Andrews
718c4becc5711be71e23202a87f3aaea1aedde79Mark Andrews# 17s real, 103d virtual, D +1mo
718c4becc5711be71e23202a87f3aaea1aedde79Mark Andrewssleep 4
718c4becc5711be71e23202a87f3aaea1aedde79Mark Andrews
718c4becc5711be71e23202a87f3aaea1aedde79Mark Andrewsecho "I:checking for KSK deleted ($n)"
718c4becc5711be71e23202a87f3aaea1aedde79Mark Andrewsret=0
718c4becc5711be71e23202a87f3aaea1aedde79Mark Andrews$DIG $DIGOPTS -t dnskey example. @10.53.0.1 > dig.out.ns1.test$n || ret=1
718c4becc5711be71e23202a87f3aaea1aedde79Mark Andrews# Note - this is looking for failure, hence the &&
718c4becc5711be71e23202a87f3aaea1aedde79Mark Andrewstr -d ' ' < dig.out.ns1.test$n | grep $kskpat > /dev/null && ret=1
718c4becc5711be71e23202a87f3aaea1aedde79Mark Andrews# Note - this is looking for failure, hence the &&
718c4becc5711be71e23202a87f3aaea1aedde79Mark Andrewsgrep 'RRSIG.*'" $rkskid "'example\. ' dig.out.ns1.test$n > /dev/null && ret=1
718c4becc5711be71e23202a87f3aaea1aedde79Mark Andrewsn=`expr $n + 1`
718c4becc5711be71e23202a87f3aaea1aedde79Mark Andrewsif [ $ret != 0 ] ; then echo "I:failed"; fi
718c4becc5711be71e23202a87f3aaea1aedde79Mark Andrewsstatus=`expr $status + $ret`
718c4becc5711be71e23202a87f3aaea1aedde79Mark Andrews
718c4becc5711be71e23202a87f3aaea1aedde79Mark Andrewsecho "I:exit status: $status"
718c4becc5711be71e23202a87f3aaea1aedde79Mark Andrewsexit $status