Expand description
Automatic certificates via ACME (RFC 8555) with the TLS-ALPN-01 challenge (RFC 8737).
This module produces certificates; server::tls only consumes them. The
contract between the two is ManagedCerts — an atomically swappable map
from CertId to the current ManagedCert — plus the
challenge::ChallengeSolver the TLS resolver asks when a ClientHello
carries ALPN acme-tls/1. Renewals swap a map entry; they never rebuild
the rustls ServerConfig.
Modules§
- challenge
- TLS-ALPN-01 (RFC 8737) challenge solving.
- client
- The ACME protocol boundary.
- manager
- The renewal scheduler: one task per managed certificate that decides when
to (re)issue, takes the storage lease so only one instance orders, runs
order::issue, persists, publishes intoManagedCerts, and backs off on failure. Instances that lose the lease poll storage and adopt whatever the leaseholder wrote, refreshing challenge certs meanwhile so the CA may validate through any of them. - metrics
- Prometheus series for managed certificates — enough for the standard “expires in < 7 d” and “renewal failing” alerts.
- order
- One certificate issuance, start to finish: fresh key → newOrder → register
every TLS-ALPN-01 key authorization with the solver → tell the CA “ready” →
wait → CSR → finalize → download → verify → hand back a
StoredCert. Challenges are cleared on every exit path so a stuck order never leaves a validatable challenge cert behind. Verification runs before anything is persisted: a CA returning garbage never evicts a working certificate. - storage
- ACME state storage: account credentials, per-certificate key+chain, pending TLS-ALPN-01 key authorizations, and the renewal lease that keeps N gateway instances from ordering the same certificate at once.
Structs§
- Acme
Runtime - Everything the rest of the process needs from ACME once started.
- CertId
- Stable identity of one managed certificate: its normalized domain set.
- Cert
Meta - Operator-facing facts about a managed certificate (never the key).
- Managed
Cert - The current certificate for one
CertId, as served by the TLS resolver. - Stored
Cert - What storage persists per certificate.
Enums§
Functions§
- build_
storage - Builds the configured
CertStorage. The redis backend keeps only the store’s name and resolves its client fromresourceson every call, so an Admin API store edit is picked up by the next operation; the name is validated here (resolved once and discarded) so a typo fails startup rather than every later renewal. - leaf_
dns_ sans - DNS SANs of the leaf, lowercased.
- load_
certified_ key - Parses a PEM chain + PEM key into a rustls [
CertifiedKey], verifying the key matches the leaf. Returns the leaf DER alongside for metadata parsing. - new_
managed_ certs - now_
unix - parse_
cert_ meta - parse_
leaf 🔒 - placeholder_
cert - A self-signed, 1-hour placeholder (SAN = all domains, CN = the first) served while no real certificate exists yet. Never persisted.
- provider 🔒
- publish
- Replaces (or inserts) the entry for
id. New TLS connections see it on their nextresolve; in-flight ones are unaffected. - start
- Builds storage, seeds
ManagedCertsfrom storage (or placeholders), and spawns the renewal manager. The CA is not contacted here — the manager connects lazily — so a CA outage never blocks the listener from starting. - update
- Mutates the entry for
idin place (no-op when absent).
Type Aliases§
- Managed
Certs - Keyed by
CertId::as_str().