mirror of
https://github.com/NLnetLabs/unbound.git
synced 2025-12-21 23:31:06 -05:00
zonemd, unit test for unbound-control auth_zone_reload with zonemd.
This commit is contained in:
parent
89087ae294
commit
caee84d92e
7 changed files with 196 additions and 0 deletions
22
testdata/zonemd_reload.tdir/zonemd_reload.conf
vendored
Normal file
22
testdata/zonemd_reload.tdir/zonemd_reload.conf
vendored
Normal file
|
|
@ -0,0 +1,22 @@
|
||||||
|
server:
|
||||||
|
verbosity: 7
|
||||||
|
# num-threads: 1
|
||||||
|
interface: 127.0.0.1
|
||||||
|
port: @PORT@
|
||||||
|
use-syslog: no
|
||||||
|
directory: ""
|
||||||
|
pidfile: "unbound.pid"
|
||||||
|
chroot: ""
|
||||||
|
username: ""
|
||||||
|
do-not-query-localhost: no
|
||||||
|
use-caps-for-id: yes
|
||||||
|
remote-control:
|
||||||
|
control-enable: yes
|
||||||
|
control-interface: @CONTROL_PATH@/controlpipe.@CONTROL_PID@
|
||||||
|
control-use-cert: no
|
||||||
|
auth-zone:
|
||||||
|
name: "example.com"
|
||||||
|
for-upstream: yes
|
||||||
|
for-downstream: yes
|
||||||
|
zonefile: "zonemd_reload.zone"
|
||||||
|
#master: "127.0.0.1@@TOPORT@"
|
||||||
16
testdata/zonemd_reload.tdir/zonemd_reload.dsc
vendored
Normal file
16
testdata/zonemd_reload.tdir/zonemd_reload.dsc
vendored
Normal file
|
|
@ -0,0 +1,16 @@
|
||||||
|
BaseName: zonemd_reload
|
||||||
|
Version: 1.0
|
||||||
|
Description: ZONEMD check after auth_zone_reload
|
||||||
|
CreationDate: Tue 23 Oct 12:00:00 CEST 2020
|
||||||
|
Maintainer: dr. W.C.A. Wijngaards
|
||||||
|
Category:
|
||||||
|
Component:
|
||||||
|
CmdDepends:
|
||||||
|
Depends:
|
||||||
|
Help:
|
||||||
|
Pre: zonemd_reload.pre
|
||||||
|
Post: zonemd_reload.post
|
||||||
|
Test: zonemd_reload.test
|
||||||
|
AuxFiles:
|
||||||
|
Passed:
|
||||||
|
Failure:
|
||||||
14
testdata/zonemd_reload.tdir/zonemd_reload.post
vendored
Normal file
14
testdata/zonemd_reload.tdir/zonemd_reload.post
vendored
Normal file
|
|
@ -0,0 +1,14 @@
|
||||||
|
# #-- zonemd_reload.post --#
|
||||||
|
# source the master var file when it's there
|
||||||
|
[ -f ../.tpkg.var.master ] && source ../.tpkg.var.master
|
||||||
|
# source the test var file when it's there
|
||||||
|
[ -f .tpkg.var.test ] && source .tpkg.var.test
|
||||||
|
#
|
||||||
|
# do your teardown here
|
||||||
|
. ../common.sh
|
||||||
|
echo "> cat logfiles"
|
||||||
|
cat fwd.log
|
||||||
|
cat unbound.log
|
||||||
|
kill_pid $FWD_PID
|
||||||
|
kill_pid $UNBOUND_PID
|
||||||
|
rm -f $CONTROL_PATH/controlpipe.$CONTROL_PID
|
||||||
35
testdata/zonemd_reload.tdir/zonemd_reload.pre
vendored
Normal file
35
testdata/zonemd_reload.tdir/zonemd_reload.pre
vendored
Normal file
|
|
@ -0,0 +1,35 @@
|
||||||
|
# #-- zonemd_reload.pre--#
|
||||||
|
# source the master var file when it's there
|
||||||
|
[ -f ../.tpkg.var.master ] && source ../.tpkg.var.master
|
||||||
|
# use .tpkg.var.test for in test variable passing
|
||||||
|
[ -f .tpkg.var.test ] && source .tpkg.var.test
|
||||||
|
|
||||||
|
. ../common.sh
|
||||||
|
get_random_port 2
|
||||||
|
UNBOUND_PORT=$RND_PORT
|
||||||
|
FWD_PORT=$(($RND_PORT + 1))
|
||||||
|
echo "UNBOUND_PORT=$UNBOUND_PORT" >> .tpkg.var.test
|
||||||
|
echo "FWD_PORT=$FWD_PORT" >> .tpkg.var.test
|
||||||
|
|
||||||
|
# start forwarder
|
||||||
|
get_ldns_testns
|
||||||
|
$LDNS_TESTNS -p $FWD_PORT zonemd_reload.testns >fwd.log 2>&1 &
|
||||||
|
FWD_PID=$!
|
||||||
|
echo "FWD_PID=$FWD_PID" >> .tpkg.var.test
|
||||||
|
|
||||||
|
# make config file
|
||||||
|
CONTROL_PATH=/tmp
|
||||||
|
CONTROL_PID=$$
|
||||||
|
sed -e 's/@PORT\@/'$UNBOUND_PORT'/' -e 's/@TOPORT\@/'$FWD_PORT'/' -e 's?@CONTROL_PATH\@?'$CONTROL_PATH'?' -e 's/@CONTROL_PID@/'$CONTROL_PID'/' < zonemd_reload.conf > ub.conf
|
||||||
|
# start unbound in the background
|
||||||
|
PRE="../.."
|
||||||
|
$PRE/unbound -d -c ub.conf >unbound.log 2>&1 &
|
||||||
|
UNBOUND_PID=$!
|
||||||
|
echo "UNBOUND_PID=$UNBOUND_PID" >> .tpkg.var.test
|
||||||
|
echo "CONTROL_PATH=$CONTROL_PATH" >> .tpkg.var.test
|
||||||
|
echo "CONTROL_PID=$CONTROL_PID" >> .tpkg.var.test
|
||||||
|
|
||||||
|
cat .tpkg.var.test
|
||||||
|
wait_ldns_testns_up fwd.log
|
||||||
|
wait_unbound_up unbound.log
|
||||||
|
|
||||||
74
testdata/zonemd_reload.tdir/zonemd_reload.test
vendored
Normal file
74
testdata/zonemd_reload.tdir/zonemd_reload.test
vendored
Normal file
|
|
@ -0,0 +1,74 @@
|
||||||
|
# #-- zonemd_reload.test --#
|
||||||
|
# source the master var file when it's there
|
||||||
|
[ -f ../.tpkg.var.master ] && source ../.tpkg.var.master
|
||||||
|
# use .tpkg.var.test for in test variable passing
|
||||||
|
[ -f .tpkg.var.test ] && source .tpkg.var.test
|
||||||
|
|
||||||
|
PRE="../.."
|
||||||
|
# do the test
|
||||||
|
echo "> dig www.example.com."
|
||||||
|
dig @localhost -p $UNBOUND_PORT www.example.com. | tee outfile
|
||||||
|
if grep SERVFAIL outfile; then
|
||||||
|
echo "> try again"
|
||||||
|
dig @localhost -p $UNBOUND_PORT www.example.com. | tee outfile
|
||||||
|
fi
|
||||||
|
if grep SERVFAIL outfile; then
|
||||||
|
echo "> try again"
|
||||||
|
sleep 1
|
||||||
|
dig @localhost -p $UNBOUND_PORT www.example.com. | tee outfile
|
||||||
|
fi
|
||||||
|
if grep SERVFAIL outfile; then
|
||||||
|
echo "> try again"
|
||||||
|
sleep 1
|
||||||
|
dig @localhost -p $UNBOUND_PORT www.example.com. | tee outfile
|
||||||
|
fi
|
||||||
|
if grep SERVFAIL outfile; then
|
||||||
|
echo "> try again"
|
||||||
|
sleep 1
|
||||||
|
dig @localhost -p $UNBOUND_PORT www.example.com. | tee outfile
|
||||||
|
fi
|
||||||
|
if grep SERVFAIL outfile; then
|
||||||
|
echo "> try again"
|
||||||
|
sleep 10
|
||||||
|
dig @localhost -p $UNBOUND_PORT www.example.com. | tee outfile
|
||||||
|
fi
|
||||||
|
if grep SERVFAIL outfile; then
|
||||||
|
echo "> try again"
|
||||||
|
sleep 10
|
||||||
|
dig @localhost -p $UNBOUND_PORT www.example.com. | tee outfile
|
||||||
|
fi
|
||||||
|
echo "> cat logfiles"
|
||||||
|
cat fwd.log
|
||||||
|
cat unbound.log
|
||||||
|
echo "> check answer"
|
||||||
|
if grep www.example.com outfile | grep "127.0.0.1"; then
|
||||||
|
echo "OK"
|
||||||
|
else
|
||||||
|
echo "Not OK"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "> unbound-control status"
|
||||||
|
$PRE/unbound-control -c ub.conf status
|
||||||
|
if test $? -ne 0; then
|
||||||
|
echo "wrong exit value."
|
||||||
|
exit 1
|
||||||
|
else
|
||||||
|
echo "exit value: OK"
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "> unbound-control auth_zone_reload example.com"
|
||||||
|
$PRE/unbound-control -c ub.conf auth_zone_reload example.com 2>&1 | tee outfile
|
||||||
|
if test $? -ne 0; then
|
||||||
|
echo "wrong exit value."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
echo "> check unbound-control output"
|
||||||
|
if grep "example.com: ZONEMD verification successful" outfile; then
|
||||||
|
echo "OK"
|
||||||
|
else
|
||||||
|
echo "Not OK"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
exit 0
|
||||||
27
testdata/zonemd_reload.tdir/zonemd_reload.testns
vendored
Normal file
27
testdata/zonemd_reload.tdir/zonemd_reload.testns
vendored
Normal file
|
|
@ -0,0 +1,27 @@
|
||||||
|
ENTRY_BEGIN
|
||||||
|
MATCH opcode qtype qname
|
||||||
|
ADJUST copy_id
|
||||||
|
REPLY QR AA NOERROR
|
||||||
|
SECTION QUESTION
|
||||||
|
example.com. IN SOA
|
||||||
|
SECTION ANSWER
|
||||||
|
example.com. IN SOA ns.example.com. hostmaster.example.com. 1 3600 900 86400 3600
|
||||||
|
ENTRY_END
|
||||||
|
|
||||||
|
ENTRY_BEGIN
|
||||||
|
MATCH opcode qtype qname
|
||||||
|
ADJUST copy_id
|
||||||
|
REPLY QR AA NOERROR
|
||||||
|
SECTION QUESTION
|
||||||
|
example.com. IN AXFR
|
||||||
|
SECTION ANSWER
|
||||||
|
example.com. IN SOA ns.example.com. hostmaster.example.com. 1 3600 900 86400 3600
|
||||||
|
example.com. IN NS ns.example.net.
|
||||||
|
EXTRA_PACKET
|
||||||
|
REPLY QR AA NOERROR
|
||||||
|
SECTION QUESTION
|
||||||
|
example.com. IN AXFR
|
||||||
|
SECTION ANSWER
|
||||||
|
www.example.com. IN A 1.2.3.4
|
||||||
|
example.com. IN SOA ns.example.com. hostmaster.example.com. 1 3600 900 86400 3600
|
||||||
|
ENTRY_END
|
||||||
8
testdata/zonemd_reload.tdir/zonemd_reload.zone
vendored
Normal file
8
testdata/zonemd_reload.tdir/zonemd_reload.zone
vendored
Normal file
|
|
@ -0,0 +1,8 @@
|
||||||
|
example.com. IN SOA ns.example.com. hostmaster.example.com. 200154054 28800 7200 604800 3600
|
||||||
|
example.com. IN NS ns.example.com.
|
||||||
|
example.com. IN ZONEMD 200154054 1 2 EFAA5B78B38AB1C45DE57B8167BCCE906451D0E72118E1F5E80B5F0C3CF04BFFC65D53C011185528EAD439D6F3A02F511961E090E5E4E0DFA013BD276D728B22
|
||||||
|
www.example.com. IN A 127.0.0.1
|
||||||
|
ns.example.com. IN A 127.0.0.1
|
||||||
|
bar.example.com. IN A 1.2.3.4
|
||||||
|
ding.example.com. IN A 1.2.3.4
|
||||||
|
foo.example.com. IN A 1.2.3.4
|
||||||
Loading…
Reference in a new issue