BUG/MEDIUM: acme: append dns-01 records instead of replacing them - #418
Open
bilhackmac wants to merge 1 commit into
Open
bilhackmac wants to merge 1 commit into
bilhackmac wants to merge 1 commit into
Conversation
A certificate covering both `example.com` and `*.example.com` gets two dns-01 authorizations, each with its own token, but both use the same record name: `_acme-challenge.example.com`. `Present()` uses `SetRecords()`, which by libdns semantics replaces every record with the same name and type. When the second challenge is deployed, it deletes the TXT record of the first one, and one of the two validations fails. Use `AppendRecords()` when the provider implements `libdns.RecordAppender`, and keep `SetRecords()` as a fallback. Cleanup is unchanged: `DeleteRecords()` matches on name, type and value, so each challenge only removes its own record.
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Hi,
Follow-up to #417, although this one is independent (both apply cleanly on master, in any order).
A certificate for
example.com+*.example.comgets two dns-01 authorizations with different tokens, but both use the same record name,_acme-challenge.example.com.Present()usesSetRecords(), which by libdns semantics replaces all records with the same name and type. So deploying the second challenge deletes the first TXT record, and one of the two validations fails.Fix
Use
AppendRecords()when the provider implementslibdns.RecordAppender, withSetRecords()as a fallback for providers that don't. This is also what certmagic (Caddy) does.Cleanup doesn't need to change:
DeleteRecords()matches on name, type and value, so each challenge only removes its own record.Testing
Built from v3.4.3 with both patches, OVH provider, certificate for
sub.example.com+*.sub.example.com: both TXT records coexist during validation, the certificate is issued, and both are removed at cleanup.Note: with HAProxy 3.4 I also had to set
challenge-ready cli,delayin the acme section.acme challenge_readycurrently marks every authorization matching the domain as ready at once, so apex and wildcard get submitted before the second record exists. That's on the HAProxy side, and I'll report it there separately.