1
0
Fork 0
mirror of https://github.com/fernwerker/ownDynDNS.git synced 2025-07-11 06:38:02 +02:00
ownDynDNS/data/hooks/auth-hook.sh

20 lines
632 B
Bash
Raw Normal View History

2024-07-24 13:37:15 +02:00
# ownDynDNS auth script for certbot dns-01 challenge
# install curl
2024-10-02 15:37:26 +02:00
apk --no-cache add curl
2024-07-24 13:37:15 +02:00
ACME_PREFIX="_acme-challenge"
2024-10-02 16:16:05 +02:00
# check if wildcard cert is requested, as that needs to be stripped
if [[ "${DDNS_HOST}" == '*.'* ]]; then DDNS_HOST=${DDNS_HOST#\*\.}; fi
# prepend acme prefix to host part
2024-07-24 13:37:15 +02:00
if [ -z "${DDNS_HOST}" ]; then DDNS_HOST=${ACME_PREFIX}; else DDNS_HOST=${ACME_PREFIX}.${DDNS_HOST}; fi
PAYLOAD="force=true&user=${DDNS_USER}&password=${DDNS_PASS}&txt=${CERTBOT_VALIDATION}&domain=${DDNS_DOMAIN}&host=${DDNS_HOST}&create=true"
# echo ${PAYLOAD}
curl -sSL -X POST --data "${PAYLOAD}" ${DDNS_SCRIPT} \
&& sleep 300