1#!/bin/sh 2 3# Copyright (C) Internet Systems Consortium, Inc. ("ISC") 4# 5# SPDX-License-Identifier: MPL-2.0 6# 7# This Source Code Form is subject to the terms of the Mozilla Public 8# License, v. 2.0. If a copy of the MPL was not distributed with this 9# file, you can obtain one at https://mozilla.org/MPL/2.0/. 10# 11# See the COPYRIGHT file distributed with this work for additional 12# information regarding copyright ownership. 13 14SYSTEMTESTTOP=.. 15. $SYSTEMTESTTOP/conf.sh 16 17DIGOPTS="-p ${PORT}" 18 19status=0 20n=1 21 22echo_i "check that 'check-integrity yes; check-mx-cname fail;' works ($n)" 23ret=0 24$DIG $DIGOPTS @10.53.0.1 mx mx-cname-fail > dig.out.test$n || ret=1 25grep "status: SERVFAIL," dig.out.test$n > /dev/null || ret=1 26grep "zone mx-cname-fail/IN: mx-cname-fail/MX 'cname.mx-cname-fail' is a CNAME (illegal)" ns1/named.run > /dev/null || ret=1 27n=`expr $n + 1` 28if [ $ret != 0 ]; then echo_i "failed"; fi 29status=`expr $status + $ret` 30 31echo_i "check that 'check-integrity yes; check-mx-cname warn;' works ($n)" 32ret=0 33$DIG $DIGOPTS @10.53.0.1 mx mx-cname-warn > dig.out.test$n || ret=1 34grep "status: NOERROR," dig.out.test$n > /dev/null || ret=1 35grep "zone mx-cname-warn/IN: mx-cname-warn/MX 'cname.mx-cname-warn' is a CNAME (illegal)" ns1/named.run > /dev/null || ret=1 36n=`expr $n + 1` 37if [ $ret != 0 ]; then echo_i "failed"; fi 38status=`expr $status + $ret` 39 40echo_i "check that 'check-integrity yes; check-mx-cname ignore;' works ($n)" 41ret=0 42$DIG $DIGOPTS @10.53.0.1 mx mx-cname-ignore > dig.out.test$n || ret=1 43grep "status: NOERROR," dig.out.test$n > /dev/null || ret=1 44grep "zone mx-cname-ignore/IN: mx-cname-ignore/MX 'cname.mx-cname-ignore' is a CNAME (illegal)" ns1/named.run > /dev/null && ret=1 45n=`expr $n + 1` 46if [ $ret != 0 ]; then echo_i "failed"; fi 47status=`expr $status + $ret` 48 49echo_i "check that 'check-integrity no; check-mx-cname fail;' works ($n)" 50ret=0 51$DIG $DIGOPTS @10.53.0.1 mx no-mx-cname-fail > dig.out.test$n || ret=1 52grep "status: NOERROR," dig.out.test$n > /dev/null || ret=1 53grep "zone no-mx-cname-fail/IN: no-mx-cname-fail/MX 'cname.no-mx-cname-fail' is a CNAME (illegal)" ns1/named.run > /dev/null && ret=1 54n=`expr $n + 1` 55if [ $ret != 0 ]; then echo_i "failed"; fi 56status=`expr $status + $ret` 57 58echo_i "check that 'check-integrity no; check-mx-cname warn;' works ($n)" 59ret=0 60$DIG $DIGOPTS @10.53.0.1 mx no-mx-cname-warn > dig.out.test$n || ret=1 61grep "status: NOERROR," dig.out.test$n > /dev/null || ret=1 62grep "zone no-mx-cname-warn/IN: no-mx-cname-warn/MX 'cname.no-mx-cname-warn' is a CNAME (illegal)" ns1/named.run > /dev/null && ret=1 63n=`expr $n + 1` 64if [ $ret != 0 ]; then echo_i "failed"; fi 65status=`expr $status + $ret` 66 67echo_i "check that 'check-integrity no; check-mx-cname ignore;' works ($n)" 68ret=0 69$DIG $DIGOPTS @10.53.0.1 mx no-mx-cname-ignore > dig.out.test$n || ret=1 70grep "status: NOERROR," dig.out.test$n > /dev/null || ret=1 71grep "zone no-mx-cname-ignore/IN: no-mx-cname-ignore/MX 'cname.no-mx-cname-ignore' is a CNAME (illegal)" ns1/named.run > /dev/null && ret=1 72n=`expr $n + 1` 73if [ $ret != 0 ]; then echo_i "failed"; fi 74status=`expr $status + $ret` 75 76echo_i "check that 'check-integrity yes; check-srv-cname fail;' works ($n)" 77ret=0 78$DIG $DIGOPTS @10.53.0.1 srv srv-cname-fail > dig.out.test$n || ret=1 79grep "status: SERVFAIL," dig.out.test$n > /dev/null || ret=1 80grep "zone srv-cname-fail/IN: srv-cname-fail/SRV 'cname.srv-cname-fail' is a CNAME (illegal)" ns1/named.run > /dev/null || ret=1 81n=`expr $n + 1` 82if [ $ret != 0 ]; then echo_i "failed"; fi 83status=`expr $status + $ret` 84 85echo_i "check that 'check-integrity yes; check-srv-cname warn;' works ($n)" 86ret=0 87$DIG $DIGOPTS @10.53.0.1 srv srv-cname-warn > dig.out.test$n || ret=1 88grep "status: NOERROR," dig.out.test$n > /dev/null || ret=1 89grep "zone srv-cname-warn/IN: srv-cname-warn/SRV 'cname.srv-cname-warn' is a CNAME (illegal)" ns1/named.run > /dev/null || ret=1 90n=`expr $n + 1` 91if [ $ret != 0 ]; then echo_i "failed"; fi 92status=`expr $status + $ret` 93 94echo_i "check that 'check-integrity yes; check-srv-cname ignore;' works ($n)" 95ret=0 96$DIG $DIGOPTS @10.53.0.1 srv srv-cname-ignore > dig.out.test$n || ret=1 97grep "status: NOERROR," dig.out.test$n > /dev/null || ret=1 98grep "zone srv-cname-ignore/IN: srv-cname-ignore/SRV 'cname.srv-cname-ignore' is a CNAME (illegal)" ns1/named.run > /dev/null && ret=1 99n=`expr $n + 1` 100if [ $ret != 0 ]; then echo_i "failed"; fi 101status=`expr $status + $ret` 102 103echo_i "check that 'check-integrity no; check-srv-cname fail;' works ($n)" 104ret=0 105$DIG $DIGOPTS @10.53.0.1 srv no-srv-cname-fail > dig.out.test$n || ret=1 106grep "status: NOERROR," dig.out.test$n > /dev/null || ret=1 107grep "zone no-srv-cname-fail/IN: no-srv-cname-fail/SRV 'cname.no-srv-cname-fail' is a CNAME (illegal)" ns1/named.run > /dev/null && ret=1 108n=`expr $n + 1` 109if [ $ret != 0 ]; then echo_i "failed"; fi 110status=`expr $status + $ret` 111 112echo_i "check that 'check-integrity no; check-srv-cname warn;' works ($n)" 113ret=0 114$DIG $DIGOPTS @10.53.0.1 srv no-srv-cname-warn > dig.out.test$n || ret=1 115grep "status: NOERROR," dig.out.test$n > /dev/null || ret=1 116grep "zone no-srv-cname-warn/IN: no-srv-cname-warn/SRV 'cname.no-srv-cname-warn' is a CNAME (illegal)" ns1/named.run > /dev/null && ret=1 117n=`expr $n + 1` 118if [ $ret != 0 ]; then echo_i "failed"; fi 119status=`expr $status + $ret` 120 121echo_i "check that 'check-integrity no; check-srv-cname ignore;' works ($n)" 122ret=0 123$DIG $DIGOPTS @10.53.0.1 srv no-srv-cname-ignore > dig.out.test$n || ret=1 124grep "status: NOERROR," dig.out.test$n > /dev/null || ret=1 125grep "zone no-srv-cname-ignore/IN: no-srv-cname-ignore/SRV 'cname.no-srv-cname-ignore' is a CNAME (illegal)" ns1/named.run > /dev/null && ret=1 126n=`expr $n + 1` 127if [ $ret != 0 ]; then echo_i "failed"; fi 128status=`expr $status + $ret` 129 130echo_i "exit status: $status" 131test $status -eq 0 || exit 1 132