summaryrefslogtreecommitdiff
path: root/scripts/acme/dns-auth.sh
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/acme/dns-auth.sh')
-rwxr-xr-xscripts/acme/dns-auth.sh16
1 files changed, 16 insertions, 0 deletions
diff --git a/scripts/acme/dns-auth.sh b/scripts/acme/dns-auth.sh
new file mode 100755
index 0000000..43a5dad
--- /dev/null
+++ b/scripts/acme/dns-auth.sh
@@ -0,0 +1,16 @@
+#!/bin/bash
+
+if [[ -z "${CERTBOT_DOMAIN}" || -z "${CERTBOT_VALIDATION}" ]]; then
+ echo "Environment not set"
+ exit 1
+fi
+
+ZONE=$(expr match "$CERTBOT_DOMAIN" '.*\.\(.*\..*\)')
+NAMEONLY=$(expr match "$CERTBOT_DOMAIN" '\(.*\.\).*\..*')
+CREATE_DOMAIN="_acme-challenge.${NAMEONLY}"
+
+pdnsutil add-record "${ZONE}" "${CREATE_DOMAIN}" TXT 120 '"'"${CERTBOT_VALIDATION}"'"'
+pdnsutil increase-serial "${ZONE}"
+pdns_control notify "${ZONE}"
+
+sleep 30