Skip to content

Instantly share code, notes, and snippets.

@jimmycuadra
Created January 21, 2016 01:35
Show Gist options
  • Save jimmycuadra/db3bb1b7c6a0d35008e0 to your computer and use it in GitHub Desktop.
Save jimmycuadra/db3bb1b7c6a0d35008e0 to your computer and use it in GitHub Desktop.
letsencrypt.sh hook script for dns-01 challenge using AWS Route 53
YOUR_HOSTED_ZONE_HERE="Route53 zone ID"
case "$1" in
"clean_challenge")
altname="$2"
challenge_token="$3"
keyauth_hook="$4"
aws route53 change-resource-record-sets --hosted-zone-id $YOUR_HOSTED_ZONE_HERE --change-batch "{\"Changes\":[{\"Action\":\"DELETE\",\"ResourceRecordSet\":{\"Name\":\"_acme-challenge.${altname}\",\"Type\":\"TXT\",\"TTL\":60,\"ResourceRecords\":[{\"Value\":\"\\\"${keyauth_hook}\\\"\"}]}}]}"
;;
"deploy_challenge")
altname="$2"
challenge_token="$3"
keyauth_hook="$4"
aws route53 change-resource-record-sets --hosted-zone-id $YOUR_HOSTED_ZONE_HERE --change-batch "{\"Changes\":[{\"Action\":\"UPSERT\",\"ResourceRecordSet\":{\"Name\":\"_acme-challenge.${altname}\",\"Type\":\"TXT\",\"TTL\":60,\"ResourceRecords\":[{\"Value\":\"\\\"${keyauth_hook}\\\"\"}]}}]}"
sleep 20
;;
"deploy_cert")
domain="$2"
private_key="$3"
cert="$4"
chain="$5"
# NO-OP
;;
esac
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment