-BaseName: ede-caching-cachedb
+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
CmdDepends:
Depends:
Help:
-Pre: ede-caching-cachedb.pre
-Post: ede-caching-cachedb.post
-Test: ede-caching-cachedb.test
+Pre: ede_caching_cachedb.pre
+Post: ede_caching_cachedb.post
+Test: ede_caching_cachedb.test
AuxFiles:
Passed:
Failure:
-# #-- ede.post --#
+# #-- ede_caching_cachedb.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
--- /dev/null
+# #-- 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
+
+$PRE/unbound -V > cachedb_module_check.txt
+
+if ! grep -q -e "enable-cachedb" cachedb_module_check.txt
+then
+ echo "Missing cachedb_module in the ./configure stage:"
+ echo "'unbound -V' output:"
+ cat cachedb_module_check.txt
+ exit 1
+fi
+
+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
-# #-- ede-caching-cachedb.test --#
+# #-- ede_caching_cachedbtest --#
# 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
--- /dev/null
+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"
--- /dev/null
+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: "root.key"
+
+ module-config: "subnetcache validator iterator"
+
+ client-subnet-always-forward: yes
+
+ ede: yes
+
+ do-not-query-localhost: no
+
+forward-zone:
+ name: "example.nl"
+ forward-addr: 127.0.0.1@@PORT2@
--- /dev/null
+BaseName: ede_caching_subnetcache
+Version: 1.0
+Description: Test caching of Extended DNS Errors (rfc8914) in the subnetcache
+CreationDate: Mon Nov 21 11:42:11 UTC 2022
+Maintainer: Tom Carpay
+Category:
+Component:
+CmdDepends:
+Depends:
+Help:
+Pre: ede_caching_subnetcache.pre
+Post: ede_caching_subnetcache.post
+Test: ede_caching_subnetcache.test
+AuxFiles:
+Passed:
+Failure:
--- /dev/null
+# #-- ede_caching_subnetcache.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
-# #-- ede-caching-cachedb.pre --#
+# #-- 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
PRE="../.."
. ../common.sh
+$PRE/unbound -V > subnet_module_check.txt
+
+if ! grep -q -e "enable-subnet" subnet_module_check.txt
+then
+ echo "Missing subnet_module in the ./configure stage:"
+ echo "'unbound -V' output:"
+ cat subnet_module_check.txt
+ exit 1
+fi
+
get_random_port 2
UNBOUND_PORT=$RND_PORT
UNBOUND_PORT2=$(($RND_PORT + 1))
--- /dev/null
+# #-- ede_caching_subnetcache.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 +subnet=127.0.0.0/17 > 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 +subnet=127.0.0.0/17 > 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
--- /dev/null
+$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
--- /dev/null
+; 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