Add TLS-ALPN-01 challenge solver - #8
Merged
Merged
Conversation
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.
Adds a TLS-ALPN-01 challenge solver (RFC 8737), mirroring the existing DNS-01 solver so a downstream crate can provision certificates over the ALPN challenge with the same shape it already uses for DNS-01.
What's new
TlsAlpn01Solver<R: ChallengeResponder>— drives an ACME order through the TLS-ALPN-01 challenge to a certificate, the counterpart toDns01Solver.ChallengeRespondertrait — the counterpart toDnsProvider. The library builds the challenge certificate; the implementer arranges for it to be served onacme-tls/1handshakes. How the certificate reaches port 443 is the consumer's architecture, not this library's.build_challenge_certificate(domain, digest)— a pure function that builds the RFC 8737 challenge certificate: a singledNSNameSAN and a criticalid-pe-acmeIdentifierextension wrapping the 32-byte key-authorization digest in an OCTET STRING. Uses rcgen'snew_acme_identifier, which is why rcgen moves from a dev-dependency to a normal one (the only dependency change).MockChallengeResponderin thetestingfeature — the counterpart toMockDnsProvider, so a downstream crate can integration-test its TLS-ALPN-01 wiring without a real TLS responder.Design
The order-driving tail — poll ready, finalize, fetch the chain — is identical to DNS-01, so
finalize_orderreproduces it. The one structural difference fromDns01Solver: challenges are collected up front (domain, digest, URL) before anyset_ready, because instant-acme's authorization stream andset_readyboth borrow the order. The digest is copied into an owned buffer, so nothing depends on the stream afterward.Cleanup is best-effort and documented as such: cheti carries no logger (matching the DNS-01 solver), a
presentthat fails after installing the cert still gets that domain torn down, and a responder needing a hard guarantee should lease its presentations.Scope note
This is the generic half of TLS-ALPN-01. The consumer-specific half — a rustls responder that serves the certificate on
acme-tls/1, and routing that protocol to it on port 443 — lives in the downstream proxy, not here.