1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152
|
echo There we go...
# #-- padding.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="../.."
. ../common.sh
echo "> query www.example.com. A"
dig @127.0.0.1 -p $UNBOUND_PORT www.example.com. | tee outfile
echo "> check answer"
if grep "10.20.30.40" outfile; then
echo "OK"
else
echo "> cat logfiles"
cat tap.log
cat tap.errlog
cat fwd.log
cat unbound2.log
cat unbound.log
echo "Not OK"
exit 1
fi
echo "> wait for log to happen"
wait_logfile tap.log "www.example.com" 45
echo "> check tap.log for dnstap info"
# see if it logged the information in tap.log
if grep "www.example.com" tap.log; then echo "yes it is in tap.log";
else
echo "information not in tap.log"
echo "failed"
echo "> cat logfiles"
cat tap.log
cat tap.errlog
cat fwd.log
cat unbound.log
echo "Not OK"
exit 1
fi
echo "> query txt.example.com. TXT"
dig @127.0.0.1 -p $UNBOUND_PORT txt.example.com. TXT | tee outfile
echo "> check answer"
if grep "Lorem ipsum" outfile; then
echo "OK"
else
echo "> cat logfiles"
cat tap.log
cat tap.errlog
cat fwd.log
cat unbound2.log
cat unbound.log
echo "Not OK"
exit 1
fi
echo "> check tap.log for dnstap info"
# see if it logged the information in tap.log
# wait for a moment for filesystem to catch up.
wait_logfile tap.log "txt.example.com" 45
if grep "txt.example.com" tap.log; then echo "yes it is in tap.log";
else
echo "information not in tap.log"
echo "failed"
echo "> cat logfiles"
cat tap.log
cat tap.errlog
cat fwd.log
cat unbound.log
echo "Not OK"
exit 1
fi
echo "> flush cache entries."
$PRE/unbound-control -c ub.conf flush_type www.example.com A
$PRE/unbound-control -c ub.conf flush_type txt.example.com TXT
echo "> disable padding of responses."
$PRE/unbound-control -c ub2.conf set_option pad-responses: no
echo "> query www.example.com. A"
dig @127.0.0.1 -p $UNBOUND_PORT www.example.com. A | tee outfile
echo "> query txt.example.com. TXT"
dig @127.0.0.1 -p $UNBOUND_PORT txt.example.com. TXT | tee outfile
echo "> flush cache entries."
$PRE/unbound-control -c ub.conf flush_type www.example.com A
$PRE/unbound-control -c ub.conf flush_type txt.example.com TXT
echo "> enable padding of responses."
$PRE/unbound-control -c ub2.conf set_option pad-responses: yes
echo "> set pad responses block size to 64"
$PRE/unbound-control -c ub2.conf set_option pad-responses-block-size: 64
echo "> disable padding of queries."
$PRE/unbound-control -c ub.conf set_option pad-queries: no
echo "> query www.example.com. A"
dig @127.0.0.1 -p $UNBOUND_PORT www.example.com. A | tee outfile
echo "> query txt.example.com. TXT"
dig @127.0.0.1 -p $UNBOUND_PORT txt.example.com. TXT | tee outfile
echo "> flush cache entries."
$PRE/unbound-control -c ub.conf flush_type www.example.com A
$PRE/unbound-control -c ub.conf flush_type txt.example.com TXT
echo "> enable padding of queries."
$PRE/unbound-control -c ub.conf set_option pad-queries: yes
echo "> set pad queries block size to 48"
$PRE/unbound-control -c ub.conf set_option pad-queries-block-size: 48
echo "> query www.example.com. A"
dig @127.0.0.1 -p $UNBOUND_PORT www.example.com. A | tee outfile
echo "> query txt.example.com. TXT"
dig @127.0.0.1 -p $UNBOUND_PORT txt.example.com. TXT | tee outfile
echo "> flush cache entries."
$PRE/unbound-control -c ub.conf flush_type www.example.com A
$PRE/unbound-control -c ub.conf flush_type txt.example.com TXT
echo "> set pad responses block size to 512"
$PRE/unbound-control -c ub2.conf set_option pad-responses-block-size: 512
echo "> query www.example.com. A"
dig @127.0.0.1 -p $UNBOUND_PORT www.example.com. A | tee outfile
echo "> query fin.example.com. TXT"
dig @127.0.0.1 -p $UNBOUND_PORT fin.example.com. TXT | tee outfile
echo "> check tap.log for dnstap info"
# see if it logged the information in tap.log
# wait for a moment for filesystem to catch up.
wait_logfile tap.log "fini" 45
if grep "fini" tap.log; then echo "yes it is in tap.log";
else
echo "information not in tap.log"
echo "failed"
echo "> cat logfiles"
cat tap.log
cat tap.errlog
cat fwd.log
cat unbound.log
echo "Not OK"
exit 1
fi
grep '^;; MSG SIZE rcvd: ' tap.log > message.sizes
if diff message.sizes padding.msgsizes
then
echo "OK - Message sizes matched expected sizes"
exit 0
else
echo "unexpected message sizes"
echo "failed"
echo "> cat logfiles"
cat tap.log
cat tap.errlog
cat fwd.log
cat unbound.log
echo "Not OK"
exit 1
fi
|