Commit 195277ca authored by Matthijs Mekking's avatar Matthijs Mekking 🏡 Committed by Mark Andrews
Browse files

Check dig TTLs.

This also fixes a bug in the tests ($n was not incremented in one
place).
parent 146202d6
......@@ -76,6 +76,7 @@ if [ -x "$DIG" ] ; then
ret=0
dig_with_opts @10.53.0.3 +split=4 -t sshfp foo.example > dig.out.test$n || ret=1
grep " 9ABC DEF6 7890 " < dig.out.test$n > /dev/null || ret=1
check_ttl_range dig.out.test$n "SSHFP" 300 || ret=1
if [ $ret -ne 0 ]; then echo_i "failed"; fi
status=$((status+ret))
......@@ -84,6 +85,7 @@ if [ -x "$DIG" ] ; then
ret=0
dig_with_opts @10.53.0.3 +unknownformat a a.example > dig.out.test$n || ret=1
grep "CLASS1[ ][ ]*TYPE1[ ][ ]*\\\\# 4 0A000001" < dig.out.test$n > /dev/null || ret=1
check_ttl_range dig.out.test$n "TYPE1" 300 || ret=1
if [ $ret -ne 0 ]; then echo_i "failed"; fi
status=$((status+ret))
......@@ -93,6 +95,7 @@ if [ -x "$DIG" ] ; then
dig_with_opts @10.53.0.3 -x 127.0.0.1 > dig.out.test$n 2>&1 || ret=1
# doesn't matter if has answer
grep -i "127\\.in-addr\\.arpa\\." < dig.out.test$n > /dev/null || ret=1
check_ttl_range dig.out.test$n "SOA" 86400 || ret=1
if [ $ret -ne 0 ]; then echo_i "failed"; fi
status=$((status+ret))
......@@ -101,6 +104,7 @@ if [ -x "$DIG" ] ; then
ret=0
dig_with_opts +tcp @10.53.0.3 a a.example > dig.out.test$n || ret=1
grep "10\\.0\\.0\\.1$" < dig.out.test$n > /dev/null || ret=1
check_ttl_range dig.out.test$n "A" 300 || ret=1
if [ $ret -ne 0 ]; then echo_i "failed"; fi
status=$((status+ret))
......@@ -109,6 +113,7 @@ if [ -x "$DIG" ] ; then
ret=0
dig_with_opts +tcp @10.53.0.3 +multi +norrcomments DNSKEY dnskey.example > dig.out.test$n || ret=1
grep "; ZSK; alg = $DEFAULT_ALGORITHM ; key id = $KEYID" < dig.out.test$n > /dev/null && ret=1
check_ttl_range dig.out.test$n "DNSKEY" 300 || ret=1
if [ $ret -ne 0 ]; then echo_i "failed"; fi
status=$((status+ret))
......@@ -117,6 +122,7 @@ if [ -x "$DIG" ] ; then
ret=0
dig_with_opts +tcp @10.53.0.3 +multi +norrcomments SOA example > dig.out.test$n || ret=1
grep "; ZSK; alg = $DEFAULT_ALGORITHM ; key id = $KEYID" < dig.out.test$n > /dev/null && ret=1
check_ttl_range dig.out.test$n "SOA" 300 || ret=1
if [ $ret -ne 0 ]; then echo_i "failed"; fi
status=$((status+ret))
......@@ -125,6 +131,7 @@ if [ -x "$DIG" ] ; then
ret=0
dig_with_opts +tcp @10.53.0.3 +rrcomments DNSKEY dnskey.example > dig.out.test$n || ret=1
grep "; ZSK; alg = $DEFAULT_ALGORITHM ; key id = $KEYID" < dig.out.test$n > /dev/null || ret=1
check_ttl_range dig.out.test$n "DNSKEY" 300 || ret=1
if [ $ret -ne 0 ]; then echo_i "failed"; fi
status=$((status+ret))
......@@ -167,6 +174,10 @@ if [ -x "$DIG" ] ; then
test "$lcmm" -ge "$lcmn" || ret=1
test "$lcnm" -ge "$lcnn" || ret=1
test "$lcmn" -ge "$lcnn" || ret=1
check_ttl_range dig.out.nn.$n "DNSKEY" 300 || ret=1
check_ttl_range dig.out.mn.$n "DNSKEY" 300 || ret=1
check_ttl_range dig.out.nm.$n "DNSKEY" 300 || ret=1
check_ttl_range dig.out.mm.$n "DNSKEY" 300 || ret=1
if [ $ret -ne 0 ]; then echo_i "failed"; fi
status=$((status+ret))
......@@ -175,6 +186,7 @@ if [ -x "$DIG" ] ; then
ret=0
dig_with_opts +tcp @10.53.0.3 +noheader-only A example > dig.out.test$n || ret=1
grep "Got answer:" < dig.out.test$n > /dev/null || ret=1
check_ttl_range dig.out.test$n "SOA" 300 || ret=1
if [ $ret -ne 0 ]; then echo_i "failed"; fi
status=$((status+ret))
......@@ -201,6 +213,7 @@ if [ -x "$DIG" ] ; then
dig_with_opts +tcp @10.53.0.3 +raflag +qr example > dig.out.test$n || ret=1
grep "^;; flags: rd ra ad; QUERY: 1, ANSWER: 0," < dig.out.test$n > /dev/null || ret=1
grep "^;; flags: qr rd ra; QUERY: 1, ANSWER: 0," < dig.out.test$n > /dev/null || ret=1
check_ttl_range dig.out.test$n "SOA" 300 || ret=1
if [ $ret -ne 0 ]; then echo_i "failed"; fi
status=$((status+ret))
......@@ -210,6 +223,7 @@ if [ -x "$DIG" ] ; then
dig_with_opts +tcp @10.53.0.3 +tcflag +qr example > dig.out.test$n || ret=1
grep "^;; flags: tc rd ad; QUERY: 1, ANSWER: 0" < dig.out.test$n > /dev/null || ret=1
grep "^;; flags: qr rd ra; QUERY: 1, ANSWER: 0," < dig.out.test$n > /dev/null || ret=1
check_ttl_range dig.out.test$n "SOA" 300 || ret=1
if [ $ret -ne 0 ]; then echo_i "failed"; fi
status=$((status+ret))
......@@ -228,6 +242,7 @@ if [ -x "$DIG" ] ; then
dig_with_opts +tcp @10.53.0.3 +zflag +qr A example > dig.out.test$n || ret=1
sed -n '/Sending:/,/Got answer:/p' dig.out.test$n | grep "^;; flags: rd ad; MBZ: 0x4;" > /dev/null || ret=1
sed -n '/Got answer:/,/AUTHORITY SECTION:/p' dig.out.test$n | grep "^;; flags: qr rd ra; QUERY: 1" > /dev/null || ret=1
check_ttl_range dig.out.test$n "SOA" 300 || ret=1
if [ $ret -ne 0 ]; then echo_i "failed"; fi
status=$((status+ret))
......@@ -240,6 +255,7 @@ if [ -x "$DIG" ] ; then
if [ $ret -ne 0 ]; then echo_i "failed"; fi
status=$((status+ret))
n=$((n+1))
echo_i "checking dig +ttlunits works ($n)"
ret=0
dig_with_opts +tcp @10.53.0.2 +ttlunits A weeks.example > dig.out.test$n || ret=1
......@@ -346,6 +362,7 @@ if [ -x "$DIG" ] ; then
ret=0
dig_with_opts +tcp @10.53.0.2 +subnet=127.0.0.1 A a.example > dig.out.test$n 2>&1 || ret=1
grep "CLIENT-SUBNET: 127.0.0.1/32/0" < dig.out.test$n > /dev/null || ret=1
check_ttl_range dig.out.test$n "A" 300 || ret=1
if [ $ret -ne 0 ]; then echo_i "failed"; fi
status=$((status+ret))
......@@ -354,6 +371,7 @@ if [ -x "$DIG" ] ; then
ret=0
dig_with_opts +tcp @10.53.0.2 +subnet=127.0.0.0 +subnet=127.0.0.1 A a.example > dig.out.test$n 2>&1 || ret=1
grep "CLIENT-SUBNET: 127.0.0.1/32/0" < dig.out.test$n > /dev/null || ret=1
check_ttl_range dig.out.test$n "A" 300 || ret=1
if [ $ret -ne 0 ]; then echo_i "failed"; fi
status=$((status+ret))
......@@ -379,6 +397,7 @@ if [ -x "$DIG" ] ; then
esac
grep "FORMERR" < dig.out.$i.test$n > /dev/null && ret=1
grep "CLIENT-SUBNET: $addr/$i/0" < dig.out.$i.test$n > /dev/null || ret=1
check_ttl_range dig.out.$i.test$n "A" 300 || ret=1
done
if [ $ret -ne 0 ]; then echo_i "failed"; fi
status=$((status+ret))
......@@ -390,6 +409,7 @@ if [ -x "$DIG" ] ; then
grep "status: NOERROR" < dig.out.test$n > /dev/null || ret=1
grep "CLIENT-SUBNET: 0.0.0.0/0/0" < dig.out.test$n > /dev/null || ret=1
grep "10.0.0.1" < dig.out.test$n > /dev/null || ret=1
check_ttl_range dig.out.test$n "A" 300 || ret=1
if [ $ret -ne 0 ]; then echo_i "failed"; fi
status=$((status+ret))
......@@ -400,6 +420,7 @@ if [ -x "$DIG" ] ; then
grep "status: NOERROR" < dig.out.test$n > /dev/null || ret=1
grep "CLIENT-SUBNET: 0.0.0.0/0/0" < dig.out.test$n > /dev/null || ret=1
grep "10.0.0.1" < dig.out.test$n > /dev/null || ret=1
check_ttl_range dig.out.test$n "A" 300 || ret=1
if [ $ret -ne 0 ]; then echo_i "failed"; fi
status=$((status+ret))
......@@ -410,6 +431,7 @@ if [ -x "$DIG" ] ; then
grep "status: NOERROR" < dig.out.test$n > /dev/null || ret=1
grep "CLIENT-SUBNET: ::/0/0" < dig.out.test$n > /dev/null || ret=1
grep "10.0.0.1" < dig.out.test$n > /dev/null || ret=1
check_ttl_range dig.out.test$n "A" 300 || ret=1
if [ $ret -ne 0 ]; then echo_i "failed"; fi
status=$((status+ret))
......@@ -420,6 +442,7 @@ if [ -x "$DIG" ] ; then
grep "status: NOERROR" < dig.out.test$n > /dev/null || ret=1
grep "CLIENT-SUBNET: 0/0/0" < dig.out.test$n > /dev/null || ret=1
grep "10.0.0.1" < dig.out.test$n > /dev/null || ret=1
check_ttl_range dig.out.test$n "A" 300 || ret=1
if [ $ret -ne 0 ]; then echo_i "failed"; fi
status=$((status+ret))
......@@ -440,6 +463,7 @@ if [ -x "$DIG" ] ; then
dig_with_opts +tcp @10.53.0.2 +subnet=10.53/$p A a.example > dig.out.test.$p.$n 2>&1 || ret=1
grep "FORMERR" < dig.out.test.$p.$n > /dev/null && ret=1
grep "CLIENT-SUBNET.*/$p/0" < dig.out.test.$p.$n > /dev/null || ret=1
check_ttl_range dig.out.test.$p.$n "A" 300 || ret=1
done
if [ $ret -ne 0 ]; then echo_i "failed"; fi
status=$((status+ret))
......@@ -449,6 +473,7 @@ if [ -x "$DIG" ] ; then
ret=0
dig_with_opts @10.53.0.3 +sp=4 -t sshfp foo.example > dig.out.test$n || ret=1
grep " 9ABC DEF6 7890 " < dig.out.test$n > /dev/null || ret=1
check_ttl_range dig.out.test$n "SSHFP" 300 || ret=1
if [ $ret -ne 0 ]; then echo_i "failed"; fi
status=$((status+ret))
......@@ -476,6 +501,7 @@ if [ -x "$DIG" ] ; then
ret=0
dig_with_opts @10.53.0.3 +ednsopt=3 a.example > dig.out.test$n 2>&1 || ret=1
grep 'NSID: .* ("ns3")' dig.out.test$n > /dev/null || ret=1
check_ttl_range dig.out.test$n "A" 300 || ret=1
if [ $ret -ne 0 ]; then echo_i "failed"; fi
status=$((status+ret))
......@@ -484,6 +510,7 @@ if [ -x "$DIG" ] ; then
ret=0
dig_with_opts @10.53.0.3 +ednsopt=nsid a.example > dig.out.test$n 2>&1 || ret=1
grep 'NSID: .* ("ns3")' dig.out.test$n > /dev/null || ret=1
check_ttl_range dig.out.test$n "A" 300 || ret=1
if [ $ret -ne 0 ]; then echo_i "failed"; fi
status=$((status+ret))
......@@ -508,6 +535,7 @@ if [ -x "$DIG" ] ; then
dig_with_opts @10.53.0.3 +ednsopt=key-tag:00010002 a.example +qr > dig.out.test$n 2>&1 || ret=1
grep "; KEY-TAG: 1, 2$" dig.out.test$n > /dev/null || ret=1
grep "status: FORMERR" dig.out.test$n > /dev/null && ret=1
check_ttl_range dig.out.test$n "A" 300 || ret=1
if [ $ret -ne 0 ]; then echo_i "failed"; fi
status=$((status+ret))
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment