Trust platform root certificates for relay WebSocket TLS - #2517
Trust platform root certificates for relay WebSocket TLS#2517ilkonovalov wants to merge 1 commit into
Conversation
connect_async uses the default TLS config, which via rustls-tls-webpki-roots trusts only the bundled Mozilla roots. Clients cannot reach a relay served behind a certificate signed by a private/internal CA (handshake fails with UnknownIssuer), and there is no runtime way to add a trusted root. Switch tokio-tungstenite to rustls-tls-native-roots so the client trusts the platform trust store (public CAs plus any operator-installed CA); in container/Helm deployments the CA can be provisioned into the container trust store with no rebuild. Signed-off-by: ilkonovalov <ilkonovalov@users.noreply.github.com>
a0ce96f to
2ecec7f
Compare
|
This is CI-green and correctly fixes the workspace-level One gap: |
Problem
crates/buzz-ws-client/src/connection.rsconnects to the relay withtokio_tungstenite::connect_async(...), which uses the default TLSconfiguration. The workspace enables:
rustls-tls-webpki-rootscompiles in a fixed copy of the Mozilla public rootlist. It does not consult the OS trust store or
SSL_CERT_FILE, and there isno code path to inject an extra trust anchor. As a result, a client/agent
cannot connect (
wss://) to a relay whose certificate chains up to a privateor internal CA — the handshake terminates with
invalid peer certificate: UnknownIssuer. This blocks any self-hosted deployment that terminates TLSwith an organization-issued certificate.
Change
Switch the TLS feature to
rustls-tls-native-roots:The client now trusts the platform trust store, which includes the public CAs
and any operator-installed CA. Public relays keep working; relays behind a
private CA start working without any client code change.
Deployment note (containers / Helm): because trust now comes from the
platform store, operators of a containerized relay can add a private CA the
standard way — provision it into the container's trust store (e.g. mount the
CA bundle into
/etc/ssl/certsvia the chart) — with no rebuild of the binary.Caveat / alternative
native-rootsrequires the runtime to actually have a trust store. Minimalimages (scratch / distroless) that ship no CA bundle would start with an empty
root set and fail TLS even to public relays; such images must include
ca-certificates.If a zero-regression path is preferred, an alternative is to build an explicit
rustls::ClientConfiginconnection.rsthat seeds roots fromwebpki-roots(so public CAs always work) and adds native certs plus an optional CA file
(e.g. from an env var), then pass it via
connect_async_tls_with_config(..., Some(Connector::Rustls(...))). Happy toswitch to that approach if maintainers prefer it.