committed by
GitHub
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 261 additions and 7 deletions
-
4.github/workflows/DNS.yml
-
4.github/workflows/Solaris.yml
-
2acme.sh
-
139dnsapi/dns_efficientip.sh
-
10dnsapi/dns_gandi_livedns.sh
-
109dnsapi/dns_mgwm.sh
@ -0,0 +1,139 @@ |
|||
#!/usr/bin/env sh |
|||
# shellcheck disable=SC2034 |
|||
dns_efficientip_info='efficientip.com |
|||
Site: https://efficientip.com/ |
|||
Docs: github.com/acmesh-official/acme.sh/wiki/dnsapi2#dns_efficientip |
|||
Options: |
|||
EfficientIP_Creds HTTP Basic Authentication credentials. E.g. "username:password" |
|||
EfficientIP_Server EfficientIP SOLIDserver Management IP address or FQDN. |
|||
EfficientIP_DNS_Name Name of the DNS smart or server hosting the zone. Optional. |
|||
EfficientIP_View Name of the DNS view hosting the zone. Optional. |
|||
OptionsAlt: |
|||
EfficientIP_Token_Key Alternative API token key, prefered over basic authentication. |
|||
EfficientIP_Token_Secret Alternative API token secret, required when using a token key. |
|||
EfficientIP_Server EfficientIP SOLIDserver Management IP address or FQDN. |
|||
EfficientIP_DNS_Name Name of the DNS smart or server hosting the zone. Optional. |
|||
EfficientIP_View Name of the DNS view hosting the zone. Optional. |
|||
Issues: github.com/acmesh-official/acme.sh/issues/6325 |
|||
Author: EfficientIP-Labs <contact@efficientip.com> |
|||
' |
|||
|
|||
dns_efficientip_add() { |
|||
fulldomain=$1 |
|||
txtvalue=$2 |
|||
|
|||
_info "Using EfficientIP API" |
|||
_debug fulldomain "$fulldomain" |
|||
_debug txtvalue "$txtvalue" |
|||
|
|||
if { [ -z "${EfficientIP_Creds}" ] && { [ -z "${EfficientIP_Token_Key}" ] || [ -z "${EfficientIP_Token_Secret}" ]; }; } || [ -z "${EfficientIP_Server}" ]; then |
|||
EfficientIP_Creds="" |
|||
EfficientIP_Token_Key="" |
|||
EfficientIP_Token_Secret="" |
|||
EfficientIP_Server="" |
|||
_err "You didn't specify any EfficientIP credentials or token or server (EfficientIP_Creds; EfficientIP_Token_Key; EfficientIP_Token_Secret; EfficientIP_Server)." |
|||
_err "Please set them via EXPORT EfficientIP_Creds=username:password or EXPORT EfficientIP_server=ip/hostname" |
|||
_err "or if you want to use Token instead EXPORT EfficientIP_Token_Key=yourkey" |
|||
_err "and EXPORT EfficientIP_Token_Secret=yoursecret" |
|||
_err "then try again." |
|||
return 1 |
|||
fi |
|||
|
|||
if [ -z "${EfficientIP_DNS_Name}" ]; then |
|||
EfficientIP_DNS_Name="" |
|||
fi |
|||
|
|||
EfficientIP_DNSNameEncoded=$(printf "%b" "${EfficientIP_DNS_Name}" | _url_encode) |
|||
|
|||
if [ -z "${EfficientIP_View}" ]; then |
|||
EfficientIP_View="" |
|||
fi |
|||
|
|||
EfficientIP_ViewEncoded=$(printf "%b" "${EfficientIP_View}" | _url_encode) |
|||
|
|||
_saveaccountconf EfficientIP_Creds "${EfficientIP_Creds}" |
|||
_saveaccountconf EfficientIP_Token_Key "${EfficientIP_Token_Key}" |
|||
_saveaccountconf EfficientIP_Token_Secret "${EfficientIP_Token_Secret}" |
|||
_saveaccountconf EfficientIP_Server "${EfficientIP_Server}" |
|||
_saveaccountconf EfficientIP_DNS_Name "${EfficientIP_DNS_Name}" |
|||
_saveaccountconf EfficientIP_View "${EfficientIP_View}" |
|||
|
|||
export _H1="Accept-Language:en-US" |
|||
baseurlnObject="https://${EfficientIP_Server}/rest/dns_rr_add?rr_type=TXT&rr_ttl=300&rr_name=${fulldomain}&rr_value1=${txtvalue}" |
|||
|
|||
if [ "${EfficientIP_DNSNameEncoded}" != "" ]; then |
|||
baseurlnObject="${baseurlnObject}&dns_name=${EfficientIP_DNSNameEncoded}" |
|||
fi |
|||
|
|||
if [ "${EfficientIP_ViewEncoded}" != "" ]; then |
|||
baseurlnObject="${baseurlnObject}&dnsview_name=${EfficientIP_ViewEncoded}" |
|||
fi |
|||
|
|||
if [ -z "${EfficientIP_Token_Secret}" ] || [ -z "${EfficientIP_Token_Key}" ]; then |
|||
EfficientIP_CredsEncoded=$(printf "%b" "${EfficientIP_Creds}" | _base64) |
|||
export _H2="Authorization: Basic ${EfficientIP_CredsEncoded}" |
|||
else |
|||
TS=$(date +%s) |
|||
Sig=$(printf "%b\n$TS\nPOST\n$baseurlnObject" "${EfficientIP_Token_Secret}" | _digest sha3-256 hex) |
|||
EfficientIP_CredsEncoded=$(printf "%b:%b" "${EfficientIP_Token_Key}" "$Sig") |
|||
export _H2="Authorization: SDS ${EfficientIP_CredsEncoded}" |
|||
export _H3="X-SDS-TS: ${TS}" |
|||
fi |
|||
|
|||
result="$(_post "" "${baseurlnObject}" "" "POST")" |
|||
|
|||
if [ "$(echo "${result}" | _egrep_o "ret_oid")" ]; then |
|||
_info "DNS record successfully created" |
|||
return 0 |
|||
else |
|||
_err "Error creating DNS record" |
|||
_err "${result}" |
|||
return 1 |
|||
fi |
|||
} |
|||
|
|||
dns_efficientip_rm() { |
|||
fulldomain=$1 |
|||
txtvalue=$2 |
|||
|
|||
_info "Using EfficientIP API" |
|||
_debug fulldomain "${fulldomain}" |
|||
_debug txtvalue "${txtvalue}" |
|||
|
|||
EfficientIP_ViewEncoded=$(printf "%b" "${EfficientIP_View}" | _url_encode) |
|||
EfficientIP_DNSNameEncoded=$(printf "%b" "${EfficientIP_DNS_Name}" | _url_encode) |
|||
EfficientIP_CredsEncoded=$(printf "%b" "${EfficientIP_Creds}" | _base64) |
|||
|
|||
export _H1="Accept-Language:en-US" |
|||
|
|||
baseurlnObject="https://${EfficientIP_Server}/rest/dns_rr_delete?rr_type=TXT&rr_name=$fulldomain&rr_value1=$txtvalue" |
|||
if [ "${EfficientIP_DNSNameEncoded}" != "" ]; then |
|||
baseurlnObject="${baseurlnObject}&dns_name=${EfficientIP_DNSNameEncoded}" |
|||
fi |
|||
|
|||
if [ "${EfficientIP_ViewEncoded}" != "" ]; then |
|||
baseurlnObject="${baseurlnObject}&dnsview_name=${EfficientIP_ViewEncoded}" |
|||
fi |
|||
|
|||
if [ -z "$EfficientIP_Token_Secret" ] || [ -z "$EfficientIP_Token_Key" ]; then |
|||
EfficientIP_CredsEncoded=$(printf "%b" "${EfficientIP_Creds}" | _base64) |
|||
export _H2="Authorization: Basic $EfficientIP_CredsEncoded" |
|||
else |
|||
TS=$(date +%s) |
|||
Sig=$(printf "%b\n$TS\nDELETE\n${baseurlnObject}" "${EfficientIP_Token_Secret}" | _digest sha3-256 hex) |
|||
EfficientIP_CredsEncoded=$(printf "%b:%b" "${EfficientIP_Token_Key}" "$Sig") |
|||
export _H2="Authorization: SDS ${EfficientIP_CredsEncoded}" |
|||
export _H3="X-SDS-TS: $TS" |
|||
fi |
|||
|
|||
result="$(_post "" "${baseurlnObject}" "" "DELETE")" |
|||
|
|||
if [ "$(echo "${result}" | _egrep_o "ret_oid")" ]; then |
|||
_info "DNS Record successfully deleted" |
|||
return 0 |
|||
else |
|||
_err "Error deleting DNS record" |
|||
_err "${result}" |
|||
return 1 |
|||
fi |
|||
} |
|||
@ -0,0 +1,109 @@ |
|||
#!/usr/bin/env sh |
|||
# shellcheck disable=SC2034 |
|||
dns_mgwm_info='mgw-media.de |
|||
Site: mgw-media.de |
|||
Docs: github.com/acmesh-official/acme.sh/wiki/dnsapi2#dns_mgwm |
|||
Options: |
|||
MGWM_CUSTOMER Your customer number |
|||
MGWM_API_HASH Your API Hash |
|||
Issues: github.com/acmesh-official/acme.sh/issues/6669 |
|||
' |
|||
# Base URL for the mgw-media.de API |
|||
MGWM_API_BASE="https://api.mgw-media.de/record" |
|||
|
|||
######## Public functions ##################### |
|||
|
|||
# This function is called by acme.sh to add a TXT record. |
|||
dns_mgwm_add() { |
|||
fulldomain=$1 |
|||
txtvalue=$2 |
|||
_info "Using mgw-media.de DNS API for domain $fulldomain (add record)" |
|||
_debug "fulldomain: $fulldomain" |
|||
_debug "txtvalue: $txtvalue" |
|||
|
|||
# Call the new private function to handle the API request. |
|||
# The 'add' action, fulldomain, type 'txt' and txtvalue are passed. |
|||
if _mgwm_request "add" "$fulldomain" "txt" "$txtvalue"; then |
|||
_info "TXT record for $fulldomain successfully added via mgw-media.de API." |
|||
_sleep 10 # Wait briefly for DNS propagation, a common practice in DNS-01 hooks. |
|||
return 0 |
|||
else |
|||
# Error message already logged by _mgwm_request, but a specific one here helps. |
|||
_err "mgwm_add: Failed to add TXT record for $fulldomain." |
|||
return 1 |
|||
fi |
|||
} |
|||
# This function is called by acme.sh to remove a TXT record after validation. |
|||
dns_mgwm_rm() { |
|||
fulldomain=$1 |
|||
txtvalue=$2 # This txtvalue is now used to identify the specific record to be removed. |
|||
_info "Removing TXT record for $fulldomain using mgw-media.de DNS API (remove record)" |
|||
_debug "fulldomain: $fulldomain" |
|||
_debug "txtvalue: $txtvalue" |
|||
|
|||
# Call the new private function to handle the API request. |
|||
# The 'rm' action, fulldomain, type 'txt' and txtvalue are passed. |
|||
if _mgwm_request "rm" "$fulldomain" "txt" "$txtvalue"; then |
|||
_info "TXT record for $fulldomain successfully removed via mgw-media.de API." |
|||
return 0 |
|||
else |
|||
# Error message already logged by _mgwm_request, but a specific one here helps. |
|||
_err "mgwm_rm: Failed to remove TXT record for $fulldomain." |
|||
return 1 |
|||
fi |
|||
} |
|||
#################### Private functions below ################################## |
|||
|
|||
# _mgwm_request() encapsulates the API call logic, including |
|||
# loading credentials, setting the Authorization header, and executing the request. |
|||
# Arguments: |
|||
# $1: action (e.g., "add", "rm") |
|||
# $2: fulldomain |
|||
# $3: type (e.g., "txt") |
|||
# $4: content (the txtvalue) |
|||
_mgwm_request() { |
|||
_action="$1" |
|||
_fulldomain="$2" |
|||
_type="$3" |
|||
_content="$4" |
|||
|
|||
_debug "Calling _mgwm_request for action: $_action, domain: $_fulldomain, type: $_type, content: $_content" |
|||
|
|||
# Load credentials from environment or acme.sh config |
|||
MGWM_CUSTOMER="${MGWM_CUSTOMER:-$(_readaccountconf_mutable MGWM_CUSTOMER)}" |
|||
MGWM_API_HASH="${MGWM_API_HASH:-$(_readaccountconf_mutable MGWM_API_HASH)}" |
|||
|
|||
# Check if credentials are set |
|||
if [ -z "$MGWM_CUSTOMER" ] || [ -z "$MGWM_API_HASH" ]; then |
|||
_err "You didn't specify one or more of MGWM_CUSTOMER or MGWM_API_HASH." |
|||
_err "Please check these environment variables and try again." |
|||
return 1 |
|||
fi |
|||
|
|||
# Save credentials for automatic renewal and future calls |
|||
_saveaccountconf_mutable MGWM_CUSTOMER "$MGWM_CUSTOMER" |
|||
_saveaccountconf_mutable MGWM_API_HASH "$MGWM_API_HASH" |
|||
|
|||
# Create the Basic Auth Header. acme.sh's _base64 function is used for encoding. |
|||
_credentials="$(printf "%s:%s" "$MGWM_CUSTOMER" "$MGWM_API_HASH" | _base64)" |
|||
export _H1="Authorization: Basic $_credentials" |
|||
_debug "Set Authorization Header: Basic <credentials_encoded>" # Log debug message without sensitive credentials |
|||
|
|||
# Construct the API URL based on the action and provided parameters. |
|||
_request_url="${MGWM_API_BASE}/${_action}/${_fulldomain}/${_type}/${_content}" |
|||
_debug "Constructed mgw-media.de API URL for action '$_action': ${_request_url}" |
|||
|
|||
# Execute the HTTP GET request with the Authorization Header. |
|||
# The 5th parameter of _get is where acme.sh expects custom HTTP headers like Authorization. |
|||
response="$(_get "$_request_url")" |
|||
_debug "mgw-media.de API response for action '$_action': $response" |
|||
|
|||
# Check the API response for success. The API returns "OK" on success. |
|||
if [ "$response" = "OK" ]; then |
|||
_info "mgw-media.de API action '$_action' for record '$_fulldomain' successful." |
|||
return 0 |
|||
else |
|||
_err "Failed mgw-media.de API action '$_action' for record '$_fulldomain'. Unexpected API Response: '$response'" |
|||
return 1 |
|||
fi |
|||
} |
|||
Write
Preview
Loading…
Cancel
Save
Reference in new issue