-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #52 from MattKobayashi/certbot-cloudflare
Add certbot-cloudflare
- Loading branch information
Showing
5 changed files
with
117 additions
and
0 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
FROM certbot/dns-cloudflare:latest | ||
|
||
ARG TARGETPLATFORM | ||
ENV SUPERCRONIC_SHA1SUM_amd64=642f4f5a2b67f3400b5ea71ff24f18c0a7d77d49 \ | ||
SUPERCRONIC_SHA1SUM_arm=4f625d77d2f9a790ea4ad679d0d2c318a14ec3be \ | ||
SUPERCRONIC_SHA1SUM_arm64=0b658d66bd54cf10aeccd9bdbd95fc7d9ba84a61 \ | ||
SUPERCRONIC_SHA1SUM_i386=1b5ebdd122b05cd2ff38b585022f1d909b0146ff \ | ||
SUPERCRONIC_VERSION=v0.2.25 | ||
|
||
RUN if [ "$TARGETPLATFORM" = "linux/amd64" ]; then ARCH=amd64; elif [ "$TARGETPLATFORM" = "linux/arm/v7" ]; then ARCH=arm; elif [ "$TARGETPLATFORM" = "linux/arm64" ]; then ARCH=arm64; elif [ "$TARGETPLATFORM" = "linux/i386" ]; then ARCH=i386; else exit 1; fi \ | ||
&& export SUPERCRONIC="supercronic-linux-${ARCH}" \ | ||
&& export SUPERCRONIC_URL="https://github.com/aptible/supercronic/releases/download/${SUPERCRONIC_VERSION}/${SUPERCRONIC}" \ | ||
&& wget "$SUPERCRONIC_URL" \ | ||
&& eval SUPERCRONIC_SHA1SUM='$SUPERCRONIC_SHA1SUM_'$ARCH \ | ||
&& echo "${SUPERCRONIC_SHA1SUM} ${SUPERCRONIC}" | sha1sum -c - \ | ||
&& chmod +x "${SUPERCRONIC}" \ | ||
&& mv "$SUPERCRONIC" "/usr/local/bin/${SUPERCRONIC}" \ | ||
&& ln -s "/usr/local/bin/${SUPERCRONIC}" /usr/local/bin/supercronic \ | ||
&& mkdir /crontab/ \ | ||
&& mkdir /opt/certs/ | ||
|
||
COPY certbot-cron /crontab/ | ||
COPY --chmod=0744 entrypoint.sh . | ||
|
||
ENTRYPOINT ["entrypoint.sh"] | ||
|
||
LABEL org.opencontainers.image.authors="MattKobayashi <[email protected]>" |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
*/5 * * * * certbot certonly --config cli.ini |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
--- | ||
services: | ||
certbot-cloudflare: | ||
image: 'ghcr.io/mattkobayashi/certbot-cloudflare:latest' | ||
restart: unless-stopped | ||
environment: | ||
- 'EMAIL=' | ||
- 'DOMAIN=' | ||
secrets: | ||
- CERTBOT_CF_DNS_API_TOKEN | ||
|
||
secrets: | ||
CERTBOT_CF_DNS_API_TOKEN: | ||
file: ${PWD}/secrets/CERTBOT_CF_DNS_API_TOKEN # Set this to the path on the host to your CERTBOT_CF_DNS_API_TOKEN secret file |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
#!/bin/sh | ||
|
||
cat > cli.ini << EOF | ||
dns-cloudflare = True | ||
agree-tos = True | ||
no-eff-email = True | ||
keep-until-expiring = True | ||
dns-cloudflare-propagation-seconds = 30 | ||
dns-cloudflare-credentials = /run/secrets/CERTBOT_CF_DNS_API_TOKEN | ||
deploy-hook = cp -RL /etc/letsencrypt/live/$DOMAIN/ /opt/certs/ && chmod -R o+r /opt/certs/ | ||
domain = $DOMAIN | ||
email = $EMAIL | ||
EOF | ||
|
||
exec supercronic /crontab/certbot-cron |