3 # Copyright (C) 2004, 2007, 2011-2014 Internet Systems Consortium, Inc. ("ISC")
4 # Copyright (C) 2000, 2001 Internet Software Consortium.
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.
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.
18 # Id: tests.sh,v 1.13 2011/10/13 22:18:05 marka Exp
20 # ns1 = stealth master
21 # ns2 = slave with update forwarding disabled; not currently used
22 # ns3 = slave with update forwarding enabled
25 .
$SYSTEMTESTTOP/conf.sh
32 echo "I:waiting for servers to be ready for testing ($n)"
33 for i
in 1 2 3 4 5 6 7 8 9 10
36 $DIG +tcp example. @
10.53.0.1 soa
-p 5300 > dig.out.ns1 || ret
=1
37 grep "status: NOERROR" dig.out.ns1
> /dev
/null || ret
=1
38 $DIG +tcp example. @
10.53.0.2 soa
-p 5300 > dig.out.ns2 || ret
=1
39 grep "status: NOERROR" dig.out.ns2
> /dev
/null || ret
=1
40 $DIG +tcp example. @
10.53.0.3 soa
-p 5300 > dig.out.ns3 || ret
=1
41 grep "status: NOERROR" dig.out.ns3
> /dev
/null || ret
=1
42 test $ret = 0 && break
45 if [ $ret != 0 ] ; then echo "I:failed"; status
=`expr $status + $ret`; fi
48 echo "I:fetching master copy of zone before update ($n)"
50 $DIG +tcp
+noadd
+nosea
+nostat
+noquest
+nocomm
+nocmd example.\
51 @
10.53.0.1 axfr
-p 5300 > dig.out.ns1 || ret
=1
52 if [ $ret != 0 ] ; then echo "I:failed"; status
=`expr $status + $ret`; fi
55 echo "I:fetching slave 1 copy of zone before update ($n)"
56 $DIG +tcp
+noadd
+nosea
+nostat
+noquest
+nocomm
+nocmd example.\
57 @
10.53.0.2 axfr
-p 5300 > dig.out.ns2 || ret
=1
58 if [ $ret != 0 ] ; then echo "I:failed"; status
=`expr $status + $ret`; fi
61 echo "I:fetching slave 2 copy of zone before update ($n)"
63 $DIG +tcp
+noadd
+nosea
+nostat
+noquest
+nocomm
+nocmd example.\
64 @
10.53.0.3 axfr
-p 5300 > dig.out.ns3 || ret
=1
65 if [ $ret != 0 ] ; then echo "I:failed"; status
=`expr $status + $ret`; fi
68 echo "I:comparing pre-update copies to known good data ($n)"
70 $PERL ..
/digcomp.pl knowngood.before
dig.out.ns1 || ret
=1
71 $PERL ..
/digcomp.pl knowngood.before
dig.out.ns2 || ret
=1
72 $PERL ..
/digcomp.pl knowngood.before
dig.out.ns3 || ret
=1
73 if [ $ret != 0 ] ; then echo "I:failed"; status
=`expr $status + $ret`; fi
75 echo "I:updating zone (signed) ($n)"
77 $NSUPDATE -y update.example
:c3Ryb25nIGVub3VnaCBmb3IgYSBtYW4gYnV0IG1hZGUgZm9yIGEgd29tYW4K
-- - <<EOF || ret=1
79 update add updated.example. 600 A 10.10.10.1
80 update add updated.example. 600 TXT Foo
83 if [ $ret != 0 ] ; then echo "I:failed"; status
=`expr $status + $ret`; fi
86 echo "I:sleeping 15 seconds for server to incorporate changes"
89 echo "I:fetching master copy of zone after update ($n)"
91 $DIG +tcp
+noadd
+nosea
+nostat
+noquest
+nocomm
+nocmd example.\
92 @
10.53.0.1 axfr
-p 5300 > dig.out.ns1 || ret
=1
93 if [ $ret != 0 ] ; then echo "I:failed"; status
=`expr $status + $ret`; fi
96 echo "I:fetching slave 1 copy of zone after update ($n)"
98 $DIG +tcp
+noadd
+nosea
+nostat
+noquest
+nocomm
+nocmd example.\
99 @
10.53.0.2 axfr
-p 5300 > dig.out.ns2 || ret
=1
100 if [ $ret != 0 ] ; then echo "I:failed"; status
=`expr $status + $ret`; fi
102 echo "I:fetching slave 2 copy of zone after update ($n)"
104 $DIG +tcp
+noadd
+nosea
+nostat
+noquest
+nocomm
+nocmd example.\
105 @
10.53.0.3 axfr
-p 5300 > dig.out.ns3 || ret
=1
106 if [ $ret != 0 ] ; then echo "I:failed"; status
=`expr $status + $ret`; fi
109 echo "I:comparing post-update copies to known good data ($n)"
111 $PERL ..
/digcomp.pl knowngood.after1
dig.out.ns1 || ret
=1
112 $PERL ..
/digcomp.pl knowngood.after1
dig.out.ns2 || ret
=1
113 $PERL ..
/digcomp.pl knowngood.after1
dig.out.ns3 || ret
=1
114 if [ $ret != 0 ] ; then echo "I:failed"; status
=`expr $status + $ret`; fi
116 echo "I:checking 'forwarding update for zone' is logged ($n)"
118 grep "forwarding update for zone 'example/IN'" ns
3/named.run
> /dev
/null || ret
=1
119 if [ $ret != 0 ] ; then echo "I:failed"; status
=`expr $status + $ret`; fi
122 echo "I:updating zone (unsigned) ($n)"
124 $NSUPDATE -- - <<EOF || ret=1
125 server 10.53.0.3 5300
126 update add unsigned.example. 600 A 10.10.10.1
127 update add unsigned.example. 600 TXT Foo
130 if [ $ret != 0 ] ; then echo "I:failed"; status
=`expr $status + $ret`; fi
133 echo "I:sleeping 15 seconds for server to incorporate changes"
136 echo "I:fetching master copy of zone after update ($n)"
138 $DIG +tcp
+noadd
+nosea
+nostat
+noquest
+nocomm
+nocmd example.\
139 @
10.53.0.1 axfr
-p 5300 > dig.out.ns1 || ret
=1
140 if [ $ret != 0 ] ; then echo "I:failed"; status
=`expr $status + $ret`; fi
142 echo "I:fetching slave 1 copy of zone after update ($n)"
144 $DIG +tcp
+noadd
+nosea
+nostat
+noquest
+nocomm
+nocmd example.\
145 @
10.53.0.2 axfr
-p 5300 > dig.out.ns2 || ret
=1
146 if [ $ret != 0 ] ; then echo "I:failed"; status
=`expr $status + $ret`; fi
149 echo "I:fetching slave 2 copy of zone after update ($n)"
151 $DIG +tcp
+noadd
+nosea
+nostat
+noquest
+nocomm
+nocmd example.\
152 @
10.53.0.3 axfr
-p 5300 > dig.out.ns3 || ret
=1
153 if [ $ret != 0 ] ; then echo "I:failed"; status
=`expr $status + $ret`; fi
155 echo "I:comparing post-update copies to known good data ($n)"
157 $PERL ..
/digcomp.pl knowngood.after2
dig.out.ns1 || ret
=1
158 $PERL ..
/digcomp.pl knowngood.after2
dig.out.ns2 || ret
=1
159 $PERL ..
/digcomp.pl knowngood.after2
dig.out.ns3 || ret
=1
160 if [ $ret != 0 ] ; then echo "I:failed"; status
=`expr $status + $ret`; fi
163 echo "I:checking update forwarding to dead master ($n)"
166 while [ $count -lt 5 -a $ret -eq 0 ]
170 server 10.53.0.3 5300
172 update add unsigned.nomaster. 600 A 10.10.10.1
173 update add unsigned.nomaster. 600 TXT Foo
177 $DIG +notcp
+noadd
+noauth nomaster.\
178 @
10.53.0.3 soa
-p 5300 > dig.out.ns3 || ret
=1
179 grep "status: NOERROR" dig.out.ns3
> /dev
/null || ret
=1
180 count
=`expr $count + 1`
182 if [ $ret != 0 ] ; then echo "I:failed"; status
=`expr $status + $ret`; fi
187 echo "I:checking update forwarding to with sig0 ($n)"
189 keyname
=`cat keyname`
190 $NSUPDATE -k $keyname.private
-- - <<EOF
191 server 10.53.0.3 5300
193 update add unsigned.example2. 600 A 10.10.10.1
194 update add unsigned.example2. 600 TXT Foo
197 $DIG unsigned.example2 A @
10.53.0.1 -p 5300 > dig.out.ns1.
test$n
198 grep "status: NOERROR" dig.out.ns1.
test$n > /dev
/null || ret
=1
199 if [ $ret != 0 ] ; then echo "I:failed"; fi
200 status
=`expr $status + $ret`
204 echo "I:exit status: $status"