📄 tests.sh
字号:
#!/bin/sh## Copyright (C) 2004 Internet Systems Consortium, Inc. ("ISC")# Copyright (C) 2000-2002 Internet Software Consortium.## Permission to use, copy, modify, and distribute this software for any# 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.# $Id: tests.sh,v 1.33.12.6 2004/05/18 03:06:24 marka Exp $SYSTEMTESTTOP=... $SYSTEMTESTTOP/conf.shstatus=0n=0rm -f dig.out.*DIGOPTS="+tcp +noadd +nosea +nostat +nocmd +dnssec -p 5300"# Check the example. domainecho "I:checking that zone transfer worked ($n)"ret=0$DIG $DIGOPTS a.example. @10.53.0.2 a > dig.out.ns2.test$n || ret=1$DIG $DIGOPTS a.example. @10.53.0.3 a > dig.out.ns3.test$n || ret=1$PERL ../digcomp.pl dig.out.ns2.test$n dig.out.ns3.test$n || ret=1n=`expr $n + 1`if [ $ret != 0 ]; then echo "I:failed"; fistatus=`expr $status + $ret`echo "I:checking positive validation ($n)"ret=0$DIG $DIGOPTS +noauth a.example. @10.53.0.2 a > dig.out.ns2.test$n || ret=1$DIG $DIGOPTS +noauth a.example. @10.53.0.4 a > dig.out.ns4.test$n || ret=1$PERL ../digcomp.pl dig.out.ns2.test$n dig.out.ns4.test$n || ret=1grep "flags:.*ad.*QUERY" dig.out.ns4.test$n > /dev/null || ret=1n=`expr $n + 1`if [ $ret != 0 ]; then echo "I:failed"; fistatus=`expr $status + $ret`echo "I:checking positive wildcard validation ($n)"ret=0$DIG $DIGOPTS a.wild.example. @10.53.0.2 a > dig.out.ns2.test$n || ret=1$DIG $DIGOPTS a.wild.example. @10.53.0.4 a > dig.out.ns4.test$n || ret=1$PERL ../digcomp.pl dig.out.ns2.test$n dig.out.ns4.test$n || ret=1grep "flags:.*ad.*QUERY" dig.out.ns4.test$n > /dev/null || ret=1n=`expr $n + 1`if [ $ret != 0 ]; then echo "I:failed"; fistatus=`expr $status + $ret`echo "I:checking negative validation ($n)"ret=0$DIG $DIGOPTS +noauth q.example. @10.53.0.2 a > dig.out.ns2.test$n || ret=1$DIG $DIGOPTS +noauth q.example. @10.53.0.4 a > dig.out.ns4.test$n || ret=1$PERL ../digcomp.pl dig.out.ns2.test$n dig.out.ns4.test$n || ret=1grep "flags:.*ad.*QUERY" dig.out.ns4.test$n > /dev/null || ret=1n=`expr $n + 1`if [ $ret != 0 ]; then echo "I:failed"; fistatus=`expr $status + $ret`echo "I:checking negative wildcard validation ($n)"ret=0$DIG $DIGOPTS b.wild.example. @10.53.0.2 txt > dig.out.ns2.test$n || ret=1$DIG $DIGOPTS b.wild.example. @10.53.0.4 txt > dig.out.ns4.test$n || ret=1$PERL ../digcomp.pl dig.out.ns2.test$n dig.out.ns4.test$n || ret=1grep "flags:.*ad.*QUERY" dig.out.ns4.test$n > /dev/null || ret=1n=`expr $n + 1`if [ $ret != 0 ]; then echo "I:failed"; fistatus=`expr $status + $ret`# Check the insecure.example domainecho "I:checking 1-server insecurity proof ($n)"ret=0$DIG $DIGOPTS +noauth a.insecure.example. @10.53.0.3 a > dig.out.ns3.test$n || ret=1$DIG $DIGOPTS +noauth a.insecure.example. @10.53.0.4 a > dig.out.ns4.test$n || ret=1$PERL ../digcomp.pl dig.out.ns3.test$n dig.out.ns4.test$n || ret=1grep "status: NOERROR" dig.out.ns4.test$n > /dev/null || ret=1# Note - this is looking for failure, hence the &&grep "flags:.*ad.*QUERY" dig.out.ns4.test$n > /dev/null && ret=1n=`expr $n + 1`if [ $ret != 0 ]; then echo "I:failed"; fistatus=`expr $status + $ret`echo "I:checking 1-server negative insecurity proof ($n)"ret=0$DIG $DIGOPTS q.insecure.example. a @10.53.0.3 \ > dig.out.ns3.test$n || ret=1$DIG $DIGOPTS q.insecure.example. a @10.53.0.4 \ > dig.out.ns4.test$n || ret=1$PERL ../digcomp.pl dig.out.ns3.test$n dig.out.ns4.test$n || ret=1grep "status: NXDOMAIN" dig.out.ns4.test$n > /dev/null || ret=1# Note - this is looking for failure, hence the &&grep "flags:.*ad.*QUERY" dig.out.ns4.test$n > /dev/null && ret=1n=`expr $n + 1`if [ $ret != 0 ]; then echo "I:failed"; fistatus=`expr $status + $ret`echo "I:checking 1-server negative insecurity proof with SOA hack ($n)"ret=0$DIG $DIGOPTS r.insecure.example. soa @10.53.0.3 \ > dig.out.ns3.test$n || ret=1$DIG $DIGOPTS r.insecure.example. soa @10.53.0.4 \ > dig.out.ns4.test$n || ret=1$PERL ../digcomp.pl dig.out.ns3.test$n dig.out.ns4.test$n || ret=1grep "status: NXDOMAIN" dig.out.ns4.test$n > /dev/null || ret=1# Note - this is looking for failure, hence the &&grep "flags:.*ad.*QUERY" dig.out.ns4.test$n > /dev/null && ret=1n=`expr $n + 1`if [ $ret != 0 ]; then echo "I:failed"; fistatus=`expr $status + $ret`# Check the secure.example domainecho "I:checking multi-stage positive validation ($n)"ret=0$DIG $DIGOPTS +noauth a.secure.example. @10.53.0.3 a > dig.out.ns3.test$n || ret=1$DIG $DIGOPTS +noauth a.secure.example. @10.53.0.4 a > dig.out.ns4.test$n || ret=1$PERL ../digcomp.pl dig.out.ns3.test$n dig.out.ns4.test$n || ret=1grep "flags:.*ad.*QUERY" dig.out.ns4.test$n > /dev/null || ret=1n=`expr $n + 1`if [ $ret != 0 ]; then echo "I:failed"; fistatus=`expr $status + $ret`# Check the bogus domainecho "I:checking failed validation ($n)"ret=0$DIG $DIGOPTS a.bogus.example. @10.53.0.4 a > dig.out.ns4.test$n || ret=1grep "SERVFAIL" dig.out.ns4.test$n > /dev/null || ret=1n=`expr $n + 1`if [ $ret != 0 ]; then echo "I:failed"; fistatus=`expr $status + $ret`# Try validating with a bad trusted key.# This should fail.echo "I:checking that validation fails with a misconfigured trusted key ($n)"ret=0$DIG $DIGOPTS example. soa @10.53.0.5 > dig.out.ns5.test$n || ret=1grep "SERVFAIL" dig.out.ns5.test$n > /dev/null || ret=1n=`expr $n + 1`if [ $ret != 0 ]; then echo "I:failed"; fistatus=`expr $status + $ret`echo "I:checking that negative validation fails with a misconfigured trusted key ($n)"ret=0$DIG $DIGOPTS example. ptr @10.53.0.5 > dig.out.ns5.test$n || ret=1grep "SERVFAIL" dig.out.ns5.test$n > /dev/null || ret=1n=`expr $n + 1`if [ $ret != 0 ]; then echo "I:failed"; fistatus=`expr $status + $ret`echo "I:checking that insecurity proofs fail with a misconfigured trusted key ($n)"ret=0$DIG $DIGOPTS a.insecure.example. a @10.53.0.5 > dig.out.ns5.test$n || ret=1grep "SERVFAIL" dig.out.ns5.test$n > /dev/null || ret=1n=`expr $n + 1`if [ $ret != 0 ]; then echo "I:failed"; fistatus=`expr $status + $ret`echo "I:checking that validation fails when key record is missing ($n)"ret=0$DIG $DIGOPTS a.b.keyless.example. a @10.53.0.4 > dig.out.ns4.test$n || ret=1grep "SERVFAIL" dig.out.ns4.test$n > /dev/null || ret=1n=`expr $n + 1`if [ $ret != 0 ]; then echo "I:failed"; fistatus=`expr $status + $ret`# Check the insecure.secure.example domain (insecurity proof)echo "I:checking 2-server insecurity proof ($n)"ret=0$DIG $DIGOPTS +noauth a.insecure.secure.example. @10.53.0.2 a \ > dig.out.ns2.test$n || ret=1$DIG $DIGOPTS +noauth a.insecure.secure.example. @10.53.0.4 a \ > dig.out.ns4.test$n || ret=1$PERL ../digcomp.pl dig.out.ns2.test$n dig.out.ns4.test$n || ret=1grep "status: NOERROR" dig.out.ns4.test$n > /dev/null || ret=1# Note - this is looking for failure, hence the &&grep "flags:.*ad.*QUERY" dig.out.ns4.test$n > /dev/null && ret=1n=`expr $n + 1`if [ $ret != 0 ]; then echo "I:failed"; fistatus=`expr $status + $ret`# Check a negative response in insecure.secure.exampleecho "I:checking 2-server insecurity proof with a negative answer ($n)"ret=0$DIG $DIGOPTS q.insecure.secure.example. @10.53.0.2 a > dig.out.ns2.test$n \ || ret=1$DIG $DIGOPTS q.insecure.secure.example. @10.53.0.4 a > dig.out.ns4.test$n \ || ret=1$PERL ../digcomp.pl dig.out.ns2.test$n dig.out.ns4.test$n || ret=1grep "status: NXDOMAIN" dig.out.ns4.test$n > /dev/null || ret=1# Note - this is looking for failure, hence the &&grep "flags:.*ad.*QUERY" dig.out.ns4.test$n > /dev/null && ret=1n=`expr $n + 1`if [ $ret != 0 ]; then echo "I:failed"; fistatus=`expr $status + $ret`echo "I:checking 2-server insecurity proof with a negative answer and SOA hack ($n)"ret=0$DIG $DIGOPTS r.insecure.secure.example. @10.53.0.2 soa > dig.out.ns2.test$n \ || ret=1$DIG $DIGOPTS r.insecure.secure.example. @10.53.0.4 soa > dig.out.ns4.test$n \ || ret=1$PERL ../digcomp.pl dig.out.ns2.test$n dig.out.ns4.test$n || ret=1grep "status: NXDOMAIN" dig.out.ns4.test$n > /dev/null || ret=1# Note - this is looking for failure, hence the &&grep "flags:.*ad.*QUERY" dig.out.ns4.test$n > /dev/null && ret=1n=`expr $n + 1`if [ $ret != 0 ]; then echo "I:failed"; fistatus=`expr $status + $ret`# Check that the query for a security root is successful and has ad setecho "I:checking security root query ($n)"ret=0$DIG $DIGOPTS . @10.53.0.4 key > dig.out.ns4.test$n || ret=1grep "NOERROR" dig.out.ns4.test$n > /dev/null || ret=1grep "flags:.*ad.*QUERY" dig.out.ns4.test$n > /dev/null || ret=1n=`expr $n + 1`if [ $ret != 0 ]; then echo "I:failed"; fistatus=`expr $status + $ret`# Check that the setting the cd bit worksecho "I:checking cd bit on a positive answer ($n)"ret=0$DIG $DIGOPTS +noauth example. soa @10.53.0.4 \ > dig.out.ns4.test$n || ret=1
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -