27424c351db1b1ee96848956cf314025f727d1deTinderbox User# Copyright (C) 2013-2016 Internet Systems Consortium, Inc. ("ISC")
0c27b3fe77ac1d5094ba3521e8142d9e7973133fMark Andrews# This Source Code Form is subject to the terms of the Mozilla Public
0c27b3fe77ac1d5094ba3521e8142d9e7973133fMark Andrews# License, v. 2.0. If a copy of the MPL was not distributed with this
0c27b3fe77ac1d5094ba3521e8142d9e7973133fMark Andrews# file, You can obtain one at http://mozilla.org/MPL/2.0/.
a0b4f6d952cc6adde281948cf995868b44f366e8Evan HuntDIGOPTS6="+tcp +short -p 5300 @fd92:7065:b8e:ffff::2"
c0c4512020c0a4a9e5b087cb8cad1cd68fb3f52eEvan Huntecho "I:checking GeoIP country database by code ($n)"
501941f0b6cce74c2ff75b10aff3f230d5d37e4cEvan Hunt $DIG $DIGOPTS txt example -b 10.53.0.$i > dig.out.ns2.test$n.$i || lret=1
d46855caedd5cb101795707f6f467fa363ef1448Evan Huntecho "I:checking GeoIP country database by code (using client subnet) ($n)"
c968a257c1ed1007307cb9b1757f70bbe45da79aMark Andrews $DIG $DIGOPTS txt example -b 127.0.0.1 +subnet="10.53.0.$i/32" > dig.out.ns2.test$n.$i || lret=1
d46855caedd5cb101795707f6f467fa363ef1448Evan Huntecho "I:checking response scope using client subnet ($n)"
d46855caedd5cb101795707f6f467fa363ef1448Evan Hunt$DIG +tcp -p5300 @10.53.0.2 txt example -b 127.0.0.1 +subnet="10.53.0.1/32" > dig.out.ns2.test$n.1 || ret=1
d46855caedd5cb101795707f6f467fa363ef1448Evan Huntgrep 'CLIENT-SUBNET.*10.53.0.1/32/32' dig.out.ns2.test$n.1 > /dev/null || ret=1
d46855caedd5cb101795707f6f467fa363ef1448Evan Hunt$DIG +tcp -p5300 @10.53.0.2 txt example -b 127.0.0.1 +subnet="192.0.2.64/32" > dig.out.ns2.test$n.2 || ret=1
d46855caedd5cb101795707f6f467fa363ef1448Evan Huntgrep 'CLIENT-SUBNET.*192.0.2.64/32/24' dig.out.ns2.test$n.2 > /dev/null || ret=1
501941f0b6cce74c2ff75b10aff3f230d5d37e4cEvan Huntecho "I:reloading server"
501941f0b6cce74c2ff75b10aff3f230d5d37e4cEvan Hunt$RNDC -c ../common/rndc.conf -s 10.53.0.2 -p 9953 reload 2>&1 | sed 's/^/I:ns2 /'
c0c4512020c0a4a9e5b087cb8cad1cd68fb3f52eEvan Huntecho "I:checking GeoIP country database by three-letter code ($n)"
501941f0b6cce74c2ff75b10aff3f230d5d37e4cEvan Hunt $DIG $DIGOPTS txt example -b 10.53.0.$i > dig.out.ns2.test$n.$i || lret=1
501941f0b6cce74c2ff75b10aff3f230d5d37e4cEvan Huntecho "I:reloading server"
501941f0b6cce74c2ff75b10aff3f230d5d37e4cEvan Hunt$RNDC -c ../common/rndc.conf -s 10.53.0.2 -p 9953 reload 2>&1 | sed 's/^/I:ns2 /'
c0c4512020c0a4a9e5b087cb8cad1cd68fb3f52eEvan Huntecho "I:checking GeoIP country database by name ($n)"
501941f0b6cce74c2ff75b10aff3f230d5d37e4cEvan Hunt $DIG $DIGOPTS txt example -b 10.53.0.$i > dig.out.ns2.test$n.$i || lret=1
501941f0b6cce74c2ff75b10aff3f230d5d37e4cEvan Huntecho "I:reloading server"
501941f0b6cce74c2ff75b10aff3f230d5d37e4cEvan Hunt$RNDC -c ../common/rndc.conf -s 10.53.0.2 -p 9953 reload 2>&1 | sed 's/^/I:ns2 /'
c0c4512020c0a4a9e5b087cb8cad1cd68fb3f52eEvan Huntecho "I:checking GeoIP region code, no specified database ($n)"
501941f0b6cce74c2ff75b10aff3f230d5d37e4cEvan Hunt# skipping 2 on purpose here; it has the same region code as 1
501941f0b6cce74c2ff75b10aff3f230d5d37e4cEvan Hunt $DIG $DIGOPTS txt example -b 10.53.0.$i > dig.out.ns2.test$n.$i || lret=1
501941f0b6cce74c2ff75b10aff3f230d5d37e4cEvan Huntecho "I:reloading server"
501941f0b6cce74c2ff75b10aff3f230d5d37e4cEvan Hunt$RNDC -c ../common/rndc.conf -s 10.53.0.2 -p 9953 reload 2>&1 | sed 's/^/I:ns2 /'
c0c4512020c0a4a9e5b087cb8cad1cd68fb3f52eEvan Huntecho "I:checking GeoIP region database by region name and country code ($n)"
501941f0b6cce74c2ff75b10aff3f230d5d37e4cEvan Hunt $DIG $DIGOPTS txt example -b 10.53.0.$i > dig.out.ns2.test$n.$i || lret=1
d46855caedd5cb101795707f6f467fa363ef1448Evan Huntecho "I:checking GeoIP region database (using client subnet) ($n)"
d46855caedd5cb101795707f6f467fa363ef1448Evan Hunt $DIG $DIGOPTS txt example -b 127.0.0.1 +subnet="10.53.0.$i/32" > dig.out.ns2.test$n.$i || lret=1
501941f0b6cce74c2ff75b10aff3f230d5d37e4cEvan Huntecho "I:reloading server"
501941f0b6cce74c2ff75b10aff3f230d5d37e4cEvan Hunt$RNDC -c ../common/rndc.conf -s 10.53.0.2 -p 9953 reload 2>&1 | sed 's/^/I:ns2 /'
a0b4f6d952cc6adde281948cf995868b44f366e8Evan Hunt echo "I:checking GeoIP city database by city name using IPv6 ($n)"
a0b4f6d952cc6adde281948cf995868b44f366e8Evan Hunt $DIG +tcp +short -p 5300 @fd92:7065:b8e:ffff::1 -6 txt example -b fd92:7065:b8e:ffff::2 > dig.out.ns2.test$n || ret=1
a0b4f6d952cc6adde281948cf995868b44f366e8Evan Hunt echo "I:IPv6 unavailable; skipping"
c0c4512020c0a4a9e5b087cb8cad1cd68fb3f52eEvan Huntecho "I:checking GeoIP city database by city name ($n)"
501941f0b6cce74c2ff75b10aff3f230d5d37e4cEvan Hunt $DIG $DIGOPTS txt example -b 10.53.0.$i > dig.out.ns2.test$n.$i || lret=1
d46855caedd5cb101795707f6f467fa363ef1448Evan Huntecho "I:checking GeoIP city database (using client subnet) ($n)"
d46855caedd5cb101795707f6f467fa363ef1448Evan Hunt $DIG $DIGOPTS txt example -b 127.0.0.1 +subnet="10.53.0.$i/32" > dig.out.ns2.test$n.$i || lret=1
501941f0b6cce74c2ff75b10aff3f230d5d37e4cEvan Huntecho "I:reloading server"
501941f0b6cce74c2ff75b10aff3f230d5d37e4cEvan Hunt$RNDC -c ../common/rndc.conf -s 10.53.0.2 -p 9953 reload 2>&1 | sed 's/^/I:ns2 /'
c0c4512020c0a4a9e5b087cb8cad1cd68fb3f52eEvan Huntecho "I:checking GeoIP isp database ($n)"
501941f0b6cce74c2ff75b10aff3f230d5d37e4cEvan Hunt $DIG $DIGOPTS txt example -b 10.53.0.$i > dig.out.ns2.test$n.$i || lret=1
d46855caedd5cb101795707f6f467fa363ef1448Evan Huntecho "I:checking GeoIP isp database (using client subnet) ($n)"
d46855caedd5cb101795707f6f467fa363ef1448Evan Hunt $DIG $DIGOPTS txt example -b 127.0.0.1 +subnet="10.53.0.$i/32" > dig.out.ns2.test$n.$i || lret=1
501941f0b6cce74c2ff75b10aff3f230d5d37e4cEvan Huntecho "I:reloading server"
501941f0b6cce74c2ff75b10aff3f230d5d37e4cEvan Hunt$RNDC -c ../common/rndc.conf -s 10.53.0.2 -p 9953 reload 2>&1 | sed 's/^/I:ns2 /'
c0c4512020c0a4a9e5b087cb8cad1cd68fb3f52eEvan Huntecho "I:checking GeoIP org database ($n)"
501941f0b6cce74c2ff75b10aff3f230d5d37e4cEvan Hunt $DIG $DIGOPTS txt example -b 10.53.0.$i > dig.out.ns2.test$n.$i || lret=1
d46855caedd5cb101795707f6f467fa363ef1448Evan Huntecho "I:checking GeoIP org database (using client subnet) ($n)"
d46855caedd5cb101795707f6f467fa363ef1448Evan Hunt $DIG $DIGOPTS txt example -b 127.0.0.1 +subnet="10.53.0.$i/32" > dig.out.ns2.test$n.$i || lret=1
501941f0b6cce74c2ff75b10aff3f230d5d37e4cEvan Huntecho "I:reloading server"
501941f0b6cce74c2ff75b10aff3f230d5d37e4cEvan Hunt$RNDC -c ../common/rndc.conf -s 10.53.0.2 -p 9953 reload 2>&1 | sed 's/^/I:ns2 /'
c0c4512020c0a4a9e5b087cb8cad1cd68fb3f52eEvan Huntecho "I:checking GeoIP asnum database ($n)"
501941f0b6cce74c2ff75b10aff3f230d5d37e4cEvan Hunt $DIG $DIGOPTS txt example -b 10.53.0.$i > dig.out.ns2.test$n.$i || lret=1
d46855caedd5cb101795707f6f467fa363ef1448Evan Huntecho "I:checking GeoIP asnum database (using client subnet) ($n)"
d46855caedd5cb101795707f6f467fa363ef1448Evan Hunt $DIG $DIGOPTS txt example -b 127.0.0.1 +subnet="10.53.0.$i/32" > dig.out.ns2.test$n.$i || lret=1
501941f0b6cce74c2ff75b10aff3f230d5d37e4cEvan Huntecho "I:reloading server"
501941f0b6cce74c2ff75b10aff3f230d5d37e4cEvan Hunt$RNDC -c ../common/rndc.conf -s 10.53.0.2 -p 9953 reload 2>&1 | sed 's/^/I:ns2 /'
180319f572fb6c1ca7000d22ea79a8dd77ae3f91Evan Huntecho "I:checking GeoIP asnum database - ASNNNN only ($n)"
501941f0b6cce74c2ff75b10aff3f230d5d37e4cEvan Hunt $DIG $DIGOPTS txt example -b 10.53.0.$i > dig.out.ns2.test$n.$i || lret=1
a0b4f6d952cc6adde281948cf995868b44f366e8Evan Huntecho "I:checking GeoIP asnum database - ASNNNN only (using client subnet) ($n)"
d46855caedd5cb101795707f6f467fa363ef1448Evan Hunt $DIG $DIGOPTS txt example -b 127.0.0.1 +subnet="10.53.0.$i/32" > dig.out.ns2.test$n.$i || lret=1
501941f0b6cce74c2ff75b10aff3f230d5d37e4cEvan Huntecho "I:reloading server"
501941f0b6cce74c2ff75b10aff3f230d5d37e4cEvan Hunt$RNDC -c ../common/rndc.conf -s 10.53.0.2 -p 9953 reload 2>&1 | sed 's/^/I:ns2 /'
180319f572fb6c1ca7000d22ea79a8dd77ae3f91Evan Huntecho "I:checking GeoIP domain database ($n)"
180319f572fb6c1ca7000d22ea79a8dd77ae3f91Evan Hunt $DIG $DIGOPTS txt example -b 10.53.0.$i > dig.out.ns2.test$n.$i || lret=1
a0b4f6d952cc6adde281948cf995868b44f366e8Evan Huntecho "I:checking GeoIP domain database (using client subnet) ($n)"
a0b4f6d952cc6adde281948cf995868b44f366e8Evan Hunt $DIG $DIGOPTS txt example -b 127.0.0.1 +subnet="10.53.0.$i/32" > dig.out.ns2.test$n.$i || lret=1
180319f572fb6c1ca7000d22ea79a8dd77ae3f91Evan Huntecho "I:reloading server"
180319f572fb6c1ca7000d22ea79a8dd77ae3f91Evan Hunt$RNDC -c ../common/rndc.conf -s 10.53.0.2 -p 9953 reload 2>&1 | sed 's/^/I:ns2 /'
c0c4512020c0a4a9e5b087cb8cad1cd68fb3f52eEvan Huntecho "I:checking GeoIP netspeed database ($n)"
501941f0b6cce74c2ff75b10aff3f230d5d37e4cEvan Hunt $DIG $DIGOPTS txt example -b 10.53.0.$i > dig.out.ns2.test$n.$i || lret=1
d46855caedd5cb101795707f6f467fa363ef1448Evan Huntecho "I:checking GeoIP netspeed database (using client subnet) ($n)"
d46855caedd5cb101795707f6f467fa363ef1448Evan Hunt $DIG $DIGOPTS txt example -b 127.0.0.1 +subnet="10.53.0.$i/32" > dig.out.ns2.test$n.$i || lret=1
d0803df3310ad09447c34b972e7594d576f5cbb5Evan Huntecho "I:reloading server"
d0803df3310ad09447c34b972e7594d576f5cbb5Evan Hunt$RNDC -c ../common/rndc.conf -s 10.53.0.2 -p 9953 reload 2>&1 | sed 's/^/I:ns2 /'
c0c4512020c0a4a9e5b087cb8cad1cd68fb3f52eEvan Huntecho "I:checking GeoIP blackhole ACL ($n)"
d0803df3310ad09447c34b972e7594d576f5cbb5Evan Hunt$DIG $DIGOPTS txt example -b 10.53.0.$i > dig.out.ns2.test$n || ret=1
d0803df3310ad09447c34b972e7594d576f5cbb5Evan Hunt$RNDC -c ../common/rndc.conf -s 10.53.0.2 -p 9953 status 2>&1 > rndc.out.ns2.test$n || ret=1
c0c4512020c0a4a9e5b087cb8cad1cd68fb3f52eEvan Huntecho "I:reloading server"
c0c4512020c0a4a9e5b087cb8cad1cd68fb3f52eEvan Hunt$RNDC -c ../common/rndc.conf -s 10.53.0.2 -p 9953 reload 2>&1 | sed 's/^/I:ns2 /'
c0c4512020c0a4a9e5b087cb8cad1cd68fb3f52eEvan Huntecho "I:checking GeoIP country database by code (using nested ACLs) ($n)"
c0c4512020c0a4a9e5b087cb8cad1cd68fb3f52eEvan Hunt $DIG $DIGOPTS txt example -b 10.53.0.$i > dig.out.ns2.test$n.$i || lret=1
d46855caedd5cb101795707f6f467fa363ef1448Evan Huntecho "I:reloading server"
d46855caedd5cb101795707f6f467fa363ef1448Evan Hunt$RNDC -c ../common/rndc.conf -s 10.53.0.2 -p 9953 reload 2>&1 | sed 's/^/I:ns2 /'
d46855caedd5cb101795707f6f467fa363ef1448Evan Huntecho "I:checking geoip-use-ecs ($n)"
d46855caedd5cb101795707f6f467fa363ef1448Evan Hunt $DIG $DIGOPTS txt example -b 10.53.0.$i > dig.out.ns2.test$n.$i || lret=1
d46855caedd5cb101795707f6f467fa363ef1448Evan Hunt $DIG $DIGOPTS txt example -b 127.0.0.1 +subnet="10.53.0.$i/32" > dig.out.ns2.test$n.ecs.$i || lret=1
a0b4f6d952cc6adde281948cf995868b44f366e8Evan Huntecho "I:reloading server with different geoip-directory ($n)"
a0b4f6d952cc6adde281948cf995868b44f366e8Evan Hunt$RNDC -c ../common/rndc.conf -s 10.53.0.2 -p 9953 reload 2>&1 | sed 's/^/I:ns2 /'
a0b4f6d952cc6adde281948cf995868b44f366e8Evan Huntawk '/using "..\/data2" as GeoIP directory/ {m=1} ; { if (m>0) { print } }' ns2/named.run | grep "GeoIP City .* DB not available" > /dev/null || ret=1
a0b4f6d952cc6adde281948cf995868b44f366e8Evan Huntecho "I:checking GeoIP v4/v6 when only IPv6 database is available ($n)"
a0b4f6d952cc6adde281948cf995868b44f366e8Evan Hunt$DIG $DIGOPTS -4 txt example -b 10.53.0.2 > dig.out.ns2.test$n.1 || ret=1
a0b4f6d952cc6adde281948cf995868b44f366e8Evan Hunt $DIG $DIGOPTS6 txt example -b fd92:7065:b8e:ffff::2 > dig.out.ns2.test$n.2 || ret=1
fbed5f0f44515f5b3ca499a3466c875507852970Evan Huntecho "I:checking other GeoIP options are parsed correctly ($n)"
501941f0b6cce74c2ff75b10aff3f230d5d37e4cEvan Huntecho "I:exit status: $status"