Lego Cloudflare Certificate Generator: github.com/ljgonzalez1/lego-cloudflare-ssl-certgen
10K+

GitHub repository and documentationâ
Issue Let's Encrypt certificates with lego and Cloudflare DNS-01. Each group in domains.yaml produces one certificate for ordinary names and wildcards. Names with A, AAAA, or CNAME records use the same challenge. The container prints a certificate summary and exits.
â ď¸ Start in staging. Repeated production runs can hit Let's Encrypt's rate limit for the same set of names. Select Staging and confirm to try a live staging order. Let's Encrypt rate limitsâ
Run these commands in a new working directory.
mkdir lego-certgen
cd lego-certgen
wget -O domains.yaml https://raw.githubusercontent.com/ljgonzalez1/lego-cloudflare-ssl-certgen/master/template.domains.yaml
wget -O .env https://raw.githubusercontent.com/ljgonzalez1/lego-cloudflare-ssl-certgen/master/template.env
chmod 600 .env
mkdir -p ssl-certs
Create a Cloudflare token with Zone DNS Edit and Zone Read for the zones you use. Fill in EMAIL and CLOUDFLARE_API_TOKEN in .env. Set ACCEPT_LEGO_TOS=true after reviewing the Let's Encrypt Terms of Serviceâ .
Replace the contents of domains.yaml with your own names. Keep wildcards quoted.
website:
- example.com
- www.example.com
- "*.example.com"
docker run --rm -it --env-file .env \
-v "$PWD/domains.yaml:/app/domains.yaml:ro" \
-v "$PWD/ssl-certs:/ssl-certs" \
ljgonzalez/lego-cloudflare-certgen:v6.0.0-alpha-1
Add --dry-run to preview the request. When staging works, choose Production and confirm it for trusted certificates. The files are saved under ssl-certs/. This command pins the Go beta; latest tracks stable releases in the table below.
â The live view reports definitive errors such as an invalid token, missing zone access or a rate limit. The failed group ends early and the other groups still run. Each certificate allows up to 100 names and has its own deadline of at most two hours. The run ends with the issued and failed counts.
đ§Ş v6.0.0-alpha-1 migrates the application to Go, with optimizations disabled, full debug symbols and redacted beta traces on errors. latest stays on stable v5.2.4. The debug image includes Delve on AMD64, ARM64 and i386; 32-bit ARM keeps full DWARF and traces.
đ¤ Add --staging to request staging certificates unattended. --production bypasses confirmation and consumes live rate limits. --test checks the compiled program and lego offline. The optional Compose file runs unattended in staging; edit its x-certgen-mode value to select production. Debugging and full documentationâ
The current image supports ARMv6, ARMv7, ARM64, i386, and AMD64. Docker selects the platform when it pulls the image.
latest tracks the last release outside the alpha, alfa and beta channels. Prerelease tags carry their suffix.
Content type
Image
Digest
sha256:56a727800âŚ
Size
23.4 MB
Last updated
7 days ago
docker pull ljgonzalez/lego-cloudflare-certgen