Skip to content

Commit 5a3a890

Browse files
committed
ACME: tls-alpn-01 challenge solver implementation.
1 parent 5d04b9f commit 5a3a890

File tree

10 files changed

+860
-7
lines changed

10 files changed

+860
-7
lines changed

README.md

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,14 @@ certificate management (ACMEv2) protocol.
1111

1212
The module implements following specifications:
1313

14-
* [RFC8555] (Automatic Certificate Management Environment) with limitations:
15-
* Only HTTP-01 challenge type is supported
14+
- [RFC8555] (Automatic Certificate Management Environment) with limitations:
15+
- Only HTTP-01 challenge type is supported
16+
- [RFC8737] (ACME TLS Application-Layer Protocol Negotiation (ALPN) Challenge
17+
Extension)
1618

1719
[NGINX]: https://nginx.org/
1820
[RFC8555]: https://www.rfc-editor.org/rfc/rfc8555.html
21+
[RFC8737]: https://www.rfc-editor.org/rfc/rfc8737.html
1922

2023
## Getting Started
2124

@@ -188,6 +191,19 @@ Accepted values:
188191
The generated account keys are preserved across reloads, but will be lost on
189192
restart unless [state_path](#state_path) is configured.
190193

194+
### challenge
195+
196+
**Syntax:** challenge `type`
197+
198+
**Default:** http-01
199+
200+
**Context:** acme_issuer
201+
202+
Sets challenge type used for this issuer. Allowed values:
203+
204+
- `http-01`
205+
- `tls-alpn-01`
206+
191207
### contact
192208

193209
**Syntax:** contact `url`

build.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,13 +54,18 @@ fn detect_nginx_features() {
5454
// Generate cfg values for version checks
5555

5656
println!("cargo::rustc-check-cfg=cfg(ngx_ssl_cache)");
57+
println!("cargo::rustc-check-cfg=cfg(ngx_ssl_client_hello_cb)");
5758
println!("cargo::rerun-if-env-changed=DEP_NGINX_VERSION_NUMBER");
5859
if let Ok(version) = env::var("DEP_NGINX_VERSION_NUMBER") {
5960
let version: u64 = version.parse().unwrap();
6061

6162
if version >= 1_027_002 {
6263
println!("cargo::rustc-cfg=ngx_ssl_cache");
6364
}
65+
66+
if version >= 1_029_002 {
67+
println!("cargo::rustc-cfg=ngx_ssl_client_hello_cb");
68+
}
6469
}
6570
}
6671

src/acme.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,13 @@ pub struct NewCertificateOutput {
4141
}
4242

4343
pub struct AuthorizationContext<'a> {
44+
/// Account key thumbprint.
4445
pub thumbprint: &'a [u8],
46+
/// A private key generated for the new certificate request.
47+
///
48+
/// This is used in tls-alpn-01 challenge to avoid generating a new key on each verification
49+
/// attempt.
50+
pub pkey: &'a PKeyRef<Private>,
4551
}
4652

4753
pub struct AcmeClient<'a, Http>
@@ -357,6 +363,7 @@ where
357363

358364
let order = AuthorizationContext {
359365
thumbprint: self.key.thumbprint(),
366+
pkey: &pkey,
360367
};
361368

362369
for (url, authorization) in authorizations {

src/acme/solvers.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ use super::AuthorizationContext;
1010
use crate::conf::identifier::Identifier;
1111

1212
pub mod http;
13+
pub mod tls_alpn;
1314

1415
#[derive(Debug, Error)]
1516
#[error("challenge registration failed: {0}")]

0 commit comments

Comments
 (0)