Skip to content

Instantly share code, notes, and snippets.

@mrizvic
Last active May 27, 2020 11:08
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mrizvic/1a08bee85e760ab9df41e6d7b57eca34 to your computer and use it in GitHub Desktop.
Save mrizvic/1a08bee85e760ab9df41e6d7b57eca34 to your computer and use it in GitHub Desktop.
#!/bin/bash
### RUNNING:
#certbot certonly -d host.domain.tld --agree-tos --manual --preferred-challenges=dns --manual-auth-hook /root/certbot-hook-dns-auth.sh --manual-public-ip-logging-ok
HOST="_acme-challenge"
DYNZONE="SET_YOURDOMAIN_NAME"
if [ -z "$CERTBOT_DOMAIN" ] || [ -z "$CERTBOT_VALIDATION" ] || [ -z "$DYNZONE" ]
then
echo "EMPTY DOMAIN OR VALIDATION OR ZONE"
exit -1
fi
echo $DYNZONE
echo $CERTBOT_DOMAIN
echo $CERTBOT_VALIDATION
echo $HOST
/usr/bin/nsupdate << EOM
zone ${DYNZONE}
update delete ${HOST}.${CERTBOT_DOMAIN} TXT
update add ${HOST}.${CERTBOT_DOMAIN} 10 TXT "${CERTBOT_VALIDATION}"
send
EOM
echo ""
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment