Trust platform root certificates for relay WebSocket TLS#2517
Open
ilkonovalov wants to merge 1 commit into
Open
Trust platform root certificates for relay WebSocket TLS#2517ilkonovalov wants to merge 1 commit into
ilkonovalov 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>
ilkonovalov
force-pushed
the
ws-client-native-root-certs
branch
from
July 23, 2026 17:29
a0ce96f to
2ecec7f
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.