tests.sh revision bfc11b9c659a9c46c478cd9176220a1a29a862a1
#
# Copyright (C) 2015 Internet Systems Consortium, Inc. ("ISC")
#
# purpose with or without fee is hereby granted, provided that the above
# copyright notice and this permission notice appear in all copies.
#
# THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
# REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
# AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
# INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
# LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
# OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
# PERFORMANCE OF THIS SOFTWARE.
status=0
n=1
DIGOPTS="+tcp +noadd +nosea +nostat +nocmd +dnssec -p 5300"
DELVOPTS="-a ns1/trusted.conf -p 5300"
echo "I: check for signed record ($n)"
ret=0
grep "^example\.[[:space:]]*[0-9].*[[:space:]]*IN[[:space:]]*TXT[[:space:]]*\"This is a test\.\"" dig.out.ns1.test$n > /dev/null || ret=1
grep "^example\.[[:space:]]*[0-9].*[[:space:]]*IN[[:space:]]*RRSIG[[:space:]]*TXT[[:space:]]" dig.out.ns1.test$n > /dev/null || ret=1
n=`expr $n + 1`
echo "I: check positive validation with valid trust anchor ($n)"
ret=0
n=`expr $n + 1`
ret=0
echo "I: check positive validation using delv ($n)"
n=`expr $n + 1`
echo "I: check for failed validation due to wrong key in managed-keys ($n)"
ret=0
n=`expr $n + 1`
echo "I: check new trust anchor can be added ($n)"
ret=0
sleep 5
# there should be two keys listed now
# two lines indicating trust status
# one indicates current trust
# one indicates pending trust
n=`expr $n + 1`
echo "I: check new trust anchor can't be added with bad initial key ($n)"
ret=0
sleep 1
# there should be one key listed now
# one line indicating trust status
# ... and the key is not trusted
n=`expr $n + 1`
echo "I: remove untrusted standby key, check timer restarts ($n)"
ret=0
sleep 3
sleep 1
sleep 1
# trust pending date must be different
n=`expr $n + 1`
ret=0
echo "I: restore untrusted standby key, revoke original key ($n)"
sleep 3
sleep 1
# two keys listed
# two lines indicating trust status
# trust is revoked
# removal scheduled
# trust is still pending on the standby key
# pending date moved forward for the standby key
n=`expr $n + 1`
ret=0
echo "I: refresh managed-keys, ensure same result ($n)"
sleep 2
# two keys listed
# two lines indicating trust status
# trust is revoked
# removal scheduled
# trust is still pending on the standby key
# pending date moved forward for the standby key
n=`expr $n + 1`
ret=0
echo "I: restore revoked key, ensure same result ($n)"
sleep 3
sleep 3
sleep 1
# two keys listed
# two lines indicating trust status
# trust is revoked
# removal scheduled
# trust is still pending on the standby key
# pending date moved forward for the standby key
echo "I: reinitialize trust anchors"
n=`expr $n + 1`
echo "I: check that standby key is now trusted ($n)"
ret=0
sleep 3
# two keys listed
# two lines indicating trust status
# both indicate current trust
n=`expr $n + 1`
echo "I: revoke original key, add new standby ($n)"
ret=0
sleep 3
sleep 1
# three keys listed
# one is revoked
# three lines indicating trust status
# one indicates current trust
# one indicates revoked trust
# one indicates trust pending
# removal scheduled
n=`expr $n + 1`
echo "I: revoke standby before it is trusted ($n)"
ret=0
sleep 3
sleep 1
# four keys listed
# one revoked
# two pending
sleep 3
sleep 1
# now three keys listed
# one revoked
# one pending
n=`expr $n + 1`
ret=0
sleep 15
sleep 1
# two keys listed
# none revoked
# two lines indicating trust status
# both indicate current trust
n=`expr $n + 1`
echo "I: revoke all keys, confirm roll to insecure ($n)"
ret=0
sleep 3
sleep 1
# two keys listed
# both revoked
# two lines indicating trust status
# both indicate trust revoked
# both have removal scheduled
n=`expr $n + 1`
echo "I: check for insecure response ($n)"
ret=0
echo "I: reset the root server"
echo "I: reinitialize trust anchors"
n=`expr $n + 1`
echo "I: check positive validation ($n)"
ret=0
n=`expr $n + 1`
echo "I: revoke key with bad signature, check revocation is ignored ($n)"
ret=0
$SIGNER -Sg -K ns1 -N unixtime -r $RANDFILE -O full -o . -f signer.out.$n ns1/root.db > /dev/null 2>&-
BADSIG="SVn2tLDzpNX2rxR4xRceiCsiTqcWNKh7NQ0EQfCrVzp9WEmLw60sQ5kP xGk4FS/xSKfh89hO2O/H20Bzp0lMdtr2tKy8IMdU/mBZxQf2PXhUWRkg V2buVBKugTiOPTJSnaqYCN3rSfV1o7NtC1VNHKKK/D5g6bpDehdn5Gaq kpBhN+MSCCh9OZP2IT20luS1ARXxLlvuSVXJ3JYuuhTsQXUbX/SQpNoB Lo6ahCE55szJnmAxZEbb2KOVnSlZRA6ZBHDhdtO0S4OkvcmTutvcVV+7 w53CbKdaXhirvHIh0mZXmYk2PbPLDY7PU9wSH40UiWPOB9f00wwn6hUe uEQ1Qg=="
sleep 3
sleep 1
# one key listed
# it's the original key id
# not revoked
# trust is still current
n=`expr $n + 1`
echo "I: check validation fails with bad DNSKEY rrset ($n)"
ret=0
n=`expr $n + 1`
echo "I: restore DNSKEY rrset, check validation succeeds again ($n)"
ret=0
sleep 1
sleep 3
sleep 1
n=`expr $n + 1`
echo "I: reset the root server with no keys, check for minimal update ($n)"
sleep 3
sleep 1
# one key listed
# it's the original key id
# not revoked
# trust is still current
n=`expr $n + 1`
echo "I: reset the root server with no signatures, check for minimal update ($n)"
sleep 3
sleep 1
# one key listed
# it's the original key id
# not revoked
# trust is still current
n=`expr $n + 1`
echo "I: restore root server, check validation succeeds again ($n)"
sleep 3
sleep 1
echo "I:exit status: $status"
exit $status