Browse Source

Merge pull request #2255 from mdbraber/update-acmeproxy

dns_acmeproxy: Username/password no longer required
pull/2268/head
neil 6 years ago
committed by GitHub
parent
commit
ccefd3be02
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 15
      dnsapi/dns_acmeproxy.sh

15
dnsapi/dns_acmeproxy.sh

@ -46,20 +46,16 @@ _acmeproxy_request() {
return 1 return 1
fi fi
## Check for the credentials
if [ -z "$ACMEPROXY_USERNAME" ] || [ -z "$ACMEPROXY_PASSWORD" ]; then
ACMEPROXY_USERNAME=""
ACMEPROXY_PASSWORD=""
_err "You didn't set username and password"
_err "Please set them via 'export ACMEPROXY_USERNAME=...' and 'export ACMEPROXY_PASSWORD=...' and try again."
return 1
fi
## Save the credentials to the account file ## Save the credentials to the account file
_saveaccountconf_mutable ACMEPROXY_ENDPOINT "$ACMEPROXY_ENDPOINT" _saveaccountconf_mutable ACMEPROXY_ENDPOINT "$ACMEPROXY_ENDPOINT"
_saveaccountconf_mutable ACMEPROXY_USERNAME "$ACMEPROXY_USERNAME" _saveaccountconf_mutable ACMEPROXY_USERNAME "$ACMEPROXY_USERNAME"
_saveaccountconf_mutable ACMEPROXY_PASSWORD "$ACMEPROXY_PASSWORD" _saveaccountconf_mutable ACMEPROXY_PASSWORD "$ACMEPROXY_PASSWORD"
if [ -z "$ACMEPROXY_USERNAME" ] || [ -z "$ACMEPROXY_PASSWORD" ]; then
_info "ACMEPROXY_USERNAME and/or ACMEPROXY_PASSWORD not set - using without client authentication! Make sure you're using server authentication (e.g. IP-based)"
export _H1="Accept: application/json"
export _H2="Content-Type: application/json"
else
## Base64 encode the credentials ## Base64 encode the credentials
credentials=$(printf "%b" "$ACMEPROXY_USERNAME:$ACMEPROXY_PASSWORD" | _base64) credentials=$(printf "%b" "$ACMEPROXY_USERNAME:$ACMEPROXY_PASSWORD" | _base64)
@ -67,6 +63,7 @@ _acmeproxy_request() {
export _H1="Authorization: Basic $credentials" export _H1="Authorization: Basic $credentials"
export _H2="Accept: application/json" export _H2="Accept: application/json"
export _H3="Content-Type: application/json" export _H3="Content-Type: application/json"
fi
## Add the challenge record to the acmeproxy grid member ## Add the challenge record to the acmeproxy grid member
response="$(_post "{\"fqdn\": \"$fulldomain.\", \"value\": \"$txtvalue\"}" "$ACMEPROXY_ENDPOINT/$action" "" "POST")" response="$(_post "{\"fqdn\": \"$fulldomain.\", \"value\": \"$txtvalue\"}" "$ACMEPROXY_ENDPOINT/$action" "" "POST")"

Loading…
Cancel
Save