1#!/bin/sh 2# 3# Copyright (C) 2004, 2007, 2009, 2011, 2012 Internet Systems Consortium, Inc. ("ISC") 4# Copyright (C) 2001 Internet Software Consortium. 5# 6# Permission to use, copy, modify, and/or distribute this software for any 7# purpose with or without fee is hereby granted, provided that the above 8# copyright notice and this permission notice appear in all copies. 9# 10# THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH 11# REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY 12# AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, 13# INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM 14# LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE 15# OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR 16# PERFORMANCE OF THIS SOFTWARE. 17 18# Id: tests.sh,v 1.11 2011/11/03 23:46:26 tbox Exp 19 20SYSTEMTESTTOP=.. 21. $SYSTEMTESTTOP/conf.sh 22 23DIGOPTS="@10.53.0.1 -p 5300" 24 25status=0 26 27RANDFILE=random.data 28 29echo "I:generating new DH key" 30ret=0 31dhkeyname=`$KEYGEN -T KEY -a DH -b 768 -n host -r $RANDFILE client` || ret=1 32if [ $ret != 0 ]; then 33 echo "I:failed" 34 echo "I:exit status: $status" 35 exit $status 36fi 37status=`expr $status + $ret` 38 39for owner in . foo.example. 40do 41 echo "I:creating new key using owner name \"$owner\"" 42 ret=0 43 keyname=`./keycreate $dhkeyname $owner` || ret=1 44 if [ $ret != 0 ]; then 45 echo "I:failed" 46 echo "I:exit status: $status" 47 exit $status 48 fi 49 status=`expr $status + $ret` 50 51 echo "I:checking the new key" 52 ret=0 53 $DIG $DIGOPTS . ns -k $keyname > dig.out.1 || ret=1 54 grep "status: NOERROR" dig.out.1 > /dev/null || ret=1 55 grep "TSIG.*hmac-md5.*NOERROR" dig.out.1 > /dev/null || ret=1 56 grep "Some TSIG could not be validated" dig.out.1 > /dev/null && ret=1 57 if [ $ret != 0 ]; then 58 echo "I:failed" 59 fi 60 status=`expr $status + $ret` 61 62 echo "I:deleting new key" 63 ret=0 64 ./keydelete $keyname || ret=1 65 if [ $ret != 0 ]; then 66 echo "I:failed" 67 fi 68 status=`expr $status + $ret` 69 70 echo "I:checking that new key has been deleted" 71 ret=0 72 $DIG $DIGOPTS . ns -k $keyname > dig.out.2 || ret=1 73 grep "status: NOERROR" dig.out.2 > /dev/null && ret=1 74 grep "TSIG.*hmac-md5.*NOERROR" dig.out.2 > /dev/null && ret=1 75 grep "Some TSIG could not be validated" dig.out.2 > /dev/null || ret=1 76 if [ $ret != 0 ]; then 77 echo "I:failed" 78 fi 79 status=`expr $status + $ret` 80done 81 82echo "I:creating new key using owner name bar.example." 83ret=0 84keyname=`./keycreate $dhkeyname bar.example.` || ret=1 85if [ $ret != 0 ]; then 86 echo "I:failed" 87 echo "I:exit status: $status" 88 exit $status 89fi 90status=`expr $status + $ret` 91 92echo "I:checking the key with 'rndc tsig-list'" 93ret=0 94$RNDC -c ../common/rndc.conf -s 10.53.0.1 -p 9953 tsig-list > rndc.out 95grep "key \"bar.example.server" rndc.out > /dev/null || ret=1 96if [ $ret != 0 ]; then 97 echo "I:failed" 98fi 99status=`expr $status + $ret` 100 101echo "I:deleting the key with 'rndc tsig-delete'" 102ret=0 103$RNDC -c ../common/rndc.conf -s 10.53.0.1 -p 9953 tsig-delete bar.example.server > /dev/null || ret=1 104$RNDC -c ../common/rndc.conf -s 10.53.0.1 -p 9953 tsig-list > rndc.out 105grep "key \"bar.example.server" rndc.out > /dev/null && ret=1 106if [ $ret != 0 ]; then 107 echo "I:failed" 108fi 109status=`expr $status + $ret` 110 111echo "I:exit status: $status" 112exit $status 113