247247# 2020-12-18 Wrong SANS when domain contains a minus character (atisne)
248248# 2020-12-22 Fixes to get_auth_dns
249249# 2020-12-22 Check that dig doesn't return an error (#611)(2.32)
250+ # 2020-12-29 Fix dig SOA lookup (#617)(2.33)
251+ # 2021-01-05 Show error if running in POSIX mode (#611)
250252# ----------------------------------------------------------------------------------------
251253
254+ case :$SHELLOPTS : in
255+ * :posix:* ) echo -e " ${0##*/ } : Running with POSIX mode enabled is not supported" >&2 ; exit 1;;
256+ esac
257+
252258PROGNAME=${0##*/ }
253259PROGDIR=" $( cd " $( dirname " $0 " ) " || exit ; pwd -P; ) "
254- VERSION=" 2.32 "
260+ VERSION=" 2.33 "
255261
256262# defaults
257263ACCOUNT_KEY_LENGTH=4096
@@ -766,7 +772,9 @@ check_getssl_upgrade() { # check if a more recent version of code is available a
766772 getssl_versions=(" ${getssl_versions[@]: 1} " )
767773 done
768774 fi
769- eval " $ORIGCMD "
775+ if ! eval " $ORIGCMD " ; then
776+ error_exit " Running upgraded getssl failed"
777+ fi
770778 graceful_exit
771779 else
772780 info " "
@@ -1310,11 +1318,11 @@ get_auth_dns() { # get the authoritative dns server for a domain (sets primary_n
13101318 if [[ " $HAS_DIG_OR_DRILL " == " dig" ]]; then
13111319 debug Using " $HAS_DIG_OR_DRILL SOA +trace +nocomments $gad_d $gad_s " to find primary nameserver
13121320 test_output " Using $HAS_DIG_OR_DRILL SOA"
1313- res=$( $HAS_DIG_OR_DRILL SOA +trace +nocomments " $gad_d " " $gad_s " 2> /dev/null | grep " IN\WNS\W" )
1321+ res=$( $HAS_DIG_OR_DRILL SOA +trace +nocomments " $gad_d " $gad_s 2> /dev/null | grep " IN\WNS\W" )
13141322 else
13151323 debug Using " $HAS_DIG_OR_DRILL -T $gad_d $gad_s " to find primary nameserver
13161324 test_output " Using $HAS_DIG_OR_DRILL SOA"
1317- res=$( $HAS_DIG_OR_DRILL -T SOA " $gad_d " " $gad_s " 2> /dev/null | grep " IN\WNS\W" )
1325+ res=$( $HAS_DIG_OR_DRILL -T SOA " $gad_d " $gad_s 2> /dev/null | grep " IN\WNS\W" )
13181326 fi
13191327 fi
13201328
@@ -1324,12 +1332,12 @@ get_auth_dns() { # get the authoritative dns server for a domain (sets primary_n
13241332
13251333 # Two options here; either dig CNAME will return the CNAME and the NS or just the CNAME
13261334 debug Checking for CNAME using " $HAS_DIG_OR_DRILL CNAME $gad_d $gad_s "
1327- res=$( $HAS_DIG_OR_DRILL CNAME " $gad_d " " $gad_s " | grep " ^$gad_d " )
1335+ res=$( $HAS_DIG_OR_DRILL CNAME " $gad_d " $gad_s | grep " ^$gad_d " )
13281336 cname=$( echo " $res " | awk ' $4 ~ "CNAME" {print $5}' | sed ' s/\.$//g' )
13291337
13301338 if [[ $_TEST_SKIP_CNAME_CALL == 0 ]]; then
13311339 debug Checking if CNAME result contains NS records
1332- res=$( $HAS_DIG_OR_DRILL CNAME " $gad_d " " $gad_s " | grep -E " IN\W(NS|SOA)\W" )
1340+ res=$( $HAS_DIG_OR_DRILL CNAME " $gad_d " $gad_s | grep -E " IN\W(NS|SOA)\W" )
13331341 else
13341342 res=" "
13351343 fi
@@ -1385,7 +1393,8 @@ get_auth_dns() { # get the authoritative dns server for a domain (sets primary_n
13851393 if [[ -z " $gad_s " ]]; then
13861394 res=$( host -t NS " $gad_d " | grep " name server" )
13871395 else
1388- res=$( host -t NS " $gad_d " " $gad_s " | grep " name server" )
1396+ # shellcheck disable=SC2086
1397+ res=$( host -t NS " $gad_d " $gad_s | grep " name server" )
13891398 fi
13901399 if [[ -n " $res " ]]; then
13911400 all_auth_dns_servers=$( echo " $res " | awk ' {print $4}' | sed ' s/\.$//g' | tr ' \n' ' ' )
0 commit comments