Created
October 19, 2018 15:04
-
-
Save uzegonemad/6d4db16ce63b9c962f37f888c53934af to your computer and use it in GitHub Desktop.
Certbot hook for iwantmyname DNS verification
This file contains hidden or 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
/usr/local/bin/certbot-auto renew --manual-auth-hook /path/to/certbot_before.sh --renew-hook "service nginx reload" | |
# Note that it might take 3-4 minutes per challenge |
This file contains hidden or 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 | |
DOMAIN_NS="$(dig +short SOA $CERTBOT_DOMAIN | cut -d' ' -f1)" | |
curl -s -S -u "[email protected]:yourpassword" "https://iwantmyname.com/basicauth/ddns?hostname=_acme-challenge.$CERTBOT_DOMAIN&type=txt&value=$CERTBOT_VALIDATION" | |
TXT_RECORDS="" | |
RESULT_LEN=0 | |
check_txt_record () { | |
TXT_RECORDS="$(dig +short txt _acme-challenge.$CERTBOT_DOMAIN @$DOMAIN_NS | grep $CERTBOT_VALIDATION)" | |
RESULT_LEN="${#TXT_RECORDS}" | |
} | |
check_txt_record | |
until [[ "$RESULT_LEN" -gt "0" ]]; do | |
check_txt_record | |
sleep 1 | |
done | |
printf "good\n" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment