ns.ghost.example.net. 3600 IN A $PREFIX.17
1.ghost.example.net. 10 IN NS ns.1.ghost.example.net.
ns.1.ghost.example.net. 10 IN A $PREFIX.18
+2.ghost.example.net. 10 IN NS ns.2.ghost.example.net.
+ns.2.ghost.example.net. 10 IN A $PREFIX.19
EOF
-### ghost domain
+### ghost domain with ever-changing NSset
mkdir $PREFIX.18
cat > $PREFIX.18/1.ghost.example.net.zone <<EOF
1.ghost.example.net. 3600 IN SOA $SOA
1.ghost.example.net. 20 IN NS ns.1.ghost.example.net.
ns.1.ghost.example.net. 20 IN A $PREFIX.18
-www.1.ghost.example.net. 20 IN A 192.0.2.7
+*.www.1.ghost.example.net. 20 IN A 192.0.2.7
EOF
cat > $PREFIX.18/prequery.lua <<EOF
function prequery ( dnspacket )
i = i + 1
qname, qtype = dnspacket:getQuestion()
- if qtype == pdns.A and string.sub(qname, -20) == ".1.ghost.example.net"
+ if qtype == pdns.A and string.sub(qname, -24) == ".www.1.ghost.example.net"
then
dnspacket:setRcode(pdns.NOERROR)
ret = {}
end
EOF
+### ghost domain with static NSset
+mkdir $PREFIX.19
+cat > $PREFIX.19/2.ghost.example.net.zone <<EOF
+2.ghost.example.net. 3600 IN SOA $SOA
+2.ghost.example.net. 20 IN NS ns.2.ghost.example.net.
+ns.2.ghost.example.net. 20 IN A $PREFIX.19
+*.www.2.ghost.example.net. 20 IN A 192.0.2.8
+EOF
+cat > $PREFIX.19/prequery.lua <<EOF
+function prequery ( dnspacket )
+ qname, qtype = dnspacket:getQuestion()
+ if qtype == pdns.A and string.sub(qname, -24) == ".www.2.ghost.example.net"
+ then
+ dnspacket:setRcode(pdns.NOERROR)
+ ret = {}
+ ret[1] = {qname=qname, qtype=pdns.A, content="192.0.2.8", ttl=20, place=1}
+ ret[2] = {qname="2.ghost.example.net", qtype=pdns.NS, content="ns.2.ghost.example.net", ttl=20, place=2}
+ ret[3] = {qname="ns.2.ghost.example.net", qtype=pdns.A, content="10.0.3.19", ttl=20, place=3}
+ dnspacket:addRecords(ret)
+ return true
+ end
+ return false
+end
+EOF
for dir in $PREFIX.*
do