[GH-ISSUE #5544] TURN-TLS health probe opens raw TCP instead of TLS for turns:// URIs #11435

Closed
opened 2026-08-05 01:29:41 -04:00 by saavagebueno · 1 comment
Owner

Originally created by @permanetjv on GitHub (Mar 8, 2026).
Original GitHub issue: https://github.com/netbirdio/netbird/issues/5544

Summary

netbird status --detail reports turns://... endpoints as unavailable even when the TURN-TLS listener is healthy and standard TLS TURN clients can allocate successfully.

What I found

The client health probe in client/internal/relay/relay.go treats turns: as plain TCP:

case stun.ProtoTypeTCP:
    tcpConn, err := nbnet.NewDialer().DialContext(ctx, "tcp", turnServerAddr)
    ...
    conn = turn.NewSTUNConn(tcpConn)

probeTURN() then sends TURN over that raw TCP connection without performing a TLS handshake first.

Reproduction

Environment:

  • NetBird clients 0.66.1 and 0.66.2
  • TURN-TLS listener on turn.permanet.io:5349

Observed in netbird status --detail on both macOS and Linux:

[turns:turn.permanet.io:5349?transport=tcp] is Unavailable, reason: allocate: turn: failed to retransmit transaction ...

But a real TLS TURN client against the same endpoint succeeds:

turnutils_uclient -v -t -S -W "$TURN_SECRET" -u test -p 5349 -e 1.1.1.1 -r 80 -n 1 turn.permanet.io

That completes TLS connect and TURN allocation successfully.

Expected

For turns: URIs, the health probe should perform a TLS handshake before sending STUN/TURN.

Actual

The probe sends TURN over raw TCP to the TLS port, so a correct TURN-TLS server times out and is reported unavailable.

Originally created by @permanetjv on GitHub (Mar 8, 2026). Original GitHub issue: https://github.com/netbirdio/netbird/issues/5544 ## Summary `netbird status --detail` reports `turns://...` endpoints as unavailable even when the TURN-TLS listener is healthy and standard TLS TURN clients can allocate successfully. ## What I found The client health probe in `client/internal/relay/relay.go` treats `turns:` as plain TCP: ```go case stun.ProtoTypeTCP: tcpConn, err := nbnet.NewDialer().DialContext(ctx, "tcp", turnServerAddr) ... conn = turn.NewSTUNConn(tcpConn) ``` `probeTURN()` then sends TURN over that raw TCP connection without performing a TLS handshake first. ## Reproduction Environment: - NetBird clients 0.66.1 and 0.66.2 - TURN-TLS listener on `turn.permanet.io:5349` Observed in `netbird status --detail` on both macOS and Linux: ```text [turns:turn.permanet.io:5349?transport=tcp] is Unavailable, reason: allocate: turn: failed to retransmit transaction ... ``` But a real TLS TURN client against the same endpoint succeeds: ```bash turnutils_uclient -v -t -S -W "$TURN_SECRET" -u test -p 5349 -e 1.1.1.1 -r 80 -n 1 turn.permanet.io ``` That completes TLS connect and TURN allocation successfully. ## Expected For `turns:` URIs, the health probe should perform a TLS handshake before sending STUN/TURN. ## Actual The probe sends TURN over raw TCP to the TLS port, so a correct TURN-TLS server times out and is reported unavailable.
Author
Owner

@permanetjv commented on GitHub (Mar 8, 2026):

Closing this because it was filed without approval. Sorry for the noise.

<!-- gh-comment-id:4019884209 --> @permanetjv commented on GitHub (Mar 8, 2026): Closing this because it was filed without approval. Sorry for the noise.
Sign in to join this conversation.
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: DYNR/netbird#11435