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 12# touch dnsrps-off to not test with DNSRPS 13 14set -e 15 16SYSTEMTESTTOP=.. 17. $SYSTEMTESTTOP/conf.sh 18 19USAGE="$0: [-DNx]" 20DEBUG= 21while getopts "DNx" c; do 22 case $c in 23 x) set -x; DEBUG=-x;; 24 D) TEST_DNSRPS="-D";; 25 N) NOCLEAN=set;; 26 *) echo "$USAGE" 1>&2; exit 1;; 27 esac 28done 29shift `expr $OPTIND - 1 || true` 30if test "$#" -ne 0; then 31 echo "$USAGE" 1>&2 32 exit 1 33fi 34 35[ ${NOCLEAN:-unset} = unset ] && $SHELL clean.sh $DEBUG 36 37$PERL testgen.pl 38 39copy_setports ns1/named.conf.in ns1/named.conf 40 41copy_setports ns2/named.conf.header.in ns2/named.conf.header 42copy_setports ns2/named.default.conf ns2/named.conf 43 44copy_setports ns3/named1.conf.in ns3/named.conf 45copy_setports ns3/named2.conf.in ns3/named2.conf 46 47copy_setports ns4/named.conf.in ns4/named.conf 48 49# setup policy zones for a 64-zone test 50i=1 51while test $i -le 64 52do 53 echo "\$TTL 60" > ns2/db.max$i.local 54 echo "@ IN SOA root.ns ns 1996072700 3600 1800 86400 60" >> ns2/db.max$i.local 55 echo " NS ns" >> ns2/db.max$i.local 56 echo "ns A 127.0.0.1" >> ns2/db.max$i.local 57 58 j=1 59 while test $j -le $i 60 do 61 echo "name$j A 10.53.0.$i" >> ns2/db.max$i.local 62 j=`expr $j + 1` 63 done 64 i=`expr $i + 1` 65done 66 67# decide whether to test DNSRPS 68$SHELL ../ckdnsrps.sh $TEST_DNSRPS $DEBUG 69test -z "`grep 'dnsrps-enable yes' dnsrps.conf`" && TEST_DNSRPS= 70 71CWD=`pwd` 72cat <<EOF >dnsrpzd.conf 73PID-FILE $CWD/dnsrpzd.pid; 74 75include $CWD/dnsrpzd-license-cur.conf 76 77zone "policy" { type master; file "`pwd`/ns3/policy.db"; }; 78EOF 79sed -n -e 's/^ *//' -e "/zone.*.*master/s@file \"@&$CWD/ns2/@p" ns2/*.conf \ 80 >>dnsrpzd.conf 81 82# Run dnsrpzd to get the license and prime the static policy zones 83if test -n "$TEST_DNSRPS"; then 84 DNSRPZD="`../rpz/dnsrps -p`" 85 "$DNSRPZD" -D./dnsrpzd.rpzf -S./dnsrpzd.sock -C./dnsrpzd.conf \ 86 -w 0 -dddd -L stdout >./dnsrpzd.run 2>&1 87fi 88