Expand description
Automatic HTTPS/TLS certificate management for Salvo via the ACME protocol.
This crate integrates certon, a production-grade ACME client, with Salvo’s listener/acceptor system.
§Features
- Multiple issuers: Let’s Encrypt, ZeroSSL, or any ACME-compatible CA.
- Multiple challenge types: HTTP-01, TLS-ALPN-01, DNS-01.
- On-demand TLS: obtain certificates at handshake time.
- OCSP stapling: automatic OCSP response fetching and stapling.
- Multiple key types: ECDSA P-256/P-384/P-521, RSA, Ed25519.
- Persistent storage: pluggable storage backend via
Storage. - Background renewal: automatic certificate renewal and OCSP refresh.
§Certificate key type
Salvo ACME defaults to KeyType::EcdsaP256 for newly generated
certificate private keys. RSA key types remain available for compatibility,
but they are explicit opt-in via AcmeConfigBuilder::key_type or
AcmeListenerBuilder::key_type.
§Quick Start - HTTP-01
ⓘ
use salvo_acme::AcmeListener;
use salvo_core::prelude::*;
#[handler]
async fn hello() -> &'static str {
"Hello World"
}
#[tokio::main]
async fn main() {
let mut router = Router::new().get(hello);
let listener = TcpListener::new("0.0.0.0:443")
.acme()
.cache_path("acme/letsencrypt")
.add_domain("example.com")
.http01_challenge(&mut router);
let acceptor = listener.join(TcpListener::new("0.0.0.0:80")).bind().await;
Server::new(acceptor).serve(router).await;
}§Quick Start - TLS-ALPN-01
ⓘ
use salvo_acme::AcmeListener;
use salvo_core::prelude::*;
#[handler]
async fn hello() -> &'static str {
"Hello World"
}
#[tokio::main]
async fn main() {
let router = Router::new().get(hello);
let acceptor = TcpListener::new("0.0.0.0:443")
.acme()
.cache_path("acme/letsencrypt")
.add_domain("example.com")
.bind().await;
Server::new(acceptor).serve(router).await;
}Re-exports§
pub use certon;
Structs§
- Acme
Acceptor - Acceptor for ACME.
- Acme
Config - ACME configuration.
- Acme
Config Builder - ACME configuration builder.
- Acme
Issuer - An ACME-based certificate issuer.
- Acme
Issuer Builder - Builder for constructing an
AcmeIssuerwith sensible defaults. - Acme
Listener Builder - A wrapper around an underlying listener which implements ACME.
- Acme
Quinn Listener quinn - A wrapper around an underlying listener which implements ACME and Quinn.
- Cert
Cache - An in-memory certificate cache that indexes certificates by subject name for efficient TLS handshake lookups.
- Cert
Resolver - A TLS certificate resolver that integrates with
CertCacheand optionally supports on-demand certificate issuance. - Certificate
- A TLS certificate chain together with its private key and parsed metadata.
- Certon
Config - Central configuration for automatic TLS certificate management.
- Certon
Config Builder - Builder for constructing a
Configwith sensible defaults. - Distributed
Solver - Wraps any
Solverfor clustered / distributed deployments. - Dns01
Solver - Solves ACME DNS-01 challenges by creating a TXT record via a
DnsProviderimplementation and optionally waiting for propagation. - File
Storage - Http01
Handler - Handler for HTTP-01 ACME challenges.
- Http01
Solver - Solves ACME HTTP-01 challenges by serving the key authorization string
at
GET /.well-known/acme-challenge/{token}on a simple HTTP server. - Issued
Certificate - The result of a successful certificate issuance.
- Maintenance
Config - Configuration for the background maintenance task.
- Ocsp
Config - Configuration for OCSP stapling behavior.
- OnDemand
Config - Configuration for on-demand TLS certificate issuance.
- TlsAlpn01
Solver - Solves ACME TLS-ALPN-01 challenges by presenting a self-signed certificate
with the
acmeIdentifierextension during the TLS handshake, negotiated via theacme-tls/1ALPN protocol (RFC 8737). - Zero
SslIssuer - A certificate issuer that obtains certificates from ZeroSSL via ACME.
Enums§
- Challenge
Type - Challenge type for ACME.
- Issuer
Policy - Controls how issuers are selected when obtaining or renewing certificates.
- KeyType
- Enumerates the supported asymmetric key algorithms.
Constants§
- LETS_
ENCRYPT_ PRODUCTION - Let’s Encrypt production ACME directory.
- LETS_
ENCRYPT_ STAGING - Let’s Encrypt staging ACME directory (for testing).
- ZEROSSL_
PRODUCTION - ZeroSSL production ACME directory.
Traits§
- Acme
Listener - Extension trait for Listener to support ACME.
- Cert
Issuer - Abstract interface for certificate issuers.
- DnsProvider
- Abstraction over a DNS provider that can create and delete TXT records.
- Manager
- An external certificate manager that can provide certificates for TLS handshakes.
- PreChecker
- Optional pre-check interface for certificate issuers.
- Revoker
- Abstract interface for certificate revokers.
- Solver
- An ACME challenge solver.
- Storage
- Persistent key-value storage with filesystem-like path semantics.