xref: /netbsd-src/external/bsd/unbound/dist/testdata/auth_https.tdir/auth_https.test (revision 7a540f2bd4f5b968566c2607d6462c7f2fb452cf)
17cd94d69Schristos# #-- auth_https.test --#
27cd94d69Schristos# source the master var file when it's there
37cd94d69Schristos[ -f ../.tpkg.var.master ] && source ../.tpkg.var.master
47cd94d69Schristos# use .tpkg.var.test for in test variable passing
57cd94d69Schristos[ -f .tpkg.var.test ] && source .tpkg.var.test
67cd94d69Schristos
77cd94d69SchristosPRE="../.."
8*7a540f2bSchristos. ../common.sh
97cd94d69Schristos# do the test
107cd94d69Schristosecho "> dig www.example.com."
117cd94d69Schristosdig @localhost -p $UNBOUND_PORT www.example.com. | tee outfile
127cd94d69Schristosif grep SERVFAIL outfile; then
137cd94d69Schristos	echo "> try again"
147cd94d69Schristos	dig @localhost -p $UNBOUND_PORT www.example.com. | tee outfile
157cd94d69Schristosfi
167cd94d69Schristosif grep SERVFAIL outfile; then
177cd94d69Schristos	echo "> try again"
187cd94d69Schristos	sleep 1
197cd94d69Schristos	dig @localhost -p $UNBOUND_PORT www.example.com. | tee outfile
207cd94d69Schristosfi
217cd94d69Schristosif grep SERVFAIL outfile; then
227cd94d69Schristos	echo "> try again"
237cd94d69Schristos	sleep 1
247cd94d69Schristos	dig @localhost -p $UNBOUND_PORT www.example.com. | tee outfile
257cd94d69Schristosfi
267cd94d69Schristosif grep SERVFAIL outfile; then
277cd94d69Schristos	echo "> try again"
287cd94d69Schristos	sleep 1
297cd94d69Schristos	dig @localhost -p $UNBOUND_PORT www.example.com. | tee outfile
307cd94d69Schristosfi
317cd94d69Schristosif grep SERVFAIL outfile; then
327cd94d69Schristos	echo "> try again"
337cd94d69Schristos	sleep 10
347cd94d69Schristos	dig @localhost -p $UNBOUND_PORT www.example.com. | tee outfile
357cd94d69Schristosfi
367cd94d69Schristosif grep SERVFAIL outfile; then
377cd94d69Schristos	echo "> try again"
387cd94d69Schristos	sleep 10
397cd94d69Schristos	dig @localhost -p $UNBOUND_PORT www.example.com. | tee outfile
407cd94d69Schristosfi
417cd94d69Schristosecho "> cat logfiles"
427cd94d69Schristoscat petal.log
437cd94d69Schristoscat unbound.log
447cd94d69Schristosecho "> check answer"
457cd94d69Schristosif grep "1.2.3.4" outfile; then
467cd94d69Schristos	echo "OK"
477cd94d69Schristoselse
487cd94d69Schristos	echo "Not OK"
497cd94d69Schristos	exit 1
507cd94d69Schristosfi
517cd94d69Schristos
52*7a540f2bSchristos# Test that notify is allowed from the webserver address
53*7a540f2bSchristosget_ldns_notify
54*7a540f2bSchristosecho "> ldns-notify -z example.com"
55*7a540f2bSchristos$LDNS_NOTIFY -p $UNBOUND_PORT -z example.com 127.0.0.1 | tee outfile
56*7a540f2bSchristosif grep "rcode: REFUSED"  outfile; then
57*7a540f2bSchristos	echo "Not OK"
58*7a540f2bSchristos	exit 1
59*7a540f2bSchristoselse
60*7a540f2bSchristos	echo "OK"
61*7a540f2bSchristosfi
62*7a540f2bSchristos
637cd94d69Schristosexit 0
64