1# Copyright (C) 2004, 2007, 2011-2014 Internet Systems Consortium, Inc. ("ISC") 2# Copyright (C) 2000, 2001 Internet Software Consortium. 3# 4# Permission to use, copy, modify, and/or distribute this software for any 5# purpose with or without fee is hereby granted, provided that the above 6# copyright notice and this permission notice appear in all copies. 7# 8# THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH 9# REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY 10# AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, 11# INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM 12# LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE 13# OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR 14# PERFORMANCE OF THIS SOFTWARE. 15 16# Id: tests.sh,v 1.9 2011/10/13 22:48:23 tbox Exp 17 18SYSTEMTESTTOP=.. 19. $SYSTEMTESTTOP/conf.sh 20 21root=10.53.0.1 22hidden=10.53.0.2 23f1=10.53.0.3 24f2=10.53.0.4 25 26status=0 27 28echo "I:checking that a forward zone overrides global forwarders" 29ret=0 30$DIG +noadd +noauth txt.example1. txt @$hidden -p 5300 > dig.out.hidden || ret=1 31$DIG +noadd +noauth txt.example1. txt @$f1 -p 5300 > dig.out.f1 || ret=1 32$PERL ../digcomp.pl dig.out.hidden dig.out.f1 || ret=1 33if [ $ret != 0 ]; then echo "I:failed"; fi 34status=`expr $status + $ret` 35 36echo "I:checking that a forward first zone no forwarders recurses" 37ret=0 38$DIG +noadd +noauth txt.example2. txt @$root -p 5300 > dig.out.root || ret=1 39$DIG +noadd +noauth txt.example2. txt @$f1 -p 5300 > dig.out.f1 || ret=1 40$PERL ../digcomp.pl dig.out.root dig.out.f1 || ret=1 41if [ $ret != 0 ]; then echo "I:failed"; fi 42status=`expr $status + $ret` 43 44echo "I:checking that a forward only zone no forwarders fails" 45ret=0 46$DIG +noadd +noauth txt.example2. txt @$root -p 5300 > dig.out.root || ret=1 47$DIG +noadd +noauth txt.example2. txt @$f1 -p 5300 > dig.out.f1 || ret=1 48$PERL ../digcomp.pl dig.out.root dig.out.f1 || ret=1 49if [ $ret != 0 ]; then echo "I:failed"; fi 50status=`expr $status + $ret` 51 52echo "I:checking that global forwarders work" 53ret=0 54$DIG +noadd +noauth txt.example4. txt @$hidden -p 5300 > dig.out.hidden || ret=1 55$DIG +noadd +noauth txt.example4. txt @$f1 -p 5300 > dig.out.f1 || ret=1 56$PERL ../digcomp.pl dig.out.hidden dig.out.f1 || ret=1 57if [ $ret != 0 ]; then echo "I:failed"; fi 58status=`expr $status + $ret` 59 60echo "I:checking that a forward zone works" 61ret=0 62$DIG +noadd +noauth txt.example1. txt @$hidden -p 5300 > dig.out.hidden || ret=1 63$DIG +noadd +noauth txt.example1. txt @$f2 -p 5300 > dig.out.f2 || ret=1 64$PERL ../digcomp.pl dig.out.hidden dig.out.f2 || ret=1 65if [ $ret != 0 ]; then echo "I:failed"; fi 66status=`expr $status + $ret` 67 68echo "I:checking that forwarding doesn't spontaneously happen" 69ret=0 70$DIG +noadd +noauth txt.example2. txt @$root -p 5300 > dig.out.root || ret=1 71$DIG +noadd +noauth txt.example2. txt @$f2 -p 5300 > dig.out.f2 || ret=1 72$PERL ../digcomp.pl dig.out.root dig.out.f2 || ret=1 73if [ $ret != 0 ]; then echo "I:failed"; fi 74status=`expr $status + $ret` 75 76echo "I:checking that a forward zone with no specified policy works" 77ret=0 78$DIG +noadd +noauth txt.example3. txt @$hidden -p 5300 > dig.out.hidden || ret=1 79$DIG +noadd +noauth txt.example3. txt @$f2 -p 5300 > dig.out.f2 || ret=1 80$PERL ../digcomp.pl dig.out.hidden dig.out.f2 || ret=1 81if [ $ret != 0 ]; then echo "I:failed"; fi 82status=`expr $status + $ret` 83 84echo "I:checking that a forward only doesn't recurse" 85ret=0 86$DIG txt.example5. txt @$f2 -p 5300 > dig.out.f2 || ret=1 87grep "SERVFAIL" dig.out.f2 > /dev/null || ret=1 88if [ $ret != 0 ]; then echo "I:failed"; fi 89status=`expr $status + $ret` 90 91echo "I:checking for negative caching of forwarder response" 92# prime the cache, shutdown the forwarder then check that we can 93# get the answer from the cache. restart forwarder. 94ret=0 95$DIG nonexist. txt @10.53.0.5 -p 5300 > dig.out.f2 || ret=1 96grep "status: NXDOMAIN" dig.out.f2 > /dev/null || ret=1 97$PERL ../stop.pl . ns4 || ret=1 98$DIG nonexist. txt @10.53.0.5 -p 5300 > dig.out.f2 || ret=1 99grep "status: NXDOMAIN" dig.out.f2 > /dev/null || ret=1 100$PERL ../start.pl --restart --noclean . ns4 || ret=1 101if [ $ret != 0 ]; then echo "I:failed"; fi 102status=`expr $status + $ret` 103 104echo "I:checking that forward only zone overrides empty zone" 105ret=0 106$DIG 1.0.10.in-addr.arpa TXT @10.53.0.4 -p 5300 > dig.out.f2 107grep "status: NOERROR" dig.out.f2 > /dev/null || ret=1 108$DIG 2.0.10.in-addr.arpa TXT @10.53.0.4 -p 5300 > dig.out.f2 109grep "status: NXDOMAIN" dig.out.f2 > /dev/null || ret=1 110if [ $ret != 0 ]; then echo "I:failed"; fi 111status=`expr $status + $ret` 112 113echo "I:checking that DS lookups for grafting forward zones are isolated" 114ret=0 115$DIG grafted A @10.53.0.4 -p 5300 > dig.out.q1 116$DIG grafted DS @10.53.0.4 -p 5300 > dig.out.q2 117$DIG grafted A @10.53.0.4 -p 5300 > dig.out.q3 118$DIG grafted AAAA @10.53.0.4 -p 5300 > dig.out.q4 119grep "status: NOERROR" dig.out.q1 > /dev/null || ret=1 120grep "status: NXDOMAIN" dig.out.q2 > /dev/null || ret=1 121grep "status: NOERROR" dig.out.q3 > /dev/null || ret=1 122grep "status: NOERROR" dig.out.q4 > /dev/null || ret=1 123if [ $ret != 0 ]; then echo "I:failed"; fi 124status=`expr $status + $ret` 125 126echo "I:exit status: $status" 127exit $status 128