3 # Copyright (C) 2004, 2007, 2009, 2012-2014 Internet Systems Consortium, Inc. ("ISC")
5 # Permission to use, copy, modify, and/or distribute this software for any
6 # purpose with or without fee is hereby granted, provided that the above
7 # copyright notice and this permission notice appear in all copies.
9 # THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
10 # REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
11 # AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
12 # INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
13 # LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
14 # OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
15 # PERFORMANCE OF THIS SOFTWARE.
18 .
$SYSTEMTESTTOP/conf.sh
23 echo "I: checking that we detect a NS which refers to a CNAME"
24 if $CHECKZONE . cname.db
> cname.out
2>&1
26 echo "I:failed (status)"; status
=`expr $status + 1`
28 if grep "is a CNAME" cname.out
> /dev
/null
32 echo "I:failed (message)"; status
=`expr $status + 1`
37 echo "I: checking that we detect a NS which is below a DNAME"
38 if $CHECKZONE . dname.db
> dname.out
2>&1
40 echo "I:failed (status)"; status
=`expr $status + 1`
42 if grep "is below a DNAME" dname.out
> /dev
/null
46 echo "I:failed (message)"; status
=`expr $status + 1`
51 echo "I: checking that we detect a NS which has no address records (A/AAAA)"
52 if $CHECKZONE . noaddress.db
> noaddress.out
54 echo "I:failed (status)"; status
=`expr $status + 1`
56 if grep "has no address records" noaddress.out
> /dev
/null
60 echo "I:failed (message)"; status
=`expr $status + 1`
65 echo "I: checking that we detect a NS which has no records"
66 if $CHECKZONE . nxdomain.db
> nxdomain.out
68 echo "I:failed (status)"; status
=`expr $status + 1`
70 if grep "has no address records" noaddress.out
> /dev
/null
74 echo "I:failed (message)"; status
=`expr $status + 1`
79 echo "I: checking that we detect a NS which looks like a A record (fail)"
80 if $CHECKZONE -n fail . a.db
> a.out
2>&1
82 echo "I:failed (status)"; status
=`expr $status + 1`
84 if grep "appears to be an address" a.out
> /dev
/null
88 echo "I:failed (message)"; status
=`expr $status + 1`
93 echo "I: checking that we detect a NS which looks like a A record (warn=default)"
94 if $CHECKZONE . a.db
> a.out
2>&1
96 if grep "appears to be an address" a.out
> /dev
/null
100 echo "I:failed (message)"; status
=`expr $status + 1`
103 echo "I:failed (status)"; status
=`expr $status + 1`
107 echo "I: checking that we detect a NS which looks like a A record (ignore)"
108 if $CHECKZONE -n ignore . a.db
> a.out
2>&1
110 if grep "appears to be an address" a.out
> /dev
/null
112 echo "I:failed (message)"; status
=`expr $status + 1`
117 echo "I:failed (status)"; status
=`expr $status + 1`
121 echo "I: checking that we detect a NS which looks like a AAAA record (fail)"
122 if $CHECKZONE -n fail . aaaa.db
> aaaa.out
2>&1
124 echo "I:failed (status)"; status
=`expr $status + 1`
126 if grep "appears to be an address" aaaa.out
> /dev
/null
130 echo "I:failed (message)"; status
=`expr $status + 1`
135 echo "I: checking that we detect a NS which looks like a AAAA record (warn=default)"
136 if $CHECKZONE . aaaa.db
> aaaa.out
2>&1
138 if grep "appears to be an address" aaaa.out
> /dev
/null
142 echo "I:failed (message)"; status
=`expr $status + 1`
145 echo "I:failed (status)"; status
=`expr $status + 1`
149 echo "I: checking that we detect a NS which looks like a AAAA record (ignore)"
150 if $CHECKZONE -n ignore . aaaa.db
> aaaa.out
2>&1
152 if grep "appears to be an address" aaaa.out
> /dev
/null
154 echo "I:failed (message)"; status
=`expr $status + 1`
159 echo "I:failed (status)"; status
=`expr $status + 1`
163 echo "I: checking 'rdnc zonestatus' output"
165 for i
in 0 1 2 3 4 5 6 7 8 9
167 $RNDC -c ..
/common
/rndc.conf
-s 10.53.0.1 -p 9953 zonestatus master.example
> rndc.out.master
2>&1
168 grep "zone not loaded" rndc.out.master
> /dev
/null ||
break
172 grep "$1" $2 > /dev
/null ||
{
174 echo "I: missing '$1' from '$2'"
177 checkfor
"name: master.example" rndc.out.master
178 checkfor
"type: master" rndc.out.master
179 checkfor
"files: master.db, master.db.signed" rndc.out.master
180 checkfor
"serial: " rndc.out.master
181 checkfor
"nodes: " rndc.out.master
182 checkfor
"last loaded: " rndc.out.master
183 checkfor
"secure: yes" rndc.out.master
184 checkfor
"inline signing: no" rndc.out.master
185 checkfor
"key maintenance: automatic" rndc.out.master
186 checkfor
"next key event: " rndc.out.master
187 checkfor
"next resign node: " rndc.out.master
188 checkfor
"next resign time: " rndc.out.master
189 checkfor
"dynamic: yes" rndc.out.master
190 checkfor
"frozen: no" rndc.out.master
191 for i
in 0 1 2 3 4 5 6 7 8 9
193 $RNDC -c ..
/common
/rndc.conf
-s 10.53.0.2 -p 9953 zonestatus master.example
> rndc.out.slave
2>&1
194 grep "zone not loaded" rndc.out.slave
> /dev
/null ||
break
197 checkfor
"name: master.example" rndc.out.slave
198 checkfor
"type: slave" rndc.out.slave
199 checkfor
"files: slave.db" rndc.out.slave
200 checkfor
"serial: " rndc.out.slave
201 checkfor
"nodes: " rndc.out.slave
202 checkfor
"next refresh: " rndc.out.slave
203 checkfor
"expires: " rndc.out.slave
204 checkfor
"secure: yes" rndc.out.slave
205 for i
in 0 1 2 3 4 5 6 7 8 9
207 $RNDC -c ..
/common
/rndc.conf
-s 10.53.0.1 -p 9953 zonestatus reload.example
> rndc.out.prereload
2>&1
208 grep "zone not loaded" rndc.out.prereload
> /dev
/null ||
break
211 checkfor
"files: reload.db, soa.db$" rndc.out.prereload
212 echo "@ 0 SOA . . 2 0 0 0 0" > ns
1/soa.db
213 $RNDC -c ..
/common
/rndc.conf
-s 10.53.0.1 -p 9953 reload reload.example
214 for i
in 0 1 2 3 4 5 6 7 8 9
216 $DIG reload.example SOA @
10.53.0.1 -p 5300 > dig.out
217 grep " 2 0 0 0 0" dig.out
>/dev
/null
&& break
220 $RNDC -c ..
/common
/rndc.conf
-s 10.53.0.1 -p 9953 zonestatus reload.example
> rndc.out.postreload
2>&1
221 checkfor
"files: reload.db, soa.db$" rndc.out.postreload
223 echo "@ 0 SOA . . 3 0 0 0 0" > ns
1/reload.db
224 echo "@ 0 NS ." >> ns
1/reload.db
225 $RNDC -c ..
/common
/rndc.conf
-s 10.53.0.1 -p 9953 reload reload.example
226 for i
in 0 1 2 3 4 5 6 7 8 9
228 $DIG reload.example SOA @
10.53.0.1 -p 5300 > dig.out
229 grep " 3 0 0 0 0" dig.out
>/dev
/null
&& break
232 $RNDC -c ..
/common
/rndc.conf
-s 10.53.0.1 -p 9953 zonestatus reload.example
> rndc.out.removeinclude
2>&1
233 checkfor
"files: reload.db$" rndc.out.removeinclude
235 if [ $ret != 0 ]; then echo "I:failed"; fi
236 status
=`expr $status + $ret`
238 echo "I: checking 'rdnc zonestatus' with duplicated zone name"
240 $RNDC -c ..
/common
/rndc.conf
-s 10.53.0.1 -p 9953 zonestatus duplicate.example
> rndc.out.duplicate
2>&1
241 checkfor
"zone 'duplicate.example' was found in multiple views" rndc.out.duplicate
242 $RNDC -c ..
/common
/rndc.conf
-s 10.53.0.1 -p 9953 zonestatus duplicate.example
in primary
> rndc.out.duplicate
2>&1
243 checkfor
"name: duplicate.example" rndc.out.duplicate
244 $RNDC -c ..
/common
/rndc.conf
-s 10.53.0.1 -p 9953 zonestatus nosuchzone.example
> rndc.out.duplicate
2>&1
245 checkfor
"no matching zone 'nosuchzone.example' in any view" rndc.out.duplicate
246 if [ $ret != 0 ]; then echo "I:failed"; fi
247 status
=`expr $status + $ret`
249 echo "I:exit status: $status"