Skip to content

Instantly share code, notes, and snippets.

@kronthto
Created August 20, 2021 17:58
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 kronthto/893715f12cc0b1cda9fcfdbd8dc176b8 to your computer and use it in GitHub Desktop.
Save kronthto/893715f12cc0b1cda9fcfdbd8dc176b8 to your computer and use it in GitHub Desktop.
certbot DNS challenge nsupdate
#!/bin/bash
# use with: manual_auth_hook = /usr/local/sbin/dns-challenge.sh
if [ -z "$CERTBOT_DOMAIN" ] || [ -z "$CERTBOT_VALIDATION" ]
then
echo "EMPTY DOMAIN OR VALIDATION"
exit -1
fi
HOST="_acme-challenge"
/usr/bin/nsupdate << EOM
server 127.0.0.1
zone ${HOST}.${CERTBOT_DOMAIN}
update add ${HOST}.${CERTBOT_DOMAIN} 300 TXT "${CERTBOT_VALIDATION}"
send
EOM
echo ""
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment