|
|
@ -440,29 +440,29 @@ check_config() { # check the config files for all obvious errors |
|
|
fi |
|
|
fi |
|
|
# check domain exists |
|
|
# check domain exists |
|
|
if [[ "$DNS_CHECK_FUNC" == "drill" ]]; then |
|
|
if [[ "$DNS_CHECK_FUNC" == "drill" ]]; then |
|
|
if [[ "$($DNS_CHECK_FUNC "${d}" |grep -c "${d}")" -ge 1 ]]; then |
|
|
|
|
|
|
|
|
if [[ "$($DNS_CHECK_FUNC "${d}" |grep -c -i "${d}")" -ge 1 ]]; then |
|
|
debug "found IP for ${d}" |
|
|
debug "found IP for ${d}" |
|
|
else |
|
|
else |
|
|
info "${DOMAIN}: DNS lookup failed for ${d}" |
|
|
info "${DOMAIN}: DNS lookup failed for ${d}" |
|
|
config_errors=true |
|
|
config_errors=true |
|
|
fi |
|
|
fi |
|
|
elif [[ "$DNS_CHECK_FUNC" == "dig" ]]; then |
|
|
elif [[ "$DNS_CHECK_FUNC" == "dig" ]]; then |
|
|
if [[ "$($DNS_CHECK_FUNC "${d}" -t SOA|grep -c "^${d}")" -ge 1 ]]; then |
|
|
|
|
|
|
|
|
if [[ "$($DNS_CHECK_FUNC "${d}" -t SOA|grep -c -i "^${d}")" -ge 1 ]]; then |
|
|
debug "found SOA IP for ${d}" |
|
|
debug "found SOA IP for ${d}" |
|
|
elif [[ "$($DNS_CHECK_FUNC "${d}" -t A|grep -c "^${d}")" -ge 1 ]]; then |
|
|
|
|
|
|
|
|
elif [[ "$($DNS_CHECK_FUNC "${d}" -t A|grep -c -i "^${d}")" -ge 1 ]]; then |
|
|
debug "found A IP for ${d}" |
|
|
debug "found A IP for ${d}" |
|
|
else |
|
|
else |
|
|
info "${DOMAIN}: DNS lookup failed for ${d}" |
|
|
info "${DOMAIN}: DNS lookup failed for ${d}" |
|
|
config_errors=true |
|
|
config_errors=true |
|
|
fi |
|
|
fi |
|
|
elif [[ "$DNS_CHECK_FUNC" == "host" ]]; then |
|
|
elif [[ "$DNS_CHECK_FUNC" == "host" ]]; then |
|
|
if [[ "$($DNS_CHECK_FUNC "${d}" |grep -c "^${d}")" -ge 1 ]]; then |
|
|
|
|
|
|
|
|
if [[ "$($DNS_CHECK_FUNC "${d}" |grep -c -i "^${d}")" -ge 1 ]]; then |
|
|
debug "found IP for ${d}" |
|
|
debug "found IP for ${d}" |
|
|
else |
|
|
else |
|
|
info "${DOMAIN}: DNS lookup failed for ${d}" |
|
|
info "${DOMAIN}: DNS lookup failed for ${d}" |
|
|
config_errors=true |
|
|
config_errors=true |
|
|
fi |
|
|
fi |
|
|
elif [[ "$(nslookup -query=AAAA "${d}"|grep -c "^${d}.*has AAAA address")" -ge 1 ]]; then |
|
|
|
|
|
|
|
|
elif [[ "$(nslookup -query=AAAA "${d}"|grep -c -i "^${d}.*has AAAA address")" -ge 1 ]]; then |
|
|
debug "found IPv6 record for ${d}" |
|
|
debug "found IPv6 record for ${d}" |
|
|
elif [[ "$(nslookup "${d}"| grep -c ^Name)" -ge 1 ]]; then |
|
|
elif [[ "$(nslookup "${d}"| grep -c ^Name)" -ge 1 ]]; then |
|
|
debug "found IPv4 record for ${d}" |
|
|
debug "found IPv4 record for ${d}" |
|
|
@ -775,6 +775,9 @@ create_order() { |
|
|
# find array position (This is O(n2) but that doubt we'll see performance issues) |
|
|
# find array position (This is O(n2) but that doubt we'll see performance issues) |
|
|
dn=0 |
|
|
dn=0 |
|
|
for d in $alldomains; do |
|
|
for d in $alldomains; do |
|
|
|
|
|
# Convert domain to lowercase as response from server will be in lowercase |
|
|
|
|
|
# shellcheck disable=SC2018,SC2019 |
|
|
|
|
|
d=$(echo "$d" | tr A-Z a-z) |
|
|
if [ "$d" == "$authdomain" ]; then |
|
|
if [ "$d" == "$authdomain" ]; then |
|
|
debug "Saving authorization response for $authdomain for domain alldomains[$dn]" |
|
|
debug "Saving authorization response for $authdomain for domain alldomains[$dn]" |
|
|
AuthLinkResponse[$dn]=$response |
|
|
AuthLinkResponse[$dn]=$response |
|
|
@ -832,20 +835,20 @@ find_dns_utils() { |
|
|
HAS_NSLOOKUP=false |
|
|
HAS_NSLOOKUP=false |
|
|
HAS_DIG_OR_DRILL="" |
|
|
HAS_DIG_OR_DRILL="" |
|
|
HAS_HOST=false |
|
|
HAS_HOST=false |
|
|
if [[ -n "$(command -v nslookup)" ]]; then |
|
|
|
|
|
|
|
|
if [[ -n "$(command -v nslookup 2>/dev/null)" ]]; then |
|
|
debug "HAS NSLOOKUP=true" |
|
|
debug "HAS NSLOOKUP=true" |
|
|
HAS_NSLOOKUP=true |
|
|
HAS_NSLOOKUP=true |
|
|
fi |
|
|
fi |
|
|
|
|
|
|
|
|
if [[ -n "$(command -v drill)" ]]; then |
|
|
|
|
|
|
|
|
if [[ -n "$(command -v drill 2>/dev/null)" ]]; then |
|
|
debug "HAS DIG_OR_DRILL=drill" |
|
|
debug "HAS DIG_OR_DRILL=drill" |
|
|
HAS_DIG_OR_DRILL="drill" |
|
|
HAS_DIG_OR_DRILL="drill" |
|
|
elif [[ -n "$(command -v dig)" ]]; then |
|
|
|
|
|
|
|
|
elif [[ -n "$(command -v dig 2>/dev/null)" ]]; then |
|
|
debug "HAS DIG_OR_DRILL=dig" |
|
|
debug "HAS DIG_OR_DRILL=dig" |
|
|
HAS_DIG_OR_DRILL="dig" |
|
|
HAS_DIG_OR_DRILL="dig" |
|
|
fi |
|
|
fi |
|
|
|
|
|
|
|
|
if [[ -n "$(command -v host)" ]]; then |
|
|
|
|
|
|
|
|
if [[ -n "$(command -v host 2>/dev/null)" ]]; then |
|
|
debug "HAS HOST=true" |
|
|
debug "HAS HOST=true" |
|
|
HAS_HOST=true |
|
|
HAS_HOST=true |
|
|
fi |
|
|
fi |
|
|
@ -915,8 +918,10 @@ for d in $alldomains; do |
|
|
| sed -e 's:=*$::g' -e 'y:+/:-_:') |
|
|
| sed -e 's:=*$::g' -e 'y:+/:-_:') |
|
|
debug auth_key "$auth_key" |
|
|
debug auth_key "$auth_key" |
|
|
|
|
|
|
|
|
debug "adding dns via command: $DNS_ADD_COMMAND $d $auth_key" |
|
|
|
|
|
if ! eval "$DNS_ADD_COMMAND" "$d" "$auth_key" ; then |
|
|
|
|
|
|
|
|
# shellcheck disable=SC2018,SC2019 |
|
|
|
|
|
lower_d=$(echo "$d" | tr A-Z a-z) |
|
|
|
|
|
debug "adding dns via command: $DNS_ADD_COMMAND $lower_d $auth_key" |
|
|
|
|
|
if ! eval "$DNS_ADD_COMMAND" "$lower_d" "$auth_key" ; then |
|
|
error_exit "DNS_ADD_COMMAND failed for domain $d" |
|
|
error_exit "DNS_ADD_COMMAND failed for domain $d" |
|
|
fi |
|
|
fi |
|
|
|
|
|
|
|
|
@ -1093,7 +1098,9 @@ if [[ $VALIDATE_VIA_DNS == "true" ]]; then |
|
|
check_challenge_completion "$uri" "$d" "$keyauthorization" |
|
|
check_challenge_completion "$uri" "$d" "$keyauthorization" |
|
|
|
|
|
|
|
|
debug "remove DNS entry" |
|
|
debug "remove DNS entry" |
|
|
eval "$DNS_DEL_COMMAND" "$d" "$auth_key" |
|
|
|
|
|
|
|
|
# shellcheck disable=SC2018,SC2019 |
|
|
|
|
|
lower_d=$(echo "$d" | tr A-Z a-z) |
|
|
|
|
|
eval "$DNS_DEL_COMMAND" "$lower_d" "$auth_key" |
|
|
# remove $dnsfile after each loop. |
|
|
# remove $dnsfile after each loop. |
|
|
rm -f "$dnsfile" |
|
|
rm -f "$dnsfile" |
|
|
fi |
|
|
fi |
|
|
|