tests.sh 5.27 KB
Newer Older
1 2
#!/bin/sh
#
3
# Copyright (C) Internet Systems Consortium, Inc. ("ISC")
Mark Andrews's avatar
Mark Andrews committed
4
#
5 6 7
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 9 10
#
# See the COPYRIGHT file distributed with this work for additional
# information regarding copyright ownership.
11

12
. ../conf.sh
13 14 15 16

status=0
n=1

Evan Hunt's avatar
Evan Hunt committed
17
DIGOPTS="+tcp +noadd +nosea +nostat +nocmd -p ${PORT}"
18 19

# Entry should exist.
Evan Hunt's avatar
Evan Hunt committed
20
echo_i "check for failure from on zone load for 'check-names fail;' ($n)"
21 22 23 24
ret=0
$DIG $DIGOPTS fail.example. @10.53.0.1 a > dig.out.ns1.test$n || ret=1
grep SERVFAIL dig.out.ns1.test$n > /dev/null || ret=1
grep 'xx_xx.fail.example: bad owner name (check-names)' ns1/named.run > /dev/null || ret=1
Evan Hunt's avatar
Evan Hunt committed
25
if [ $ret != 0 ]; then echo_i "failed"; fi
26 27 28 29
status=`expr $status + $ret`
n=`expr $n + 1`

# Entry should exist.
Evan Hunt's avatar
Evan Hunt committed
30
echo_i "check for warnings from on zone load for 'check-names warn;' ($n)"
31 32
ret=0
grep 'xx_xx.warn.example: bad owner name (check-names)' ns1/named.run > /dev/null || ret=1
Evan Hunt's avatar
Evan Hunt committed
33
if [ $ret != 0 ]; then echo_i "failed"; fi
34 35 36 37
status=`expr $status + $ret`
n=`expr $n + 1`

# Entry should not exist.
Evan Hunt's avatar
Evan Hunt committed
38
echo_i "check for warnings from on zone load for 'check-names ignore;' ($n)"
39 40
ret=1
grep 'yy_yy.ignore.example: bad owner name (check-names)' ns1/named.run || ret=0
Evan Hunt's avatar
Evan Hunt committed
41
if [ $ret != 0 ]; then echo_i "failed"; fi
42 43 44 45
status=`expr $status + $ret`
n=`expr $n + 1`

# Entry should exist
Evan Hunt's avatar
Evan Hunt committed
46
echo_i "check that 'check-names response warn;' works ($n)"
47
ret=0
48 49
$DIG $DIGOPTS +noauth yy_yy.ignore.example. @10.53.0.1 a > dig.out.ns1.test$n || ret=1
$DIG $DIGOPTS +noauth yy_yy.ignore.example. @10.53.0.2 a > dig.out.ns2.test$n || ret=1
Evan Hunt's avatar
Evan Hunt committed
50
digcomp dig.out.ns1.test$n dig.out.ns2.test$n || ret=1
51
grep "check-names warning yy_yy.ignore.example/A/IN" ns2/named.run > /dev/null || ret=1
Evan Hunt's avatar
Evan Hunt committed
52
if [ $ret != 0 ]; then echo_i "failed"; fi
53 54 55 56
status=`expr $status + $ret`
n=`expr $n + 1`

# Entry should exist
Evan Hunt's avatar
Evan Hunt committed
57
echo_i "check that 'check-names response (owner) fails;' works ($n)"
58 59 60 61 62 63
ret=0
$DIG $DIGOPTS yy_yy.ignore.example. @10.53.0.1 a > dig.out.ns1.test$n || ret=1
$DIG $DIGOPTS yy_yy.ignore.example. @10.53.0.3 a > dig.out.ns3.test$n || ret=1
grep NOERROR dig.out.ns1.test$n > /dev/null || ret=1
grep REFUSED dig.out.ns3.test$n > /dev/null || ret=1
grep "check-names failure yy_yy.ignore.example/A/IN" ns3/named.run > /dev/null || ret=1
Evan Hunt's avatar
Evan Hunt committed
64
if [ $ret != 0 ]; then echo_i "failed"; fi
65 66 67 68
status=`expr $status + $ret`
n=`expr $n + 1`

# Entry should exist
Evan Hunt's avatar
Evan Hunt committed
69
echo_i "check that 'check-names response (rdata) fails;' works ($n)"
70 71 72 73 74 75
ret=0
$DIG $DIGOPTS mx.ignore.example. @10.53.0.1 MX > dig.out.ns1.test$n || ret=1
$DIG $DIGOPTS mx.ignore.example. @10.53.0.3 MX > dig.out.ns3.test$n || ret=1
grep NOERROR dig.out.ns1.test$n > /dev/null || ret=1
grep SERVFAIL dig.out.ns3.test$n > /dev/null || ret=1
grep "check-names failure mx.ignore.example/MX/IN" ns3/named.run > /dev/null || ret=1
Evan Hunt's avatar
Evan Hunt committed
76
if [ $ret != 0 ]; then echo_i "failed"; fi
77 78 79
status=`expr $status + $ret`
n=`expr $n + 1`

Evan Hunt's avatar
Evan Hunt committed
80
echo_i "check that updates to 'check-names fail;' are rejected ($n)"
81 82
ret=0
not=1
83
$NSUPDATE -d <<END > nsupdate.out.test$n 2>&1 || not=0
84
check-names off
Evan Hunt's avatar
Evan Hunt committed
85
server 10.53.0.1 ${PORT}
86 87 88 89 90 91 92
update add xxx_xxx.fail.update. 600 A 10.10.10.1
send
END
if [ $not != 0 ]; then ret=1; fi
$DIG $DIGOPTS xxx_xxx.fail.update @10.53.0.1 A > dig.out.ns1.test$n || ret=1
grep "xxx_xxx.fail.update/A: bad owner name (check-names)" ns1/named.run > /dev/null || ret=1
grep NXDOMAIN dig.out.ns1.test$n > /dev/null || ret=1
Evan Hunt's avatar
Evan Hunt committed
93
if [ $ret != 0 ]; then echo_i "failed"; fi
94 95 96
status=`expr $status + $ret`
n=`expr $n + 1`

Evan Hunt's avatar
Evan Hunt committed
97
echo_i "check that updates to 'check-names warn;' succeed and are logged ($n)"
98
ret=0
99
$NSUPDATE -d <<END > nsupdate.out.test$n  2>&1|| ret=1
100
check-names off
Evan Hunt's avatar
Evan Hunt committed
101
server 10.53.0.1 ${PORT}
102 103 104 105 106 107
update add xxx_xxx.warn.update. 600 A 10.10.10.1
send
END
$DIG $DIGOPTS xxx_xxx.warn.update @10.53.0.1 A > dig.out.ns1.test$n || ret=1
grep "xxx_xxx.warn.update/A: bad owner name (check-names)" ns1/named.run > /dev/null || ret=1
grep NOERROR dig.out.ns1.test$n > /dev/null || ret=1
Evan Hunt's avatar
Evan Hunt committed
108
if [ $ret != 0 ]; then echo_i "failed"; fi
109 110 111
status=`expr $status + $ret`
n=`expr $n + 1`

Evan Hunt's avatar
Evan Hunt committed
112
echo_i "check that updates to 'check-names ignore;' succeed and are not logged ($n)"
113 114
ret=0
not=1
115
$NSUPDATE -d <<END > nsupdate.out.test$n 2>&1 || ret=1
116
check-names off
Evan Hunt's avatar
Evan Hunt committed
117
server 10.53.0.1 ${PORT}
118 119 120 121 122 123 124
update add xxx_xxx.ignore.update. 600 A 10.10.10.1
send
END
grep "xxx_xxx.ignore.update/A.*(check-names)" ns1/named.run > /dev/null || not=0
if [ $not != 0 ]; then ret=1; fi
$DIG $DIGOPTS xxx_xxx.ignore.update @10.53.0.1 A > dig.out.ns1.test$n || ret=1
grep NOERROR dig.out.ns1.test$n > /dev/null || ret=1
Evan Hunt's avatar
Evan Hunt committed
125
if [ $ret != 0 ]; then echo_i "failed"; fi
126 127 128
status=`expr $status + $ret`
n=`expr $n + 1`

129
echo_i "check that updates to 'check-names primary ignore;' succeed and are not logged ($n)"
130 131
ret=0
not=1
132
$NSUPDATE -d <<END > nsupdate.out.test$n 2>&1 || ret=1
133
check-names off
Evan Hunt's avatar
Evan Hunt committed
134
server 10.53.0.4 ${PORT}
135 136 137 138 139 140 141
update add xxx_xxx.master-ignore.update. 600 A 10.10.10.1
send
END
grep "xxx_xxx.master-ignore.update/A.*(check-names)" ns1/named.run > /dev/null || not=0
if [ $not != 0 ]; then ret=1; fi
$DIG $DIGOPTS xxx_xxx.master-ignore.update @10.53.0.4 A > dig.out.ns4.test$n || ret=1
grep NOERROR dig.out.ns4.test$n > /dev/null || ret=1
Evan Hunt's avatar
Evan Hunt committed
142
if [ $ret != 0 ]; then echo_i "failed"; fi
143 144 145
status=`expr $status + $ret`
n=`expr $n + 1`

Evan Hunt's avatar
Evan Hunt committed
146
echo_i "exit status: $status"
147
[ $status -eq 0 ] || exit 1