Last active
June 27, 2020 20:25
-
-
Save aadityabhatia/1ed4a658cbb9fd0c928bc050a84b6715 to your computer and use it in GitHub Desktop.
generate letsencrypt cert using docker
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 | |
set -e | |
HOST=$1 | |
test "$UID" -ne "0" && echo "Must be root." >&2 && exit 2 | |
test -z "$HOST" && echo -e "\n\tUSAGE: $0 HOST\n" >&2 && exit 2 | |
echo HOST: $HOST | |
echo Generating SSL certificate... | |
docker run -it --rm --name certbot -v "$HOME/workspace/letsencrypt/etc:/etc/letsencrypt" -v "$HOME/workspace/letsencrypt/var:/var/lib/letsencrypt" certbot/dns-cloudflare certonly --agree-tos -d $HOST | |
cat etc/archive/$HOST/{privkey1.pem,fullchain1.pem} > server.pem | |
echo Generated: server.pem | |
## SETUP: | |
# mkdir etc | |
# echo "dns_cloudflare_api_token = " > etc/cloudflare.ini | |
# echo "authenticator = dns-cloudflare\ndns-cloudflare-credentials = /etc/letsencrypt/cloudflare.ini" > etc/cli.ini | |
## REFERENCES: | |
# https://certbot.eff.org/docs/install.html#running-with-docker | |
# https://certbot.eff.org/docs/using.html#configuration-file | |
# https://certbot-dns-cloudflare.readthedocs.io/en/stable/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
certbot
can be aliased to