Skip to content

Commit 1a2071a

Browse files
authored
Merge branch 'acmesh-official:dev' into dev
2 parents e5dea48 + 0c9d2da commit 1a2071a

File tree

6 files changed

+261
-7
lines changed

6 files changed

+261
-7
lines changed

.github/workflows/DNS.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -441,7 +441,9 @@ jobs:
441441
with:
442442
envs: 'TEST_DNS TestingDomain TEST_DNS_NO_WILDCARD TEST_DNS_NO_SUBDOMAIN TEST_DNS_SLEEP CASE TEST_LOCAL DEBUG http_proxy https_proxy HTTPS_INSECURE TokenName1 TokenName2 TokenName3 TokenName4 TokenName5 ${{ secrets.TokenName1}} ${{ secrets.TokenName2}} ${{ secrets.TokenName3}} ${{ secrets.TokenName4}} ${{ secrets.TokenName5}}'
443443
copyback: false
444-
prepare: pkgutil -y -i socat
444+
prepare: |
445+
pkgutil -U
446+
pkgutil -y -i socat
445447
run: |
446448
pkg set-mediator -v -I [email protected] openssl
447449
export PATH=/usr/gnu/bin:$PATH

.github/workflows/Solaris.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,9 @@ jobs:
6666
envs: 'TEST_LOCAL TestingDomain TEST_ACME_Server CA_ECDSA CA CA_EMAIL TEST_PREFERRED_CHAIN ACME_USE_WGET'
6767
nat: |
6868
"8080": "80"
69-
prepare: pkgutil -y -i socat curl wget
69+
prepare: |
70+
pkgutil -U
71+
pkgutil -y -i socat curl wget
7072
copyback: false
7173
run: |
7274
cd ../acmetest \

acme.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1031,7 +1031,7 @@ _digest() {
10311031

10321032
outputhex="$2"
10331033

1034-
if [ "$alg" = "sha256" ] || [ "$alg" = "sha1" ] || [ "$alg" = "md5" ]; then
1034+
if [ "$alg" = "sha3-256" ] || [ "$alg" = "sha256" ] || [ "$alg" = "sha1" ] || [ "$alg" = "md5" ]; then
10351035
if [ "$outputhex" ]; then
10361036
${ACME_OPENSSL_BIN:-openssl} dgst -"$alg" -hex | cut -d = -f 2 | tr -d ' '
10371037
else

dnsapi/dns_efficientip.sh

Lines changed: 139 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,139 @@
1+
#!/usr/bin/env sh
2+
# shellcheck disable=SC2034
3+
dns_efficientip_info='efficientip.com
4+
Site: https://efficientip.com/
5+
Docs: github.com/acmesh-official/acme.sh/wiki/dnsapi2#dns_efficientip
6+
Options:
7+
EfficientIP_Creds HTTP Basic Authentication credentials. E.g. "username:password"
8+
EfficientIP_Server EfficientIP SOLIDserver Management IP address or FQDN.
9+
EfficientIP_DNS_Name Name of the DNS smart or server hosting the zone. Optional.
10+
EfficientIP_View Name of the DNS view hosting the zone. Optional.
11+
OptionsAlt:
12+
EfficientIP_Token_Key Alternative API token key, prefered over basic authentication.
13+
EfficientIP_Token_Secret Alternative API token secret, required when using a token key.
14+
EfficientIP_Server EfficientIP SOLIDserver Management IP address or FQDN.
15+
EfficientIP_DNS_Name Name of the DNS smart or server hosting the zone. Optional.
16+
EfficientIP_View Name of the DNS view hosting the zone. Optional.
17+
Issues: github.com/acmesh-official/acme.sh/issues/6325
18+
Author: EfficientIP-Labs <[email protected]>
19+
'
20+
21+
dns_efficientip_add() {
22+
fulldomain=$1
23+
txtvalue=$2
24+
25+
_info "Using EfficientIP API"
26+
_debug fulldomain "$fulldomain"
27+
_debug txtvalue "$txtvalue"
28+
29+
if { [ -z "${EfficientIP_Creds}" ] && { [ -z "${EfficientIP_Token_Key}" ] || [ -z "${EfficientIP_Token_Secret}" ]; }; } || [ -z "${EfficientIP_Server}" ]; then
30+
EfficientIP_Creds=""
31+
EfficientIP_Token_Key=""
32+
EfficientIP_Token_Secret=""
33+
EfficientIP_Server=""
34+
_err "You didn't specify any EfficientIP credentials or token or server (EfficientIP_Creds; EfficientIP_Token_Key; EfficientIP_Token_Secret; EfficientIP_Server)."
35+
_err "Please set them via EXPORT EfficientIP_Creds=username:password or EXPORT EfficientIP_server=ip/hostname"
36+
_err "or if you want to use Token instead EXPORT EfficientIP_Token_Key=yourkey"
37+
_err "and EXPORT EfficientIP_Token_Secret=yoursecret"
38+
_err "then try again."
39+
return 1
40+
fi
41+
42+
if [ -z "${EfficientIP_DNS_Name}" ]; then
43+
EfficientIP_DNS_Name=""
44+
fi
45+
46+
EfficientIP_DNSNameEncoded=$(printf "%b" "${EfficientIP_DNS_Name}" | _url_encode)
47+
48+
if [ -z "${EfficientIP_View}" ]; then
49+
EfficientIP_View=""
50+
fi
51+
52+
EfficientIP_ViewEncoded=$(printf "%b" "${EfficientIP_View}" | _url_encode)
53+
54+
_saveaccountconf EfficientIP_Creds "${EfficientIP_Creds}"
55+
_saveaccountconf EfficientIP_Token_Key "${EfficientIP_Token_Key}"
56+
_saveaccountconf EfficientIP_Token_Secret "${EfficientIP_Token_Secret}"
57+
_saveaccountconf EfficientIP_Server "${EfficientIP_Server}"
58+
_saveaccountconf EfficientIP_DNS_Name "${EfficientIP_DNS_Name}"
59+
_saveaccountconf EfficientIP_View "${EfficientIP_View}"
60+
61+
export _H1="Accept-Language:en-US"
62+
baseurlnObject="https://${EfficientIP_Server}/rest/dns_rr_add?rr_type=TXT&rr_ttl=300&rr_name=${fulldomain}&rr_value1=${txtvalue}"
63+
64+
if [ "${EfficientIP_DNSNameEncoded}" != "" ]; then
65+
baseurlnObject="${baseurlnObject}&dns_name=${EfficientIP_DNSNameEncoded}"
66+
fi
67+
68+
if [ "${EfficientIP_ViewEncoded}" != "" ]; then
69+
baseurlnObject="${baseurlnObject}&dnsview_name=${EfficientIP_ViewEncoded}"
70+
fi
71+
72+
if [ -z "${EfficientIP_Token_Secret}" ] || [ -z "${EfficientIP_Token_Key}" ]; then
73+
EfficientIP_CredsEncoded=$(printf "%b" "${EfficientIP_Creds}" | _base64)
74+
export _H2="Authorization: Basic ${EfficientIP_CredsEncoded}"
75+
else
76+
TS=$(date +%s)
77+
Sig=$(printf "%b\n$TS\nPOST\n$baseurlnObject" "${EfficientIP_Token_Secret}" | _digest sha3-256 hex)
78+
EfficientIP_CredsEncoded=$(printf "%b:%b" "${EfficientIP_Token_Key}" "$Sig")
79+
export _H2="Authorization: SDS ${EfficientIP_CredsEncoded}"
80+
export _H3="X-SDS-TS: ${TS}"
81+
fi
82+
83+
result="$(_post "" "${baseurlnObject}" "" "POST")"
84+
85+
if [ "$(echo "${result}" | _egrep_o "ret_oid")" ]; then
86+
_info "DNS record successfully created"
87+
return 0
88+
else
89+
_err "Error creating DNS record"
90+
_err "${result}"
91+
return 1
92+
fi
93+
}
94+
95+
dns_efficientip_rm() {
96+
fulldomain=$1
97+
txtvalue=$2
98+
99+
_info "Using EfficientIP API"
100+
_debug fulldomain "${fulldomain}"
101+
_debug txtvalue "${txtvalue}"
102+
103+
EfficientIP_ViewEncoded=$(printf "%b" "${EfficientIP_View}" | _url_encode)
104+
EfficientIP_DNSNameEncoded=$(printf "%b" "${EfficientIP_DNS_Name}" | _url_encode)
105+
EfficientIP_CredsEncoded=$(printf "%b" "${EfficientIP_Creds}" | _base64)
106+
107+
export _H1="Accept-Language:en-US"
108+
109+
baseurlnObject="https://${EfficientIP_Server}/rest/dns_rr_delete?rr_type=TXT&rr_name=$fulldomain&rr_value1=$txtvalue"
110+
if [ "${EfficientIP_DNSNameEncoded}" != "" ]; then
111+
baseurlnObject="${baseurlnObject}&dns_name=${EfficientIP_DNSNameEncoded}"
112+
fi
113+
114+
if [ "${EfficientIP_ViewEncoded}" != "" ]; then
115+
baseurlnObject="${baseurlnObject}&dnsview_name=${EfficientIP_ViewEncoded}"
116+
fi
117+
118+
if [ -z "$EfficientIP_Token_Secret" ] || [ -z "$EfficientIP_Token_Key" ]; then
119+
EfficientIP_CredsEncoded=$(printf "%b" "${EfficientIP_Creds}" | _base64)
120+
export _H2="Authorization: Basic $EfficientIP_CredsEncoded"
121+
else
122+
TS=$(date +%s)
123+
Sig=$(printf "%b\n$TS\nDELETE\n${baseurlnObject}" "${EfficientIP_Token_Secret}" | _digest sha3-256 hex)
124+
EfficientIP_CredsEncoded=$(printf "%b:%b" "${EfficientIP_Token_Key}" "$Sig")
125+
export _H2="Authorization: SDS ${EfficientIP_CredsEncoded}"
126+
export _H3="X-SDS-TS: $TS"
127+
fi
128+
129+
result="$(_post "" "${baseurlnObject}" "" "DELETE")"
130+
131+
if [ "$(echo "${result}" | _egrep_o "ret_oid")" ]; then
132+
_info "DNS Record successfully deleted"
133+
return 0
134+
else
135+
_err "Error deleting DNS record"
136+
_err "${result}"
137+
return 1
138+
fi
139+
}

dnsapi/dns_gandi_livedns.sh

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ dns_gandi_livedns_add() {
2323
fulldomain=$1
2424
txtvalue=$2
2525

26+
GANDI_LIVEDNS_KEY="${GANDI_LIVEDNS_KEY:-$(_readaccountconf_mutable GANDI_LIVEDNS_KEY)}"
27+
GANDI_LIVEDNS_TOKEN="${GANDI_LIVEDNS_TOKEN:-$(_readaccountconf_mutable GANDI_LIVEDNS_TOKEN)}"
2628
if [ -z "$GANDI_LIVEDNS_KEY" ] && [ -z "$GANDI_LIVEDNS_TOKEN" ]; then
2729
_err "No Token or API key (deprecated) specified for Gandi LiveDNS."
2830
_err "Create your token or key and export it as GANDI_LIVEDNS_KEY or GANDI_LIVEDNS_TOKEN respectively"
@@ -31,11 +33,11 @@ dns_gandi_livedns_add() {
3133

3234
# Keep only one secret in configuration
3335
if [ -n "$GANDI_LIVEDNS_TOKEN" ]; then
34-
_saveaccountconf GANDI_LIVEDNS_TOKEN "$GANDI_LIVEDNS_TOKEN"
35-
_clearaccountconf GANDI_LIVEDNS_KEY
36+
_saveaccountconf_mutable GANDI_LIVEDNS_TOKEN "$GANDI_LIVEDNS_TOKEN"
37+
_clearaccountconf_mutable GANDI_LIVEDNS_KEY
3638
elif [ -n "$GANDI_LIVEDNS_KEY" ]; then
37-
_saveaccountconf GANDI_LIVEDNS_KEY "$GANDI_LIVEDNS_KEY"
38-
_clearaccountconf GANDI_LIVEDNS_TOKEN
39+
_saveaccountconf_mutable GANDI_LIVEDNS_KEY "$GANDI_LIVEDNS_KEY"
40+
_clearaccountconf_mutable GANDI_LIVEDNS_TOKEN
3941
fi
4042

4143
_debug "First detect the root zone"

dnsapi/dns_mgwm.sh

Lines changed: 109 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,109 @@
1+
#!/usr/bin/env sh
2+
# shellcheck disable=SC2034
3+
dns_mgwm_info='mgw-media.de
4+
Site: mgw-media.de
5+
Docs: github.com/acmesh-official/acme.sh/wiki/dnsapi2#dns_mgwm
6+
Options:
7+
MGWM_CUSTOMER Your customer number
8+
MGWM_API_HASH Your API Hash
9+
Issues: github.com/acmesh-official/acme.sh/issues/6669
10+
'
11+
# Base URL for the mgw-media.de API
12+
MGWM_API_BASE="https://api.mgw-media.de/record"
13+
14+
######## Public functions #####################
15+
16+
# This function is called by acme.sh to add a TXT record.
17+
dns_mgwm_add() {
18+
fulldomain=$1
19+
txtvalue=$2
20+
_info "Using mgw-media.de DNS API for domain $fulldomain (add record)"
21+
_debug "fulldomain: $fulldomain"
22+
_debug "txtvalue: $txtvalue"
23+
24+
# Call the new private function to handle the API request.
25+
# The 'add' action, fulldomain, type 'txt' and txtvalue are passed.
26+
if _mgwm_request "add" "$fulldomain" "txt" "$txtvalue"; then
27+
_info "TXT record for $fulldomain successfully added via mgw-media.de API."
28+
_sleep 10 # Wait briefly for DNS propagation, a common practice in DNS-01 hooks.
29+
return 0
30+
else
31+
# Error message already logged by _mgwm_request, but a specific one here helps.
32+
_err "mgwm_add: Failed to add TXT record for $fulldomain."
33+
return 1
34+
fi
35+
}
36+
# This function is called by acme.sh to remove a TXT record after validation.
37+
dns_mgwm_rm() {
38+
fulldomain=$1
39+
txtvalue=$2 # This txtvalue is now used to identify the specific record to be removed.
40+
_info "Removing TXT record for $fulldomain using mgw-media.de DNS API (remove record)"
41+
_debug "fulldomain: $fulldomain"
42+
_debug "txtvalue: $txtvalue"
43+
44+
# Call the new private function to handle the API request.
45+
# The 'rm' action, fulldomain, type 'txt' and txtvalue are passed.
46+
if _mgwm_request "rm" "$fulldomain" "txt" "$txtvalue"; then
47+
_info "TXT record for $fulldomain successfully removed via mgw-media.de API."
48+
return 0
49+
else
50+
# Error message already logged by _mgwm_request, but a specific one here helps.
51+
_err "mgwm_rm: Failed to remove TXT record for $fulldomain."
52+
return 1
53+
fi
54+
}
55+
#################### Private functions below ##################################
56+
57+
# _mgwm_request() encapsulates the API call logic, including
58+
# loading credentials, setting the Authorization header, and executing the request.
59+
# Arguments:
60+
# $1: action (e.g., "add", "rm")
61+
# $2: fulldomain
62+
# $3: type (e.g., "txt")
63+
# $4: content (the txtvalue)
64+
_mgwm_request() {
65+
_action="$1"
66+
_fulldomain="$2"
67+
_type="$3"
68+
_content="$4"
69+
70+
_debug "Calling _mgwm_request for action: $_action, domain: $_fulldomain, type: $_type, content: $_content"
71+
72+
# Load credentials from environment or acme.sh config
73+
MGWM_CUSTOMER="${MGWM_CUSTOMER:-$(_readaccountconf_mutable MGWM_CUSTOMER)}"
74+
MGWM_API_HASH="${MGWM_API_HASH:-$(_readaccountconf_mutable MGWM_API_HASH)}"
75+
76+
# Check if credentials are set
77+
if [ -z "$MGWM_CUSTOMER" ] || [ -z "$MGWM_API_HASH" ]; then
78+
_err "You didn't specify one or more of MGWM_CUSTOMER or MGWM_API_HASH."
79+
_err "Please check these environment variables and try again."
80+
return 1
81+
fi
82+
83+
# Save credentials for automatic renewal and future calls
84+
_saveaccountconf_mutable MGWM_CUSTOMER "$MGWM_CUSTOMER"
85+
_saveaccountconf_mutable MGWM_API_HASH "$MGWM_API_HASH"
86+
87+
# Create the Basic Auth Header. acme.sh's _base64 function is used for encoding.
88+
_credentials="$(printf "%s:%s" "$MGWM_CUSTOMER" "$MGWM_API_HASH" | _base64)"
89+
export _H1="Authorization: Basic $_credentials"
90+
_debug "Set Authorization Header: Basic <credentials_encoded>" # Log debug message without sensitive credentials
91+
92+
# Construct the API URL based on the action and provided parameters.
93+
_request_url="${MGWM_API_BASE}/${_action}/${_fulldomain}/${_type}/${_content}"
94+
_debug "Constructed mgw-media.de API URL for action '$_action': ${_request_url}"
95+
96+
# Execute the HTTP GET request with the Authorization Header.
97+
# The 5th parameter of _get is where acme.sh expects custom HTTP headers like Authorization.
98+
response="$(_get "$_request_url")"
99+
_debug "mgw-media.de API response for action '$_action': $response"
100+
101+
# Check the API response for success. The API returns "OK" on success.
102+
if [ "$response" = "OK" ]; then
103+
_info "mgw-media.de API action '$_action' for record '$_fulldomain' successful."
104+
return 0
105+
else
106+
_err "Failed mgw-media.de API action '$_action' for record '$_fulldomain'. Unexpected API Response: '$response'"
107+
return 1
108+
fi
109+
}

0 commit comments

Comments
 (0)