Skip to content

cloudflare dns challenge #585

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

lawso017
Copy link
Contributor

Just in case you'd find it useful, I'm a big fan of using Cloudflare's DNS challenge to easily generate trusted certs when using private IP addresses.

I wired this in using the commit below, and three additional variables in my pigsty.yml:

    dns_cloudflare_api_token: "{{ lookup('env', 'DNS_CLOUDFLARE_API_TOKEN') }}"
    repo_packages: "{{ repo_packages_default + ['python3-certbot-dns-cloudflare'] }}"
    infra_packages: "{{ infra_packages_default + ['python3-certbot-dns-cloudflare'] }}"

The only caveat is that you really don't want this running on multiple nodes simultaneously... so I added "run_once" to the sign-cert operation. It needs to be serialized so you don't have multiple nodes modifying DNS records at the same time.

Thanks again!

@lawso017
Copy link
Contributor Author

... a true HA setup with redundant infra nodes required a bit more work to properly store & distribute keys. I started running into LetsEncrypt rate limits, which further highlighted the point that really there should be one node managing certbot, and that one certbot-enabled node should distribute certs to the other reverse proxies.

Your nginx configuration is spot-on and quite sophisticated, however I'm wondering if you have used Caddy?

Given the ease of accessing shared storage with Minio already bundled in the stack, Caddy is Go-based and does a beautiful job synchronizing certificates out of shared storage in multi-node HA setup. The nginx configuration would translate easily to Caddy I think, and could simplify life in a certbot-enabled environment.

@Vonng
Copy link
Member

Vonng commented Apr 28, 2025

This is a great feature, I'll merge it before the next release.

I’ve used Caddy and it’s a fantastic web server, but I’m not sure whether we should migrate from Nginx to Caddy—the main concern is user familiarity. After all, Nginx still offers top-tier performance and the largest user base.

That said, I do think introducing a dedicated Caddy role as an alternative implementation to Nginx could be an excellent idea.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants