Skip to content

BUG/MEDIUM: acme: append dns-01 records instead of replacing them - #418

Open
bilhackmac wants to merge 1 commit into
haproxytech:masterfrom
bilhackmac:fix/dns-append-records
Open

bilhackmac wants to merge 1 commit into
haproxytech:masterfrom
bilhackmac:fix/dns-append-records

Conversation

@bilhackmac

Copy link
Copy Markdown

Hi,

Follow-up to #417, although this one is independent (both apply cleanly on master, in any order).

A certificate for example.com + *.example.com gets two dns-01 authorizations with different tokens, but both use the same record name, _acme-challenge.example.com. Present() uses SetRecords(), 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 implements libdns.RecordAppender, with SetRecords() 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,delay in the acme section. acme challenge_ready currently 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.

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.
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.

1 participant