didbot_tls/lib.rs
1//! The PDS's own TLS certificate: obtained over ACME DNS-01, renewed without
2//! a restart, stored with the same care the signing keys get.
3//!
4//! # The shape
5//!
6//! * [`dns`] -- what ACME's DNS-01 step needs from a DNS backend, stated as
7//! its own seam because `didbot-dns` cannot do it yet. Read this module
8//! first; it explains the two-simultaneous-TXT-values problem that shapes
9//! everything downstream of it.
10//! * [`directory`] -- staging vs. production, staging by default.
11//! * [`acme`] -- one ACME order, start to finish, generic over [`dns`].
12//! * [`http_client`] -- the HTTP client [`acme`] uses, and why it is not
13//! instant-acme's own default one.
14//! * [`cert`] -- PEM in, `rustls::sign::CertifiedKey` and an expiry out.
15//! * [`resolver`] -- the certificate as swappable state a live `rustls`
16//! handshake reads, so a renewal never touches the listener or an
17//! established connection. Read this module for the hot-reload story.
18//! * [`renew`] -- when renewal is due, and how loudly a failing one should
19//! be surfaced, as pure functions of a supplied clock.
20//! * [`storage`] -- the certificate, its key and the ACME account key on
21//! disk, `0600` inside `0700`.
22//! * [`source`] -- which authority a zone's certificate comes from. One
23//! table, so ACME and the local authority can never both apply to a zone.
24//! * [`test_support`] -- certificates for a test standing up a server over
25//! TLS, behind the `test-support` feature so nothing ships it.
26//! * [`local`] -- the authority a developer's machine trusts, for a zone no
27//! public authority can issue for. Read this module for what bounds a
28//! certificate that sits in a trust store.
29//! * [`fleet`] -- one [`manager::CertificateManager`] per configured zone,
30//! and the SNI dispatch between their certificates. Read this module for
31//! why a deployment cannot have one certificate.
32//! * [`manager`] -- everything above, tied into one
33//! [`manager::CertificateManager`] a caller bootstraps once and hands a
34//! [`rustls::ServerConfig`] to a listener.
35//!
36//! # What this crate's tests do and do not verify
37//!
38//! `tests/acme_conformance.rs` drives the real `instant-acme` client through
39//! a full order -- directory, nonce, account, order, authorization,
40//! challenge, finalize, certificate -- against an in-process fake ACME
41//! directory, with no network and no real zone. [`manager`]'s own
42//! documentation says exactly which pieces that does and does not stand in
43//! for -- most importantly, no real CA and no real DNS-01 propagation over
44//! the network, so passing here is not proof that a real Let's Encrypt
45//! exchange succeeds, only that this crate's own orchestration (the
46//! apex+wildcard grouping, cleanup, renewal, retry and multi-zone
47//! isolation) is correct against something that answers like a CA.
48
49#![forbid(unsafe_code)]
50
51pub mod acme;
52pub mod cert;
53pub mod directory;
54pub mod dns;
55pub mod fleet;
56pub mod http_client;
57pub mod local;
58pub mod manager;
59pub mod renew;
60pub mod resolver;
61pub mod source;
62pub mod storage;
63
64#[cfg(any(test, feature = "test-support"))]
65pub mod test_support;