Last active
July 19, 2022 00:52
-
-
Save amane-katagiri/a567d26bab9d73d8f19933b66329bca7 to your computer and use it in GitHub Desktop.
/etc/letsencrypt/scripts/dns-01-auth-netlify.sh
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/sh | |
API_TOKEN='YOUR_NETLIFY_API_TOKEN' | |
if [ "$CERTBOT_VALIDATION" != "" ] && [ "$CERTBOT_DOMAIN" != "" ]; then | |
DNS_ZONE_ID=$(curl -Ss \ | |
-H 'Authorization: Bearer '"$API_TOKEN" \ | |
'https://api.netlify.com/api/v1/dns_zones' \ | |
| jq -r '(.[] | select(.name == "'"$CERTBOT_DOMAIN"'")).id') | |
curl -Ss -X POST \ | |
-H 'Content-Type: application/json' \ | |
-H "Authorization: Bearer $API_TOKEN" \ | |
--data '{"type":"TXT","hostname": "_acme-challenge","value":"'"$CERTBOT_VALIDATION"'"}' \ | |
"https://api.netlify.com/api/v1/dns_zones/${DNS_ZONE_ID}/dns_records" | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment