|
1 |
| -# docker-certbot-cloudflare |
| 1 | +# Certbot Cloudflare Docker Image |
| 2 | + |
| 3 | +[](https://github.com/Scalified/docker-certbot-cloudflare/releases/latest) |
| 4 | +[](https://hub.docker.com/r/scalified/certbot-cloudflare) |
| 5 | +[](https://github.com/Scalified/docker-certbot-cloudflare/blob/master/LICENSE) |
| 6 | + |
| 7 | +## Overview |
| 8 | + |
| 9 | +[**Alpine**](https://www.alpinelinux.org/) [**Docker**](https://www.docker.com/) image with [**Certbot**](https://certbot.eff.org/) preconfigured to autorenew SSL certificates |
| 10 | +using [**Cloudflare**](https://www.cloudflare.com) DNS. Built on top of the [**Scalified CRON**](https://github.com/Scalified/docker-cron) image |
| 11 | + |
| 12 | +[**Certbot**](https://certbot.eff.org/) is used in `certonly` mode and runs with the `--keep-until-expiring` flag, which ensures that an existing certificate is reused until it is |
| 13 | +within 30 days of expiration. A CRON job is configured to run Certbot at container startup and once daily at night, helping to ensure that SSL certificates are always up to date |
| 14 | + |
| 15 | +## Usage |
| 16 | + |
| 17 | +1. Generate a [Cloudflare User API Token](https://developers.cloudflare.com/fundamentals/api/get-started/create-token/) with `Zone:DNS:Edit` permissions |
| 18 | +2. Save the generated token in a [Cloudflare credentials](https://certbot-dns-cloudflare.readthedocs.io/en/stable/#credentials) file |
| 19 | +3. Launch the `scalified/certbot-cloudflare` Docker image: |
| 20 | + |
| 21 | +```bash |
| 22 | +docker run \ |
| 23 | + --name certbot \ |
| 24 | + -e CF_EMAIL="admin@example.com" \ |
| 25 | + -e CF_CREDENTIALS_FILE="/etc/certbot/cloudflare.ini" \ |
| 26 | + -e CF_PROPAGATION_SECONDS="60" \ |
| 27 | + -e DOMAINS="*.example.com example.com" \ |
| 28 | + -e LETSENCRYPT_DIR="/etc/letsencrypt" \ |
| 29 | + -e DEPLOY_HOOK="docker exec nginx nginx -s reload" \ |
| 30 | + -e CERTBOT_CRON_SCHEDULE="27 1 * * *" \ |
| 31 | + -v ./cloudflare.ini:/etc/certbot/cloudflare.ini:ro \ |
| 32 | + -v ./letsencrypt:/etc/letsencrypt \ |
| 33 | + -v /var/run/docker.sock:/var/run/docker.sock \ |
| 34 | + --detach \ |
| 35 | + --restart always \ |
| 36 | + scalified/certbot-cloudflare |
| 37 | +``` |
| 38 | + |
| 39 | +| Environment Variable | Description | Default Value | |
| 40 | +|-------------------------|-------------------------------------------------------------------------------------------------|-------------------------------| |
| 41 | +| `CF_EMAIL` | Email address associated with **Cloudflare** account | | |
| 42 | +| `CF_CREDENTIALS_FILE` | Path to the **Cloudflare** credentials file used for DNS authentication | `/etc/certbot/cloudflare.ini` | |
| 43 | +| `CF_PROPAGATION_SECODS` | Number of seconds to wait for DNS propagation before requesting validation from the ACME server | `60` | |
| 44 | +| `LETSENCRYPT_DIR` | Directory where Certbot stores the generated Let's Encrypt SSL certificates | `/etc/letsencrypt` | |
| 45 | +| `DOMAINS` | Space-separated list of domains for which SSL certificates should be generated | | |
| 46 | +| `DEPLOY_HOOK` | Shell command to run once per successfully issued certificate | | |
| 47 | +| `CERTBOT_CRON_SCHEDULE` | **CRON** expression that defines when to run the Certbot renewal | `27 1 * * *` | |
| 48 | + |
| 49 | +## Scalified Links |
| 50 | + |
| 51 | +* [Scalified](http://www.scalified.com) |
| 52 | +* [Scalified Official Facebook Page](https://www.facebook.com/scalified) |
| 53 | +* <a href="mailto:info@scalified.com?subject=[Docker Certbot Cloudflare]: Proposals And Suggestions">Scalified Support</a> |
| 54 | + |
0 commit comments