Skip to content

Instantly share code, notes, and snippets.

@charignon
Created October 11, 2017 07:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save charignon/070eec6125531d75867644dc32a9e00d to your computer and use it in GitHub Desktop.
Save charignon/070eec6125531d75867644dc32a9e00d to your computer and use it in GitHub Desktop.
Makefile to simplify let's encrypt domain maintenance using lego, digital ocean spaces and dns
.PHONY: new renew upload download
ENDPOINT=--endpoint-url https://nyc3.digitaloceanspaces.com
AWS=aws ${ENDPOINT}
LEGO=lego --accept-tos --email xxx --dns digitalocean
S3_PATH="s3://domain-certificates/acme"
LOCAL_PATH=${PWD}/.lego
DOMAINS=`ls .lego/certificates | grep key | sed "s/.key$$//"`
new:
@$(if ${DOMAIN}, echo "Setting up ${DOMAIN}", echo "Please set DOMAIN env var" ; exit 1 )
${LEGO} -d ${DOMAIN} run
renew:
@echo "Renewing ${DOMAINS}"
@for d in ${DOMAINS};do ${LEGO} -d $$d renew --days 30 ; done
upload:
@echo "uploading"
${AWS} s3 sync ${PWD}/.lego ${S3_PATH}
download:
@echo "Download"
${AWS} s3 sync ${S3_PATH} ${PWD}/.lego
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment