From 559ec01fee2a1fc31003279b5f928666ea73a5e3 Mon Sep 17 00:00:00 2001 From: selikhov Date: Sun, 4 Oct 2026 03:25:24 +0300 Subject: [PATCH] Reach wss:// gateways: TLS in the gateway client The gateway client was built without TLS, so every wss:// gateway, the setup docs/gateway-admin.md recommends and what a _tsgws._tcp record names, failed with "TLS support not compiled in". tokio-tungstenite now uses rustls with the system's certificates; rustls and its crates were in the tree already (reqwest), so nothing new is downloaded. Checked end to end against the TeamSpeak 6 dev server: tsgw behind a TLS terminator with a certificate from a throwaway CA, the login over wss:// works when the CA is trusted (SSL_CERT_FILE) and is refused with UnknownIssuer when it is not. Android has no system store to read, so wss:// stays out of reach there; the docs say so. Co-Authored-By: Claude Opus 5.5 --- Cargo.lock | 6 ++++++ crates/voelin-gateway-proto/Cargo.toml | 4 +++- docs/gateway-admin.md | 6 +++++- 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index de2ea89..d3f44bd 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -8638,7 +8638,11 @@ checksum = "17a073bfed563fa236697a068031408a93cd9522e08abf9933ead3e73411bd71" dependencies = [ "futures-util", "log", + "rustls", + "rustls-native-certs", + "rustls-pki-types", "tokio", + "tokio-rustls", "tungstenite 0.30.0", ] @@ -9188,6 +9192,8 @@ dependencies = [ "httparse", "log", "rand 0.10.3", + "rustls", + "rustls-pki-types", "sha1 0.11.0", "thiserror 2.0.21", ] diff --git a/crates/voelin-gateway-proto/Cargo.toml b/crates/voelin-gateway-proto/Cargo.toml index 64ad14b..2a03809 100644 --- a/crates/voelin-gateway-proto/Cargo.toml +++ b/crates/voelin-gateway-proto/Cargo.toml @@ -21,7 +21,9 @@ sha1 = { package = "sha-1", version = "0.10" } sha2 = "0.10" thiserror = "2" tokio = { version = "1", features = ["macros", "rt", "sync"], optional = true } -tokio-tungstenite = { version = "0.30", optional = true } +# TLS (`wss://`, as gateways run behind a proxy) with the system's +# certificates; rustls and its crates are in the tree already (reqwest). +tokio-tungstenite = { version = "0.30", optional = true, features = ["rustls-tls-native-roots"] } voelin-model = { path = "../voelin-model" } tsproto-types = { path = "../proto/tsproto-types" } diff --git a/docs/gateway-admin.md b/docs/gateway-admin.md index 407a169..5738d28 100644 --- a/docs/gateway-admin.md +++ b/docs/gateway-admin.md @@ -133,7 +133,11 @@ port on the server's host is found with no setup at all; behind a proxy, set `listen.public_url` so the answer points at the proxy. Discovery is as trustworthy as DNS and the network, like TSDNS: prefer a -`_tsgws` record, so TLS proves the gateway is yours. A user logs in with +`_tsgws` record, so TLS proves the gateway is yours. Voelin checks a +`wss://` gateway's certificate against the system's certificate store, so +use one from a public CA (Caddy's automatic Let's Encrypt certificates +work); the Android app cannot reach `wss://` gateways yet (it has no +system store to read). A user logs in with their own identity, and only when they choose to observe the server. ## Install