tests.sh revision 247bf378605811d695e968dbe930a7fc45c0038e
d6fa26d0adaec6c910115be34fe7a5a5f402c14fMark Andrews#!/bin/sh
fc2381b901eb162810f54a11cc512b95f55a60dfAutomatic Updater#
71cef386fae61275b03e203825680b39fedaa8c6Tinderbox User * Copyright (C) 2008 Internet Systems Consortium, Inc. ("ISC")
bef75d63d74f58abc0f834ed271526672777ba29Automatic Updater *
5347c0fcb04eaea19d9f39795646239f487c6207Tinderbox User * Permission to use, copy, modify, and/or distribute this software for any
5347c0fcb04eaea19d9f39795646239f487c6207Tinderbox User * purpose with or without fee is hereby granted, provided that the above
5347c0fcb04eaea19d9f39795646239f487c6207Tinderbox User * copyright notice and this permission notice appear in all copies.
fc2381b901eb162810f54a11cc512b95f55a60dfAutomatic Updater *
d6fa26d0adaec6c910115be34fe7a5a5f402c14fMark Andrews * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
fc2381b901eb162810f54a11cc512b95f55a60dfAutomatic Updater * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
fc2381b901eb162810f54a11cc512b95f55a60dfAutomatic Updater * AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
fc2381b901eb162810f54a11cc512b95f55a60dfAutomatic Updater * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
fd2597f75693a2279fdf588bd40dfe2407c42028Tinderbox User * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
14a656f94b1fd0ababd84a772228dfa52276ba15Evan Hunt * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
cd32f419a8a5432fbb139f56ee73cbf68b9350ccTinderbox User * PERFORMANCE OF THIS SOFTWARE.
fc2381b901eb162810f54a11cc512b95f55a60dfAutomatic Updater
10b865e9187fc77cae02f106ddcc9e03eecdfe06Tinderbox User# $Id: tests.sh,v 1.4 2008/07/19 00:02:14 each Exp $
fc2381b901eb162810f54a11cc512b95f55a60dfAutomatic Updater
fc2381b901eb162810f54a11cc512b95f55a60dfAutomatic UpdaterSYSTEMTESTTOP=..
fc2381b901eb162810f54a11cc512b95f55a60dfAutomatic Updater. $SYSTEMTESTTOP/conf.sh
fc2381b901eb162810f54a11cc512b95f55a60dfAutomatic Updater
fc2381b901eb162810f54a11cc512b95f55a60dfAutomatic UpdaterDIGOPTS="+tcp +noadd +nosea +nostat +noquest +nocomm +nocmd"
fc2381b901eb162810f54a11cc512b95f55a60dfAutomatic Updater
fc2381b901eb162810f54a11cc512b95f55a60dfAutomatic Updaterstatus=0
fc2381b901eb162810f54a11cc512b95f55a60dfAutomatic Updatert=0
fc2381b901eb162810f54a11cc512b95f55a60dfAutomatic Updater
10b865e9187fc77cae02f106ddcc9e03eecdfe06Tinderbox Userecho "I:testing basic ACL processing"
fc2381b901eb162810f54a11cc512b95f55a60dfAutomatic Updater# key "one" should fail
fc2381b901eb162810f54a11cc512b95f55a60dfAutomatic Updatert=`expr $t + 1`
fc2381b901eb162810f54a11cc512b95f55a60dfAutomatic Updater$DIG $DIGOPTS tsigzone. \
fc2381b901eb162810f54a11cc512b95f55a60dfAutomatic Updater @10.53.0.2 -b 10.53.0.1 axfr -y one:1234abcd8765 -p 5300 > dig.out
fc2381b901eb162810f54a11cc512b95f55a60dfAutomatic Updatergrep "^;" dig.out > /dev/null 2>&1 || { echo "I:test $t failed" ; status=1; }
fd2597f75693a2279fdf588bd40dfe2407c42028Tinderbox User
fc2381b901eb162810f54a11cc512b95f55a60dfAutomatic Updater# any other key should be fine
7911e6f9de303bca5a3d8b34f4330c8f7cecffaeTinderbox Usert=`expr $t + 1`
7911e6f9de303bca5a3d8b34f4330c8f7cecffaeTinderbox User$DIG $DIGOPTS tsigzone. \
7911e6f9de303bca5a3d8b34f4330c8f7cecffaeTinderbox User @10.53.0.2 -b 10.53.0.1 axfr -y two:1234abcd8765 -p 5300 > dig.out
7911e6f9de303bca5a3d8b34f4330c8f7cecffaeTinderbox Usergrep "^;" dig.out > /dev/null 2>&1 && { echo "I:test $t failed" ; status=1; }
7911e6f9de303bca5a3d8b34f4330c8f7cecffaeTinderbox User
fc2381b901eb162810f54a11cc512b95f55a60dfAutomatic Updatercp -f ns2/named2.conf ns2/named.conf
7911e6f9de303bca5a3d8b34f4330c8f7cecffaeTinderbox User$RNDC -c ../common/rndc.conf -s 10.53.0.2 -p 9953 reload 2>&1 | sed 's/^/I:ns2 /'
7911e6f9de303bca5a3d8b34f4330c8f7cecffaeTinderbox Usersleep 5
7911e6f9de303bca5a3d8b34f4330c8f7cecffaeTinderbox User
7911e6f9de303bca5a3d8b34f4330c8f7cecffaeTinderbox User# prefix 10/8 should fail
fc2381b901eb162810f54a11cc512b95f55a60dfAutomatic Updatert=`expr $t + 1`
7911e6f9de303bca5a3d8b34f4330c8f7cecffaeTinderbox User$DIG $DIGOPTS tsigzone. \
7911e6f9de303bca5a3d8b34f4330c8f7cecffaeTinderbox User @10.53.0.2 -b 10.53.0.1 axfr -y one:1234abcd8765 -p 5300 > dig.out
7911e6f9de303bca5a3d8b34f4330c8f7cecffaeTinderbox Usergrep "^;" dig.out > /dev/null 2>&1 || { echo "I:test $t failed" ; status=1; }
7911e6f9de303bca5a3d8b34f4330c8f7cecffaeTinderbox User
fc2381b901eb162810f54a11cc512b95f55a60dfAutomatic Updater# any other address should work, as long as it sends key "one"
7911e6f9de303bca5a3d8b34f4330c8f7cecffaeTinderbox Usert=`expr $t + 1`
7911e6f9de303bca5a3d8b34f4330c8f7cecffaeTinderbox User$DIG $DIGOPTS tsigzone. \
7911e6f9de303bca5a3d8b34f4330c8f7cecffaeTinderbox User @10.53.0.2 -b 127.0.0.1 axfr -y two:1234abcd8765 -p 5300 > dig.out
7911e6f9de303bca5a3d8b34f4330c8f7cecffaeTinderbox Usergrep "^;" dig.out > /dev/null 2>&1 || { echo "I:test $t failed" ; status=1; }
7911e6f9de303bca5a3d8b34f4330c8f7cecffaeTinderbox User
7911e6f9de303bca5a3d8b34f4330c8f7cecffaeTinderbox Usert=`expr $t + 1`
7911e6f9de303bca5a3d8b34f4330c8f7cecffaeTinderbox User$DIG $DIGOPTS tsigzone. \
7e71f05d8643aca84914437c900cb716444507e4Tinderbox User @10.53.0.2 -b 127.0.0.1 axfr -y one:1234abcd8765 -p 5300 > dig.out
7911e6f9de303bca5a3d8b34f4330c8f7cecffaeTinderbox Usergrep "^;" dig.out > /dev/null 2>&1 && { echo "I:test $t failed" ; status=1; }
7911e6f9de303bca5a3d8b34f4330c8f7cecffaeTinderbox User
14a656f94b1fd0ababd84a772228dfa52276ba15Evan Huntecho "I:testing nested ACL processing"
fc2381b901eb162810f54a11cc512b95f55a60dfAutomatic Updater# all combinations of 10.53.0.{1|2} with key {one|two}, should succeed
fc2381b901eb162810f54a11cc512b95f55a60dfAutomatic Updatercp -f ns2/named3.conf ns2/named.conf
7911e6f9de303bca5a3d8b34f4330c8f7cecffaeTinderbox User$RNDC -c ../common/rndc.conf -s 10.53.0.2 -p 9953 reload 2>&1 | sed 's/^/I:ns2 /'
7911e6f9de303bca5a3d8b34f4330c8f7cecffaeTinderbox Usersleep 5
7911e6f9de303bca5a3d8b34f4330c8f7cecffaeTinderbox User
7e71f05d8643aca84914437c900cb716444507e4Tinderbox User# should succeed
7911e6f9de303bca5a3d8b34f4330c8f7cecffaeTinderbox Usert=`expr $t + 1`
7911e6f9de303bca5a3d8b34f4330c8f7cecffaeTinderbox User$DIG $DIGOPTS tsigzone. \
fc2381b901eb162810f54a11cc512b95f55a60dfAutomatic Updater @10.53.0.2 -b 10.53.0.2 axfr -y two:1234abcd8765 -p 5300 > dig.out
fc2381b901eb162810f54a11cc512b95f55a60dfAutomatic Updatergrep "^;" dig.out > /dev/null 2>&1 && { echo "I:test $t failed" ; status=1; }
7911e6f9de303bca5a3d8b34f4330c8f7cecffaeTinderbox User
7911e6f9de303bca5a3d8b34f4330c8f7cecffaeTinderbox User# should succeed
fc2381b901eb162810f54a11cc512b95f55a60dfAutomatic Updatert=`expr $t + 1`
fc2381b901eb162810f54a11cc512b95f55a60dfAutomatic Updater$DIG $DIGOPTS tsigzone. \
fc2381b901eb162810f54a11cc512b95f55a60dfAutomatic Updater @10.53.0.2 -b 10.53.0.2 axfr -y one:1234abcd8765 -p 5300 > dig.out
fc2381b901eb162810f54a11cc512b95f55a60dfAutomatic Updatergrep "^;" dig.out > /dev/null 2>&1 && { echo "I:test $t failed" ; status=1; }
fc2381b901eb162810f54a11cc512b95f55a60dfAutomatic Updater
fc2381b901eb162810f54a11cc512b95f55a60dfAutomatic Updater# should succeed
fc2381b901eb162810f54a11cc512b95f55a60dfAutomatic Updatert=`expr $t + 1`
cd32f419a8a5432fbb139f56ee73cbf68b9350ccTinderbox User$DIG $DIGOPTS tsigzone. \
10b865e9187fc77cae02f106ddcc9e03eecdfe06Tinderbox User @10.53.0.2 -b 10.53.0.1 axfr -y two:1234abcd8765 -p 5300 > dig.out
fc2381b901eb162810f54a11cc512b95f55a60dfAutomatic Updatergrep "^;" dig.out > /dev/null 2>&1 && { echo "I:test $t failed" ; status=1; }
fc2381b901eb162810f54a11cc512b95f55a60dfAutomatic Updater
fc2381b901eb162810f54a11cc512b95f55a60dfAutomatic Updater# should succeed
fc2381b901eb162810f54a11cc512b95f55a60dfAutomatic Updatert=`expr $t + 1`
fc2381b901eb162810f54a11cc512b95f55a60dfAutomatic Updater$DIG $DIGOPTS tsigzone. \
fc2381b901eb162810f54a11cc512b95f55a60dfAutomatic Updater @10.53.0.2 -b 10.53.0.1 axfr -y two:1234abcd8765 -p 5300 > dig.out
10b865e9187fc77cae02f106ddcc9e03eecdfe06Tinderbox Usergrep "^;" dig.out > /dev/null 2>&1 && { echo "I:test $t failed" ; status=1; }
fc2381b901eb162810f54a11cc512b95f55a60dfAutomatic Updater
fc2381b901eb162810f54a11cc512b95f55a60dfAutomatic Updater# but only one or the other should fail
fc2381b901eb162810f54a11cc512b95f55a60dfAutomatic Updatert=`expr $t + 1`
fc2381b901eb162810f54a11cc512b95f55a60dfAutomatic Updater$DIG $DIGOPTS tsigzone. \
c313914d0e66b20969215e519bbf2ab4ecf39512Tinderbox User @10.53.0.2 -b 127.0.0.1 axfr -y one:1234abcd8765 -p 5300 > dig.out
fc2381b901eb162810f54a11cc512b95f55a60dfAutomatic Updatergrep "^;" dig.out > /dev/null 2>&1 || { echo "I:test $t failed" ; status=1; }
fc2381b901eb162810f54a11cc512b95f55a60dfAutomatic Updater
t=`expr $t + 1`
$DIG $DIGOPTS tsigzone. \
@10.53.0.2 -b 10.53.0.2 axfr -p 5300 > dig.out
grep "^;" dig.out > /dev/null 2>&1 || { echo "I:test $tt failed" ; status=1; }
# and other values? right out
t=`expr $t + 1`
$DIG $DIGOPTS tsigzone. \
@10.53.0.2 -b 127.0.0.1 axfr -y three:1234abcd8765 -p 5300 > dig.out
grep "^;" dig.out > /dev/null 2>&1 || { echo "I:test $t failed" ; status=1; }
# now we only allow 10.53.0.1 *and* key one, or 10.53.0.2 *and* key two
cp -f ns2/named4.conf ns2/named.conf
$RNDC -c ../common/rndc.conf -s 10.53.0.2 -p 9953 reload 2>&1 | sed 's/^/I:ns2 /'
sleep 5
# should succeed
t=`expr $t + 1`
$DIG $DIGOPTS tsigzone. \
@10.53.0.2 -b 10.53.0.2 axfr -y two:1234abcd8765 -p 5300 > dig.out
grep "^;" dig.out > /dev/null 2>&1 && { echo "I:test $t failed" ; status=1; }
# should succeed
t=`expr $t + 1`
$DIG $DIGOPTS tsigzone. \
@10.53.0.2 -b 10.53.0.1 axfr -y one:1234abcd8765 -p 5300 > dig.out
grep "^;" dig.out > /dev/null 2>&1 && { echo "I:test $t failed" ; status=1; }
# should fail
t=`expr $t + 1`
$DIG $DIGOPTS tsigzone. \
@10.53.0.2 -b 10.53.0.2 axfr -y one:1234abcd8765 -p 5300 > dig.out
grep "^;" dig.out > /dev/null 2>&1 || { echo "I:test $t failed" ; status=1; }
# should fail
t=`expr $t + 1`
$DIG $DIGOPTS tsigzone. \
@10.53.0.2 -b 10.53.0.1 axfr -y two:1234abcd8765 -p 5300 > dig.out
grep "^;" dig.out > /dev/null 2>&1 || { echo "I:test $t failed" ; status=1; }
# should fail
t=`expr $t + 1`
$DIG $DIGOPTS tsigzone. \
@10.53.0.2 -b 10.53.0.3 axfr -y one:1234abcd8765 -p 5300 > dig.out
grep "^;" dig.out > /dev/null 2>&1 || { echo "I:test $t failed" ; status=1; }
echo "I:exit status: $status"
exit $status