5 ALGORITHM
=${ALGORITHM:="hmac-md5"}
6 KEY
=${KEY:="kp4/24gyYsEzbuTVJRUMoqGFmN3LYgVDzJ/3oRSP7ys="}
7 if [ "$RUNWRAPPER" = "" ]; then
15 [ -z "$port" ] && port
=53
17 trap "kill_process 2" EXIT INT TERM
21 ${ZONE2SQL} --transactions --$1 --named-conf=.
/named.conf
35 minimal-responses yes;
47 cat > pdns-gsqlite3-master.conf
<<EOF
48 module-dir=../regression-tests/modules
51 gsqlite3-database=master.db
53 cat > pdns-gsqlite3-slave.conf
<<EOF
54 module-dir=../regression-tests/modules
57 gsqlite3-database=slave.db
59 rm -f master.db slave.db
60 sqlite3 master.db
< ..
/modules
/gsqlite3backend
/schema.sqlite3.sql
61 sqlite3 slave.db
< ..
/modules
/gsqlite3backend
/schema.sqlite3.sql
63 tosql gsqlite | sqlite3 master.db
64 # change them to master
65 sqlite3 master.db
<<EOF
66 UPDATE domains SET type = 'MASTER', notified_serial = NULL;
69 $PDNSUTIL --config-name=gsqlite3-master
--config-dir=. import-tsig-key tsig.com
$ALGORITHM "$KEY"
70 $PDNSUTIL --config-name=gsqlite3-slave
--config-dir=. import-tsig-key tsig.com
$ALGORITHM "$KEY"
71 $ZONE2SQL --transactions --gsqlite --zone=zones
/example.com
--zone-name=example.com | sqlite3 slave.db
73 sqlite3 slave.db
<<EOF
74 UPDATE domains SET type = 'SLAVE', master = '127.0.0.1' WHERE name = 'example.com';
76 # setup metadata on master
77 $PDNSUTIL --config-name=gsqlite3-master
--config-dir=. set-meta example.com TSIG-ALLOW-AXFR tsig.com
78 $PDNSUTIL --config-name=gsqlite3-master
--config-dir=. set-meta
test.com TSIG-ALLOW-AXFR tsig.com
79 $PDNSUTIL --config-name=gsqlite3-slave
--config-dir=. set-meta example.com AXFR-MASTER-TSIG tsig.com
80 # i suppose we are done here...
85 $RUNWRAPPER $PDNS --daemon=no
--local-port=$port --config-dir=.
--module-dir=..
/regression-tests
/modules \
86 --config-name=gsqlite3-master
--socket-dir=.
/ --no-shuffle \
87 --master=yes --local-address=127.0.0.1 \
88 --query-local-address=127.0.0.1 --cache-ttl=$cachettl --dname-processing --allow-axfr-ips= &
95 $RUNWRAPPER $PDNS --daemon=no
--local-port=$slaveport --config-dir=.
--module-dir=..
/regression-tests
/modules \
96 --config-name=gsqlite3-slave
--socket-dir=.
/ --no-shuffle --local-address=127.0.0.2 \
97 --slave --retrieval-threads=4 --slave=yes --superslave=yes --query-local-address=127.0.0.2 \
98 --slave-cycle-interval=300 --allow-unsigned-notify=no
--allow-unsigned-supermaster=no
&
105 while [ $loopcount -lt 5 ]; do
107 pids
=$
(cat pdns
*.pid
2>/dev
/null
)
110 kill -0 $pids >/dev
/null
2>&1
117 let loopcount
=loopcount
+1
119 echo "PowerDNS did not start"
130 echo "exitvalue$1" >> failed_tests
133 pids
=$
(cat pdns
*.pid
)
138 # make sure they die.
141 while [ $loopcount -lt 10 ] && [ $done -eq 0 ]
146 kill -0 $pid > /dev
/null
2>&1
152 let loopcount
=loopcount
+1
165 # make sure domains are transferred and created
171 while [ $retries -ge 0 ]; do
172 domcount
=`sqlite3 slave.db "select count(*) from domains"`
173 # at the moment we want three domains
174 if [ $domcount -eq $domains ]; then
178 let retries
=retries-1
181 if [ $domcount -ne $domains ]; then
182 echo "Supermaster provisioning failed"
192 # to avoid locking issues later on
195 # then we check that test.com has not been transferred yet.
196 for domain
in test.com
; do
197 reccount
=`sqlite3 slave.db "select count(*) from records join domains on records.domain_id = domains.id where domains.name='$domain'"`
198 if [ $reccount -ne 0 ]; then
199 echo "Transfer of '$domain' has unexpectedly succeeded"
204 sqlite3 slave.db
<<EOF
205 INSERT INTO supermasters (ip,nameserver,account) VALUES('127.0.0.1','ns1.example.com','');
209 $PDNSCONTROL --config-dir=.
--config-name=gsqlite3-master
--socket-dir=. notify
test.com
212 # hopefully notifications have gone thru
215 # then we check that we got records in database for both domains
216 for domain
in test.com
; do
217 reccount
=`sqlite3 slave.db "select count(*) from records join domains on records.domain_id = domains.id where domains.name='$domain'"`
218 if [ $reccount -lt 3 ]; then
219 echo "Transfer of '$domain' did not succeed"
221 result
=`sqlite3 slave.db "select kind,content from domainmetadata join domains on domainmetadata.domain_id = domains.id where domains.name='$domain'"`
222 if [ "$result" != "AXFR-MASTER-TSIG|tsig.com" ]; then
223 echo "Domain '$domain' did not provision correctly"
227 # ensure unsigned notifications are refused
228 $NOTIFY 127.0.0.2:53 test.com
2>&1