mirror of
https://github.com/Moepchi/webspeak3.git
synced 2026-12-01 00:42:49 +08:00
fix(gateway): don't let clients pick their IP behind TRUST_PROXY
TRUST_PROXY=1 trusted CF-Connecting-IP and the first X-Forwarded-For entry, both of which a client can send itself when the proxy in front isn't Cloudflare (nginx's $proxy_add_x_forwarded_for only appends), so per-IP limits could be sidestepped. Now TRUST_PROXY=1 takes the last X-Forwarded-For entry (the one the proxy appended), and the new TRUST_PROXY=cloudflare takes only CF-Connecting-IP. The bundled compose file (cloudflared) switches to cloudflare. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Hu2cuPLqpuKVfd9wWFFakU
This commit is contained in:
1 parent
bda908029b
commit
bbb44b3eaa
3 files changed
+16
-14
No files matched your search
@@ -207,7 +207,7 @@ All optional; add them under `environment:` in your compose override next to `PO
|
||||
| `TURN_URLS` | unset | Comma-separated TURN URLs (e.g. `turn:turn.example.com:3478`) offered to browsers for screen streams, for viewers or publishers behind NATs where direct P2P fails. Pair with `TURN_SECRET` (coturn's `use-auth-secret`; each browser gets its own credential valid for 24 h) or with static `TURN_USERNAME` / `TURN_CREDENTIAL`, which every visitor can read. |
|
||||
| `ALLOWED_ORIGINS` | unset (any origin) | Comma-separated list of web origins allowed to open `/ws` (e.g. `https://client.example.com`). Stops other websites from silently using your gateway as their relay. |
|
||||
| `MAX_CONNECTIONS_PER_IP` / `MAX_CONNECTIONS` | `10` / `300` | Concurrent `/ws` connections per client IP and in total (each can hold a live TeamSpeak session). `0` disables a limit. |
|
||||
| `TRUST_PROXY` | off | Set to `1` when the gateway is **only** reachable through a reverse proxy/tunnel (e.g. cloudflared): per-IP limits then use `CF-Connecting-IP` / `X-Forwarded-For` instead of the proxy's own address. Don't set it on a directly exposed gateway - clients could then spoof their IP. |
|
||||
| `TRUST_PROXY` | off | Only when the gateway is reachable **solely** through a proxy/tunnel, so per-IP limits see the real client instead of the proxy: `cloudflare` (Cloudflare Tunnel or proxy) uses `CF-Connecting-IP`; `1` (your own nginx/Caddy/Traefik) uses the last `X-Forwarded-For` entry, the one your proxy appended. Don't set it on a directly exposed gateway - clients could then fake their IP. |
|
||||
|
||||
> **Trust model:** the gateway speaks the TeamSpeak protocol on the user's behalf, so whoever runs it necessarily handles their identity key, server/channel passwords and privilege keys (they're kept out of process listings, but the operator can still see them). Only use gateways you trust, and serve them over HTTPS/WSS (`TLS_CERT`/`TLS_KEY` or a TLS-terminating proxy) - plain HTTP exposes all of that on the wire. File uploads are limited to 24 MiB, downloads to 25 MiB.
|
||||
|
||||
|
||||
Reference in new issue
Block a user