bind9/bin/tests/system/dsdigest/tests.sh

53 lines
1.7 KiB
Bash
Raw Normal View History

2012-10-03 00:04:48 -04:00
#!/bin/sh
#
# Copyright (C) Internet Systems Consortium, Inc. ("ISC")
2012-10-03 00:04:48 -04:00
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
#
# See the COPYRIGHT file distributed with this work for additional
# information regarding copyright ownership.
2012-10-03 00:04:48 -04:00
SYSTEMTESTTOP=..
. $SYSTEMTESTTOP/conf.sh
status=0
rm -f dig.out.*
2018-02-20 18:43:27 -05:00
DIGOPTS="+tcp +noadd +nosea +nostat +nocmd +dnssec -p ${PORT}"
2012-10-03 00:04:48 -04:00
# Check the good. domain
2018-02-20 18:43:27 -05:00
echo_i "checking that validation with enabled digest types works"
2012-10-03 00:04:48 -04:00
ret=0
$DIG $DIGOPTS a.good. @10.53.0.3 a > dig.out.good || ret=1
grep "status: NOERROR" dig.out.good > /dev/null || ret=1
grep "flags:[^;]* ad[ ;]" dig.out.good > /dev/null || ret=1
2018-02-20 18:43:27 -05:00
if [ $ret != 0 ]; then echo_i "failed"; fi
2012-10-03 00:04:48 -04:00
status=`expr $status + $ret`
# Check the bad. domain
2018-02-20 18:43:27 -05:00
echo_i "checking that validation with no supported digest types and must-be-secure results in SERVFAIL"
2012-10-03 00:04:48 -04:00
ret=0
$DIG $DIGOPTS a.bad. @10.53.0.3 a > dig.out.bad || ret=1
grep "SERVFAIL" dig.out.bad > /dev/null || ret=1
2018-02-20 18:43:27 -05:00
if [ $ret != 0 ]; then echo_i "failed"; fi
2012-10-03 00:04:48 -04:00
status=`expr $status + $ret`
2018-02-20 18:43:27 -05:00
echo_i "checking that validation with no supported digest algorithms results in insecure"
2012-10-03 00:04:48 -04:00
ret=0
$DIG $DIGOPTS bad. @10.53.0.4 ds > dig.out.ds || ret=1
grep "NOERROR" dig.out.ds > /dev/null || ret=1
grep "flags:[^;]* ad[ ;]" dig.out.ds > /dev/null || ret=1
$DIG $DIGOPTS a.bad. @10.53.0.4 a > dig.out.insecure || ret=1
grep "NOERROR" dig.out.insecure > /dev/null || ret=1
grep "flags:[^;]* ad[ ;]" dig.out.insecure > /dev/null && ret=1
2018-02-20 18:43:27 -05:00
if [ $ret != 0 ]; then echo_i "failed"; fi
2012-10-03 00:04:48 -04:00
status=`expr $status + $ret`
2018-02-20 18:43:27 -05:00
echo_i "exit status: $status"
2012-10-03 00:04:48 -04:00
[ $status -eq 0 ] || exit 1