tests.sh revision 7ed4399c6598276b76df95e6dc91ed7b2834abc6
40f53fa8d9c6a4fc38c0014495e7a42b08f52481David Lawrence# Copyright (C) 2008 Internet Systems Consortium, Inc. ("ISC")
7c74e180c206e6ed99e8beb820da5f399d845c3eDavid Lawrence# Permission to use, copy, modify, and/or distribute this software for any
7c74e180c206e6ed99e8beb820da5f399d845c3eDavid Lawrence# purpose with or without fee is hereby granted, provided that the above
40f53fa8d9c6a4fc38c0014495e7a42b08f52481David Lawrence# copyright notice and this permission notice appear in all copies.
dafcb997e390efa4423883dafd100c975c4095d6Mark Andrews# THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
dafcb997e390efa4423883dafd100c975c4095d6Mark Andrews# REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
dafcb997e390efa4423883dafd100c975c4095d6Mark Andrews# AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
dafcb997e390efa4423883dafd100c975c4095d6Mark Andrews# INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
dafcb997e390efa4423883dafd100c975c4095d6Mark Andrews# LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
dafcb997e390efa4423883dafd100c975c4095d6Mark Andrews# OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
9c3531d72aeaad6c5f01efe6a1c82023e1379e4dDavid Lawrence# PERFORMANCE OF THIS SOFTWARE.
74cb99072c4b0ebd2ccafcfa284288fa760f7a1aMark Andrews# $Id: tests.sh,v 1.4 2008/07/19 00:02:14 each Exp $
ea31416b4fcdf23732355a8002f93f29e3b3d2dbAndreas GustafssonDIGOPTS="+tcp +noadd +nosea +nostat +noquest +nocomm +nocmd"
be801b0fdbcf9b55b3a8cc6bf042ff6c86be6b11Mark Andrewsecho "I:testing basic ACL processing"
a5d43b72413db3edd6b36a58f9bdf2cf6ff692f2Bob Halley# key "one" should fail
ccdac53c027e8964753b36c4d8c7b0e98af501c2Michael Graff @10.53.0.2 -b 10.53.0.1 axfr -y one:1234abcd8765 -p 5300 > dig.out
ccdac53c027e8964753b36c4d8c7b0e98af501c2Michael Graffgrep "^;" dig.out > /dev/null 2>&1 || { echo "I:test $t failed" ; status=1; }
a903095bf4512dae561c7f6fc7854a51bebf334aMark Andrews# any other key should be fine
ccdac53c027e8964753b36c4d8c7b0e98af501c2Michael Graff @10.53.0.2 -b 10.53.0.1 axfr -y two:1234abcd8765 -p 5300 > dig.out
ccdac53c027e8964753b36c4d8c7b0e98af501c2Michael Graffgrep "^;" dig.out > /dev/null 2>&1 && { echo "I:test $t failed" ; status=1; }
03e200df5dc283f24a6a349f0b31d3eab26da893Mark Andrews$RNDC -c ../common/rndc.conf -s 10.53.0.2 -p 9953 reload 2>&1 | sed 's/^/I:ns2 /'
03e200df5dc283f24a6a349f0b31d3eab26da893Mark Andrews# prefix 10/8 should fail
03e200df5dc283f24a6a349f0b31d3eab26da893Mark Andrews @10.53.0.2 -b 10.53.0.1 axfr -y one:1234abcd8765 -p 5300 > dig.out
75a4dd0d377dca2f85cea44e28bf110314c1fe8cDavid Lawrencegrep "^;" dig.out > /dev/null 2>&1 || { echo "I:test $t failed" ; status=1; }
75a4dd0d377dca2f85cea44e28bf110314c1fe8cDavid Lawrence# any other address should work, as long as it sends key "one"
91306d962f9d147d94b82fb14edb28f8d907cae7Andreas Gustafsson @10.53.0.2 -b 127.0.0.1 axfr -y two:1234abcd8765 -p 5300 > dig.out
91306d962f9d147d94b82fb14edb28f8d907cae7Andreas Gustafssongrep "^;" dig.out > /dev/null 2>&1 || { echo "I:test $t failed" ; status=1; }
e893dce91279d7313a579f72caae3941f6dc5a27David Lawrence @10.53.0.2 -b 127.0.0.1 axfr -y one:1234abcd8765 -p 5300 > dig.out
e893dce91279d7313a579f72caae3941f6dc5a27David Lawrencegrep "^;" dig.out > /dev/null 2>&1 && { echo "I:test $t failed" ; status=1; }
e893dce91279d7313a579f72caae3941f6dc5a27David Lawrenceecho "I:testing nested ACL processing"
e893dce91279d7313a579f72caae3941f6dc5a27David Lawrence# all combinations of 10.53.0.{1|2} with key {one|two}, should succeed
e893dce91279d7313a579f72caae3941f6dc5a27David Lawrence$RNDC -c ../common/rndc.conf -s 10.53.0.2 -p 9953 reload 2>&1 | sed 's/^/I:ns2 /'
e893dce91279d7313a579f72caae3941f6dc5a27David Lawrence# should succeed
3b77946b751f39bd4db5a7d1fe48a81e6b1e7a28Bob Halley @10.53.0.2 -b 10.53.0.2 axfr -y two:1234abcd8765 -p 5300 > dig.out
8e06cea14c857429ab7e7299af2dce5eeeaa5ff0Michael Graffgrep "^;" dig.out > /dev/null 2>&1 && { echo "I:test $t failed" ; status=1; }
3b77946b751f39bd4db5a7d1fe48a81e6b1e7a28Bob Halley# should succeed
3b77946b751f39bd4db5a7d1fe48a81e6b1e7a28Bob Halley @10.53.0.2 -b 10.53.0.2 axfr -y one:1234abcd8765 -p 5300 > dig.out
3b77946b751f39bd4db5a7d1fe48a81e6b1e7a28Bob Halleygrep "^;" dig.out > /dev/null 2>&1 && { echo "I:test $t failed" ; status=1; }
3b77946b751f39bd4db5a7d1fe48a81e6b1e7a28Bob Halley# should succeed
3b77946b751f39bd4db5a7d1fe48a81e6b1e7a28Bob Halley @10.53.0.2 -b 10.53.0.1 axfr -y two:1234abcd8765 -p 5300 > dig.out
3b77946b751f39bd4db5a7d1fe48a81e6b1e7a28Bob Halleygrep "^;" dig.out > /dev/null 2>&1 && { echo "I:test $t failed" ; status=1; }
3b77946b751f39bd4db5a7d1fe48a81e6b1e7a28Bob Halley# should succeed
3ecf3394e37dc2848a09ffc643565d454e9e6974Andreas Gustafsson @10.53.0.2 -b 10.53.0.1 axfr -y two:1234abcd8765 -p 5300 > dig.out
3ecf3394e37dc2848a09ffc643565d454e9e6974Andreas Gustafssongrep "^;" dig.out > /dev/null 2>&1 && { echo "I:test $t failed" ; status=1; }
3ecf3394e37dc2848a09ffc643565d454e9e6974Andreas Gustafsson# but only one or the other should fail
df3c4c7988b9bae7d121a8ac9ed17a23366a948dDavid Lawrence @10.53.0.2 -b 127.0.0.1 axfr -y one:1234abcd8765 -p 5300 > dig.out
df3c4c7988b9bae7d121a8ac9ed17a23366a948dDavid Lawrencegrep "^;" dig.out > /dev/null 2>&1 || { echo "I:test $t failed" ; status=1; }
df3c4c7988b9bae7d121a8ac9ed17a23366a948dDavid Lawrence @10.53.0.2 -b 10.53.0.2 axfr -p 5300 > dig.out
df3c4c7988b9bae7d121a8ac9ed17a23366a948dDavid Lawrencegrep "^;" dig.out > /dev/null 2>&1 || { echo "I:test $tt failed" ; status=1; }
df3c4c7988b9bae7d121a8ac9ed17a23366a948dDavid Lawrence# and other values? right out
df3c4c7988b9bae7d121a8ac9ed17a23366a948dDavid Lawrence @10.53.0.2 -b 127.0.0.1 axfr -y three:1234abcd8765 -p 5300 > dig.out
df3c4c7988b9bae7d121a8ac9ed17a23366a948dDavid Lawrencegrep "^;" dig.out > /dev/null 2>&1 || { echo "I:test $t failed" ; status=1; }
df3c4c7988b9bae7d121a8ac9ed17a23366a948dDavid Lawrence# now we only allow 10.53.0.1 *and* key one, or 10.53.0.2 *and* key two
df3c4c7988b9bae7d121a8ac9ed17a23366a948dDavid Lawrence$RNDC -c ../common/rndc.conf -s 10.53.0.2 -p 9953 reload 2>&1 | sed 's/^/I:ns2 /'
df3c4c7988b9bae7d121a8ac9ed17a23366a948dDavid Lawrence# should succeed
289ae548d52bc8f982d9823af64cafda7bd92232Mark Andrews @10.53.0.2 -b 10.53.0.2 axfr -y two:1234abcd8765 -p 5300 > dig.out
289ae548d52bc8f982d9823af64cafda7bd92232Mark Andrewsgrep "^;" dig.out > /dev/null 2>&1 && { echo "I:test $t failed" ; status=1; }
289ae548d52bc8f982d9823af64cafda7bd92232Mark Andrews# should succeed
289ae548d52bc8f982d9823af64cafda7bd92232Mark Andrews @10.53.0.2 -b 10.53.0.1 axfr -y one:1234abcd8765 -p 5300 > dig.out
289ae548d52bc8f982d9823af64cafda7bd92232Mark Andrewsgrep "^;" dig.out > /dev/null 2>&1 && { echo "I:test $t failed" ; status=1; }
289ae548d52bc8f982d9823af64cafda7bd92232Mark Andrews# should fail
ae4cbb69eef32ced103fe4561e8d2031ee4c3497David Lawrence @10.53.0.2 -b 10.53.0.2 axfr -y one:1234abcd8765 -p 5300 > dig.out
df3c4c7988b9bae7d121a8ac9ed17a23366a948dDavid Lawrencegrep "^;" dig.out > /dev/null 2>&1 || { echo "I:test $t failed" ; status=1; }
df3c4c7988b9bae7d121a8ac9ed17a23366a948dDavid Lawrence @10.53.0.2 -b 10.53.0.1 axfr -y two:1234abcd8765 -p 5300 > dig.out
df3c4c7988b9bae7d121a8ac9ed17a23366a948dDavid Lawrencegrep "^;" dig.out > /dev/null 2>&1 || { echo "I:test $t failed" ; status=1; }
289ae548d52bc8f982d9823af64cafda7bd92232Mark Andrews @10.53.0.2 -b 10.53.0.3 axfr -y one:1234abcd8765 -p 5300 > dig.out
289ae548d52bc8f982d9823af64cafda7bd92232Mark Andrewsgrep "^;" dig.out > /dev/null 2>&1 || { echo "I:test $t failed" ; status=1; }
289ae548d52bc8f982d9823af64cafda7bd92232Mark Andrewsecho "I:exit status: $status"