From ebbd227b9f47cf099a58e85cb62e8fb3459a3f79 Mon Sep 17 00:00:00 2001 From: John B Date: Thu, 3 Feb 2022 14:22:56 -0800 Subject: [PATCH 01/10] First commit/add of DNS Exit API add/remove script - jberlet --- dnsapi/dns_japi.sh | 100 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 100 insertions(+) create mode 100755 dnsapi/dns_japi.sh diff --git a/dnsapi/dns_japi.sh b/dnsapi/dns_japi.sh new file mode 100755 index 00000000..bffe6370 --- /dev/null +++ b/dnsapi/dns_japi.sh @@ -0,0 +1,100 @@ +#!/usr/bin/env sh + +#This is a working API script to add a TXT record to the DNS Exit-managed DNS service. +# dns_myapi_add() +#Which will be called by acme.sh to add the txt record to th DNS Exit DNS service as part +of the SSL certificate provisioning request. +#returns 0 means success, otherwise error. +# +#Author: John Berlet +#Date: 31/01/2022 +#Report Bugs here: https://github.com/acmesh-official/acme.sh/issues/3925 +# +######## Public functions ##################### + + +dns_japi_add() { + + + fulldomain=$1 + txtvalue=$2 + #_debug "Domain being used with custom script is: $domain" + fullchallengedomain="${JAPI_domain:-$(_readaccountconf_mutable JAPI_domain)}" + _debug "Full Challenge Domain is: $fullchallengedomain" + JAPI_apikey="${JAPI_apikey:-$(_readaccountconf_mutable JAPI_apikey)}" + #Set H1,H2 headers with DNS Exit API key + export _H1="Content-Type: application/json" + export _H2="apikey: $JAPI_apikey" + + _debug "Defined apikey $JAPI_apikey" + if [ -z "$JAPI_apikey" ] || [ -z "$fullchallengedomain" ]; then + JAPI_apikey="" + _info "You didn't specify the api key or the full zone domain name" + _info "Please define --> 'export xxx' your api key and fully qualified zone and domain name" + _info "Example: 'export JAPI_apikey='" + _info "Cont: 'export JAPI_domain=<_acme-challenge.your domain name>'" + return 1 + fi + #Save DNS Exit account API/domain challenge zone/domain name in account.conf for future renewals + _saveaccountconf_mutable JAPI_apikey "$JAPI_apikey" + _saveaccountconf_mutable JAPI_domain "$JAPI_domain" + + + _debug "First detect the root zone" + _debug "Calling DNS Exit DNS API..." + _info "Using JAPI" + _debug "Passed domain to function: $fulldomain" + _debug "Full Challenge domain: $fullchallengedomain" + _debug txtvalue "$txtvalue" + #_err "Not implemented!" + + response="$(_post "{\"domain\":\"$domain\",\"update\": {\"type\":\"TXT\",\"name\":\"$fullchallengedomain\",\"content\":\"$txtvalue\",\"ttl\":0}}" https://api.dnsexit.com/dns/ "" POST "application/json")" + if ! printf "%s" "$response" | grep \"code\":0>/dev/null; then + _err "There was an error updating the TXT record..." + _err "DNS Exit API response: $response" + _err "Please refer to this site for additional information related to this error code - https://dnsexit.com/dns/dns-api/" + return 1 + fi + return 0 +} +#Usage: fulldomain txtvalue +#Remove the txt record after validation. +dns_japi_rm() { + fulldomain=$1 + txtvalue=$2 + #_debug "Domain being used with custom script is: $domain" + fullchallengedomain="${JAPI_domain:-$(_readaccountconf_mutable JAPI_domain)}" + _debug "Full Challenge Domain is: $fullchallengedomain" + JAPI_apikey="${JAPI_apikey:-$(_readaccountconf_mutable JAPI_apikey)}" + #Set H1,H2 headers with DNS Exit API key + export _H1="Content-Type: application/json" + export _H2="apikey: $JAPI_apikey" + + _debug "Defined apikey $JAPI_apikey" + if [ -z "$JAPI_apikey" ] || [ -z "$fullchallengedomain" ]; then + JAPI_apikey="" + _info "You didn't specify the api key or the full zone domain name for the TXT record removal" + _info "Please define --> 'export xxx' your api key and fully qualified zone and domain name" + _info "Example: 'export JAPI_apikey='" + _info "Cont: 'export JAPI_domain=<_acme-challenge.your domain name>'" + return 1 + fi + _debug "First detect the root zone" + _debug "Calling DNS Exit DNS API..." + _info "Using JAPI" + _debug "Passed domain to function: $fulldomain" + _debug "Full Challenge domain: $fullchallengedomain" + _debug txtvalue "$txtvalue" + #_err "Not implemented!" + response="$(_post "{\"domain\":\"$domain\",\"delete\": {\"type\":\"TXT\",\"name\":\"$fullchallengedomain\",\"content\":\"$txtvalue\",\"ttl\":0}}" https://api.dnsexit.com/dns/ "" POST "application/json")" + if ! printf "%s" "$response" | grep \"code\":0>/dev/null; then + _err "There was an error deleting the TXT record..." + _err "DNS Exit API response: $response" + _err "Please refer to this site for additional information related to this error code - https://dnsexit.com/dns/dns-api/" + return 1 + fi + return 0 + + _debug fulldomain "$fulldomain" + _debug txtvalue "$txtvalue" +} From 1e80d8279b75d3a586f6da66d7057578ec2b8f2a Mon Sep 17 00:00:00 2001 From: John B Date: Thu, 3 Feb 2022 17:24:35 -0800 Subject: [PATCH 02/10] Fixed DNS Exit API endpoint url - placed in variable --- dnsapi/dns_japi.sh | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/dnsapi/dns_japi.sh b/dnsapi/dns_japi.sh index bffe6370..a1b748ab 100755 --- a/dnsapi/dns_japi.sh +++ b/dnsapi/dns_japi.sh @@ -18,6 +18,7 @@ dns_japi_add() { fulldomain=$1 txtvalue=$2 + apiendpoint="https://api.dnsexit.com/dns/" #_debug "Domain being used with custom script is: $domain" fullchallengedomain="${JAPI_domain:-$(_readaccountconf_mutable JAPI_domain)}" _debug "Full Challenge Domain is: $fullchallengedomain" @@ -48,7 +49,7 @@ dns_japi_add() { _debug txtvalue "$txtvalue" #_err "Not implemented!" - response="$(_post "{\"domain\":\"$domain\",\"update\": {\"type\":\"TXT\",\"name\":\"$fullchallengedomain\",\"content\":\"$txtvalue\",\"ttl\":0}}" https://api.dnsexit.com/dns/ "" POST "application/json")" + response="$(_post "{\"domain\":\"$domain\",\"update\": {\"type\":\"TXT\",\"name\":\"$fullchallengedomain\",\"content\":\"$txtvalue\",\"ttl\":0}}" $apiendpoint "" POST "application/json")" if ! printf "%s" "$response" | grep \"code\":0>/dev/null; then _err "There was an error updating the TXT record..." _err "DNS Exit API response: $response" @@ -62,6 +63,7 @@ dns_japi_add() { dns_japi_rm() { fulldomain=$1 txtvalue=$2 + apiendpoint="https://api.dnsexit.com/dns/" #_debug "Domain being used with custom script is: $domain" fullchallengedomain="${JAPI_domain:-$(_readaccountconf_mutable JAPI_domain)}" _debug "Full Challenge Domain is: $fullchallengedomain" @@ -86,7 +88,7 @@ dns_japi_rm() { _debug "Full Challenge domain: $fullchallengedomain" _debug txtvalue "$txtvalue" #_err "Not implemented!" - response="$(_post "{\"domain\":\"$domain\",\"delete\": {\"type\":\"TXT\",\"name\":\"$fullchallengedomain\",\"content\":\"$txtvalue\",\"ttl\":0}}" https://api.dnsexit.com/dns/ "" POST "application/json")" + response="$(_post "{\"domain\":\"$domain\",\"delete\": {\"type\":\"TXT\",\"name\":\"$fullchallengedomain\",\"content\":\"$txtvalue\",\"ttl\":0}}" $apiendpoint "" POST "application/json")" if ! printf "%s" "$response" | grep \"code\":0>/dev/null; then _err "There was an error deleting the TXT record..." _err "DNS Exit API response: $response" From 80aa60c38f6f9b05527ada04f9bc0fc310be2100 Mon Sep 17 00:00:00 2001 From: John B Date: Thu, 3 Feb 2022 17:58:33 -0800 Subject: [PATCH 03/10] Fixed again API endpoint url for shcheck test --- dnsapi/dns_japi.sh | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/dnsapi/dns_japi.sh b/dnsapi/dns_japi.sh index a1b748ab..f4371e94 100755 --- a/dnsapi/dns_japi.sh +++ b/dnsapi/dns_japi.sh @@ -18,7 +18,7 @@ dns_japi_add() { fulldomain=$1 txtvalue=$2 - apiendpoint="https://api.dnsexit.com/dns/" + JAPIendpoint="https://api.dnsexit.com/dns/" #_debug "Domain being used with custom script is: $domain" fullchallengedomain="${JAPI_domain:-$(_readaccountconf_mutable JAPI_domain)}" _debug "Full Challenge Domain is: $fullchallengedomain" @@ -49,7 +49,7 @@ dns_japi_add() { _debug txtvalue "$txtvalue" #_err "Not implemented!" - response="$(_post "{\"domain\":\"$domain\",\"update\": {\"type\":\"TXT\",\"name\":\"$fullchallengedomain\",\"content\":\"$txtvalue\",\"ttl\":0}}" $apiendpoint "" POST "application/json")" + response="$(_post "{\"domain\":\"$domain\",\"update\": {\"type\":\"TXT\",\"name\":\"$fullchallengedomain\",\"content\":\"$txtvalue\",\"ttl\":0}}" $JAPIendpoint "" POST "application/json")" if ! printf "%s" "$response" | grep \"code\":0>/dev/null; then _err "There was an error updating the TXT record..." _err "DNS Exit API response: $response" @@ -63,7 +63,7 @@ dns_japi_add() { dns_japi_rm() { fulldomain=$1 txtvalue=$2 - apiendpoint="https://api.dnsexit.com/dns/" + JAPIendpoint="https://api.dnsexit.com/dns/" #_debug "Domain being used with custom script is: $domain" fullchallengedomain="${JAPI_domain:-$(_readaccountconf_mutable JAPI_domain)}" _debug "Full Challenge Domain is: $fullchallengedomain" @@ -88,7 +88,8 @@ dns_japi_rm() { _debug "Full Challenge domain: $fullchallengedomain" _debug txtvalue "$txtvalue" #_err "Not implemented!" - response="$(_post "{\"domain\":\"$domain\",\"delete\": {\"type\":\"TXT\",\"name\":\"$fullchallengedomain\",\"content\":\"$txtvalue\",\"ttl\":0}}" $apiendpoint "" POST "application/json")" + + response="$(_post "{\"domain\":\"$domain\",\"delete\": {\"type\":\"TXT\",\"name\":\"$fullchallengedomain\",\"content\":\"$txtvalue\",\"ttl\":0}}" $JAPIendpoint "" POST "application/json")" if ! printf "%s" "$response" | grep \"code\":0>/dev/null; then _err "There was an error deleting the TXT record..." _err "DNS Exit API response: $response" From e52230e54e718d504362c31c5c136328dcfc78af Mon Sep 17 00:00:00 2001 From: John B Date: Fri, 4 Feb 2022 00:29:36 -0800 Subject: [PATCH 04/10] change to pass shcheck --- dnsapi/dns_japi.sh | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/dnsapi/dns_japi.sh b/dnsapi/dns_japi.sh index f4371e94..6d47a795 100755 --- a/dnsapi/dns_japi.sh +++ b/dnsapi/dns_japi.sh @@ -3,7 +3,7 @@ #This is a working API script to add a TXT record to the DNS Exit-managed DNS service. # dns_myapi_add() #Which will be called by acme.sh to add the txt record to th DNS Exit DNS service as part -of the SSL certificate provisioning request. +#of the SSL certificate provisioning request. #returns 0 means success, otherwise error. # #Author: John Berlet @@ -24,6 +24,7 @@ dns_japi_add() { _debug "Full Challenge Domain is: $fullchallengedomain" JAPI_apikey="${JAPI_apikey:-$(_readaccountconf_mutable JAPI_apikey)}" #Set H1,H2 headers with DNS Exit API key + domainUpdate=$domain export _H1="Content-Type: application/json" export _H2="apikey: $JAPI_apikey" @@ -49,7 +50,7 @@ dns_japi_add() { _debug txtvalue "$txtvalue" #_err "Not implemented!" - response="$(_post "{\"domain\":\"$domain\",\"update\": {\"type\":\"TXT\",\"name\":\"$fullchallengedomain\",\"content\":\"$txtvalue\",\"ttl\":0}}" $JAPIendpoint "" POST "application/json")" + response="$(_post "{\"domain\":\"$domainUpdate\",\"update\": {\"type\":\"TXT\",\"name\":\"$fullchallengedomain\",\"content\":\"$txtvalue\",\"ttl\":0}}" $JAPIendpoint "" POST "application/json")" if ! printf "%s" "$response" | grep \"code\":0>/dev/null; then _err "There was an error updating the TXT record..." _err "DNS Exit API response: $response" @@ -71,7 +72,7 @@ dns_japi_rm() { #Set H1,H2 headers with DNS Exit API key export _H1="Content-Type: application/json" export _H2="apikey: $JAPI_apikey" - + domainUpdate=$domain _debug "Defined apikey $JAPI_apikey" if [ -z "$JAPI_apikey" ] || [ -z "$fullchallengedomain" ]; then JAPI_apikey="" @@ -89,7 +90,7 @@ dns_japi_rm() { _debug txtvalue "$txtvalue" #_err "Not implemented!" - response="$(_post "{\"domain\":\"$domain\",\"delete\": {\"type\":\"TXT\",\"name\":\"$fullchallengedomain\",\"content\":\"$txtvalue\",\"ttl\":0}}" $JAPIendpoint "" POST "application/json")" + response="$(_post "{\"domain\":\"$domainUpdate\",\"delete\": {\"type\":\"TXT\",\"name\":\"$fullchallengedomain\",\"content\":\"$txtvalue\",\"ttl\":0}}" $JAPIendpoint "" POST "application/json")" if ! printf "%s" "$response" | grep \"code\":0>/dev/null; then _err "There was an error deleting the TXT record..." _err "DNS Exit API response: $response" From 0cde1c54d44c10fdd74be8b23db1f3b29efbfbff Mon Sep 17 00:00:00 2001 From: John B Date: Fri, 4 Feb 2022 01:00:09 -0800 Subject: [PATCH 05/10] Fixed for shtest --- dnsapi/dns_japi.sh | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/dnsapi/dns_japi.sh b/dnsapi/dns_japi.sh index 6d47a795..9243b5a9 100755 --- a/dnsapi/dns_japi.sh +++ b/dnsapi/dns_japi.sh @@ -23,8 +23,9 @@ dns_japi_add() { fullchallengedomain="${JAPI_domain:-$(_readaccountconf_mutable JAPI_domain)}" _debug "Full Challenge Domain is: $fullchallengedomain" JAPI_apikey="${JAPI_apikey:-$(_readaccountconf_mutable JAPI_apikey)}" + "$_domain" + #Set H1,H2 headers with DNS Exit API key - domainUpdate=$domain export _H1="Content-Type: application/json" export _H2="apikey: $JAPI_apikey" @@ -50,7 +51,7 @@ dns_japi_add() { _debug txtvalue "$txtvalue" #_err "Not implemented!" - response="$(_post "{\"domain\":\"$domainUpdate\",\"update\": {\"type\":\"TXT\",\"name\":\"$fullchallengedomain\",\"content\":\"$txtvalue\",\"ttl\":0}}" $JAPIendpoint "" POST "application/json")" + response="$(_post "{\"domain\":\"$_domain\",\"update\": {\"type\":\"TXT\",\"name\":\"$fullchallengedomain\",\"content\":\"$txtvalue\",\"ttl\":0}}" $JAPIendpoint "" POST "application/json")" if ! printf "%s" "$response" | grep \"code\":0>/dev/null; then _err "There was an error updating the TXT record..." _err "DNS Exit API response: $response" @@ -72,7 +73,7 @@ dns_japi_rm() { #Set H1,H2 headers with DNS Exit API key export _H1="Content-Type: application/json" export _H2="apikey: $JAPI_apikey" - domainUpdate=$domain + #domainUpdate=$domain _debug "Defined apikey $JAPI_apikey" if [ -z "$JAPI_apikey" ] || [ -z "$fullchallengedomain" ]; then JAPI_apikey="" @@ -90,7 +91,7 @@ dns_japi_rm() { _debug txtvalue "$txtvalue" #_err "Not implemented!" - response="$(_post "{\"domain\":\"$domainUpdate\",\"delete\": {\"type\":\"TXT\",\"name\":\"$fullchallengedomain\",\"content\":\"$txtvalue\",\"ttl\":0}}" $JAPIendpoint "" POST "application/json")" + response="$(_post "{\"domain\":\"$_domain\",\"delete\": {\"type\":\"TXT\",\"name\":\"$fullchallengedomain\",\"content\":\"$txtvalue\",\"ttl\":0}}" $JAPIendpoint "" POST "application/json")" if ! printf "%s" "$response" | grep \"code\":0>/dev/null; then _err "There was an error deleting the TXT record..." _err "DNS Exit API response: $response" From 188713349a31df3c9222965c3baa1f2752c99dca Mon Sep 17 00:00:00 2001 From: John B Date: Fri, 4 Feb 2022 01:03:20 -0800 Subject: [PATCH 06/10] Fixed again - typo --- dnsapi/dns_japi.sh | 1 - 1 file changed, 1 deletion(-) diff --git a/dnsapi/dns_japi.sh b/dnsapi/dns_japi.sh index 9243b5a9..c8ec79e2 100755 --- a/dnsapi/dns_japi.sh +++ b/dnsapi/dns_japi.sh @@ -23,7 +23,6 @@ dns_japi_add() { fullchallengedomain="${JAPI_domain:-$(_readaccountconf_mutable JAPI_domain)}" _debug "Full Challenge Domain is: $fullchallengedomain" JAPI_apikey="${JAPI_apikey:-$(_readaccountconf_mutable JAPI_apikey)}" - "$_domain" #Set H1,H2 headers with DNS Exit API key export _H1="Content-Type: application/json" From 55b40cc9022723cfec4ebe5b69482824cf635143 Mon Sep 17 00:00:00 2001 From: John B Date: Fri, 4 Feb 2022 01:11:56 -0800 Subject: [PATCH 07/10] Shcheck fix again... --- dnsapi/dns_japi.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/dnsapi/dns_japi.sh b/dnsapi/dns_japi.sh index c8ec79e2..9243b5a9 100755 --- a/dnsapi/dns_japi.sh +++ b/dnsapi/dns_japi.sh @@ -23,6 +23,7 @@ dns_japi_add() { fullchallengedomain="${JAPI_domain:-$(_readaccountconf_mutable JAPI_domain)}" _debug "Full Challenge Domain is: $fullchallengedomain" JAPI_apikey="${JAPI_apikey:-$(_readaccountconf_mutable JAPI_apikey)}" + "$_domain" #Set H1,H2 headers with DNS Exit API key export _H1="Content-Type: application/json" From 0b3aaa177fa978f046fbe1b9de8462f1c1baff11 Mon Sep 17 00:00:00 2001 From: John B Date: Fri, 4 Feb 2022 01:44:28 -0800 Subject: [PATCH 08/10] Fix again for shcheck variable declaration/assignment --- dnsapi/dns_japi.sh | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/dnsapi/dns_japi.sh b/dnsapi/dns_japi.sh index 9243b5a9..3dbb598f 100755 --- a/dnsapi/dns_japi.sh +++ b/dnsapi/dns_japi.sh @@ -23,7 +23,7 @@ dns_japi_add() { fullchallengedomain="${JAPI_domain:-$(_readaccountconf_mutable JAPI_domain)}" _debug "Full Challenge Domain is: $fullchallengedomain" JAPI_apikey="${JAPI_apikey:-$(_readaccountconf_mutable JAPI_apikey)}" - "$_domain" + #$passedDomain=$_domain #Set H1,H2 headers with DNS Exit API key export _H1="Content-Type: application/json" @@ -49,9 +49,12 @@ dns_japi_add() { _debug "Passed domain to function: $fulldomain" _debug "Full Challenge domain: $fullchallengedomain" _debug txtvalue "$txtvalue" + _debug _domain_id "$_domain_id" + _debug _sub_domain "$_sub_domain" + _debug _domain "$_domain" #_err "Not implemented!" - response="$(_post "{\"domain\":\"$_domain\",\"update\": {\"type\":\"TXT\",\"name\":\"$fullchallengedomain\",\"content\":\"$txtvalue\",\"ttl\":0}}" $JAPIendpoint "" POST "application/json")" + response="$(_post "{\"domain\":\"${_domain}\",\"update\": {\"type\":\"TXT\",\"name\":\"$fullchallengedomain\",\"content\":\"$txtvalue\",\"ttl\":0}}" $JAPIendpoint "" POST "application/json")" if ! printf "%s" "$response" | grep \"code\":0>/dev/null; then _err "There was an error updating the TXT record..." _err "DNS Exit API response: $response" @@ -71,6 +74,7 @@ dns_japi_rm() { _debug "Full Challenge Domain is: $fullchallengedomain" JAPI_apikey="${JAPI_apikey:-$(_readaccountconf_mutable JAPI_apikey)}" #Set H1,H2 headers with DNS Exit API key + $passedDomain=$_domain export _H1="Content-Type: application/json" export _H2="apikey: $JAPI_apikey" #domainUpdate=$domain @@ -89,9 +93,12 @@ dns_japi_rm() { _debug "Passed domain to function: $fulldomain" _debug "Full Challenge domain: $fullchallengedomain" _debug txtvalue "$txtvalue" + _debug _domain_id "$_domain_id" + _debug _sub_domain "$_sub_domain" + _debug _domain "$_domain" #_err "Not implemented!" - response="$(_post "{\"domain\":\"$_domain\",\"delete\": {\"type\":\"TXT\",\"name\":\"$fullchallengedomain\",\"content\":\"$txtvalue\",\"ttl\":0}}" $JAPIendpoint "" POST "application/json")" + response="$(_post "{\"domain\":\"${_domain}\",\"delete\": {\"type\":\"TXT\",\"name\":\"$fullchallengedomain\",\"content\":\"$txtvalue\",\"ttl\":0}}" $JAPIendpoint "" POST "application/json")" if ! printf "%s" "$response" | grep \"code\":0>/dev/null; then _err "There was an error deleting the TXT record..." _err "DNS Exit API response: $response" From 570f621e2d82e0c2276df645ff0ae53f185f9f27 Mon Sep 17 00:00:00 2001 From: John B Date: Fri, 4 Feb 2022 01:50:40 -0800 Subject: [PATCH 09/10] Remove shcheck flagged variable checks - again --- dnsapi/dns_japi.sh | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/dnsapi/dns_japi.sh b/dnsapi/dns_japi.sh index 3dbb598f..6b74f076 100755 --- a/dnsapi/dns_japi.sh +++ b/dnsapi/dns_japi.sh @@ -49,9 +49,9 @@ dns_japi_add() { _debug "Passed domain to function: $fulldomain" _debug "Full Challenge domain: $fullchallengedomain" _debug txtvalue "$txtvalue" - _debug _domain_id "$_domain_id" - _debug _sub_domain "$_sub_domain" - _debug _domain "$_domain" + #_debug _domain_id "$_domain_id" + #_debug _sub_domain "$_sub_domain" + #_debug _domain "$_domain" #_err "Not implemented!" response="$(_post "{\"domain\":\"${_domain}\",\"update\": {\"type\":\"TXT\",\"name\":\"$fullchallengedomain\",\"content\":\"$txtvalue\",\"ttl\":0}}" $JAPIendpoint "" POST "application/json")" @@ -74,7 +74,6 @@ dns_japi_rm() { _debug "Full Challenge Domain is: $fullchallengedomain" JAPI_apikey="${JAPI_apikey:-$(_readaccountconf_mutable JAPI_apikey)}" #Set H1,H2 headers with DNS Exit API key - $passedDomain=$_domain export _H1="Content-Type: application/json" export _H2="apikey: $JAPI_apikey" #domainUpdate=$domain @@ -93,9 +92,9 @@ dns_japi_rm() { _debug "Passed domain to function: $fulldomain" _debug "Full Challenge domain: $fullchallengedomain" _debug txtvalue "$txtvalue" - _debug _domain_id "$_domain_id" - _debug _sub_domain "$_sub_domain" - _debug _domain "$_domain" + #_debug _domain_id "$_domain_id" + #_debug _sub_domain "$_sub_domain" + #_debug _domain "$_domain" #_err "Not implemented!" response="$(_post "{\"domain\":\"${_domain}\",\"delete\": {\"type\":\"TXT\",\"name\":\"$fullchallengedomain\",\"content\":\"$txtvalue\",\"ttl\":0}}" $JAPIendpoint "" POST "application/json")" From 0db69550bb08c272a61ec2495b8b10e456c58871 Mon Sep 17 00:00:00 2001 From: John B Date: Fri, 4 Feb 2022 01:59:05 -0800 Subject: [PATCH 10/10] Another shcheck work-around --- dnsapi/dns_japi.sh | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/dnsapi/dns_japi.sh b/dnsapi/dns_japi.sh index 6b74f076..50b788de 100755 --- a/dnsapi/dns_japi.sh +++ b/dnsapi/dns_japi.sh @@ -19,6 +19,7 @@ dns_japi_add() { fulldomain=$1 txtvalue=$2 JAPIendpoint="https://api.dnsexit.com/dns/" + JAPIdomain="${_domain}" #_debug "Domain being used with custom script is: $domain" fullchallengedomain="${JAPI_domain:-$(_readaccountconf_mutable JAPI_domain)}" _debug "Full Challenge Domain is: $fullchallengedomain" @@ -54,7 +55,7 @@ dns_japi_add() { #_debug _domain "$_domain" #_err "Not implemented!" - response="$(_post "{\"domain\":\"${_domain}\",\"update\": {\"type\":\"TXT\",\"name\":\"$fullchallengedomain\",\"content\":\"$txtvalue\",\"ttl\":0}}" $JAPIendpoint "" POST "application/json")" + response="$(_post "{\"domain\":\"$JAPIdomain\",\"update\": {\"type\":\"TXT\",\"name\":\"$fullchallengedomain\",\"content\":\"$txtvalue\",\"ttl\":0}}" $JAPIendpoint "" POST "application/json")" if ! printf "%s" "$response" | grep \"code\":0>/dev/null; then _err "There was an error updating the TXT record..." _err "DNS Exit API response: $response" @@ -69,6 +70,7 @@ dns_japi_rm() { fulldomain=$1 txtvalue=$2 JAPIendpoint="https://api.dnsexit.com/dns/" + JAPIdomain="${_domain}" #_debug "Domain being used with custom script is: $domain" fullchallengedomain="${JAPI_domain:-$(_readaccountconf_mutable JAPI_domain)}" _debug "Full Challenge Domain is: $fullchallengedomain" @@ -97,7 +99,7 @@ dns_japi_rm() { #_debug _domain "$_domain" #_err "Not implemented!" - response="$(_post "{\"domain\":\"${_domain}\",\"delete\": {\"type\":\"TXT\",\"name\":\"$fullchallengedomain\",\"content\":\"$txtvalue\",\"ttl\":0}}" $JAPIendpoint "" POST "application/json")" + response="$(_post "{\"domain\":\"$JAPIdomain\",\"delete\": {\"type\":\"TXT\",\"name\":\"$fullchallengedomain\",\"content\":\"$txtvalue\",\"ttl\":0}}" $JAPIendpoint "" POST "application/json")" if ! printf "%s" "$response" | grep \"code\":0>/dev/null; then _err "There was an error deleting the TXT record..." _err "DNS Exit API response: $response"