Skip to content
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

Support for DNS challenge delegation #4071

Closed
francislavoie opened this issue Mar 19, 2021 · 4 comments
Closed

Support for DNS challenge delegation #4071

francislavoie opened this issue Mar 19, 2021 · 4 comments
Labels
feature ⚙️ New feature or request
Milestone

Comments

@francislavoie
Copy link
Member

See https://letsencrypt.org/docs/challenge-types/#dns-01-challenge

Since Let’s Encrypt follows the DNS standards when looking up TXT records for DNS-01 validation, you can use CNAME records or NS records to delegate answering the challenge to other DNS zones. This can be used to delegate the _acme-challenge subdomain to a validation-specific server or zone. It can also be used if your DNS provider is slow to update, and you want to delegate to a quicker-updating server.

The DuckDNS plugin for Caddy directly supports this, via a configuration option to override the domain that Caddy passed it with the actual *.duckdns.org subdomain the user has control of: https://github.com/caddy-dns/duckdns#challenge-delegation

I suggest that we introduce support for this in Caddy (and therefore certmagic) by providing that domain override functionality at a higher level so that DNS plugins don't need to support this themselves.

This would probably be configured in Caddy in the TLS automation policy, on the DNS challenge config: https://caddyserver.com/docs/json/apps/tls/automation/policies/issuers/acme/challenges/ and in the Caddyfile it would probably be a new subdirective of tls, maybe dns_challenge_domain, and maybe a global option to go with acme_dns.

What this would do, if configured, is make certmagic make a libdns request to the configured DNS plugin with this domain override, instead of the domain Caddy actually wants the certificate for. This obviously requires the user to understand that they need a CNAME record as described above.

This feature would be particularly useful as a workaround for users who have domains with providers that either don't provide a DNS management API (e.g. Google Domains) or have really terrible APIs (namecheap). It's solved by pairing it with free DNS services like DuckDNS which support TXT records, or with DNS servers like https://github.com/joohoi/acme-dns (which is purpose-built for making challenge delegation easy).

(Note that we don't have a DNS plugin that supports https://github.com/joohoi/acme-dns yet but it should be very easy to write; the name of the project makes it kinda ambiguous what it's for though, which is annoying from the perspective of publishing the plugin on https://caddyserver.com/download, but I digress)

@francislavoie francislavoie added the feature ⚙️ New feature or request label Mar 19, 2021
@francislavoie francislavoie added this to the 2.x milestone Mar 19, 2021
@xdu31
Copy link
Contributor

xdu31 commented Apr 10, 2021

I'm interested in taking a look at this. @francislavoie

@bgeneto
Copy link

bgeneto commented Dec 23, 2021

That would be amazing... AFAIK only duckdns plugin has this capability via override_domain directive. Problem is many (when not all) subdomains from duckdns.org have been blocked by several dns servers worldwide because of phishing/abuse. So please don't forget to add this feature... Thx.

@francislavoie
Copy link
Member Author

francislavoie commented Mar 9, 2022

This is implemented in caddyserver/certmagic#160 and #4596

@francislavoie francislavoie modified the milestones: 2.x, v2.5.0 Mar 9, 2022
@gc-ss
Copy link

gc-ss commented Mar 25, 2022

(Note that we don't have a DNS plugin that supports https://github.com/joohoi/acme-dns yet but it should be very easy to write; the name of the project makes it kinda ambiguous what it's for though, which is annoying from the perspective of publishing the plugin on https://caddyserver.com/download, but I digress)

An update. This is now available at:

https://github.com/libdns/acmedns
https://github.com/caddy-dns/acmedns

Initial discussions: https://caddy.community/t/new-acme-dns-libdns-plugin/15474/3?u=gcss

Hat tip to @vbsd for design and development!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature ⚙️ New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants