263263# 2021-07-07 Request new certificate if SANs have changed (#669)(#673)
264264# 2021-07-12 Do not redirect outputs on remote commands when the debug option is used (atisne)
265265# 2021-07-20 Use +noidnout to enable certificates for IDN domains (#679)(2.37)
266+ # 2021-07-22 Only pass +noidnout param to dig/drill(#682)(2.38)
266267# ----------------------------------------------------------------------------------------
267268
268269case :$SHELLOPTS : in
271272
272273PROGNAME=${0##*/ }
273274PROGDIR=" $( cd " $( dirname " $0 " ) " || exit ; pwd -P; ) "
274- VERSION=" 2.37 "
275+ VERSION=" 2.38 "
275276
276277# defaults
277278ACCOUNT_KEY_LENGTH=4096
@@ -693,36 +694,35 @@ check_config() { # check the config files for all obvious errors
693694
694695 # check domain exists using all DNS utilities. DNS_CHECK_OPTIONS may bind IP address or provide TSIG
695696
696- # add +noidnout if idn-domain so search for domain in results works
697- if [[ " ${d} " == xn--* || " ${d} " == * " .xn--" * ]]; then
698- if [[ " $HAS_DIG_OR_DRILL " != " dig" || " $DIG_SUPPORTS_NOIDNOUT " == " true" ]]; then
699- DNS_CHECK_OPTIONS=" $DNS_CHECK_OPTIONS +noidnout"
700- fi
701- fi
702-
703697 found_ip=false
704698 if [[ -n " $HAS_DIG_OR_DRILL " ]]; then
705- debug " DNS lookup using $HAS_DIG_OR_DRILL $DNS_CHECK_OPTIONS ${d} "
699+ # add +noidnout if idn-domain so search for domain in results works
700+ DIG_CHECK_OPTIONS=" $DNS_CHECK_OPTIONS "
701+ if [[ (" ${d} " == xn--* || " ${d} " == * " .xn--" * ) && " $DIG_SUPPORTS_NOIDNOUT " == " true" ]]; then
702+ DIG_CHECK_OPTIONS=" $DNS_CHECK_OPTIONS +noidnout"
703+ fi
704+
705+ debug " DNS lookup using $HAS_DIG_OR_DRILL $DIG_CHECK_OPTIONS ${d} "
706706 # shellcheck disable=SC2086
707- if [[ " $( $HAS_DIG_OR_DRILL $DNS_CHECK_OPTIONS -t SOA " ${d} " | grep -c -i " ^${d} " ) " -ge 1 ]]; then
707+ if [[ " $( $HAS_DIG_OR_DRILL $DIG_CHECK_OPTIONS -t SOA " ${d} " | grep -c -i " ^${d} " ) " -ge 1 ]]; then
708708 found_ip=true
709- elif [[ " $( $HAS_DIG_OR_DRILL $DNS_CHECK_OPTIONS -t A " ${d} " | grep -c -i " ^${d} " ) " -ge 1 ]]; then
709+ elif [[ " $( $HAS_DIG_OR_DRILL $DIG_CHECK_OPTIONS -t A " ${d} " | grep -c -i " ^${d} " ) " -ge 1 ]]; then
710710 found_ip=true
711- elif [[ " $( $HAS_DIG_OR_DRILL $DNS_CHECK_OPTIONS -t AAAA " ${d} " | grep -c -i " ^${d} " ) " -ge 1 ]]; then
711+ elif [[ " $( $HAS_DIG_OR_DRILL $DIG_CHECK_OPTIONS -t AAAA " ${d} " | grep -c -i " ^${d} " ) " -ge 1 ]]; then
712712 found_ip=true
713713 fi
714714 fi
715715
716716 if [[ " $HAS_HOST " == " true" ]]; then
717- debug " DNS lookup using host ${d} "
717+ debug " DNS lookup using host $DNS_CHECK_OPTIONS $ {d}"
718718 # shellcheck disable=SC2086
719719 if [[ " $( host $DNS_CHECK_OPTIONS " ${d} " | grep -c -i " ^${d} " ) " -ge 1 ]]; then
720720 found_ip=true
721721 fi
722722 fi
723723
724724 if [[ " $HAS_NSLOOKUP " == " true" ]]; then
725- debug " DNS lookup using nslookup -query AAAA ${d} "
725+ debug " DNS lookup using nslookup $DNS_CHECK_OPTIONS -query AAAA ${d} "
726726 # shellcheck disable=SC2086
727727 if [[ " $( nslookup $DNS_CHECK_OPTIONS -query=AAAA " ${d} " | grep -c -i " ^${d} .*has AAAA address" ) " -ge 1 ]]; then
728728 debug " found IPv6 record for ${d} "
@@ -1161,7 +1161,6 @@ find_dns_utils() {
11611161 fi
11621162
11631163 if [[ -n " $( command -v drill 2> /dev/null) " ]]; then
1164- debug " HAS DIG_OR_DRILL=drill"
11651164 HAS_DIG_OR_DRILL=" drill"
11661165 elif [[ -n " $( command -v dig 2> /dev/null) " ]] && dig > /dev/null 2>&1 ; then
11671166 if dig -r > /dev/null 2>&1 ; then
@@ -1170,8 +1169,10 @@ find_dns_utils() {
11701169 else
11711170 HAS_DIG_OR_DRILL=" dig"
11721171 fi
1172+ fi
11731173
1174- if dig +noidnout > /dev/null 2>&1 ; then
1174+ if [[ -n " $HAS_DIG_OR_DRILL " ]]; then
1175+ if $HAS_DIG_OR_DRILL +noidnout > /dev/null 2>&1 ; then
11751176 DIG_SUPPORTS_NOIDNOUT=true
11761177 fi
11771178
0 commit comments