Home | History | Annotate | Line # | Download | only in checkconf
      1  1.1.1.10  christos #!/bin/sh
      2  1.1.1.10  christos 
      3       1.1  christos # Copyright (C) Internet Systems Consortium, Inc. ("ISC")
      4       1.1  christos #
      5   1.1.1.9  christos # SPDX-License-Identifier: MPL-2.0
      6   1.1.1.9  christos #
      7       1.1  christos # This Source Code Form is subject to the terms of the Mozilla Public
      8   1.1.1.9  christos # License, v. 2.0.  If a copy of the MPL was not distributed with this
      9   1.1.1.7  christos # file, you can obtain one at https://mozilla.org/MPL/2.0/.
     10       1.1  christos #
     11       1.1  christos # See the COPYRIGHT file distributed with this work for additional
     12       1.1  christos # information regarding copyright ownership.
     13       1.1  christos 
     14  1.1.1.11  christos set -e
     15  1.1.1.11  christos 
     16  1.1.1.11  christos . ../conf.sh
     17       1.1  christos 
     18       1.1  christos status=0
     19       1.1  christos n=0
     20       1.1  christos 
     21  1.1.1.11  christos mkdir -p keys
     22   1.1.1.8  christos 
     23  1.1.1.11  christos n=$((n + 1))
     24       1.1  christos echo_i "checking that named-checkconf handles a known good config ($n)"
     25       1.1  christos ret=0
     26  1.1.1.11  christos $CHECKCONF good.conf >checkconf.out$n 2>&1 || ret=1
     27  1.1.1.10  christos if [ $ret -ne 0 ]; then echo_i "failed"; fi
     28  1.1.1.11  christos status=$((status + ret))
     29       1.1  christos 
     30  1.1.1.11  christos n=$((n + 1))
     31       1.1  christos echo_i "checking that named-checkconf prints a known good config ($n)"
     32       1.1  christos ret=0
     33  1.1.1.12  christos awk 'BEGIN { ok = 0; } /cut here/ { ok = 1; getline } ok == 1 { print }' good.conf >good.conf.raw
     34  1.1.1.12  christos [ -s good.conf.raw ] || ret=1
     35  1.1.1.12  christos $CHECKCONF -p good.conf.raw >checkconf.out$n || ret=1
     36  1.1.1.12  christos grep -v '^good.conf.raw:' <checkconf.out$n >good.conf.out 2>&1 || ret=1
     37  1.1.1.12  christos cmp good.conf.raw good.conf.out || ret=1
     38  1.1.1.10  christos if [ $ret -ne 0 ]; then echo_i "failed"; fi
     39  1.1.1.11  christos status=$((status + ret))
     40       1.1  christos 
     41  1.1.1.11  christos n=$((n + 1))
     42       1.1  christos echo_i "checking that named-checkconf -x removes secrets ($n)"
     43       1.1  christos ret=0
     44       1.1  christos # ensure there is a secret and that it is not the check string.
     45  1.1.1.12  christos grep 'secret "' good.conf.raw >/dev/null || ret=1
     46  1.1.1.12  christos grep 'secret "????????????????"' good.conf.raw >/dev/null 2>&1 && ret=1
     47  1.1.1.12  christos $CHECKCONF -p -x good.conf.raw >checkconf.out$n || ret=1
     48  1.1.1.12  christos grep -v '^good.conf.raw:' <checkconf.out$n >good.conf.out 2>&1 || ret=1
     49  1.1.1.11  christos grep 'secret "????????????????"' good.conf.out >/dev/null 2>&1 || ret=1
     50  1.1.1.11  christos if [ $ret -ne 0 ]; then echo_i "failed"; fi
     51  1.1.1.11  christos status=$((status + ret))
     52  1.1.1.11  christos 
     53  1.1.1.11  christos for bad in bad-*.conf; do
     54  1.1.1.11  christos   n=$((n + 1))
     55  1.1.1.11  christos   echo_i "checking that named-checkconf detects error in $bad ($n)"
     56  1.1.1.11  christos   ret=0
     57  1.1.1.11  christos   {
     58  1.1.1.11  christos     $CHECKCONF $bad >checkconf.out$n 2>&1
     59  1.1.1.11  christos     rc=$?
     60  1.1.1.11  christos   } || true
     61  1.1.1.11  christos   if [ $rc -ne 1 ]; then ret=1; fi
     62  1.1.1.11  christos   grep "^$bad:[0-9]*: " <checkconf.out$n >/dev/null || ret=1
     63  1.1.1.11  christos   case $bad in
     64       1.1  christos     bad-update-policy[123].conf)
     65  1.1.1.11  christos       pat="identity and name fields are not the same"
     66  1.1.1.11  christos       grep "$pat" <checkconf.out$n >/dev/null || ret=1
     67  1.1.1.11  christos       ;;
     68  1.1.1.11  christos     bad-update-policy[4589].conf | bad-update-policy1[01].conf)
     69  1.1.1.11  christos       pat="name field not set to placeholder value"
     70  1.1.1.11  christos       grep "$pat" <checkconf.out$n >/dev/null || ret=1
     71  1.1.1.11  christos       ;;
     72  1.1.1.11  christos     bad-update-policy[67].conf | bad-update-policy1[2345789].conf | bad-update-policy20.conf)
     73  1.1.1.11  christos       pat="missing name field type '.*' found"
     74  1.1.1.11  christos       grep "$pat" <checkconf.out$n >/dev/null || ret=1
     75  1.1.1.11  christos       ;;
     76  1.1.1.11  christos   esac
     77  1.1.1.11  christos   if [ $ret -ne 0 ]; then echo_i "failed"; fi
     78  1.1.1.11  christos   status=$((status + ret))
     79  1.1.1.11  christos done
     80  1.1.1.11  christos 
     81  1.1.1.11  christos for good in good-*.conf; do
     82  1.1.1.11  christos   n=$((n + 1))
     83  1.1.1.11  christos   echo_i "checking that named-checkconf detects no error in $good ($n)"
     84  1.1.1.11  christos   ret=0
     85  1.1.1.11  christos   if ! $FEATURETEST --with-libnghttp2; then
     86  1.1.1.11  christos     case $good in
     87  1.1.1.11  christos       good-doh-*.conf) continue ;;
     88  1.1.1.11  christos       good-dot-*.conf) continue ;;
     89  1.1.1.12  christos       good-proxy-*doh*.conf) continue ;;
     90  1.1.1.12  christos       bad-proxy-*doh*.conf) continue ;;
     91  1.1.1.12  christos     esac
     92  1.1.1.12  christos   elif ! $FEATURETEST --have-openssl-cipher-suites; then
     93  1.1.1.12  christos     case $good in
     94  1.1.1.12  christos       good-tls-cipher-suites-*.conf) continue ;;
     95       1.1  christos     esac
     96  1.1.1.11  christos   fi
     97  1.1.1.11  christos   {
     98  1.1.1.11  christos     $CHECKCONF $good >checkconf.out$n 2>&1
     99  1.1.1.11  christos     rc=$?
    100  1.1.1.11  christos   } || true
    101  1.1.1.11  christos   if [ $rc -ne 0 ]; then
    102  1.1.1.11  christos     echo_i "failed"
    103  1.1.1.11  christos     ret=1
    104  1.1.1.11  christos   fi
    105  1.1.1.11  christos   status=$((status + ret))
    106       1.1  christos done
    107       1.1  christos 
    108  1.1.1.11  christos for lmdb in lmdb-*.conf; do
    109  1.1.1.11  christos   n=$((n + 1))
    110  1.1.1.11  christos   ret=0
    111  1.1.1.11  christos 
    112  1.1.1.11  christos   if $FEATURETEST --with-lmdb; then
    113  1.1.1.11  christos     echo_i "checking that named-checkconf detects no error in $lmdb ($n)"
    114  1.1.1.11  christos     {
    115  1.1.1.11  christos       $CHECKCONF $lmdb >checkconf.out$n 2>&1
    116  1.1.1.11  christos       rc=$?
    117  1.1.1.11  christos     } || true
    118  1.1.1.11  christos     if [ $rc -ne 0 ]; then
    119  1.1.1.11  christos       echo_i "failed"
    120  1.1.1.11  christos       ret=1
    121  1.1.1.11  christos     fi
    122  1.1.1.11  christos   else
    123  1.1.1.11  christos     echo_i "checking that named-checkconf detects error in $lmdb ($n)"
    124  1.1.1.11  christos     {
    125  1.1.1.11  christos       $CHECKCONF $lmdb >checkconf.out$n 2>&1
    126  1.1.1.11  christos       rc=$?
    127  1.1.1.11  christos     } || true
    128  1.1.1.11  christos     if [ $rc -eq 0 ]; then
    129  1.1.1.11  christos       echo_i "failed"
    130  1.1.1.11  christos       ret=1
    131  1.1.1.11  christos     fi
    132  1.1.1.11  christos   fi
    133  1.1.1.11  christos   status=$((status + ret))
    134       1.1  christos done
    135       1.1  christos 
    136  1.1.1.11  christos n=$((n + 1))
    137   1.1.1.3  christos echo_i "checking that ancient options report a fatal error ($n)"
    138   1.1.1.3  christos ret=0
    139  1.1.1.11  christos $CHECKCONF ancient.conf >ancient.out 2>&1 && ret=1
    140  1.1.1.11  christos grep "no longer exists" ancient.out >/dev/null || ret=1
    141  1.1.1.10  christos if [ $ret -ne 0 ]; then echo_i "failed"; fi
    142  1.1.1.11  christos status=$((status + ret))
    143   1.1.1.3  christos 
    144  1.1.1.11  christos n=$((n + 1))
    145       1.1  christos echo_i "checking that named-checkconf -z catches missing hint file ($n)"
    146       1.1  christos ret=0
    147  1.1.1.11  christos $CHECKCONF -z hint-nofile.conf >hint-nofile.out 2>&1 && ret=1
    148  1.1.1.11  christos grep "could not configure root hints from 'nonexistent.db': file not found" hint-nofile.out >/dev/null || ret=1
    149  1.1.1.10  christos if [ $ret -ne 0 ]; then echo_i "failed"; fi
    150  1.1.1.11  christos status=$((status + ret))
    151       1.1  christos 
    152  1.1.1.11  christos n=$((n + 1))
    153       1.1  christos echo_i "checking that named-checkconf catches range errors ($n)"
    154       1.1  christos ret=0
    155  1.1.1.11  christos $CHECKCONF range.conf >checkconf.out$n 2>&1 && ret=1
    156  1.1.1.10  christos if [ $ret -ne 0 ]; then echo_i "failed"; fi
    157  1.1.1.11  christos status=$((status + ret))
    158       1.1  christos 
    159  1.1.1.11  christos n=$((n + 1))
    160       1.1  christos echo_i "checking that named-checkconf warns of notify inconsistencies ($n)"
    161       1.1  christos ret=0
    162  1.1.1.11  christos $CHECKCONF notify.conf >checkconf.out$n 2>&1
    163  1.1.1.11  christos warnings=$(grep "'notify' is disabled" <checkconf.out$n | wc -l)
    164       1.1  christos [ $warnings -eq 3 ] || ret=1
    165  1.1.1.10  christos if [ $ret -ne 0 ]; then echo_i "failed"; fi
    166  1.1.1.11  christos status=$((status + ret))
    167       1.1  christos 
    168  1.1.1.12  christos if grep "^#define DNS_RDATASET_FIXED" "$TOP_BUILDDIR/config.h" >/dev/null 2>&1; then
    169  1.1.1.12  christos   test_fixed=true
    170  1.1.1.12  christos else
    171  1.1.1.12  christos   test_fixed=false
    172  1.1.1.12  christos fi
    173   1.1.1.5  christos 
    174  1.1.1.11  christos n=$((n + 1))
    175   1.1.1.5  christos echo_i "checking named-checkconf deprecate warnings ($n)"
    176   1.1.1.5  christos ret=0
    177  1.1.1.11  christos $CHECKCONF deprecated.conf >checkconf.out$n.1 2>&1
    178  1.1.1.11  christos grep "option 'managed-keys' is deprecated" <checkconf.out$n.1 >/dev/null || ret=1
    179  1.1.1.11  christos grep "option 'trusted-keys' is deprecated" <checkconf.out$n.1 >/dev/null || ret=1
    180  1.1.1.12  christos grep "option 'max-zone-ttl' is deprecated" <checkconf.out$n.1 >/dev/null || ret=1
    181  1.1.1.11  christos grep "option 'use-v4-udp-ports' is deprecated" <checkconf.out$n.1 >/dev/null || ret=1
    182  1.1.1.11  christos grep "option 'use-v6-udp-ports' is deprecated" <checkconf.out$n.1 >/dev/null || ret=1
    183  1.1.1.11  christos grep "option 'avoid-v4-udp-ports' is deprecated" <checkconf.out$n.1 >/dev/null || ret=1
    184  1.1.1.11  christos grep "option 'avoid-v6-udp-ports' is deprecated" <checkconf.out$n.1 >/dev/null || ret=1
    185  1.1.1.11  christos grep "option 'dialup' is deprecated" <checkconf.out$n.1 >/dev/null || ret=1
    186  1.1.1.11  christos grep "option 'heartbeat-interval' is deprecated" <checkconf.out$n.1 >/dev/null || ret=1
    187  1.1.1.11  christos grep "option 'dnssec-must-be-secure' is deprecated" <checkconf.out$n.1 >/dev/null || ret=1
    188  1.1.1.12  christos grep "option 'sortlist' is deprecated" <checkconf.out$n.1 >/dev/null || ret=1
    189  1.1.1.11  christos grep "token 'port' is deprecated" <checkconf.out$n.1 >/dev/null || ret=1
    190  1.1.1.12  christos if $test_fixed; then
    191  1.1.1.12  christos   grep "rrset-order: order 'fixed' is deprecated" <checkconf.out$n.1 >/dev/null || ret=1
    192  1.1.1.12  christos else
    193  1.1.1.12  christos   grep "rrset-order: order 'fixed' was disabled at compilation time" <checkconf.out$n.1 >/dev/null || ret=1
    194  1.1.1.12  christos fi
    195  1.1.1.10  christos if [ $ret -ne 0 ]; then echo_i "failed"; fi
    196  1.1.1.11  christos status=$((status + ret))
    197   1.1.1.5  christos # set -i to ignore deprecate warnings
    198  1.1.1.12  christos $CHECKCONF -i deprecated.conf 2>&1 | grep_v "rrset-order: order 'fixed' was disabled at compilation time" >checkconf.out$n.2
    199  1.1.1.12  christos grep '^.+$' <checkconf.out$n.2 >/dev/null && ret=1
    200  1.1.1.10  christos if [ $ret -ne 0 ]; then echo_i "failed"; fi
    201  1.1.1.11  christos status=$((status + ret))
    202       1.1  christos 
    203  1.1.1.11  christos n=$((n + 1))
    204   1.1.1.7  christos echo_i "checking named-checkconf servestale warnings ($n)"
    205   1.1.1.7  christos ret=0
    206  1.1.1.11  christos $CHECKCONF servestale.stale-refresh-time.0.conf >checkconf.out$n.1 2>&1
    207  1.1.1.11  christos grep "'stale-refresh-time' should either be 0 or otherwise 30 seconds or higher" <checkconf.out$n.1 >/dev/null && ret=1
    208  1.1.1.10  christos if [ $ret -ne 0 ]; then echo_i "failed"; fi
    209  1.1.1.11  christos status=$((status + ret))
    210   1.1.1.7  christos ret=0
    211  1.1.1.11  christos $CHECKCONF servestale.stale-refresh-time.29.conf >checkconf.out$n.1 2>&1
    212  1.1.1.11  christos grep "'stale-refresh-time' should either be 0 or otherwise 30 seconds or higher" <checkconf.out$n.1 >/dev/null || ret=1
    213  1.1.1.10  christos if [ $ret -ne 0 ]; then echo_i "failed"; fi
    214  1.1.1.11  christos status=$((status + ret))
    215   1.1.1.7  christos 
    216  1.1.1.11  christos n=$((n + 1))
    217       1.1  christos echo_i "range checking fields that do not allow zero ($n)"
    218       1.1  christos ret=0
    219       1.1  christos for field in max-retry-time min-retry-time max-refresh-time min-refresh-time; do
    220  1.1.1.11  christos   cat >badzero.conf <<EOF
    221       1.1  christos options {
    222       1.1  christos     $field 0;
    223       1.1  christos };
    224       1.1  christos EOF
    225  1.1.1.11  christos   {
    226  1.1.1.11  christos     $CHECKCONF badzero.conf >checkconf.out$n.1 2>&1
    227  1.1.1.11  christos     rc=$?
    228  1.1.1.11  christos   } || true
    229  1.1.1.11  christos   [ $rc -eq 1 ] || {
    230  1.1.1.11  christos     echo_i "options $field failed"
    231  1.1.1.11  christos     ret=1
    232  1.1.1.11  christos   }
    233  1.1.1.11  christos   cat >badzero.conf <<EOF
    234       1.1  christos view dummy {
    235       1.1  christos     $field 0;
    236       1.1  christos };
    237       1.1  christos EOF
    238  1.1.1.11  christos   {
    239  1.1.1.11  christos     $CHECKCONF badzero.conf >checkconf.out$n.2 2>&1
    240  1.1.1.11  christos     rc=$?
    241  1.1.1.11  christos   } || true
    242  1.1.1.11  christos   [ $rc -eq 1 ] || {
    243  1.1.1.11  christos     echo_i "view $field failed"
    244  1.1.1.11  christos     ret=1
    245  1.1.1.11  christos   }
    246  1.1.1.11  christos   cat >badzero.conf <<EOF
    247       1.1  christos options {
    248       1.1  christos     $field 0;
    249       1.1  christos };
    250       1.1  christos view dummy {
    251       1.1  christos };
    252       1.1  christos EOF
    253  1.1.1.11  christos   {
    254  1.1.1.11  christos     $CHECKCONF badzero.conf >checkconf.out$n.3 2>&1
    255  1.1.1.11  christos     rc=$?
    256  1.1.1.11  christos   } || true
    257  1.1.1.11  christos   [ $rc -eq 1 ] || {
    258  1.1.1.11  christos     echo_i "options + view $field failed"
    259  1.1.1.11  christos     ret=1
    260  1.1.1.11  christos   }
    261  1.1.1.11  christos   cat >badzero.conf <<EOF
    262       1.1  christos zone dummy {
    263   1.1.1.7  christos     type secondary;
    264   1.1.1.7  christos     primaries { 0.0.0.0; };
    265       1.1  christos     $field 0;
    266       1.1  christos };
    267       1.1  christos EOF
    268  1.1.1.11  christos   {
    269  1.1.1.11  christos     $CHECKCONF badzero.conf >checkconf.out$n.4 2>&1
    270  1.1.1.11  christos     rc=$?
    271  1.1.1.11  christos   } || true
    272  1.1.1.11  christos   [ $rc -eq 1 ] || {
    273  1.1.1.11  christos     echo_i "zone $field failed"
    274  1.1.1.11  christos     ret=1
    275  1.1.1.11  christos   }
    276       1.1  christos done
    277  1.1.1.10  christos if [ $ret -ne 0 ]; then echo_i "failed"; fi
    278  1.1.1.11  christos status=$((status + ret))
    279       1.1  christos 
    280  1.1.1.11  christos n=$((n + 1))
    281   1.1.1.7  christos echo_i "checking options allowed in inline-signing secondaries ($n)"
    282       1.1  christos ret=0
    283  1.1.1.11  christos $CHECKCONF bad-dnssec.conf >checkconf.out$n.2 2>&1 && ret=1
    284  1.1.1.11  christos l=$(grep "dnssec-loadkeys-interval.*requires inline" <checkconf.out$n.2 | wc -l)
    285       1.1  christos [ $l -eq 1 ] || ret=1
    286  1.1.1.10  christos if [ $ret -ne 0 ]; then echo_i "failed"; fi
    287  1.1.1.11  christos status=$((status + ret))
    288       1.1  christos 
    289  1.1.1.11  christos n=$((n + 1))
    290   1.1.1.7  christos echo_i "check file + inline-signing for secondary zones ($n)"
    291  1.1.1.11  christos $CHECKCONF inline-no.conf >checkconf.out$n.1 2>&1 && ret=1
    292  1.1.1.11  christos l=$(grep "missing 'file' entry" <checkconf.out$n.1 | wc -l)
    293       1.1  christos [ $l -eq 0 ] || ret=1
    294  1.1.1.11  christos $CHECKCONF inline-good.conf >checkconf.out$n.2 2>&1 || ret=1
    295  1.1.1.11  christos l=$(grep "missing 'file' entry" <checkconf.out$n.2 | wc -l)
    296       1.1  christos [ $l -eq 0 ] || ret=1
    297  1.1.1.11  christos $CHECKCONF inline-bad.conf >checkconf.out$n.3 2>&1 && ret=1
    298  1.1.1.11  christos l=$(grep "missing 'file' entry" <checkconf.out$n.3 | wc -l)
    299       1.1  christos [ $l -eq 1 ] || ret=1
    300  1.1.1.10  christos if [ $ret -ne 0 ]; then echo_i "failed"; fi
    301  1.1.1.11  christos status=$((status + ret))
    302       1.1  christos 
    303  1.1.1.11  christos n=$((n + 1))
    304       1.1  christos echo_i "checking named-checkconf DLZ warnings ($n)"
    305       1.1  christos ret=0
    306  1.1.1.11  christos $CHECKCONF dlz-bad.conf >checkconf.out$n 2>&1 && ret=1
    307  1.1.1.11  christos grep "'dlz' and 'database'" <checkconf.out$n >/dev/null || ret=1
    308  1.1.1.10  christos if [ $ret -ne 0 ]; then echo_i "failed"; fi
    309  1.1.1.11  christos status=$((status + ret))
    310       1.1  christos 
    311  1.1.1.11  christos n=$((n + 1))
    312       1.1  christos echo_i "checking for missing key directory warning ($n)"
    313       1.1  christos ret=0
    314       1.1  christos rm -rf test.keydir
    315  1.1.1.12  christos rm -rf test.keystoredir
    316  1.1.1.11  christos $CHECKCONF warn-keydir.conf >checkconf.out$n.1 2>&1
    317  1.1.1.11  christos l=$(grep "'test.keydir' does not exist" <checkconf.out$n.1 | wc -l)
    318       1.1  christos [ $l -eq 1 ] || ret=1
    319  1.1.1.12  christos l=$(grep "'test.keystoredir' does not exist" <checkconf.out$n.1 | wc -l)
    320  1.1.1.12  christos [ $l -eq 1 ] || ret=1
    321       1.1  christos touch test.keydir
    322  1.1.1.12  christos touch test.keystoredir
    323  1.1.1.11  christos $CHECKCONF warn-keydir.conf >checkconf.out$n.2 2>&1
    324  1.1.1.11  christos l=$(grep "'test.keydir' is not a directory" <checkconf.out$n.2 | wc -l)
    325       1.1  christos [ $l -eq 1 ] || ret=1
    326  1.1.1.12  christos l=$(grep "'test.keystoredir' is not a directory" <checkconf.out$n.2 | wc -l)
    327  1.1.1.12  christos [ $l -eq 1 ] || ret=1
    328       1.1  christos rm -f test.keydir
    329  1.1.1.12  christos rm -f test.keystoredir
    330       1.1  christos mkdir test.keydir
    331  1.1.1.12  christos mkdir test.keystoredir
    332  1.1.1.11  christos $CHECKCONF warn-keydir.conf >checkconf.out$n.3 2>&1
    333  1.1.1.11  christos l=$(grep "key-directory" <checkconf.out$n.3 | wc -l)
    334       1.1  christos [ $l -eq 0 ] || ret=1
    335  1.1.1.12  christos l=$(grep "key-store directory" <checkconf.out$n.3 | wc -l)
    336  1.1.1.12  christos [ $l -eq 0 ] || ret=1
    337       1.1  christos rm -rf test.keydir
    338  1.1.1.12  christos rm -rf test.keystoredir
    339  1.1.1.10  christos if [ $ret -ne 0 ]; then echo_i "failed"; fi
    340  1.1.1.12  christos status=$((status + ret))
    341       1.1  christos 
    342  1.1.1.11  christos n=$((n + 1))
    343       1.1  christos echo_i "checking that named-checkconf -z catches conflicting ttl with max-ttl ($n)"
    344       1.1  christos ret=0
    345  1.1.1.11  christos $CHECKCONF -z max-ttl.conf >check.out 2>&1 && ret=1
    346  1.1.1.11  christos grep 'TTL 900 exceeds configured max-zone-ttl 600' check.out >/dev/null 2>&1 || ret=1
    347  1.1.1.11  christos grep 'TTL 900 exceeds configured max-zone-ttl 600' check.out >/dev/null 2>&1 || ret=1
    348  1.1.1.11  christos grep 'TTL 900 exceeds configured max-zone-ttl 600' check.out >/dev/null 2>&1 || ret=1
    349  1.1.1.11  christos if [ $ret -ne 0 ]; then
    350  1.1.1.11  christos   echo_i "failed"
    351  1.1.1.11  christos   ret=1
    352  1.1.1.11  christos fi
    353  1.1.1.11  christos status=$((status + ret))
    354       1.1  christos 
    355  1.1.1.11  christos n=$((n + 1))
    356       1.1  christos echo_i "checking that named-checkconf -z catches invalid max-ttl ($n)"
    357       1.1  christos ret=0
    358  1.1.1.11  christos $CHECKCONF -z max-ttl-bad.conf >checkconf.out$n 2>&1 && ret=1
    359  1.1.1.11  christos if [ $ret -ne 0 ]; then
    360  1.1.1.11  christos   echo_i "failed"
    361  1.1.1.11  christos   ret=1
    362  1.1.1.11  christos fi
    363  1.1.1.11  christos status=$((status + ret))
    364       1.1  christos 
    365  1.1.1.11  christos n=$((n + 1))
    366       1.1  christos echo_i "checking that named-checkconf -z skips zone check with alternate databases ($n)"
    367       1.1  christos ret=0
    368  1.1.1.11  christos $CHECKCONF -z altdb.conf >checkconf.out$n 2>&1 || ret=1
    369  1.1.1.11  christos if [ $ret -ne 0 ]; then
    370  1.1.1.11  christos   echo_i "failed"
    371  1.1.1.11  christos   ret=1
    372  1.1.1.11  christos fi
    373  1.1.1.11  christos status=$((status + ret))
    374       1.1  christos 
    375  1.1.1.11  christos n=$((n + 1))
    376       1.1  christos echo_i "checking that named-checkconf -z skips zone check with DLZ ($n)"
    377       1.1  christos ret=0
    378  1.1.1.11  christos $CHECKCONF -z altdlz.conf >checkconf.out$n 2>&1 || ret=1
    379  1.1.1.11  christos if [ $ret -ne 0 ]; then
    380  1.1.1.11  christos   echo_i "failed"
    381  1.1.1.11  christos   ret=1
    382  1.1.1.11  christos fi
    383  1.1.1.11  christos status=$((status + ret))
    384       1.1  christos 
    385  1.1.1.11  christos n=$((n + 1))
    386       1.1  christos echo_i "checking that named-checkconf -z fails on view with ANY class ($n)"
    387       1.1  christos ret=0
    388  1.1.1.11  christos $CHECKCONF -z view-class-any1.conf >checkconf.out$n 2>&1 && ret=1
    389  1.1.1.11  christos if [ $ret -ne 0 ]; then
    390  1.1.1.11  christos   echo_i "failed"
    391  1.1.1.11  christos   ret=1
    392  1.1.1.11  christos fi
    393  1.1.1.11  christos status=$((status + ret))
    394       1.1  christos 
    395  1.1.1.11  christos n=$((n + 1))
    396       1.1  christos echo_i "checking that named-checkconf -z fails on view with CLASS255 class ($n)"
    397       1.1  christos ret=0
    398  1.1.1.11  christos $CHECKCONF -z view-class-any2.conf >checkconf.out$n 2>&1 && ret=1
    399  1.1.1.11  christos if [ $ret -ne 0 ]; then
    400  1.1.1.11  christos   echo_i "failed"
    401  1.1.1.11  christos   ret=1
    402  1.1.1.11  christos fi
    403  1.1.1.11  christos status=$((status + ret))
    404       1.1  christos 
    405  1.1.1.11  christos n=$((n + 1))
    406       1.1  christos echo_i "checking that named-checkconf -z passes on view with IN class ($n)"
    407       1.1  christos ret=0
    408  1.1.1.11  christos $CHECKCONF -z view-class-in1.conf >checkconf.out$n 2>&1 || ret=1
    409  1.1.1.11  christos if [ $ret -ne 0 ]; then
    410  1.1.1.11  christos   echo_i "failed"
    411  1.1.1.11  christos   ret=1
    412  1.1.1.11  christos fi
    413  1.1.1.11  christos status=$((status + ret))
    414       1.1  christos 
    415  1.1.1.11  christos n=$((n + 1))
    416       1.1  christos echo_i "checking that named-checkconf -z passes on view with CLASS1 class ($n)"
    417       1.1  christos ret=0
    418  1.1.1.11  christos $CHECKCONF -z view-class-in2.conf >checkconf.out$n 2>&1 || ret=1
    419  1.1.1.11  christos if [ $ret -ne 0 ]; then
    420  1.1.1.11  christos   echo_i "failed"
    421  1.1.1.11  christos   ret=1
    422  1.1.1.11  christos fi
    423  1.1.1.11  christos status=$((status + ret))
    424       1.1  christos 
    425  1.1.1.11  christos n=$((n + 1))
    426       1.1  christos echo_i "check that check-names fails as configured ($n)"
    427       1.1  christos ret=0
    428  1.1.1.11  christos $CHECKCONF -z check-names-fail.conf >checkconf.out$n 2>&1 && ret=1
    429  1.1.1.11  christos grep "near '_underscore': bad name (check-names)" <checkconf.out$n >/dev/null || ret=1
    430  1.1.1.11  christos grep "zone check-names/IN: loaded serial" <checkconf.out$n >/dev/null && ret=1
    431  1.1.1.11  christos if [ $ret -ne 0 ]; then
    432  1.1.1.11  christos   echo_i "failed"
    433  1.1.1.11  christos   ret=1
    434  1.1.1.11  christos fi
    435  1.1.1.11  christos status=$((status + ret))
    436       1.1  christos 
    437  1.1.1.11  christos n=$((n + 1))
    438       1.1  christos echo_i "check that check-mx fails as configured ($n)"
    439       1.1  christos ret=0
    440  1.1.1.11  christos $CHECKCONF -z check-mx-fail.conf >checkconf.out$n 2>&1 && ret=1
    441  1.1.1.11  christos grep "near '10.0.0.1': MX is an address" <checkconf.out$n >/dev/null || ret=1
    442  1.1.1.11  christos grep "zone check-mx/IN: loaded serial" <checkconf.out$n >/dev/null && ret=1
    443  1.1.1.11  christos if [ $ret -ne 0 ]; then
    444  1.1.1.11  christos   echo_i "failed"
    445  1.1.1.11  christos   ret=1
    446  1.1.1.11  christos fi
    447  1.1.1.11  christos status=$((status + ret))
    448       1.1  christos 
    449  1.1.1.11  christos n=$((n + 1))
    450       1.1  christos echo_i "check that check-dup-records fails as configured ($n)"
    451       1.1  christos ret=0
    452  1.1.1.11  christos $CHECKCONF -z check-dup-records-fail.conf >checkconf.out$n 2>&1 && ret=1
    453  1.1.1.11  christos grep "has semantically identical records" <checkconf.out$n >/dev/null || ret=1
    454  1.1.1.11  christos grep "zone check-dup-records/IN: loaded serial" <checkconf.out$n >/dev/null && ret=1
    455  1.1.1.11  christos if [ $ret -ne 0 ]; then
    456  1.1.1.11  christos   echo_i "failed"
    457  1.1.1.11  christos   ret=1
    458  1.1.1.11  christos fi
    459  1.1.1.11  christos status=$((status + ret))
    460       1.1  christos 
    461  1.1.1.11  christos n=$((n + 1))
    462       1.1  christos echo_i "check that check-mx fails as configured ($n)"
    463       1.1  christos ret=0
    464  1.1.1.11  christos $CHECKCONF -z check-mx-fail.conf >checkconf.out$n 2>&1 && ret=1
    465  1.1.1.11  christos grep "failed: MX is an address" <checkconf.out$n >/dev/null || ret=1
    466  1.1.1.11  christos grep "zone check-mx/IN: loaded serial" <checkconf.out$n >/dev/null && ret=1
    467  1.1.1.11  christos if [ $ret -ne 0 ]; then
    468  1.1.1.11  christos   echo_i "failed"
    469  1.1.1.11  christos   ret=1
    470  1.1.1.11  christos fi
    471  1.1.1.11  christos status=$((status + ret))
    472       1.1  christos 
    473  1.1.1.11  christos n=$((n + 1))
    474       1.1  christos echo_i "check that check-mx-cname fails as configured ($n)"
    475       1.1  christos ret=0
    476  1.1.1.11  christos $CHECKCONF -z check-mx-cname-fail.conf >checkconf.out$n 2>&1 && ret=1
    477  1.1.1.11  christos grep "MX.* is a CNAME (illegal)" <checkconf.out$n >/dev/null || ret=1
    478  1.1.1.11  christos grep "zone check-mx-cname/IN: loaded serial" <checkconf.out$n >/dev/null && ret=1
    479  1.1.1.11  christos if [ $ret -ne 0 ]; then
    480  1.1.1.11  christos   echo_i "failed"
    481  1.1.1.11  christos   ret=1
    482  1.1.1.11  christos fi
    483  1.1.1.11  christos status=$((status + ret))
    484       1.1  christos 
    485  1.1.1.11  christos n=$((n + 1))
    486       1.1  christos echo_i "check that check-srv-cname fails as configured ($n)"
    487       1.1  christos ret=0
    488  1.1.1.11  christos $CHECKCONF -z check-srv-cname-fail.conf >checkconf.out$n 2>&1 && ret=1
    489  1.1.1.11  christos grep "SRV.* is a CNAME (illegal)" <checkconf.out$n >/dev/null || ret=1
    490  1.1.1.11  christos grep "zone check-mx-cname/IN: loaded serial" <checkconf.out$n >/dev/null && ret=1
    491  1.1.1.11  christos if [ $ret -ne 0 ]; then
    492  1.1.1.11  christos   echo_i "failed"
    493  1.1.1.11  christos   ret=1
    494  1.1.1.11  christos fi
    495  1.1.1.11  christos status=$((status + ret))
    496       1.1  christos 
    497  1.1.1.11  christos n=$((n + 1))
    498       1.1  christos echo_i "check that named-checkconf -p properly print a port range ($n)"
    499       1.1  christos ret=0
    500  1.1.1.11  christos $CHECKCONF -p portrange-good.conf >checkconf.out$n 2>&1 || ret=1
    501  1.1.1.11  christos grep "range 8610 8614;" <checkconf.out$n >/dev/null || ret=1
    502  1.1.1.11  christos if [ $ret -ne 0 ]; then
    503  1.1.1.11  christos   echo_i "failed"
    504  1.1.1.11  christos   ret=1
    505  1.1.1.11  christos fi
    506  1.1.1.11  christos status=$((status + ret))
    507       1.1  christos 
    508  1.1.1.11  christos n=$((n + 1))
    509       1.1  christos echo_i "check that named-checkconf -z handles in-view ($n)"
    510       1.1  christos ret=0
    511  1.1.1.11  christos $CHECKCONF -z in-view-good.conf >checkconf.out$n 2>&1 || ret=1
    512  1.1.1.11  christos grep "zone shared.example/IN: loaded serial" <checkconf.out$n >/dev/null || ret=1
    513  1.1.1.11  christos if [ $ret -ne 0 ]; then
    514  1.1.1.11  christos   echo_i "failed"
    515  1.1.1.11  christos   ret=1
    516  1.1.1.11  christos fi
    517  1.1.1.11  christos status=$((status + ret))
    518       1.1  christos 
    519  1.1.1.11  christos n=$((n + 1))
    520   1.1.1.5  christos echo_i "check that named-checkconf -z returns error when a later view is okay ($n)"
    521   1.1.1.5  christos ret=0
    522  1.1.1.11  christos $CHECKCONF -z check-missing-zone.conf >checkconf.out$n 2>&1 && ret=1
    523  1.1.1.11  christos if [ $ret -ne 0 ]; then
    524  1.1.1.11  christos   echo_i "failed"
    525  1.1.1.11  christos   ret=1
    526  1.1.1.11  christos fi
    527  1.1.1.11  christos status=$((status + ret))
    528   1.1.1.5  christos 
    529  1.1.1.11  christos n=$((n + 1))
    530       1.1  christos echo_i "check that named-checkconf prints max-cache-size <percentage> correctly ($n)"
    531       1.1  christos ret=0
    532  1.1.1.11  christos $CHECKCONF -p max-cache-size-good.conf >checkconf.out$n 2>&1 || ret=1
    533  1.1.1.11  christos grep "max-cache-size 60%;" <checkconf.out$n >/dev/null || ret=1
    534  1.1.1.11  christos if [ $ret -ne 0 ]; then
    535  1.1.1.11  christos   echo_i "failed"
    536  1.1.1.11  christos   ret=1
    537  1.1.1.11  christos fi
    538  1.1.1.11  christos status=$((status + ret))
    539       1.1  christos 
    540  1.1.1.11  christos n=$((n + 1))
    541   1.1.1.6  christos echo_i "check that named-checkconf -l prints out the zone list ($n)"
    542       1.1  christos ret=0
    543  1.1.1.11  christos $CHECKCONF -l good.conf \
    544  1.1.1.11  christos   | grep -v "is deprecated" \
    545  1.1.1.11  christos   | grep -v "is not implemented" \
    546  1.1.1.11  christos   | grep -v "is not recommended" \
    547  1.1.1.11  christos   | grep -v "no longer exists" \
    548  1.1.1.11  christos   | grep -v "is obsolete" >checkconf.out$n || ret=1
    549  1.1.1.11  christos diff good.zonelist checkconf.out$n >diff.out$n || ret=1
    550  1.1.1.11  christos if [ $ret -ne 0 ]; then
    551  1.1.1.11  christos   echo_i "failed"
    552  1.1.1.11  christos   ret=1
    553  1.1.1.11  christos fi
    554  1.1.1.11  christos status=$((status + ret))
    555       1.1  christos 
    556  1.1.1.11  christos n=$((n + 1))
    557       1.1  christos echo_i "check that the 2010 ICANN ROOT KSK without the 2017 ICANN ROOT KSK generates a warning ($n)"
    558       1.1  christos ret=0
    559  1.1.1.11  christos $CHECKCONF check-root-ksk-2010.conf >checkconf.out$n 2>/dev/null || ret=1
    560       1.1  christos [ -s checkconf.out$n ] || ret=1
    561  1.1.1.11  christos grep "key without the updated" <checkconf.out$n >/dev/null || ret=1
    562  1.1.1.11  christos if [ $ret -ne 0 ]; then
    563  1.1.1.11  christos   echo_i "failed"
    564  1.1.1.11  christos   ret=1
    565  1.1.1.11  christos fi
    566  1.1.1.11  christos status=$((status + ret))
    567       1.1  christos 
    568  1.1.1.11  christos n=$((n + 1))
    569   1.1.1.4  christos echo_i "check that the 2010 ICANN ROOT KSK with the 2017 ICANN ROOT KSK does not generate a warning ($n)"
    570       1.1  christos ret=0
    571  1.1.1.11  christos $CHECKCONF check-root-ksk-both.conf >checkconf.out$n 2>/dev/null || ret=1
    572       1.1  christos [ -s checkconf.out$n ] && ret=1
    573  1.1.1.11  christos if [ $ret -ne 0 ]; then
    574  1.1.1.11  christos   echo_i "failed"
    575  1.1.1.11  christos   ret=1
    576  1.1.1.11  christos fi
    577  1.1.1.11  christos status=$((status + ret))
    578       1.1  christos 
    579  1.1.1.11  christos n=$((n + 1))
    580   1.1.1.5  christos echo_i "check that the 2017 ICANN ROOT KSK alone does not generate a warning ($n)"
    581       1.1  christos ret=0
    582  1.1.1.11  christos $CHECKCONF check-root-ksk-2017.conf >checkconf.out$n 2>/dev/null || ret=1
    583       1.1  christos [ -s checkconf.out$n ] && ret=1
    584  1.1.1.11  christos if [ $ret -ne 0 ]; then
    585  1.1.1.11  christos   echo_i "failed"
    586  1.1.1.11  christos   ret=1
    587  1.1.1.11  christos fi
    588  1.1.1.11  christos status=$((status + ret))
    589       1.1  christos 
    590  1.1.1.11  christos n=$((n + 1))
    591   1.1.1.5  christos echo_i "check that a static root key generates a warning ($n)"
    592       1.1  christos ret=0
    593  1.1.1.11  christos $CHECKCONF check-root-static-key.conf >checkconf.out$n 2>/dev/null || ret=1
    594  1.1.1.11  christos grep "static entry for the root zone WILL FAIL" checkconf.out$n >/dev/null || ret=1
    595  1.1.1.11  christos if [ $ret -ne 0 ]; then
    596  1.1.1.11  christos   echo_i "failed"
    597  1.1.1.11  christos   ret=1
    598  1.1.1.11  christos fi
    599  1.1.1.11  christos status=$((status + ret))
    600       1.1  christos 
    601  1.1.1.11  christos n=$((n + 1))
    602   1.1.1.5  christos echo_i "check that a static root DS trust anchor generates a warning ($n)"
    603   1.1.1.5  christos ret=0
    604  1.1.1.11  christos $CHECKCONF check-root-static-ds.conf >checkconf.out$n 2>/dev/null || ret=1
    605  1.1.1.11  christos grep "static entry for the root zone WILL FAIL" checkconf.out$n >/dev/null || ret=1
    606  1.1.1.11  christos if [ $ret -ne 0 ]; then
    607  1.1.1.11  christos   echo_i "failed"
    608  1.1.1.11  christos   ret=1
    609  1.1.1.11  christos fi
    610  1.1.1.11  christos status=$((status + ret))
    611   1.1.1.5  christos 
    612  1.1.1.11  christos n=$((n + 1))
    613   1.1.1.5  christos echo_i "check that a trusted-keys entry for root generates a warning ($n)"
    614   1.1.1.5  christos ret=0
    615  1.1.1.11  christos $CHECKCONF check-root-trusted-key.conf >checkconf.out$n 2>/dev/null || ret=1
    616  1.1.1.11  christos grep "trusted-keys entry for the root zone WILL FAIL" checkconf.out$n >/dev/null || ret=1
    617  1.1.1.11  christos if [ $ret -ne 0 ]; then
    618  1.1.1.11  christos   echo_i "failed"
    619  1.1.1.11  christos   ret=1
    620  1.1.1.11  christos fi
    621  1.1.1.11  christos status=$((status + ret))
    622   1.1.1.5  christos 
    623  1.1.1.11  christos n=$((n + 1))
    624   1.1.1.5  christos echo_i "check that using trust-anchors and managed-keys generates an error ($n)"
    625   1.1.1.5  christos ret=0
    626  1.1.1.11  christos $CHECKCONF check-mixed-keys.conf >checkconf.out$n 2>/dev/null && ret=1
    627  1.1.1.11  christos grep "use of managed-keys is not allowed" checkconf.out$n >/dev/null || ret=1
    628  1.1.1.11  christos if [ $ret -ne 0 ]; then
    629  1.1.1.11  christos   echo_i "failed"
    630  1.1.1.11  christos   ret=1
    631  1.1.1.11  christos fi
    632  1.1.1.11  christos status=$((status + ret))
    633   1.1.1.5  christos 
    634  1.1.1.11  christos n=$((n + 1))
    635   1.1.1.5  christos echo_i "checking named-checkconf kasp errors ($n)"
    636   1.1.1.5  christos ret=0
    637  1.1.1.11  christos $CHECKCONF kasp-and-other-dnssec-options.conf >checkconf.out$n 2>&1 && ret=1
    638  1.1.1.11  christos grep "'inline-signing yes;' must also be configured explicitly for zones using dnssec-policy without a configured 'allow-update' or 'update-policy'" <checkconf.out$n >/dev/null || ret=1
    639  1.1.1.10  christos if [ $ret -ne 0 ]; then echo_i "failed"; fi
    640  1.1.1.11  christos status=$((status + ret))
    641   1.1.1.5  christos 
    642  1.1.1.11  christos n=$((n + 1))
    643   1.1.1.7  christos echo_i "checking named-checkconf kasp nsec3 iterations errors ($n)"
    644   1.1.1.7  christos ret=0
    645  1.1.1.12  christos if [ $RSASHA1_SUPPORTED = 0 ]; then
    646  1.1.1.12  christos   conf=kasp-bad-nsec3-iter-fips.conf
    647  1.1.1.12  christos   expect=2
    648  1.1.1.12  christos else
    649  1.1.1.12  christos   conf=kasp-bad-nsec3-iter.conf
    650  1.1.1.13  christos   expect=5
    651  1.1.1.12  christos fi
    652  1.1.1.12  christos $CHECKCONF $conf >checkconf.out$n 2>&1 && ret=1
    653  1.1.1.12  christos grep "dnssec-policy: nsec3 iterations value 1 not allowed, must be zero" <checkconf.out$n >/dev/null || ret=1
    654  1.1.1.11  christos lines=$(wc -l <"checkconf.out$n")
    655  1.1.1.12  christos if [ $lines -ne $expect ]; then ret=1; fi
    656  1.1.1.10  christos if [ $ret -ne 0 ]; then echo_i "failed"; fi
    657  1.1.1.11  christos status=$((status + ret))
    658   1.1.1.7  christos 
    659  1.1.1.11  christos n=$((n + 1))
    660   1.1.1.7  christos echo_i "checking named-checkconf kasp nsec3 algorithm errors ($n)"
    661   1.1.1.7  christos ret=0
    662  1.1.1.11  christos $CHECKCONF kasp-bad-nsec3-alg.conf >checkconf.out$n 2>&1 && ret=1
    663  1.1.1.12  christos if [ $RSASHA1_SUPPORTED = 0 ]; then
    664  1.1.1.12  christos   grep "dnssec-policy: algorithm rsasha1 not supported" <checkconf.out$n >/dev/null || ret=1
    665  1.1.1.12  christos else
    666  1.1.1.12  christos   grep "dnssec-policy: cannot use nsec3 with algorithm 'RSASHA1'" <checkconf.out$n >/dev/null || ret=1
    667  1.1.1.12  christos fi
    668  1.1.1.10  christos if [ $ret -ne 0 ]; then echo_i "failed"; fi
    669  1.1.1.11  christos status=$((status + ret))
    670   1.1.1.7  christos 
    671  1.1.1.11  christos n=$((n + 1))
    672   1.1.1.7  christos echo_i "checking named-checkconf kasp key errors ($n)"
    673   1.1.1.7  christos ret=0
    674  1.1.1.11  christos $CHECKCONF kasp-bad-keylen.conf >checkconf.out$n 2>&1 && ret=1
    675  1.1.1.12  christos grep "dnssec-policy: key with algorithm rsasha256 has invalid key length 511" <checkconf.out$n >/dev/null || ret=1
    676  1.1.1.12  christos if [ $ret -ne 0 ]; then echo_i "failed"; fi
    677  1.1.1.12  christos status=$((status + ret))
    678  1.1.1.12  christos 
    679  1.1.1.12  christos n=$((n + 1))
    680  1.1.1.12  christos echo_i "checking named-checkconf kasp offline-ksk with csk errors ($n)"
    681  1.1.1.12  christos ret=0
    682  1.1.1.12  christos $CHECKCONF kasp-bad-offline-ksk.conf >checkconf.out$n 2>&1 && ret=1
    683  1.1.1.12  christos grep "dnssec-policy: csk keys are not allowed when offline-ksk is enabled" <checkconf.out$n >/dev/null || ret=1
    684  1.1.1.11  christos if [ $ret -ne 0 ]; then echo_i "failed"; fi
    685  1.1.1.11  christos status=$((status + ret))
    686  1.1.1.11  christos 
    687  1.1.1.11  christos n=$((n + 1))
    688  1.1.1.11  christos echo_i "checking named-checkconf kasp signatures refresh errors ($n)"
    689  1.1.1.11  christos ret=0
    690  1.1.1.11  christos $CHECKCONF kasp-bad-signatures-refresh.conf >checkconf.out$n 2>&1 && ret=1
    691  1.1.1.11  christos grep "dnssec-policy: policy 'bad-sigrefresh' signatures-refresh must be at most 90% of the signatures-validity" <checkconf.out$n >/dev/null || ret=1
    692  1.1.1.11  christos grep "dnssec-policy: policy 'bad-sigrefresh-dnskey' signatures-refresh must be at most 90% of the signatures-validity-dnskey" <checkconf.out$n >/dev/null || ret=1
    693  1.1.1.11  christos lines=$(wc -l <"checkconf.out$n")
    694  1.1.1.11  christos if [ $lines -ne 2 ]; then ret=1; fi
    695  1.1.1.10  christos if [ $ret -ne 0 ]; then echo_i "failed"; fi
    696  1.1.1.11  christos status=$((status + ret))
    697   1.1.1.7  christos 
    698  1.1.1.11  christos n=$((n + 1))
    699  1.1.1.11  christos echo_i "checking named-checkconf kasp key lifetime errors ($n)"
    700  1.1.1.11  christos ret=0
    701  1.1.1.11  christos $CHECKCONF kasp-bad-lifetime.conf >checkconf.out$n 2>&1 && ret=1
    702  1.1.1.11  christos lines=$(grep "dnssec-policy: key lifetime is shorter than the time it takes to do a rollover" <checkconf.out$n | wc -l) || ret=1
    703  1.1.1.11  christos if [ $lines -ne 3 ]; then ret=1; fi
    704  1.1.1.11  christos if [ $ret -ne 0 ]; then echo_i "failed"; fi
    705  1.1.1.11  christos status=$((status + ret))
    706  1.1.1.11  christos 
    707  1.1.1.11  christos n=$((n + 1))
    708   1.1.1.7  christos echo_i "checking named-checkconf kasp predefined key length ($n)"
    709   1.1.1.5  christos ret=0
    710  1.1.1.11  christos $CHECKCONF kasp-ignore-keylen.conf >checkconf.out$n 2>&1 || ret=1
    711  1.1.1.11  christos grep "dnssec-policy: key algorithm ecdsa256 has predefined length; ignoring length value 2048" <checkconf.out$n >/dev/null || ret=1
    712  1.1.1.10  christos if [ $ret -ne 0 ]; then echo_i "failed"; fi
    713  1.1.1.11  christos status=$((status + ret))
    714   1.1.1.5  christos 
    715  1.1.1.11  christos n=$((n + 1))
    716  1.1.1.11  christos echo_i "checking named-checkconf kasp warns about weird policies ($n)"
    717  1.1.1.11  christos ret=0
    718  1.1.1.11  christos $CHECKCONF kasp-warning.conf >checkconf.out$n 2>&1 || ret=1
    719  1.1.1.11  christos grep "dnssec-policy: algorithm 8 has multiple keys with ZSK role" <checkconf.out$n >/dev/null || ret=1
    720  1.1.1.11  christos grep "dnssec-policy: algorithm 8 has multiple keys with ZSK role" <checkconf.out$n >/dev/null || ret=1
    721  1.1.1.11  christos grep "dnssec-policy: algorithm 13 has multiple keys with KSK role" <checkconf.out$n >/dev/null || ret=1
    722  1.1.1.11  christos grep "dnssec-policy: algorithm 13 has multiple keys with ZSK role" <checkconf.out$n >/dev/null || ret=1
    723  1.1.1.11  christos grep "dnssec-policy: key lifetime is shorter than 30 days" <checkconf.out$n >/dev/null || ret=1
    724  1.1.1.11  christos lines=$(wc -l <"checkconf.out$n")
    725  1.1.1.11  christos if [ $lines -ne 5 ]; then ret=1; fi
    726  1.1.1.11  christos if [ $ret -ne 0 ]; then echo_i "failed"; fi
    727  1.1.1.11  christos status=$((status + ret))
    728  1.1.1.11  christos 
    729  1.1.1.11  christos n=$((n + 1))
    730  1.1.1.13  christos echo_i "checking named-checkconf kasp deprecated algorithms and digests ($n)"
    731  1.1.1.13  christos ret=0
    732  1.1.1.13  christos if [ $RSASHA1_SUPPORTED = 0 ]; then
    733  1.1.1.13  christos   $CHECKCONF kasp-deprecated-fips.conf >checkconf.out$n 2>&1 || ret=1
    734  1.1.1.13  christos else
    735  1.1.1.13  christos   $CHECKCONF kasp-deprecated.conf >checkconf.out$n 2>&1 || ret=1
    736  1.1.1.13  christos   grep "dnssec-policy: DNSSEC algorithm rsasha1 is deprecated" checkconf.out$n >/dev/null || ret=1
    737  1.1.1.13  christos   grep "dnssec-policy: DNSSEC algorithm nsec3rsasha1 is deprecated" checkconf.out$n >/dev/null || ret=1
    738  1.1.1.13  christos fi
    739  1.1.1.13  christos grep "dnssec-policy: deprecated CDS digest-type sha1" checkconf.out$n >/dev/null || ret=1
    740  1.1.1.13  christos if [ $ret -ne 0 ]; then echo_i "failed"; fi
    741  1.1.1.13  christos status=$((status + ret))
    742  1.1.1.13  christos 
    743  1.1.1.13  christos n=$((n + 1))
    744   1.1.1.5  christos echo_i "check that a good 'kasp' configuration is accepted ($n)"
    745   1.1.1.5  christos ret=0
    746  1.1.1.11  christos $CHECKCONF good-kasp.conf >checkconf.out$n 2>/dev/null || ret=1
    747  1.1.1.10  christos if [ $ret -ne 0 ]; then echo_i "failed"; fi
    748  1.1.1.11  christos status=$((status + ret))
    749   1.1.1.5  christos 
    750  1.1.1.11  christos n=$((n + 1))
    751   1.1.1.5  christos echo_i "checking that named-checkconf prints a known good kasp config ($n)"
    752   1.1.1.5  christos ret=0
    753  1.1.1.11  christos awk 'BEGIN { ok = 0; } /cut here/ { ok = 1; getline } ok == 1 { print }' good-kasp.conf >good-kasp.conf.in
    754   1.1.1.5  christos [ -s good-kasp.conf.in ] || ret=1
    755  1.1.1.11  christos $CHECKCONF -p good-kasp.conf.in | grep -v '^good-kasp.conf.in:' >good-kasp.conf.out 2>&1 || ret=1
    756   1.1.1.5  christos cmp good-kasp.conf.in good-kasp.conf.out || ret=1
    757  1.1.1.10  christos if [ $ret -ne 0 ]; then echo_i "failed"; fi
    758  1.1.1.11  christos status=$((status + ret))
    759   1.1.1.5  christos 
    760  1.1.1.11  christos n=$((n + 1))
    761   1.1.1.7  christos echo_i "check that max-ixfr-ratio 100% generates a warning ($n)"
    762   1.1.1.7  christos ret=0
    763  1.1.1.11  christos $CHECKCONF warn-maxratio1.conf >checkconf.out$n 2>/dev/null || ret=1
    764  1.1.1.11  christos grep "exceeds 100%" <checkconf.out$n >/dev/null || ret=1
    765  1.1.1.11  christos if [ $ret -ne 0 ]; then
    766  1.1.1.11  christos   echo_i "failed"
    767  1.1.1.11  christos   ret=1
    768  1.1.1.11  christos fi
    769  1.1.1.11  christos status=$((status + ret))
    770   1.1.1.7  christos 
    771  1.1.1.11  christos n=$((n + 1))
    772   1.1.1.9  christos echo_i "check that *-source options with specified port generate warnings ($n)"
    773   1.1.1.9  christos ret=0
    774  1.1.1.11  christos $CHECKCONF warn-transfer-source.conf >checkconf.out$n 2>/dev/null || ret=1
    775  1.1.1.11  christos grep "not recommended" <checkconf.out$n >/dev/null || ret=1
    776  1.1.1.11  christos $CHECKCONF warn-notify-source.conf >checkconf.out$n 2>/dev/null || ret=1
    777  1.1.1.11  christos grep "not recommended" <checkconf.out$n >/dev/null || ret=1
    778  1.1.1.11  christos $CHECKCONF warn-parental-source.conf >checkconf.out$n 2>/dev/null || ret=1
    779  1.1.1.11  christos grep "not recommended" <checkconf.out$n >/dev/null || ret=1
    780  1.1.1.11  christos if [ $ret -ne 0 ]; then
    781  1.1.1.11  christos   echo_i "failed"
    782  1.1.1.11  christos   ret=1
    783  1.1.1.11  christos fi
    784  1.1.1.11  christos status=$((status + ret))
    785   1.1.1.9  christos 
    786  1.1.1.11  christos n=$((n + 1))
    787  1.1.1.10  christos echo_i "check that 'check-wildcard no;' succeeds as configured ($n)"
    788  1.1.1.10  christos ret=0
    789  1.1.1.11  christos $CHECKCONF -z check-wildcard-no.conf >checkconf.out$n 2>&1 || ret=1
    790  1.1.1.11  christos grep -F "warning: ownername 'foo.*.check-wildcard' contains an non-terminal wildcard" checkconf.out$n >/dev/null && ret=1
    791  1.1.1.11  christos if [ $ret != 0 ]; then
    792  1.1.1.11  christos   echo_i "failed"
    793  1.1.1.11  christos   ret=1
    794  1.1.1.11  christos fi
    795  1.1.1.11  christos status=$((status + ret))
    796  1.1.1.10  christos 
    797  1.1.1.11  christos n=$((n + 1))
    798  1.1.1.10  christos echo_i "check that 'check-wildcard yes;' warns as configured ($n)"
    799  1.1.1.10  christos ret=0
    800  1.1.1.11  christos $CHECKCONF -z check-wildcard.conf >checkconf.out$n 2>&1 || ret=1
    801  1.1.1.11  christos grep -F "warning: ownername 'foo.*.check-wildcard' contains an non-terminal wildcard" checkconf.out$n >/dev/null || ret=1
    802  1.1.1.11  christos if [ $ret != 0 ]; then
    803  1.1.1.11  christos   echo_i "failed"
    804  1.1.1.11  christos   ret=1
    805  1.1.1.11  christos fi
    806  1.1.1.11  christos status=$((status + ret))
    807   1.1.1.8  christos 
    808       1.1  christos echo_i "exit status: $status"
    809       1.1  christos [ $status -eq 0 ] || exit 1
    810