3 # Copyright (C) 2013 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.
24 dsfromkey
=${DSFROMKEY}
31 _a
=$1 _b
=$2 _c
=$3 _d
=$4
34 256) _c
=$
(($_c + 1)); _d
=0;;
37 256) _b
=$
(($_b + 1)); _c
=0;;
60 echo " listen-on { $1; };"
61 echo " query-source $1;"
62 echo " notify-source $1;"
63 echo " transfer-source $1;"
64 echo ' key-directory "keys";'
65 echo " recursion ${2:-no};"
66 echo ' pid-file "pids/'"${addr}"'.pid";'
67 echo ' blackhole { 127.127.0.0; };'
74 echo " listen-on { $1; };"
75 echo " query-source $1;"
76 echo " notify-source $1;"
77 echo " transfer-source $1;"
78 echo ' key-directory "keys";'
79 echo " recursion ${2:-no};"
80 echo ' pid-file "pids/'"${addr}"'.pid";'
81 echo ' allow-query { !127.127.0.0; any; };'
88 echo " listen-on { $1; };"
89 echo " query-source $1;"
90 echo " notify-source $1;"
91 echo " transfer-source $1;"
92 echo ' key-directory "keys";'
93 echo " recursion ${2:-no};"
94 echo ' pid-file "pids/'"${addr}"'.pid";'
99 echo 'include "rndc.key";'
100 echo "controls { inet $addr port 9953 allow { any; } keys { "rndc-key
"; }; };"
115 1) echo -T delay
=${_d:-100};;
116 2) echo -T delay
=${2:-50};;
117 3) echo -T delay
=${3:-150};;
118 4) echo -T delay
=${4:-250};;
119 5) echo -T delay
=${5:-125};;
120 6) echo -T delay
=${6:-25};;
121 7) echo -T delay
=${7:-75};;
122 8) echo -T delay
=${8:-125};;
123 9) echo -T delay
=${9:-10};;
124 10) echo -T delay
=${10:-40};;
125 11) echo -T delay
=${11:-80};;
126 12) echo -T delay
=${12:-90};;
127 *) echo -T delay
=50;;
132 awk '$3 == "DNSKEY" {
133 b = ""; for (i=7; i <= NF; i++) { b = b $i; };
134 print "trusted-keys { \""$1"\"",$4,$5,$6,"\""b"\"; };" };'
138 echo "zone "'"'"${1:-.}"'"'" {"
140 echo " file "'"'"master/${2}.db"'"'";"
141 echo " auto-dnssec maintain;"
142 echo " allow-update { any; };"
147 echo "zone "'"'"${1:-.}"'"'" {"
149 echo " file "'"'"master/${2}.db"'"'";"
154 echo "zone "'"'"${zone:-.}"'"'" {"
156 echo " masters { ${master}; };"
160 rm -rf servers master keys setup teardown run
165 echo "ifconfig lo0 $addr netmask 0xffffffff alias" >> setup
166 echo "ifconfig lo0 $addr -alias" >> teardown
167 controls
$addr > named.conf
168 options
$addr yes >> named.conf
169 echo 'zone "." { type hint; file "master/hint.db"; };' >> named.conf
171 while read zone servers nsfmt signed delay blackhole refuse flags
178 if [ "${zone}" != "" ] ; then
186 #echo "zone='${zone}' parent='${p}'"
187 addr
=$
(nextaddr
$addr)
188 ns
=$
(printf "$nsfmt" ${i} "${zone}")
189 d
=$
(delay
$i ${delay:-.})
191 echo "${zone}. ${ttl} soa ${ns}. hostmaster.${zone}${zone:+.} 1 3600 1200 604800 1200" >> master/${file}.db
192 echo "${zone}. ${ttl} ns ${ns}." >> master/${file}.db
193 echo "${ns}. ${ttl} a ${addr}" >> master/${file}.db
194 echo "${zone}. ${ttl} ns ${ns}." >> master/${p}.db
195 echo "${ns}. ${ttl} a ${addr}" >> master/${p}.db
196 if [ $signed = "S
" ]; then
197 kskkey=`${keygen} -K keys -f KSK ${zone:-.}`
198 zskkey=`${keygen} -K keys ${zone:-.}`
199 if [ "${zone}" != "" ] ; then
200 ${dsfromkey} -T ${ttl} keys/${kskkey}.key >> master/${p}.db
202 trusted-keys < keys/${kskkey}.key >> named.conf
205 echo "ifconfig lo0
$addr netmask
0xffffffff alias" >> setup
206 echo "ifconfig lo0
$addr -alias" >> teardown
207 echo "${named} -D bigtest
-c servers
/${addr}.conf
$d $flags" >> run
208 options ${addr} > servers/${addr}.conf
210 S) signed-zone ${zone:-.} ${file} >> servers/${addr}.conf;;
211 P) unsigned-zone ${zone:-.} ${file} >> servers/${addr}.conf;;
212 *) echo ${signed}; exit 1;;
216 while [ $i -lt $servers ]
220 ns=$(printf "$nsfmt" ${i} "${zone}")
221 d=$(delay $i ${delay:-.})
222 addr=$(nextaddr $addr)
223 echo "${zone}. ${ttl} ns ${ns}." >> master/${file}.db
224 echo "${ns}. ${ttl} a ${addr}" >> master/${file}.db
225 echo "${zone}. ${ttl} ns ${ns}." >> master/${p}.db
226 echo "${ns}. ${ttl} a ${addr}" >> master/${p}.db
227 echo "ifconfig lo0
$addr netmask
0xffffffff alias" >> setup
228 echo "ifconfig lo0
$addr -alias" >> teardown
229 echo "${named} -D bigtest
-c servers
/${addr}.conf
$d $flags" >> run
230 if [ $i = ${refuse:-.} ]
232 refuse $addr > servers/${addr}.conf
233 elif [ $i = ${blackhole:-.} ]
235 blackhole $addr > servers/${addr}.conf
237 options $addr > servers/${addr}.conf
239 slave-zone ${zone:-.} ${master} >> servers/${addr}.conf
241 if [ "${zone}" != "" ] ; then
242 echo "www.
${zone}. ${ttl} a 127.0.0.1" >> master/${file}.db
243 echo "www.${zone}. ${ttl} aaaa ::1" >> master/${file}.db
244 echo "${zone}. ${ttl} mx 10 mail.${zone}." >> master/${file}.db
245 echo "mail.${zone}. ${ttl} a 127.0.0.1" >> master/${file}.db
246 echo "mail.
${zone}. ${ttl} aaaa ::1" >> master/${file}.db
247 echo "*.big.${zone}. ${ttl} txt (" >> master/${file}.db
251 echo "1234567890" >> master/${file}.db
254 echo ")" >> master/${file}.db
255 echo "*.medium.
${zone}. ${ttl} txt (" >> master/${file}.db
259 echo "1234567890" >> master
/${file}.db
262 echo ")" >> master
/${file}.db
263 echo "*.medium.${zone}. ${ttl} txt (" >> master/${file}.db
267 echo "1234567890" >> master/${file}.db
270 echo ")" >> master/${file}.db