13

WebRTC makes use of TURN-Servers if the direct peer to peer connection fails. There are two protocols available: TURN and TURNS (TURN over TLS).

According to the MDN:

All data transferred using WebRTC is encrypted.

If all data sent via a data channel is end to end encrypted with DTLS by default, why does TURNS even exists?

Isn't TURNS only encrypting the connection between the server and the client?

Wouldn't that be unnecessary overhead?

EDIT - Why not simply use plain TURNwithout any server/client encryption? I know what TURN-servers are used for, but I do not get why we would want to encrypt the connection to the TURN-server. Because of the DTLS encryption between the peers, the TURN-server cannot read any of the transferred data. Hence nobody else can, so why even bother adding another layer of encryption?

1

4 Answers 4

7

One reason is for better firewall traversal. You can get past some stricter firewalls with TURN/TLS over port 443 to disguise WebRTC traffic as HTTPS traffic.

3

In addition to better firewall traversal. Without wrapping the TURN payload in TLS, An eavesdropper would be able to see the IP address of the peer (the destination of the relayed traffic). Depending on your threat model this may or may not be important.

Excerpt from the RFC

The primary protocol content of the messages is the IP address of the peer. If it is important to prevent an eavesdropper on a TURN connection from learning this, TURN can be run over TLS.

rfc5766#section-17.1.6

1
  • Isn't the TURN server receiving/sending packets from/to the each peer? The IPv4/6 source/destination addresses and ports can't be protected with TLS, else the packet couldn't be routed to its destination.
    – thinkski
    Commented Aug 30, 2021 at 23:20
1

From my understanding Traversal Using Relays around NAT (TURN) seems more aimed towards better traversal of firewalls behind NAT, RFC5766. So, although the TURN server handles encryption (like a web server handles HTTPS), it's not the primary use of TURN servers.

TURN Server

If direct communication is allowed, but the firewall blocked signalling, no initiation would take place: no P2P communication would be established.

WebRTC

Image source, and further explanation

TURN's purpose of firewall traversal could equally be achieved by using an SSL VPN or OpenVPN to circumvent restrict firewall(s).

2
  • 2
    This answer doesn't seem to include anything about the difference between TURN and TURNS.
    – Macil
    Commented Apr 30, 2018 at 23:58
  • 1
    Thanks for your answer! :) But my question aims at why we need to encrypt the TURN connection with TLS. As far as I understand TLS is obsolete in this case. Commented May 1, 2018 at 8:18
0

There are three transport modes - TURN/UDP, TURN/TCP & TURN/TLS. Depending on LAN FW policy, browser will select the least restrictive transport mode.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .