Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions config.default.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,14 @@
# global_api_key="YOUR_GLOBAL_KEY"
# zones="YOUR_ZONES"
# email="admin@example.com"
#
# If you wish to delegate the DNS challenges to another domain, you can set the suffix variable. For example:
# suffix=".dns-01.example.org"
# And then add the appropriate CNAME records to delegate the challenges:
# _acme-challenge.www.example.com CNAME _acme-challenge.www.example.com.dns-01.example.org
# _acme-challenge.www.example.net CNAME _acme-challenge.www.example.net.dns-01.example.org
# In this case, the zone ID must refer to the delegated domain, and the API token must have edit
# permissions (only) for that domain.

case ${1} in
"www.example.com")
Expand Down
5 changes: 3 additions & 2 deletions hook.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ set -o nounset
shopt -s lastpipe

prefix="_acme-challenge."
suffix=""

#if [[ ! -f "${PWD}/hooks/cfhookbash/config.sh" ]]; then
# if [[ -f "${PWD}/config.sh" ]]; then
Expand Down Expand Up @@ -71,7 +72,7 @@ deploy_challenge() {

echo " - Setting up token for ${DOMAIN}"

local DATA='{"type":"TXT","name":"'${prefix}${DOMAIN}'","content":"'${TOKEN_VALUE}'","ttl":120,"priority":10,"proxied":false}'
local DATA='{"type":"TXT","name":"'${prefix}${DOMAIN}${suffix}'","content":"'${TOKEN_VALUE}'","ttl":120,"priority":10,"proxied":false}'
curl "${curlParams[@]}" --data "${DATA}" | check_status
shift 3
done
Expand Down Expand Up @@ -114,7 +115,7 @@ clean_challenge() {
local DOMAIN="${1}" TOKEN_FILENAME="${2}" TOKEN_VALUE="${3}" curlParams response
load_config "$DOMAIN" curlParams

curl "${curlParams[@]}" -G -d 'match=all' -d 'per_page=100' -d 'type=TXT' -d "name=${prefix}${DOMAIN}" | readarray response
curl "${curlParams[@]}" -G -d 'match=all' -d 'per_page=100' -d 'type=TXT' -d "name=${prefix}${DOMAIN}${suffix}" | readarray response
echo "${response[@]}" | check_status

record_ids=$( echo "${response[@]}" | jq -r '.result | .[] | .id' )
Expand Down