Repository navigation
turn: refuse TCP relays and limit relays to this host to media ports - #4992
Merged
Merged
Conversation
Embedded TURN let any participant relay to arbitrary peers (#4924): - RFC 6062 TCP relays, accepted since pion/turn v5, let a client open TCP connections to any permitted address, e.g. SSH on the node itself. WebRTC clients never request them, so they are now refused for both embedded and standalone TURN. - Relays to the host's own addresses are delivered locally and bypass any firewall in front of the host. Embedded TURN now only relays to this host's RTC media UDP ports. - Carrier-grade NAT, NAT64 and a few other special-purpose ranges are added to the restricted peer ranges. The issue also suggested allowing relays only to the media node's IPs. That is not done here because, with the changes above, the remaining relays do not form a security concern: they are UDP only, to public addresses outside the restricted ranges, and reach a peer exactly as the client could from its own address (no amplification, no spoofed source). This is standard TURN behavior. Limiting destinations to media nodes would also require TURN server to know media node all endpoints, for little benefit. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Comment on lines
+140
to
+144
| if rtcConf.ICEPortRangeStart != 0 && rtcConf.ICEPortRangeEnd != 0 { | ||
| ports = append(ports, portRange{start: uint16(rtcConf.ICEPortRangeStart), end: uint16(rtcConf.ICEPortRangeEnd)}) | ||
| } else if rtcConf.UDPPort.Valid() { | ||
| end := max(rtcConf.UDPPort.End, rtcConf.UDPPort.Start) | ||
| ports = append(ports, portRange{start: uint16(rtcConf.UDPPort.Start), end: uint16(end)}) |
Contributor
There was a problem hiding this comment.
🟥 Unused ICE range exposes local UDP services
When UDPPort and ICEPortRangeStart are both configured, getTURNMediaPorts permits the ICE range instead of the active mux port. A TURN client can reach unrelated local UDP services in that range despite the host firewall.
Was this helpful? React with 👍 or 👎 to provide feedback.
Contributor
Author
There was a problem hiding this comment.
mux port will not work in this case
paulwe
approved these changes
Oct 12, 2026
boks1971
approved these changes
Oct 12, 2026
eleboucher
pushed a commit
to eleboucher/homelab
that referenced
this pull request
Oct 14, 2026
…9 ➔ v1.13.10) (#2338) This PR contains the following updates: | Package | Update | Change | |---|---|---| | [docker.io/livekit/livekit-server](https://github.com/livekit/livekit) | patch | `v1.13.9` → `v1.13.10` | --- ### Release Notes <details> <summary>livekit/livekit (docker.io/livekit/livekit-server)</summary> ### [`v1.13.10`](https://github.com/livekit/livekit/releases/tag/v1.13.10) [Compare Source](livekit/livekit@v1.13.9...v1.13.10) ##### Changed - sfu: forward the dependency descriptor for VP8 simulcast ([#​4987](livekit/livekit#4987)) - sfu: keep VP8 descriptor frame numbers across migration ([#​4989](livekit/livekit#4989)) - sfu: filter VP9 and AV1 simulcast temporal layers with the dependency descriptor ([#​4991](livekit/livekit#4991)) - sfu: filter VP8 temporal layers by frame when the dependency descriptor is sent ([#​4976](livekit/livekit#4976)) - sfu: switch VP8 temporal layers up with the dependency descriptor ([#​4974](livekit/livekit#4974)) - sfu: pad the slot of a filtered packet that follows a sequence number gap ([#​4983](livekit/livekit#4983)) - sfu: send padding in the slot of a dropped out-of-order packet ([#​4979](livekit/livekit#4979)) - sfu: parse VP8 and VP9 payload descriptors without an allocation ([#​4981](livekit/livekit#4981)) - DownTrack: arm key frame requester timer only while a layer lock is pending ([#​4980](livekit/livekit#4980)) - turn: refuse TCP relays and limit relays to this host to media ports ([#​4992](livekit/livekit#4992)) - agent endpoints: address an unnamed deployment as "\_" ([#​4997](livekit/livekit#4997)) - Add OSS Scanner build image and threat model ([#​4995](livekit/livekit#4995)) - Update golang Docker tag to v1.27.1 ([#​4985](livekit/livekit#4985)) - Update alpine Docker tag to v3.24.2 ([#​4984](livekit/livekit#4984)) - Update module github.com/maxbrunsfeld/counterfeiter/v6 to v6.13.0 ([#​4915](livekit/livekit#4915)) ##### Fixed - Send NACKs when processing RTX packets ([#​5000](livekit/livekit#5000)) - sfu: send padding-only packets with no payload ([#​4993](livekit/livekit#4993)) - rtc: release timed out pending tracks at the pending track limit ([#​4998](livekit/livekit#4998)) - Fix nil pointer dereference in IOInfoService.UpdateIngressState ([#​4806](livekit/livekit#4806)) - rtc: keep update cache eviction order when listing recent disconnects ([#​4975](livekit/livekit#4975)) - fix(cli): return non-zero exit status on command errors ([#​4888](livekit/livekit#4888)) - Disable AV1 for Firefox clients before 157 ([#​4962](livekit/livekit#4962)) </details> --- ### Configuration 📅 **Schedule**: (UTC) - Branch creation - At any time (no schedule defined) - Automerge - At any time (no schedule defined) 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about these updates again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR has been generated by [Mend Renovate CLI](https://github.com/renovatebot/renovate). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0NC4xNTEuMiIsInVwZGF0ZWRJblZlciI6IjQ0LjE1MS4yIiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6W119--> Reviewed-on: https://git.erwanleboucher.dev/eleboucher/homelab/pulls/2338
1 task
hbjydev
pushed a commit
to hbjydev/phoebe
that referenced
this pull request
Oct 20, 2026
…v1.13.10) (#884) This PR contains the following updates: | Package | Update | Change | |---|---|---| | [docker.io/livekit/livekit-server](https://github.com/livekit/livekit) | patch | `v1.13.9` → `v1.13.10` | --- ### Release Notes <details> <summary>livekit/livekit (docker.io/livekit/livekit-server)</summary> ### [`v1.13.10`](https://github.com/livekit/livekit/releases/tag/v1.13.10) [Compare Source](livekit/livekit@v1.13.9...v1.13.10) ##### Changed - sfu: forward the dependency descriptor for VP8 simulcast ([#​4987](livekit/livekit#4987)) - sfu: keep VP8 descriptor frame numbers across migration ([#​4989](livekit/livekit#4989)) - sfu: filter VP9 and AV1 simulcast temporal layers with the dependency descriptor ([#​4991](livekit/livekit#4991)) - sfu: filter VP8 temporal layers by frame when the dependency descriptor is sent ([#​4976](livekit/livekit#4976)) - sfu: switch VP8 temporal layers up with the dependency descriptor ([#​4974](livekit/livekit#4974)) - sfu: pad the slot of a filtered packet that follows a sequence number gap ([#​4983](livekit/livekit#4983)) - sfu: send padding in the slot of a dropped out-of-order packet ([#​4979](livekit/livekit#4979)) - sfu: parse VP8 and VP9 payload descriptors without an allocation ([#​4981](livekit/livekit#4981)) - DownTrack: arm key frame requester timer only while a layer lock is pending ([#​4980](livekit/livekit#4980)) - turn: refuse TCP relays and limit relays to this host to media ports ([#​4992](livekit/livekit#4992)) - agent endpoints: address an unnamed deployment as "\_" ([#​4997](livekit/livekit#4997)) - Add OSS Scanner build image and threat model ([#​4995](livekit/livekit#4995)) - Update golang Docker tag to v1.27.1 ([#​4985](livekit/livekit#4985)) - Update alpine Docker tag to v3.24.2 ([#​4984](livekit/livekit#4984)) - Update module github.com/maxbrunsfeld/counterfeiter/v6 to v6.13.0 ([#​4915](livekit/livekit#4915)) ##### Fixed - Send NACKs when processing RTX packets ([#​5000](livekit/livekit#5000)) - sfu: send padding-only packets with no payload ([#​4993](livekit/livekit#4993)) - rtc: release timed out pending tracks at the pending track limit ([#​4998](livekit/livekit#4998)) - Fix nil pointer dereference in IOInfoService.UpdateIngressState ([#​4806](livekit/livekit#4806)) - rtc: keep update cache eviction order when listing recent disconnects ([#​4975](livekit/livekit#4975)) - fix(cli): return non-zero exit status on command errors ([#​4888](livekit/livekit#4888)) - Disable AV1 for Firefox clients before 157 ([#​4962](livekit/livekit#4962)) </details> --- ### Configuration 📅 **Schedule**: (in timezone Europe/London) - Branch creation - At any time (no schedule defined) - Automerge - At any time (no schedule defined) 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about these updates again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR has been generated by [Mend Renovate CLI](https://github.com/renovatebot/renovate). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0NC4xNjcuNSIsInVwZGF0ZWRJblZlciI6IjQ0LjE2Ny41IiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6WyJyZW5vdmF0ZS9jb250YWluZXIiLCJ0eXBlL3BhdGNoIl19--> Reviewed-on: https://git.hayden.moe/hayden/phoebe/pulls/884
pabloFuente
added a commit
to OpenVidu/openvidu-livekit
that referenced
this pull request
Nov 6, 2026
Conflicts: .github/workflows/buildtest.yaml, go.mod, go.sum, pkg/rtc/config.go, pkg/rtc/mediatrackreceiver.go, pkg/rtc/participant.go, pkg/service/server.go and pkg/service/turn.go. Upstream's TURN relay policy (livekit#4992, pkg/service/turnrelay.go) is taken as is: every TURN server refuses RFC 6062 TCP relays, and the embedded one relays to this host's own addresses only on its RTC media ports. It replaces the OpenVidu relay generator (ICE port range check, RFC 6062 opt-in, standalone telemetry): - the media port limit stays for every peer, not only this host, as one fenced wrapper over upstream's chain (openviduRelayPortPolicy): TURNSecurity lets the relay reach the other cluster nodes' private addresses, which sit behind the same firewall. The ports come from upstream's getTURNMediaPorts (the ICE port range, else rtc.udp_port plus 3478 with rtc.use_stun_port_as_ice, none with rtc.force_tcp), and packets to other ports are dropped silently as upstream does; a node with only rtc.udp_port used to drop every relayed packet. - turn.enable_rfc6062 is deprecated and ignored: upstream refuses TCP relays unconditionally, and the key shipped in 3.8.0, so it stays parsed (strict config parsing would refuse the files that set it) and logs a warning. - the standalone relay telemetry duplicated upstream's. TURNSecurity's cluster-node peer allowlist, the relay address resolution, the idle TCP timeout and the quota default stay: upstream declined to limit relay peers to the media nodes. The allow-list check reuses upstream's isRestrictedPeerIP, so the carrier-grade NAT, NAT64 and other special ranges count as restricted too. Upstream's new turnrelay_test.go passes with NewTurnServer's rc argument fenced in. The upstream PRs carried unfenced since 3.9.0 (livekit#4907, livekit#4910, livekit#4911) merge away with no leftover delta. Our tests follow psrpc's move from NewRedisMessageBus to redisbus.New. go.mod takes upstream's versions and keeps our requires (go mod tidy); wire_gen.go merged on its own, and regenerating it only differs in the fence comments. The failed-tests step added upstream to the Test workflow also reads the analytics integration log. Verified: go build and go vet, golangci-lint on the touched packages, go test -short ./... with a Redis on localhost:6379, the 116 TURN tests including upstream's relay policy tests through TURNSecurity, and the analytics integration tests (go test -tags integration ./openvidu/analytics/...). Co-Authored-By: Claude Fable 5.1 <[email protected]>
pabloFuente
added a commit
to OpenVidu/openvidu-livekit
that referenced
this pull request
Nov 10, 2026
The v1.13.11 sync (768b085) took LiveKit's refusal of RFC 6062 TCP relays (livekit#4992) as is and made turn.enable_rfc6062 deprecated and ignored. The key has been public since 3.8.0 and the TURN security guide documents it, so a deployment that sets it lost its TCP relays: a breaking change. TURNSecurity's peer allowlist and the port limit already cover what upstream guards against (relays to other services of the hosts, such as SSH), so the opt-in stays. openviduTCPRelayAddrGen (turn_security.go) takes the place of upstream's newRejectTCPRelayAddressGenerator in NewTurnServer, one fenced line in turn.go. With the key false, the default, it refuses TCP Allocate and Connect with an error that wraps upstream's ErrTURNTCPRelayDisabled. With it true, TCP Allocate goes through and Connect only reaches the ICE port range, every Connect refused without one, as in 3.9. pion/turn checks every TCP peer against TURNSecurity, as for UDP. The startup log moves into the existing TURNSecurity fence, and the empty fence the old generator left in statsconn.go is removed, so that file is upstream's again. The tests of 3.9 come back: the four config tests, the two end-to-end TCP allocation tests and the generator's unit tests. The sample configs document the key again and CHANGELOG-openvidu.md drops the deprecation. The changelog also records the other change the sync made to the TURN security rules: with turn.allow_restricted_peer_cidrs set, upstream's wider definition of restricted addresses (0.0.0.0/8, carrier-grade NAT, 198.18.0.0/15, 240.0.0.0/4, NAT64) applies. Verified with go build, go vet, golangci-lint (0 issues) and go test -short of every package except test/, which could not bind its ports while a local OpenVidu deployment was running. Co-Authored-By: Claude Opus 5.5 <[email protected]>
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.
Embedded TURN let any participant relay to arbitrary peers (#4924):
The issue also suggested allowing relays only to the media node's IPs. That is not done here because, with the changes above, the remaining relays do not form a security concern: they are UDP only, to public addresses outside the restricted ranges, and reach a peer exactly as the client could from its own address (no amplification, no spoofed source). This is standard TURN behavior. Limiting destinations to media nodes would also require TURN server to know media node all endpoints, for little benefit.