Skip to content

Instantly share code, notes, and snippets.

@mrrooijen
Last active August 6, 2022 08:29
Show Gist options
  • Save mrrooijen/8ac6293cc4640a71fed3d92bfc9c05d5 to your computer and use it in GitHub Desktop.
Save mrrooijen/8ac6293cc4640a71fed3d92bfc9c05d5 to your computer and use it in GitHub Desktop.
Script to acquire Let's Encrypt SSL certificate using DNS challenge against Cloudflare.
#! /bin/sh
email="[email protected]"
domains="example.com,*.example.com"
cloudflare_email="[email protected]"
cloudflare_api_key="me-api-key"
# END CONFIG
brew install certbot
$(brew --prefix certbot)/libexec/bin/pip install certbot-dns-cloudflare
echo "dns_cloudflare_email = $cloudflare_email" > cloudflare.ini
echo "dns_cloudflare_api_key = $cloudflare_api_key" >> cloudflare.ini
chmod 0600 cloudflare.ini
certbot certonly \
-n \
--agree-tos \
--dns-cloudflare \
--dns-cloudflare-credentials ./cloudflare.ini \
--config-dir letsencrypt-config \
--work-dir .letsencrypt \
--logs-dir letsencrypt-log \
-m $email \
-d $domains
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment