pub struct TlsConfig {
pub sni: Option<String>,
pub cert_file: Option<PathBuf>,
pub key_file: Option<PathBuf>,
pub managed: Option<ManagedSpec>,
pub enable_zero_rtt: bool,
pub client_auth: Option<ClientAuthConfig>,
pub ocsp_path: Option<PathBuf>,
pub ocsp_fetch: bool,
}Expand description
Listener-side TLS termination config — paths to the cert chain + private key in PEM, plus an optional SNI hostname this cert serves.
sni: None marks the cert as the listener’s default — used when
the ClientHello has no SNI extension, or when the SNI doesn’t
match any of the listener’s Some(_) entries. A listener has at
most one default cert.
SNI hostnames are normalised to ASCII-lowercase at every ingest
boundary per spec/crates/engine-tls.md § SNI peek (L4, no decrypt); comparison against
rustls’s already-lowercased ClientHello::server_name() is then
byte-for-byte.
Fields§
§sni: Option<String>§cert_file: Option<PathBuf>Path to the leaf+chain PEM. Required when the cert is operator-
supplied (static); absent when the cert comes from managed.
Per-rule validation enforces “exactly one of static paths or
managed”; lower-pass branches on the result.
key_file: Option<PathBuf>Path to the private key PEM. Same lifecycle as cert_file.
managed: Option<ManagedSpec>ACME-managed cert source. When set, cert_file / key_file
must be absent. The compiler routes this rule into the
listener’s managed_snis table; the engine’s
ManagedCertPopulator supplies the actual cert.
enable_zero_rtt: boolListener-side TLS 1.3 0-RTT opt-in. Required on every rule that
carries a tls block; rules sharing one listener must agree on
this value (lower aggregates them). See
spec/crates/engine-tls.md § TLS 1.3 0-RTT (early data).
client_auth: Option<ClientAuthConfig>Listener-side mTLS — per spec/crates/engine-tls.md § Client certificate verification (mTLS on listener). Per-rule input; the lower pass aggregates each
rule’s client_auth into one ClientAuthSpec per listener
address (rules on the same listener must agree, else compile
error). None keeps the listener at ClientAuth::None.
ocsp_path: Option<PathBuf>Path to a pre-fetched OCSP response (DER) on disk. The
populator reads this file at every refresh and stages the
bytes into the resolver. Useful for HTTPS-only OCSP
responders (which vane does not fetch from — see
spec/crates/engine-tls.md § OCSP stapling) and for
air-gapped deployments where the operator cron-runs
openssl ocsp themselves. Mutually exclusive with
Self::ocsp_fetch.
ocsp_fetch: boolWhen true, the populator extracts the OCSP responder URL
from the cert’s AIA extension and fetches the response over
HTTP at refresh time. HTTP-only by policy (per
spec/crates/engine-tls.md § OCSP stapling).
Mutually exclusive with Self::ocsp_path.
Implementations§
Source§impl TlsConfig
impl TlsConfig
Sourcepub const fn is_managed(&self) -> bool
pub const fn is_managed(&self) -> bool
true when this tls block routes through ACME, not static disk
paths. Inverse of Self::is_static.
Sourcepub const fn is_static(&self) -> bool
pub const fn is_static(&self) -> bool
true when both cert_file and key_file are present and
managed is absent. The lower pass guarantees this for every
TlsConfig it stores in ListenerTlsSpec::default /
ListenerTlsSpec::sni_certs, so static-cert consumers can
rely on the static-paths invariant downstream.
Sourcepub fn static_paths(&self) -> Option<(&Path, &Path)>
pub fn static_paths(&self) -> Option<(&Path, &Path)>
Static cert paths if this is a static config. The lower pass
guarantees (cert_file, key_file) are both Some whenever
managed is None, so this returns Some for every
post-lower static TlsConfig.
Sourcepub fn validate(&self) -> Result<(), Error>
pub fn validate(&self) -> Result<(), Error>
Per-rule pre-lower validation per spec/crates/engine-acme.md § Configuration schema and spec/crates/engine-tls.md § Upstream-side TLS:
- Exactly one of (
cert_file∧key_file) ormanagedis present. - When
managedis set, every requiredManagedSpecinvariant holds:agree_tos == true, non-emptycontact, non-emptysan,tls.sni ∈ san, no wildcard SAN unlessdns-01,dns-01⇒dns_provider,renew_beforeparses to a positiveDuration.
§Errors
Returns Error::compile with a single sentence pointing at
the offending field. The error string is operator-readable —
the vane compile UI surfaces it verbatim.