Last active
November 16, 2023 13:46
-
-
Save angel333/1aae17b1ea53a9cd538966979781d8aa to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# | |
# Certbot hook for Hurricane Electric DNS service | |
# | |
# Usage: | |
# | |
# Renew all certificates: | |
# HE_SESSID=<session_id> certbot renew \ | |
# --preferred-challenges dns \ | |
# --manual-auth-hook /path/to/certbot-he-hook.sh \ | |
# --manual-public-ip-logging-ok | |
# | |
# Create a new certificate: | |
# HE_SESSID=<session_id> certbot certonly \ | |
# --preferred-challenges dns \ | |
# --email [email protected] \ | |
# --manual \ | |
# --manual-auth-hook /path/to/certbot-he-hook.sh \ | |
# --manual-public-ip-logging-ok \ | |
# --domain <requested.domain.com> | |
# | |
ZONENAME_REGEX=$(echo $CERTBOT_DOMAIN | awk -F '.' '{ print $(NF-1) "\\." $NF }') | |
HE_ZONEID=$(curl --stderr - --cookie CGISESSID=$HE_SESSID https://dns.he.net/index.cgi \ | |
| grep -Eo "delete_dom.*name=\"$ZONENAME_REGEX\" value=\"[0-9]+" | grep -Eo "[0-9]+$") | |
curl --stderr - -o /dev/null --cookie CGISESSID=$HE_SESSID https://dns.he.net/index.cgi \ | |
-d "account=&menu=edit_zone&Type=TXT&hosted_dns_zoneid=$HE_ZONEID&hosted_dns_recordid=&hosted_dns_editzone=1&Priority=&Name=_acme-challenge.$CERTBOT_DOMAIN&Content=$CERTBOT_VALIDATION&TTL=300&hosted_dns_editrecord=Submit" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
An improved version is here: https://github.com/angel333/certbot-he-hook