1#!/bin/sh 2# 3# Copyright (C) Internet Systems Consortium, Inc. ("ISC") 4# 5# This Source Code Form is subject to the terms of the Mozilla Public 6# License, v. 2.0. If a copy of the MPL was not distributed with this 7# file, you can obtain one at https://mozilla.org/MPL/2.0/. 8# 9# See the COPYRIGHT file distributed with this work for additional 10# information regarding copyright ownership. 11 12SYSTEMTESTTOP=.. 13. $SYSTEMTESTTOP/conf.sh 14 15status=0 16n=1 17 18DIGOPTS="+tcp +noadd +nosea +nostat +nocmd -p ${PORT}" 19 20# Entry should exist. 21echo_i "check for failure from on zone load for 'check-names fail;' ($n)" 22ret=0 23$DIG $DIGOPTS fail.example. @10.53.0.1 a > dig.out.ns1.test$n || ret=1 24grep SERVFAIL dig.out.ns1.test$n > /dev/null || ret=1 25grep 'xx_xx.fail.example: bad owner name (check-names)' ns1/named.run > /dev/null || ret=1 26if [ $ret != 0 ]; then echo_i "failed"; fi 27status=`expr $status + $ret` 28n=`expr $n + 1` 29 30# Entry should exist. 31echo_i "check for warnings from on zone load for 'check-names warn;' ($n)" 32ret=0 33grep 'xx_xx.warn.example: bad owner name (check-names)' ns1/named.run > /dev/null || ret=1 34if [ $ret != 0 ]; then echo_i "failed"; fi 35status=`expr $status + $ret` 36n=`expr $n + 1` 37 38# Entry should not exist. 39echo_i "check for warnings from on zone load for 'check-names ignore;' ($n)" 40ret=1 41grep 'yy_yy.ignore.example: bad owner name (check-names)' ns1/named.run || ret=0 42if [ $ret != 0 ]; then echo_i "failed"; fi 43status=`expr $status + $ret` 44n=`expr $n + 1` 45 46# Entry should exist 47echo_i "check that 'check-names response warn;' works ($n)" 48ret=0 49$DIG $DIGOPTS +noauth yy_yy.ignore.example. @10.53.0.1 a > dig.out.ns1.test$n || ret=1 50$DIG $DIGOPTS +noauth yy_yy.ignore.example. @10.53.0.2 a > dig.out.ns2.test$n || ret=1 51digcomp dig.out.ns1.test$n dig.out.ns2.test$n || ret=1 52grep "check-names warning yy_yy.ignore.example/A/IN" ns2/named.run > /dev/null || ret=1 53if [ $ret != 0 ]; then echo_i "failed"; fi 54status=`expr $status + $ret` 55n=`expr $n + 1` 56 57# Entry should exist 58echo_i "check that 'check-names response (owner) fails;' works ($n)" 59ret=0 60$DIG $DIGOPTS yy_yy.ignore.example. @10.53.0.1 a > dig.out.ns1.test$n || ret=1 61$DIG $DIGOPTS yy_yy.ignore.example. @10.53.0.3 a > dig.out.ns3.test$n || ret=1 62grep NOERROR dig.out.ns1.test$n > /dev/null || ret=1 63grep REFUSED dig.out.ns3.test$n > /dev/null || ret=1 64grep "check-names failure yy_yy.ignore.example/A/IN" ns3/named.run > /dev/null || ret=1 65if [ $ret != 0 ]; then echo_i "failed"; fi 66status=`expr $status + $ret` 67n=`expr $n + 1` 68 69# Entry should exist 70echo_i "check that 'check-names response (rdata) fails;' works ($n)" 71ret=0 72$DIG $DIGOPTS mx.ignore.example. @10.53.0.1 MX > dig.out.ns1.test$n || ret=1 73$DIG $DIGOPTS mx.ignore.example. @10.53.0.3 MX > dig.out.ns3.test$n || ret=1 74grep NOERROR dig.out.ns1.test$n > /dev/null || ret=1 75grep SERVFAIL dig.out.ns3.test$n > /dev/null || ret=1 76grep "check-names failure mx.ignore.example/MX/IN" ns3/named.run > /dev/null || ret=1 77if [ $ret != 0 ]; then echo_i "failed"; fi 78status=`expr $status + $ret` 79n=`expr $n + 1` 80 81echo_i "check that updates to 'check-names fail;' are rejected ($n)" 82ret=0 83not=1 84$NSUPDATE -d <<END > nsupdate.out.test$n 2>&1 || not=0 85check-names off 86server 10.53.0.1 ${PORT} 87update add xxx_xxx.fail.update. 600 A 10.10.10.1 88send 89END 90if [ $not != 0 ]; then ret=1; fi 91$DIG $DIGOPTS xxx_xxx.fail.update @10.53.0.1 A > dig.out.ns1.test$n || ret=1 92grep "xxx_xxx.fail.update/A: bad owner name (check-names)" ns1/named.run > /dev/null || ret=1 93grep NXDOMAIN dig.out.ns1.test$n > /dev/null || ret=1 94if [ $ret != 0 ]; then echo_i "failed"; fi 95status=`expr $status + $ret` 96n=`expr $n + 1` 97 98echo_i "check that updates to 'check-names warn;' succeed and are logged ($n)" 99ret=0 100$NSUPDATE -d <<END > nsupdate.out.test$n 2>&1|| ret=1 101check-names off 102server 10.53.0.1 ${PORT} 103update add xxx_xxx.warn.update. 600 A 10.10.10.1 104send 105END 106$DIG $DIGOPTS xxx_xxx.warn.update @10.53.0.1 A > dig.out.ns1.test$n || ret=1 107grep "xxx_xxx.warn.update/A: bad owner name (check-names)" ns1/named.run > /dev/null || ret=1 108grep NOERROR dig.out.ns1.test$n > /dev/null || ret=1 109if [ $ret != 0 ]; then echo_i "failed"; fi 110status=`expr $status + $ret` 111n=`expr $n + 1` 112 113echo_i "check that updates to 'check-names ignore;' succeed and are not logged ($n)" 114ret=0 115not=1 116$NSUPDATE -d <<END > nsupdate.out.test$n 2>&1 || ret=1 117check-names off 118server 10.53.0.1 ${PORT} 119update add xxx_xxx.ignore.update. 600 A 10.10.10.1 120send 121END 122grep "xxx_xxx.ignore.update/A.*(check-names)" ns1/named.run > /dev/null || not=0 123if [ $not != 0 ]; then ret=1; fi 124$DIG $DIGOPTS xxx_xxx.ignore.update @10.53.0.1 A > dig.out.ns1.test$n || ret=1 125grep NOERROR dig.out.ns1.test$n > /dev/null || ret=1 126if [ $ret != 0 ]; then echo_i "failed"; fi 127status=`expr $status + $ret` 128n=`expr $n + 1` 129 130echo_i "check that updates to 'check-names primary ignore;' succeed and are not logged ($n)" 131ret=0 132not=1 133$NSUPDATE -d <<END > nsupdate.out.test$n 2>&1 || ret=1 134check-names off 135server 10.53.0.4 ${PORT} 136update add xxx_xxx.master-ignore.update. 600 A 10.10.10.1 137send 138END 139grep "xxx_xxx.master-ignore.update/A.*(check-names)" ns1/named.run > /dev/null || not=0 140if [ $not != 0 ]; then ret=1; fi 141$DIG $DIGOPTS xxx_xxx.master-ignore.update @10.53.0.4 A > dig.out.ns4.test$n || ret=1 142grep NOERROR dig.out.ns4.test$n > /dev/null || ret=1 143if [ $ret != 0 ]; then echo_i "failed"; fi 144status=`expr $status + $ret` 145n=`expr $n + 1` 146 147echo_i "exit status: $status" 148[ $status -eq 0 ] || exit 1 149