diff --git a/dnsapi/README.md b/dnsapi/README.md index 507818c1..82734f12 100644 --- a/dnsapi/README.md +++ b/dnsapi/README.md @@ -1013,8 +1013,6 @@ acme.sh --issue --dns dns_netcup -d example.com -d www.example.com The `NC_Apikey`,`NC_Apipw` and `NC_CID` will be saved in `~/.acme.sh/account.conf` and will be reused when needed. ## 52. Use GratisDNS.dk - - GratisDNS.dk (https://gratisdns.dk/) does not provide an API to update DNS records (other than IPv4 and IPv6 dynamic DNS addresses). The acme.sh plugin therefore retrieves and updates domain TXT records by logging into the GratisDNS website to read the HTML and posting updates as HTTP. The plugin needs to know your diff --git a/dnsapi/dns_fh.sh b/dnsapi/dns_fh.sh index 499a5220..d346d044 100644 --- a/dnsapi/dns_fh.sh +++ b/dnsapi/dns_fh.sh @@ -41,7 +41,7 @@ dns_fh_add() { _post_data="{\"zone_id\": \"${_zone_id}\", \"type\": \"TXT\", \"host\": \"${host}\", \"target\": \"${txtvalue}\", \"ttl\": \"300\"}" if _rest POST "dns-record" "${_post_data}" && [ -n "${response}" ]; then - _record_id=$(printf "%s\n" "${response}" | _egrep_o "\"record_id\":\s*[0-9]+" | cut -d : -f 2 | tr -d " " | _head_n 1) + _record_id=$(printf "%s\n" "${response}" | _egrep_o "\"record_id\": *[0-9]+" | cut -d : -f 2 | tr -d " " | _head_n 1) _debug _record_id "${_record_id}" if [ -z "$_record_id" ]; then @@ -87,11 +87,11 @@ dns_fh_rm() { response="$(echo "${response}" | tr -d "\n" | sed 's/^\[\(.*\)\]$/\1/' | sed -e 's/{"record_id":/|"record_id":/g' | sed 's/|/&{/g' | tr "|" "\n")" _debug response "${response}" - record="$(echo "${response}" | _egrep_o "{.*\"host\":\s*\"${_sub_domain}\",\s*\"target\":\s*\"${txtvalue}\".*}")" + record="$(echo "${response}" | _egrep_o "{.*\"host\": *\"${_sub_domain}\", *\"target\": *\"${txtvalue}\".*}")" _debug record "${record}" if [ "${record}" ]; then - _record_id=$(printf "%s\n" "${record}" | _egrep_o "\"record_id\":\s*[0-9]+" | _head_n 1 | cut -d : -f 2 | tr -d \ ) + _record_id=$(printf "%s\n" "${record}" | _egrep_o "\"record_id\": *[0-9]+" | _head_n 1 | cut -d : -f 2 | tr -d \ ) if [ "${_record_id}" ]; then _debug _record_id "${_record_id}" @@ -112,7 +112,7 @@ dns_fh_rm() { _check_fh_api_token() { if [ -z "${FH_API_TOKEN}" ]; then - FH_API_TOKEN="${FH_API_TOKEN:-$(_readaccountconf FH_API_TOKEN)}" + FH_API_TOKEN="${FH_API_TOKEN:-$(_readaccountconf_mutable FH_API_TOKEN)}" _err "You have not defined your FH_API_TOKEN." _err "Please create your token and try again." @@ -122,7 +122,7 @@ _check_fh_api_token() { return 1 fi - _saveaccountconf FH_API_TOKEN "${FH_API_TOKEN}" + _saveaccountconf_mutable FH_API_TOKEN "${FH_API_TOKEN}" } _get_root() { @@ -142,9 +142,9 @@ _get_root() { return 1 fi - hostedzone="$(echo "${response}" | _egrep_o "{.*\"domain\":\s*\"${h}\".*}")" + hostedzone="$(echo "${response}" | _egrep_o "{.*\"domain\": *\"${h}\".*}")" if [ "${hostedzone}" ]; then - _zone_id=$(printf "%s\n" "${hostedzone}" | _egrep_o "\"zone_id\":\s*[0-9]+" | _head_n 1 | cut -d : -f 2 | tr -d \ ) + _zone_id=$(printf "%s\n" "${hostedzone}" | _egrep_o "\"zone_id\": *[0-9]+" | _head_n 1 | cut -d : -f 2 | tr -d \ ) if [ "${_zone_id}" ]; then _sub_domain=$(printf "%s" "${domain}" | cut -d . -f 1-${p}) _domain="${h}" diff --git a/dnsapi/dns_nexcess.sh b/dnsapi/dns_nexcess.sh index 72882fd7..eb0001c0 100644 --- a/dnsapi/dns_nexcess.sh +++ b/dnsapi/dns_nexcess.sh @@ -41,7 +41,7 @@ dns_nexcess_add() { _post_data="{\"zone_id\": \"${_zone_id}\", \"type\": \"TXT\", \"host\": \"${host}\", \"target\": \"${txtvalue}\", \"ttl\": \"300\"}" if _rest POST "dns-record" "${_post_data}" && [ -n "${response}" ]; then - _record_id=$(printf "%s\n" "${response}" | _egrep_o "\"record_id\":\s*[0-9]+" | cut -d : -f 2 | tr -d " " | _head_n 1) + _record_id=$(printf "%s\n" "${response}" | _egrep_o "\"record_id\": *[0-9]+" | cut -d : -f 2 | tr -d " " | _head_n 1) _debug _record_id "${_record_id}" if [ -z "$_record_id" ]; then @@ -87,11 +87,11 @@ dns_nexcess_rm() { response="$(echo "${response}" | tr -d "\n" | sed 's/^\[\(.*\)\]$/\1/' | sed -e 's/{"record_id":/|"record_id":/g' | sed 's/|/&{/g' | tr "|" "\n")" _debug response "${response}" - record="$(echo "${response}" | _egrep_o "{.*\"host\":\s*\"${_sub_domain}\",\s*\"target\":\s*\"${txtvalue}\".*}")" + record="$(echo "${response}" | _egrep_o "{.*\"host\": *\"${_sub_domain}\", *\"target\": *\"${txtvalue}\".*}")" _debug record "${record}" if [ "${record}" ]; then - _record_id=$(printf "%s\n" "${record}" | _egrep_o "\"record_id\":\s*[0-9]+" | _head_n 1 | cut -d : -f 2 | tr -d \ ) + _record_id=$(printf "%s\n" "${record}" | _egrep_o "\"record_id\": *[0-9]+" | _head_n 1 | cut -d : -f 2 | tr -d \ ) if [ "${_record_id}" ]; then _debug _record_id "${_record_id}" @@ -112,7 +112,7 @@ dns_nexcess_rm() { _check_nexcess_api_token() { if [ -z "${NEXCESS_API_TOKEN}" ]; then - NEXCESS_API_TOKEN="${NEXCESS_API_TOKEN:-$(_readaccountconf NEXCESS_API_TOKEN)}" + NEXCESS_API_TOKEN="${NEXCESS_API_TOKEN:-$(_readaccountconf_mutable NEXCESS_API_TOKEN)}" _err "You have not defined your NEXCESS_API_TOKEN." _err "Please create your token and try again." @@ -122,7 +122,7 @@ _check_nexcess_api_token() { return 1 fi - _saveaccountconf NEXCESS_API_TOKEN "${NEXCESS_API_TOKEN}" + _saveaccountconf_mutable NEXCESS_API_TOKEN "${NEXCESS_API_TOKEN}" } _get_root() { @@ -142,9 +142,9 @@ _get_root() { return 1 fi - hostedzone="$(echo "${response}" | _egrep_o "{.*\"domain\":\s*\"${h}\".*}")" + hostedzone="$(echo "${response}" | _egrep_o "{.*\"domain\": *\"${h}\".*}")" if [ "${hostedzone}" ]; then - _zone_id=$(printf "%s\n" "${hostedzone}" | _egrep_o "\"zone_id\":\s*[0-9]+" | _head_n 1 | cut -d : -f 2 | tr -d \ ) + _zone_id=$(printf "%s\n" "${hostedzone}" | _egrep_o "\"zone_id\": *[0-9]+" | _head_n 1 | cut -d : -f 2 | tr -d \ ) if [ "${_zone_id}" ]; then _sub_domain=$(printf "%s" "${domain}" | cut -d . -f 1-${p}) _domain="${h}" diff --git a/dnsapi/dns_thermo.sh b/dnsapi/dns_thermo.sh index d82c73d1..149d13f6 100644 --- a/dnsapi/dns_thermo.sh +++ b/dnsapi/dns_thermo.sh @@ -41,7 +41,7 @@ dns_thermo_add() { _post_data="{\"zone_id\": \"${_zone_id}\", \"type\": \"TXT\", \"host\": \"${host}\", \"target\": \"${txtvalue}\", \"ttl\": \"300\"}" if _rest POST "dns-record" "${_post_data}" && [ -n "${response}" ]; then - _record_id=$(printf "%s\n" "${response}" | _egrep_o "\"record_id\":\s*[0-9]+" | cut -d : -f 2 | tr -d " " | _head_n 1) + _record_id=$(printf "%s\n" "${response}" | _egrep_o "\"record_id\": *[0-9]+" | cut -d : -f 2 | tr -d " " | _head_n 1) _debug _record_id "${_record_id}" if [ -z "$_record_id" ]; then @@ -87,11 +87,11 @@ dns_thermo_rm() { response="$(echo "${response}" | tr -d "\n" | sed 's/^\[\(.*\)\]$/\1/' | sed -e 's/{"record_id":/|"record_id":/g' | sed 's/|/&{/g' | tr "|" "\n")" _debug response "${response}" - record="$(echo "${response}" | _egrep_o "{.*\"host\":\s*\"${_sub_domain}\",\s*\"target\":\s*\"${txtvalue}\".*}")" + record="$(echo "${response}" | _egrep_o "{.*\"host\": *\"${_sub_domain}\", *\"target\": *\"${txtvalue}\".*}")" _debug record "${record}" if [ "${record}" ]; then - _record_id=$(printf "%s\n" "${record}" | _egrep_o "\"record_id\":\s*[0-9]+" | _head_n 1 | cut -d : -f 2 | tr -d \ ) + _record_id=$(printf "%s\n" "${record}" | _egrep_o "\"record_id\": *[0-9]+" | _head_n 1 | cut -d : -f 2 | tr -d \ ) if [ "${_record_id}" ]; then _debug _record_id "${_record_id}" @@ -112,7 +112,7 @@ dns_thermo_rm() { _check_thermo_api_token() { if [ -z "${THERMO_API_TOKEN}" ]; then - THERMO_API_TOKEN="${THERMO_API_TOKEN:-$(_readaccountconf THERMO_API_TOKEN)}" + THERMO_API_TOKEN="${THERMO_API_TOKEN:-$(_readaccountconf_mutable THERMO_API_TOKEN)}" _err "You have not defined your THERMO_API_TOKEN." _err "Please create your token and try again." @@ -122,7 +122,7 @@ _check_thermo_api_token() { return 1 fi - _saveaccountconf THERMO_API_TOKEN "${THERMO_API_TOKEN}" + _saveaccountconf_mutable THERMO_API_TOKEN "${THERMO_API_TOKEN}" } _get_root() { @@ -142,9 +142,9 @@ _get_root() { return 1 fi - hostedzone="$(echo "${response}" | _egrep_o "{.*\"domain\":\s*\"${h}\".*}")" + hostedzone="$(echo "${response}" | _egrep_o "{.*\"domain\": *\"${h}\".*}")" if [ "${hostedzone}" ]; then - _zone_id=$(printf "%s\n" "${hostedzone}" | _egrep_o "\"zone_id\":\s*[0-9]+" | _head_n 1 | cut -d : -f 2 | tr -d \ ) + _zone_id=$(printf "%s\n" "${hostedzone}" | _egrep_o "\"zone_id\": *[0-9]+" | _head_n 1 | cut -d : -f 2 | tr -d \ ) if [ "${_zone_id}" ]; then _sub_domain=$(printf "%s" "${domain}" | cut -d . -f 1-${p}) _domain="${h}"