add ede cachedb test

This commit is contained in:
TCY16 2022-11-21 15:26:49 +01:00
parent 6dcba49ff1
commit 79108f4c3d
8 changed files with 151 additions and 0 deletions

View file

@ -0,0 +1,13 @@
server:
verbosity: 1
use-syslog: no
chroot: ""
username: ""
directory: ""
pidfile: "unbound2.pid"
interface: 127.0.0.1
port: @PORT2@
auth-zone:
name: "example.nl"
zonefile: "example.nl.zone"

View file

@ -0,0 +1,16 @@
BaseName: ede-caching-cachedb
Version: 1.0
Description: Test caching of Extended DNS Errors (rfc8914) in the cachedb
CreationDate: Mon Nov 21 11:42:11 UTC 2022
Maintainer: Tom Carpay
Category:
Component:
CmdDepends:
Depends:
Help:
Pre: ede-caching-cachedb.pre
Post: ede-caching-cachedb.post
Test: ede-caching-cachedb.test
AuxFiles:
Passed:
Failure:

View file

@ -0,0 +1,9 @@
# #-- ede.post --#
# 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
# teardown
. ../common.sh
kill_pid $UNBOUND_PID

View file

@ -0,0 +1,33 @@
# #-- ede-caching-cachedb.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
PRE="../.."
. ../common.sh
get_random_port 2
UNBOUND_PORT=$RND_PORT
UNBOUND_PORT2=$(($RND_PORT + 1))
echo "UNBOUND_PORT=$UNBOUND_PORT" >> .tpkg.var.test
echo "UNBOUND_PORT2=$UNBOUND_PORT2" >> .tpkg.var.test
# rewrite config file with created ports
sed -e 's/@PORT\@/'$UNBOUND_PORT'/' < ede.conf > temp.conf
sed -e 's/@PORT2\@/'$UNBOUND_PORT2'/' < temp.conf > ub.conf
sed -e 's/@PORT2\@/'$UNBOUND_PORT2'/' < ede-auth.conf > ub2.conf
# start unbound in the background
$PRE/unbound -d -c ub.conf > unbound.log 2>&1 &
UNBOUND_PID=$!
echo "UNBOUND_PID=$UNBOUND_PID" >> .tpkg.var.test
# start authoritative unbound in the background
$PRE/unbound -d -c ub2.conf > unbound2.log 2>&1 &
UNBOUND_PID2=$!
echo "UNBOUND_PID2=$UNBOUND_PID2" >> .tpkg.var.test
cat .tpkg.var.test
wait_unbound_up unbound.log
wait_unbound_up unbound2.log

View file

@ -0,0 +1,29 @@
# #-- ede-caching-cachedb.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
. ../common.sh
# query with the priming edns opt
dig @127.0.0.1 -p $UNBOUND_PORT example.nl +ednsopt=49152 > query1.txt
if ! grep -q -e "OPT=15: 00 09" -e "EDE: 9" query1.txt
then
echo "Priming query fails"
cat query1.txt
exit 1
fi
# kill the authoritative Unbound instance?
kill_pid $UNBOUND_PID2
# query again to see if we have indeed cached the response
dig @127.0.0.1 -p $UNBOUND_PORT example.nl +ednsopt=49152 > query2.txt
if ! grep -q -e "OPT=15: 00 09" -e "EDE: 9" query2.txt
then
echo "Cached query fails"
cat query2.txt
exit 1
fi

View file

@ -0,0 +1,26 @@
server:
verbosity: 3
interface: 127.0.0.1
port: @PORT@
use-syslog: no
directory: .
pidfile: "unbound.pid"
chroot: ""
username: ""
directory: ""
val-log-level: 2
auto-trust-anchor-file: "/usr/local/etc/unbound/root.key"
module-config: "cachedb validator iterator"
ede: yes
do-not-query-localhost: no
forward-zone:
name: "example.nl"
forward-addr: 127.0.0.1@@PORT2@
cachedb:
backend: testframe

View file

@ -0,0 +1,16 @@
$ORIGIN example.nl.
$TTL 86400 ; default time-to-live for this zone
example.nl. IN SOA ns.example.nl. noc.dns.icann.org. (
2020080302 ;Serial
7200 ;Refresh
3600 ;Retry
1209600 ;Expire
3600 ;Negative response caching TTL
)
; The nameserver that are authoritative for this zone.
NS example.nl.
; these A records below are equivalent
example.nl. A 1.2.3.4

View file

@ -0,0 +1,9 @@
; autotrust trust anchor file
;;id: . 1
;;last_queried: 1669040556 ;;Mon Nov 21 15:22:36 2022
;;last_success: 1669040556 ;;Mon Nov 21 15:22:36 2022
;;next_probe_time: 1669081693 ;;Tue Nov 22 02:48:13 2022
;;query_failed: 0
;;query_interval: 43200
;;retry_time: 8640
. 86400 IN DNSKEY 257 3 8 AwEAAaz/tAm8yTn4Mfeh5eyI96WSVexTBAvkMgJzkKTOiW1vkIbzxeF3+/4RgWOq7HrxRixHlFlExOLAJr5emLvN7SWXgnLh4+B5xQlNVz8Og8kvArMtNROxVQuCaSnIDdD5LKyWbRd2n9WGe2R8PzgCmr3EgVLrjyBxWezF0jLHwVN8efS3rCj/EWgvIWgb9tarpVUDK/b58Da+sqqls3eNbuv7pr+eoZG+SrDK6nWeL3c6H5Apxz7LjVc1uTIdsIXxuOLYA4/ilBmSVIzuDWfdRUfhHdY6+cn8HFRm+2hM8AnXGXws9555KrUB5qihylGa8subX2Nn6UwNR1AkUTV74bU= ;{id = 20326 (ksk), size = 2048b} ;;state=2 [ VALID ] ;;count=0 ;;lastchange=1628842824 ;;Fri Aug 13 10:20:24 2021