-
Notifications
You must be signed in to change notification settings - Fork 138
feat: Implement ACME ALPN-01 challenge type #1897
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
base: master
Are you sure you want to change the base?
Conversation
This commit introduces support for the ACME `tls-alpn-01` challenge type, as specified in RFC 8737. This allows for domain validation by presenting a specific certificate during a TLS handshake using the ALPN extension. Key changes include: - **Challenge Definition:** Added `tls-alpn-01` as a recognized challenge type. - **Certificate Generation:** Implemented `AcmeClient.generateAlpnCertificate()` to create the required self-signed certificate with a `subjectAlternativeName` and a critical `acmeIdentifier` extension containing the SHA-256 digest of the key authorization. - **TLS Handshake Modification:** - `AcmeSSLContext` now uses a custom `X509ExtendedKeyManager` (`AlpnKeyManager`). - This key manager dynamically selects the ALPN challenge certificate when the `acme-tls/1` protocol is negotiated via ALPN and the SNI hostname matches a domain undergoing ALPN-01 validation. - **`AcmeClient` Update:** - `AcmeClient.provision()` now handles the `tls-alpn-01` challenge, including generating the certificate, instructing `AcmeSSLContext` to use it, and providing a cleanup mechanism. - **Configuration:** - You can now specify preferred challenge types via the `challengeTypes` attribute on the `<acme>` element in the XML configuration (e.g., `challengeTypes="tls-alpn-01,http-01"`). - `AcmeClient` will attempt challenges based on this preferred order. - **Testing:** - Added unit tests for certificate generation, `AlpnKeyManager` (conceptual tests due to private inner class), end-to-end `AcmeClient` provisioning flow for ALPN-01, and configuration parsing. This allows you to leverage ALPN-01 for domain validation, which can be particularly useful in environments where modifying HTTP request handling for `http-01` is difficult, such as behind certain load balancers or CDNs.
Important Review skippedDraft detected. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
This pull request needs "/ok-to-test" from an authorized committer. |
/ok-to-test |
@t-burch this doesn't even compile... ;) |
This commit introduces support for the ACME
tls-alpn-01
challenge type, as specified in RFC 8737. This allows for domain validation by presenting a specific certificate during a TLS handshake using the ALPN extension.Key changes include:
tls-alpn-01
as a recognized challenge type.AcmeClient.generateAlpnCertificate()
to create the required self-signed certificate with asubjectAlternativeName
and a criticalacmeIdentifier
extension containing the SHA-256 digest of the key authorization.AcmeSSLContext
now uses a customX509ExtendedKeyManager
(AlpnKeyManager
).acme-tls/1
protocol is negotiated via ALPN and the SNI hostname matches a domain undergoing ALPN-01 validation.AcmeClient
Update:AcmeClient.provision()
now handles thetls-alpn-01
challenge, including generating the certificate, instructingAcmeSSLContext
to use it, and providing a cleanup mechanism.challengeTypes
attribute on the<acme>
element in the XML configuration (e.g.,challengeTypes="tls-alpn-01,http-01"
).AcmeClient
will attempt challenges based on this preferred order.AlpnKeyManager
(conceptual tests due to private inner class), end-to-endAcmeClient
provisioning flow for ALPN-01, and configuration parsing.This allows you to leverage ALPN-01 for domain validation, which can be particularly useful in environments where modifying HTTP request handling for
http-01
is difficult, such as behind certain load balancers or CDNs.