idnits 2.17.1 draft-ietf-tram-turnbis-13.txt: Checking boilerplate required by RFC 5378 and the IETF Trust (see https://trustee.ietf.org/license-info): ---------------------------------------------------------------------------- No issues found here. Checking nits according to https://www.ietf.org/id-info/1id-guidelines.txt: ---------------------------------------------------------------------------- No issues found here. Checking nits according to https://www.ietf.org/id-info/checklist : ---------------------------------------------------------------------------- ** The abstract seems to contain references ([RFC6156], [RFC5766]), which it shouldn't. Please replace those with straight textual mentions of the documents in question. -- The document has examples using IPv4 documentation addresses according to RFC6890, but does not use any IPv6 documentation addresses. Maybe there should be IPv6 examples, too? -- The draft header indicates that this document obsoletes RFC6156, but the abstract doesn't seem to directly say this. It does mention RFC6156 though, so this could be OK. Miscellaneous warnings: ---------------------------------------------------------------------------- == The copyright year in the IETF Trust and authors Copyright Line does not match the current year -- The document date (February 11, 2018) is 2266 days in the past. Is this intentional? Checking references for intended status: Proposed Standard ---------------------------------------------------------------------------- (See RFCs 3967 and 4897 for information about using normative references to lower-maturity documents in RFCs) == Missing Reference: '0x4001' is mentioned on line 662, but not defined == Outdated reference: A later version (-21) exists of draft-ietf-tram-stunbis-15 ** Obsolete normative reference: RFC 5246 (Obsoleted by RFC 8446) ** Obsolete normative reference: RFC 6347 (Obsoleted by RFC 9147) ** Obsolete normative reference: RFC 6555 (Obsoleted by RFC 8305) == Outdated reference: A later version (-20) exists of draft-ietf-tram-stun-pmtud-06 -- Obsolete informational reference (is this intentional?): RFC 5245 (Obsoleted by RFC 8445, RFC 8839) -- Obsolete informational reference (is this intentional?): RFC 5766 (Obsoleted by RFC 8656) -- Obsolete informational reference (is this intentional?): RFC 6156 (Obsoleted by RFC 8656) Summary: 4 errors (**), 0 flaws (~~), 4 warnings (==), 6 comments (--). Run idnits with the --verbose option for more detailed information about the items above. -------------------------------------------------------------------------------- 2 TRAM WG T. Reddy, Ed. 3 Internet-Draft McAfee 4 Obsoletes: 5766,6156 (if approved) A. Johnston, Ed. 5 Intended status: Standards Track Rowan University 6 Expires: August 15, 2018 P. Matthews 7 Alcatel-Lucent 8 J. Rosenberg 9 jdrosen.net 10 February 11, 2018 12 Traversal Using Relays around NAT (TURN): Relay Extensions to Session 13 Traversal Utilities for NAT (STUN) 14 draft-ietf-tram-turnbis-13 16 Abstract 18 If a host is located behind a NAT, then in certain situations it can 19 be impossible for that host to communicate directly with other hosts 20 (peers). In these situations, it is necessary for the host to use 21 the services of an intermediate node that acts as a communication 22 relay. This specification defines a protocol, called TURN (Traversal 23 Using Relays around NAT), that allows the host to control the 24 operation of the relay and to exchange packets with its peers using 25 the relay. TURN differs from some other relay control protocols in 26 that it allows a client to communicate with multiple peers using a 27 single relay address. 29 The TURN protocol was designed to be used as part of the ICE 30 (Interactive Connectivity Establishment) approach to NAT traversal, 31 though it also can be used without ICE. 33 This document obsoletes [RFC5766] and [RFC6156]. 35 Status of This Memo 37 This Internet-Draft is submitted in full conformance with the 38 provisions of BCP 78 and BCP 79. 40 Internet-Drafts are working documents of the Internet Engineering 41 Task Force (IETF). Note that other groups may also distribute 42 working documents as Internet-Drafts. The list of current Internet- 43 Drafts is at https://datatracker.ietf.org/drafts/current/. 45 Internet-Drafts are draft documents valid for a maximum of six months 46 and may be updated, replaced, or obsoleted by other documents at any 47 time. It is inappropriate to use Internet-Drafts as reference 48 material or to cite them other than as "work in progress." 49 This Internet-Draft will expire on August 15, 2018. 51 Copyright Notice 53 Copyright (c) 2018 IETF Trust and the persons identified as the 54 document authors. All rights reserved. 56 This document is subject to BCP 78 and the IETF Trust's Legal 57 Provisions Relating to IETF Documents 58 (https://trustee.ietf.org/license-info) in effect on the date of 59 publication of this document. Please review these documents 60 carefully, as they describe your rights and restrictions with respect 61 to this document. Code Components extracted from this document must 62 include Simplified BSD License text as described in Section 4.e of 63 the Trust Legal Provisions and are provided without warranty as 64 described in the Simplified BSD License. 66 Table of Contents 68 1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . 4 69 2. Overview of Operation . . . . . . . . . . . . . . . . . . . . 6 70 2.1. Transports . . . . . . . . . . . . . . . . . . . . . . . 8 71 2.2. Allocations . . . . . . . . . . . . . . . . . . . . . . . 9 72 2.3. Permissions . . . . . . . . . . . . . . . . . . . . . . . 11 73 2.4. Send Mechanism . . . . . . . . . . . . . . . . . . . . . 12 74 2.5. Channels . . . . . . . . . . . . . . . . . . . . . . . . 14 75 2.6. Unprivileged TURN Servers . . . . . . . . . . . . . . . . 16 76 2.7. Avoiding IP Fragmentation . . . . . . . . . . . . . . . . 16 77 2.8. RTP Support . . . . . . . . . . . . . . . . . . . . . . . 18 78 2.9. Happy Eyeballs for TURN . . . . . . . . . . . . . . . . . 18 79 3. Terminology . . . . . . . . . . . . . . . . . . . . . . . . . 19 80 4. Discovery of TURN server . . . . . . . . . . . . . . . . . . 21 81 4.1. TURN URI Scheme Semantics . . . . . . . . . . . . . . . . 21 82 5. General Behavior . . . . . . . . . . . . . . . . . . . . . . 21 83 6. Allocations . . . . . . . . . . . . . . . . . . . . . . . . . 24 84 7. Creating an Allocation . . . . . . . . . . . . . . . . . . . 25 85 7.1. Sending an Allocate Request . . . . . . . . . . . . . . . 25 86 7.2. Receiving an Allocate Request . . . . . . . . . . . . . . 26 87 7.3. Receiving an Allocate Success Response . . . . . . . . . 31 88 7.4. Receiving an Allocate Error Response . . . . . . . . . . 32 89 8. Refreshing an Allocation . . . . . . . . . . . . . . . . . . 34 90 8.1. Sending a Refresh Request . . . . . . . . . . . . . . . . 34 91 8.2. Receiving a Refresh Request . . . . . . . . . . . . . . . 35 92 8.3. Receiving a Refresh Response . . . . . . . . . . . . . . 36 93 9. Permissions . . . . . . . . . . . . . . . . . . . . . . . . . 36 94 10. CreatePermission . . . . . . . . . . . . . . . . . . . . . . 37 95 10.1. Forming a CreatePermission Request . . . . . . . . . . . 37 96 10.2. Receiving a CreatePermission Request . . . . . . . . . . 38 97 10.3. Receiving a CreatePermission Response . . . . . . . . . 38 98 11. Send and Data Methods . . . . . . . . . . . . . . . . . . . . 39 99 11.1. Forming a Send Indication . . . . . . . . . . . . . . . 39 100 11.2. Receiving a Send Indication . . . . . . . . . . . . . . 39 101 11.3. Receiving a UDP Datagram . . . . . . . . . . . . . . . . 40 102 11.4. Receiving a Data Indication . . . . . . . . . . . . . . 40 103 11.5. Receiving an ICMP Packet . . . . . . . . . . . . . . . . 41 104 11.6. Receiving a Data Indication with an ICMP attribute . . . 42 105 12. Channels . . . . . . . . . . . . . . . . . . . . . . . . . . 42 106 12.1. Sending a ChannelBind Request . . . . . . . . . . . . . 44 107 12.2. Receiving a ChannelBind Request . . . . . . . . . . . . 44 108 12.3. Receiving a ChannelBind Response . . . . . . . . . . . . 46 109 12.4. The ChannelData Message . . . . . . . . . . . . . . . . 46 110 12.5. Sending a ChannelData Message . . . . . . . . . . . . . 46 111 12.6. Receiving a ChannelData Message . . . . . . . . . . . . 47 112 12.7. Relaying Data from the Peer . . . . . . . . . . . . . . 48 113 13. Packet Translations . . . . . . . . . . . . . . . . . . . . . 48 114 13.1. IPv4-to-IPv6 Translations . . . . . . . . . . . . . . . 49 115 13.2. IPv6-to-IPv6 Translations . . . . . . . . . . . . . . . 49 116 13.3. IPv6-to-IPv4 Translations . . . . . . . . . . . . . . . 51 117 14. IP Header Fields . . . . . . . . . . . . . . . . . . . . . . 52 118 15. STUN Methods . . . . . . . . . . . . . . . . . . . . . . . . 53 119 16. STUN Attributes . . . . . . . . . . . . . . . . . . . . . . . 54 120 16.1. CHANNEL-NUMBER . . . . . . . . . . . . . . . . . . . . . 54 121 16.2. LIFETIME . . . . . . . . . . . . . . . . . . . . . . . . 54 122 16.3. XOR-PEER-ADDRESS . . . . . . . . . . . . . . . . . . . . 55 123 16.4. DATA . . . . . . . . . . . . . . . . . . . . . . . . . . 55 124 16.5. XOR-RELAYED-ADDRESS . . . . . . . . . . . . . . . . . . 55 125 16.6. REQUESTED-ADDRESS-FAMILY . . . . . . . . . . . . . . . . 55 126 16.7. EVEN-PORT . . . . . . . . . . . . . . . . . . . . . . . 56 127 16.8. REQUESTED-TRANSPORT . . . . . . . . . . . . . . . . . . 56 128 16.9. DONT-FRAGMENT . . . . . . . . . . . . . . . . . . . . . 57 129 16.10. RESERVATION-TOKEN . . . . . . . . . . . . . . . . . . . 57 130 16.11. ADDITIONAL-ADDRESS-FAMILY . . . . . . . . . . . . . . . 57 131 16.12. ADDRESS-ERROR-CODE Attribute . . . . . . . . . . . . . . 57 132 16.13. ICMP Attribute . . . . . . . . . . . . . . . . . . . . . 58 133 17. STUN Error Response Codes . . . . . . . . . . . . . . . . . . 58 134 18. Detailed Example . . . . . . . . . . . . . . . . . . . . . . 59 135 19. Security Considerations . . . . . . . . . . . . . . . . . . . 67 136 19.1. Outsider Attacks . . . . . . . . . . . . . . . . . . . . 67 137 19.1.1. Obtaining Unauthorized Allocations . . . . . . . . . 67 138 19.1.2. Offline Dictionary Attacks . . . . . . . . . . . . . 67 139 19.1.3. Faked Refreshes and Permissions . . . . . . . . . . 68 140 19.1.4. Fake Data . . . . . . . . . . . . . . . . . . . . . 68 141 19.1.5. Impersonating a Server . . . . . . . . . . . . . . . 69 142 19.1.6. Eavesdropping Traffic . . . . . . . . . . . . . . . 69 143 19.1.7. TURN Loop Attack . . . . . . . . . . . . . . . . . . 70 144 19.2. Firewall Considerations . . . . . . . . . . . . . . . . 70 145 19.2.1. Faked Permissions . . . . . . . . . . . . . . . . . 71 146 19.2.2. Blacklisted IP Addresses . . . . . . . . . . . . . . 71 147 19.2.3. Running Servers on Well-Known Ports . . . . . . . . 72 148 19.3. Insider Attacks . . . . . . . . . . . . . . . . . . . . 72 149 19.3.1. DoS against TURN Server . . . . . . . . . . . . . . 72 150 19.3.2. Anonymous Relaying of Malicious Traffic . . . . . . 72 151 19.3.3. Manipulating Other Allocations . . . . . . . . . . . 73 152 19.4. Tunnel Amplification Attack . . . . . . . . . . . . . . 73 153 19.5. Other Considerations . . . . . . . . . . . . . . . . . . 74 154 20. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 74 155 21. IAB Considerations . . . . . . . . . . . . . . . . . . . . . 75 156 22. Changes since RFC 5766 . . . . . . . . . . . . . . . . . . . 77 157 23. Acknowledgements . . . . . . . . . . . . . . . . . . . . . . 77 158 24. References . . . . . . . . . . . . . . . . . . . . . . . . . 77 159 24.1. Normative References . . . . . . . . . . . . . . . . . . 77 160 24.2. Informative References . . . . . . . . . . . . . . . . . 79 161 Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . 82 163 1. Introduction 165 A host behind a NAT may wish to exchange packets with other hosts, 166 some of which may also be behind NATs. To do this, the hosts 167 involved can use "hole punching" techniques (see [RFC5128]) in an 168 attempt discover a direct communication path; that is, a 169 communication path that goes from one host to another through 170 intervening NATs and routers, but does not traverse any relays. 172 As described in [RFC5128] and [RFC4787], hole punching techniques 173 will fail if both hosts are behind NATs that are not well behaved. 174 For example, if both hosts are behind NATs that have a mapping 175 behavior of "address-dependent mapping" or "address- and port- 176 dependent mapping", then hole punching techniques generally fail. 178 When a direct communication path cannot be found, it is necessary to 179 use the services of an intermediate host that acts as a relay for the 180 packets. This relay typically sits in the public Internet and relays 181 packets between two hosts that both sit behind NATs. 183 This specification defines a protocol, called TURN, that allows a 184 host behind a NAT (called the TURN client) to request that another 185 host (called the TURN server) act as a relay. The client can arrange 186 for the server to relay packets to and from certain other hosts 187 (called peers) and can control aspects of how the relaying is done. 188 The client does this by obtaining an IP address and port on the 189 server, called the relayed transport address. When a peer sends a 190 packet to the relayed transport address, the server relays the packet 191 to the client. When the client sends a data packet to the server, 192 the server relays it to the appropriate peer using the relayed 193 transport address as the source. 195 A client using TURN must have some way to communicate the relayed 196 transport address to its peers, and to learn each peer's IP address 197 and port (more precisely, each peer's server-reflexive transport 198 address, see Section 2). How this is done is out of the scope of the 199 TURN protocol. One way this might be done is for the client and 200 peers to exchange email messages. Another way is for the client and 201 its peers to use a special-purpose "introduction" or "rendezvous" 202 protocol (see [RFC5128] for more details). 204 If TURN is used with ICE [RFC5245], then the relayed transport 205 address and the IP addresses and ports of the peers are included in 206 the ICE candidate information that the rendezvous protocol must 207 carry. For example, if TURN and ICE are used as part of a multimedia 208 solution using SIP [RFC3261], then SIP serves the role of the 209 rendezvous protocol, carrying the ICE candidate information inside 210 the body of SIP messages. If TURN and ICE are used with some other 211 rendezvous protocol, then [I-D.rosenberg-mmusic-ice-nonsip] provides 212 guidance on the services the rendezvous protocol must perform. 214 Though the use of a TURN server to enable communication between two 215 hosts behind NATs is very likely to work, it comes at a high cost to 216 the provider of the TURN server, since the server typically needs a 217 high-bandwidth connection to the Internet. As a consequence, it is 218 best to use a TURN server only when a direct communication path 219 cannot be found. When the client and a peer use ICE to determine the 220 communication path, ICE will use hole punching techniques to search 221 for a direct path first and only use a TURN server when a direct path 222 cannot be found. 224 TURN was originally invented to support multimedia sessions signaled 225 using SIP. Since SIP supports forking, TURN supports multiple peers 226 per relayed transport address; a feature not supported by other 227 approaches (e.g., SOCKS [RFC1928]). However, care has been taken to 228 make sure that TURN is suitable for other types of applications. 230 TURN was designed as one piece in the larger ICE approach to NAT 231 traversal. Implementors of TURN are urged to investigate ICE and 232 seriously consider using it for their application. However, it is 233 possible to use TURN without ICE. 235 TURN is an extension to the STUN (Session Traversal Utilities for 236 NAT) protocol [I-D.ietf-tram-stunbis]. Most, though not all, TURN 237 messages are STUN-formatted messages. A reader of this document 238 should be familiar with STUN. 240 2. Overview of Operation 242 This section gives an overview of the operation of TURN. It is non- 243 normative. 245 In a typical configuration, a TURN client is connected to a private 246 network [RFC1918] and through one or more NATs to the public 247 Internet. On the public Internet is a TURN server. Elsewhere in the 248 Internet are one or more peers with which the TURN client wishes to 249 communicate. These peers may or may not be behind one or more NATs. 250 The client uses the server as a relay to send packets to these peers 251 and to receive packets from these peers. 253 Peer A 254 Server-Reflexive +---------+ 255 Transport Address | | 256 192.0.2.150:32102 | | 257 | /| | 258 TURN | / ^| Peer A | 259 Client's Server | / || | 260 Host Transport Transport | // || | 261 Address Address | // |+---------+ 262 198.51.100.2:49721 192.0.2.15:3478 |+-+ // Peer A 263 | | ||N| / Host Transport 264 | +-+ | ||A|/ Address 265 | | | | v|T| 203.0.113.2:49582 266 | | | | /+-+ 267 +---------+| | | |+---------+ / +---------+ 268 | || |N| || | // | | 269 | TURN |v | | v| TURN |/ | | 270 | Client |----|A|----------| Server |------------------| Peer B | 271 | | | |^ | |^ ^| | 272 | | |T|| | || || | 273 +---------+ | || +---------+| |+---------+ 274 | || | | 275 | || | | 276 +-+| | | 277 | | | 278 | | | 279 Client's | Peer B 280 Server-Reflexive Relayed Transport 281 Transport Address Transport Address Address 282 192.0.2.1:7000 192.0.2.15:50000 192.0.2.210:49191 284 Figure 1 286 Figure 1 shows a typical deployment. In this figure, the TURN client 287 and the TURN server are separated by a NAT, with the client on the 288 private side and the server on the public side of the NAT. This NAT 289 is assumed to be a "bad" NAT; for example, it might have a mapping 290 property of "address-and-port-dependent mapping" (see [RFC4787]). 292 The client talks to the server from a (IP address, port) combination 293 called the client's HOST TRANSPORT ADDRESS. (The combination of an 294 IP address and port is called a TRANSPORT ADDRESS.) 296 The client sends TURN messages from its host transport address to a 297 transport address on the TURN server that is known as the TURN SERVER 298 TRANSPORT ADDRESS. The client learns the TURN server transport 299 address through some unspecified means (e.g., configuration), and 300 this address is typically used by many clients simultaneously. 302 Since the client is behind a NAT, the server sees packets from the 303 client as coming from a transport address on the NAT itself. This 304 address is known as the client's SERVER-REFLEXIVE transport address; 305 packets sent by the server to the client's server-reflexive transport 306 address will be forwarded by the NAT to the client's host transport 307 address. 309 The client uses TURN commands to create and manipulate an ALLOCATION 310 on the server. An allocation is a data structure on the server. 311 This data structure contains, amongst other things, the RELAYED 312 TRANSPORT ADDRESS for the allocation. The relayed transport address 313 is the transport address on the server that peers can use to have the 314 server relay data to the client. An allocation is uniquely 315 identified by its relayed transport address. 317 Once an allocation is created, the client can send application data 318 to the server along with an indication of to which peer the data is 319 to be sent, and the server will relay this data to the appropriate 320 peer. The client sends the application data to the server inside a 321 TURN message; at the server, the data is extracted from the TURN 322 message and sent to the peer in a UDP datagram. In the reverse 323 direction, a peer can send application data in a UDP datagram to the 324 relayed transport address for the allocation; the server will then 325 encapsulate this data inside a TURN message and send it to the client 326 along with an indication of which peer sent the data. Since the TURN 327 message always contains an indication of which peer the client is 328 communicating with, the client can use a single allocation to 329 communicate with multiple peers. 331 When the peer is behind a NAT, then the client must identify the peer 332 using its server-reflexive transport address rather than its host 333 transport address. For example, to send application data to Peer A 334 in the example above, the client must specify 192.0.2.150:32102 (Peer 335 A's server-reflexive transport address) rather than 203.0.113.2:49582 336 (Peer A's host transport address). 338 Each allocation on the server belongs to a single client and has 339 exactly one relayed transport address that is used only by that 340 allocation. Thus, when a packet arrives at a relayed transport 341 address on the server, the server knows for which client the data is 342 intended. 344 The client may have multiple allocations on a server at the same 345 time. 347 2.1. Transports 349 TURN, as defined in this specification, always uses UDP between the 350 server and the peer. However, this specification allows the use of 351 any one of UDP, TCP, Transport Layer Security (TLS) over TCP or 352 Datagram Transport Layer Security (DTLS) over UDP to carry the TURN 353 messages between the client and the server. 355 +----------------------------+---------------------+ 356 | TURN client to TURN server | TURN server to peer | 357 +----------------------------+---------------------+ 358 | UDP | UDP | 359 | TCP | UDP | 360 | TLS-over-TCP | UDP | 361 | DTLS-over-UDP | UDP | 362 +----------------------------+---------------------+ 364 If TCP or TLS-over-TCP is used between the client and the server, 365 then the server will convert between these transports and UDP 366 transport when relaying data to/from the peer. 368 Since this version of TURN only supports UDP between the server and 369 the peer, it is expected that most clients will prefer to use UDP 370 between the client and the server as well. That being the case, some 371 readers may wonder: Why also support TCP and TLS-over-TCP? 373 TURN supports TCP transport between the client and the server because 374 some firewalls are configured to block UDP entirely. These firewalls 375 block UDP but not TCP, in part because TCP has properties that make 376 the intention of the nodes being protected by the firewall more 377 obvious to the firewall. For example, TCP has a three-way handshake 378 that makes in clearer that the protected node really wishes to have 379 that particular connection established, while for UDP the best the 380 firewall can do is guess which flows are desired by using filtering 381 rules. Also, TCP has explicit connection teardown; while for UDP, 382 the firewall has to use timers to guess when the flow is finished. 384 TURN supports TLS-over-TCP transport and DTLS-over-UDP transport 385 between the client and the server because (D)TLS provides additional 386 security properties not provided by TURN's default digest 387 authentication; properties that some clients may wish to take 388 advantage of. In particular, (D)TLS provides a way for the client to 389 ascertain that it is talking to the correct server, and provides for 390 confidentiality of TURN control messages. TURN does not require 391 (D)TLS because the overhead of using (D)TLS is higher than that of 392 digest authentication; for example, using (D)TLS likely means that 393 most application data will be doubly encrypted (once by (D)TLS and 394 once to ensure it is still encrypted in the UDP datagram). 396 There is an extension to TURN for TCP transport between the server 397 and the peers [RFC6062]. For this reason, allocations that use UDP 398 between the server and the peers are known as UDP allocations, while 399 allocations that use TCP between the server and the peers are known 400 as TCP allocations. This specification describes only UDP 401 allocations. 403 In some applications for TURN, the client may send and receive 404 packets other than TURN packets on the host transport address it uses 405 to communicate with the server. This can happen, for example, when 406 using TURN with ICE. In these cases, the client can distinguish TURN 407 packets from other packets by examining the source address of the 408 arriving packet: those arriving from the TURN server will be TURN 409 packets. The algorithm of demultiplexing packets received from 410 multiple protocols on the host transport address is discussed in 411 [RFC7983]. 413 2.2. Allocations 415 To create an allocation on the server, the client uses an Allocate 416 transaction. The client sends an Allocate request to the server, and 417 the server replies with an Allocate success response containing the 418 allocated relayed transport address. The client can include 419 attributes in the Allocate request that describe the type of 420 allocation it desires (e.g., the lifetime of the allocation). Since 421 relaying data has security implications, the server requires that the 422 client authenticate itself, typically using STUN's long-term 423 credential mechanism or the STUN Extension for Third-Party 424 Authorization [RFC7635], to show that it is authorized to use the 425 server. 427 Once a relayed transport address is allocated, a client must keep the 428 allocation alive. To do this, the client periodically sends a 429 Refresh request to the server. TURN deliberately uses a different 430 method (Refresh rather than Allocate) for refreshes to ensure that 431 the client is informed if the allocation vanishes for some reason. 433 The frequency of the Refresh transaction is determined by the 434 lifetime of the allocation. The default lifetime of an allocation is 435 10 minutes -- this value was chosen to be long enough so that 436 refreshing is not typically a burden on the client, while expiring 437 allocations where the client has unexpectedly quit in a timely 438 manner. However, the client can request a longer lifetime in the 439 Allocate request and may modify its request in a Refresh request, and 440 the server always indicates the actual lifetime in the response. The 441 client must issue a new Refresh transaction within "lifetime" seconds 442 of the previous Allocate or Refresh transaction. Once a client no 443 longer wishes to use an allocation, it should delete the allocation 444 using a Refresh request with a requested lifetime of 0. 446 Both the server and client keep track of a value known as the 447 5-TUPLE. At the client, the 5-tuple consists of the client's host 448 transport address, the server transport address, and the transport 449 protocol used by the client to communicate with the server. At the 450 server, the 5-tuple value is the same except that the client's host 451 transport address is replaced by the client's server-reflexive 452 address, since that is the client's address as seen by the server. 454 Both the client and the server remember the 5-tuple used in the 455 Allocate request. Subsequent messages between the client and the 456 server use the same 5-tuple. In this way, the client and server know 457 which allocation is being referred to. If the client wishes to 458 allocate a second relayed transport address, it must create a second 459 allocation using a different 5-tuple (e.g., by using a different 460 client host address or port). 462 NOTE: While the terminology used in this document refers to 463 5-tuples, the TURN server can store whatever identifier it likes 464 that yields identical results. Specifically, an implementation 465 may use a file-descriptor in place of a 5-tuple to represent a TCP 466 connection. 468 TURN TURN Peer Peer 469 client server A B 470 |-- Allocate request --------------->| | | 471 | | | | 472 |<--------------- Allocate failure --| | | 473 | (401 Unauthenticated) | | | 474 | | | | 475 |-- Allocate request --------------->| | | 476 | | | | 477 |<---------- Allocate success resp --| | | 478 | (192.0.2.15:50000) | | | 479 // // // // 480 | | | | 481 |-- Refresh request ---------------->| | | 482 | | | | 483 |<----------- Refresh success resp --| | | 484 | | | | 486 Figure 2 488 In Figure 2, the client sends an Allocate request to the server 489 without credentials. Since the server requires that all requests be 490 authenticated using STUN's long-term credential mechanism, the server 491 rejects the request with a 401 (Unauthorized) error code. The client 492 then tries again, this time including credentials (not shown). This 493 time, the server accepts the Allocate request and returns an Allocate 494 success response containing (amongst other things) the relayed 495 transport address assigned to the allocation. Sometime later, the 496 client decides to refresh the allocation and thus sends a Refresh 497 request to the server. The refresh is accepted and the server 498 replies with a Refresh success response. 500 2.3. Permissions 502 To ease concerns amongst enterprise IT administrators that TURN could 503 be used to bypass corporate firewall security, TURN includes the 504 notion of permissions. TURN permissions mimic the address-restricted 505 filtering mechanism of NATs that comply with [RFC4787]. 507 An allocation can have zero or more permissions. Each permission 508 consists of an IP address and a lifetime. When the server receives a 509 UDP datagram on the allocation's relayed transport address, it first 510 checks the list of permissions. If the source IP address of the 511 datagram matches a permission, the application data is relayed to the 512 client, otherwise the UDP datagram is silently discarded. 514 A permission expires after 5 minutes if it is not refreshed, and 515 there is no way to explicitly delete a permission. This behavior was 516 selected to match the behavior of a NAT that complies with [RFC4787]. 518 The client can install or refresh a permission using either a 519 CreatePermission request or a ChannelBind request. Using the 520 CreatePermission request, multiple permissions can be installed or 521 refreshed with a single request -- this is important for applications 522 that use ICE. For security reasons, permissions can only be 523 installed or refreshed by transactions that can be authenticated; 524 thus, Send indications and ChannelData messages (which are used to 525 send data to peers) do not install or refresh any permissions. 527 Note that permissions are within the context of an allocation, so 528 adding or expiring a permission in one allocation does not affect 529 other allocations. 531 2.4. Send Mechanism 533 There are two mechanisms for the client and peers to exchange 534 application data using the TURN server. The first mechanism uses the 535 Send and Data methods, the second mechanism uses channels. Common to 536 both mechanisms is the ability of the client to communicate with 537 multiple peers using a single allocated relayed transport address; 538 thus, both mechanisms include a means for the client to indicate to 539 the server which peer should receive the data, and for the server to 540 indicate to the client which peer sent the data. 542 The Send mechanism uses Send and Data indications. Send indications 543 are used to send application data from the client to the server, 544 while Data indications are used to send application data from the 545 server to the client. 547 When using the Send mechanism, the client sends a Send indication to 548 the TURN server containing (a) an XOR-PEER-ADDRESS attribute 549 specifying the (server-reflexive) transport address of the peer and 550 (b) a DATA attribute holding the application data. When the TURN 551 server receives the Send indication, it extracts the application data 552 from the DATA attribute and sends it in a UDP datagram to the peer, 553 using the allocated relay address as the source address. Note that 554 there is no need to specify the relayed transport address, since it 555 is implied by the 5-tuple used for the Send indication. 557 In the reverse direction, UDP datagrams arriving at the relayed 558 transport address on the TURN server are converted into Data 559 indications and sent to the client, with the server-reflexive 560 transport address of the peer included in an XOR-PEER-ADDRESS 561 attribute and the data itself in a DATA attribute. Since the relayed 562 transport address uniquely identified the allocation, the server 563 knows which client should receive the data. 565 Some ICMP (Internet Control Message Protocol) packets arriving at the 566 relayed transport address on the TURN server may be converted into 567 Data indications and sent to the client, with the transport address 568 of the peer included in an XOR-PEER-ADDRESS attribute and the ICMP 569 type and code in a ICMP attribute. ICMP attribute forwarding always 570 uses Data indications containing the XOR-PEER-ADDRESS and ICMP 571 attributes, even when using the channel mechanism to forward UDP 572 data. 574 Send and Data indications cannot be authenticated, since the long- 575 term credential mechanism of STUN does not support authenticating 576 indications. This is not as big an issue as it might first appear, 577 since the client-to-server leg is only half of the total path to the 578 peer. Applications that want proper security should encrypt the data 579 sent between the client and a peer. 581 Because Send indications are not authenticated, it is possible for an 582 attacker to send bogus Send indications to the server, which will 583 then relay these to a peer. To partly mitigate this attack, TURN 584 requires that the client install a permission towards a peer before 585 sending data to it using a Send indication. 587 TURN TURN Peer Peer 588 client server A B 589 | | | | 590 |-- CreatePermission req (Peer A) -->| | | 591 |<-- CreatePermission success resp --| | | 592 | | | | 593 |--- Send ind (Peer A)-------------->| | | 594 | |=== data ===>| | 595 | | | | 596 | |<== data ====| | 597 |<-------------- Data ind (Peer A) --| | | 598 | | | | 599 | | | | 600 |--- Send ind (Peer B)-------------->| | | 601 | | dropped | | 602 | | | | 603 | |<== data ==================| 604 | dropped | | | 605 | | | | 607 Figure 3 609 In Figure 3, the client has already created an allocation and now 610 wishes to send data to its peers. The client first creates a 611 permission by sending the server a CreatePermission request 612 specifying Peer A's (server-reflexive) IP address in the XOR-PEER- 613 ADDRESS attribute; if this was not done, the server would not relay 614 data between the client and the server. The client then sends data 615 to Peer A using a Send indication; at the server, the application 616 data is extracted and forwarded in a UDP datagram to Peer A, using 617 the relayed transport address as the source transport address. When 618 a UDP datagram from Peer A is received at the relayed transport 619 address, the contents are placed into a Data indication and forwarded 620 to the client. Later, the client attempts to exchange data with Peer 621 B; however, no permission has been installed for Peer B, so the Send 622 indication from the client and the UDP datagram from the peer are 623 both dropped by the server. 625 2.5. Channels 627 For some applications (e.g., Voice over IP), the 36 bytes of overhead 628 that a Send indication or Data indication adds to the application 629 data can substantially increase the bandwidth required between the 630 client and the server. To remedy this, TURN offers a second way for 631 the client and server to associate data with a specific peer. 633 This second way uses an alternate packet format known as the 634 ChannelData message. The ChannelData message does not use the STUN 635 header used by other TURN messages, but instead has a 4-byte header 636 that includes a number known as a channel number. Each channel 637 number in use is bound to a specific peer and thus serves as a 638 shorthand for the peer's host transport address. 640 To bind a channel to a peer, the client sends a ChannelBind request 641 to the server, and includes an unbound channel number and the 642 transport address of the peer. Once the channel is bound, the client 643 can use a ChannelData message to send the server data destined for 644 the peer. Similarly, the server can relay data from that peer 645 towards the client using a ChannelData message. 647 Channel bindings last for 10 minutes unless refreshed -- this 648 lifetime was chosen to be longer than the permission lifetime. 649 Channel bindings are refreshed by sending another ChannelBind request 650 rebinding the channel to the peer. Like permissions (but unlike 651 allocations), there is no way to explicitly delete a channel binding; 652 the client must simply wait for it to time out. 654 TURN TURN Peer Peer 655 client server A B 656 | | | | 657 |-- ChannelBind req ---------------->| | | 658 | (Peer A to 0x4001) | | | 659 | | | | 660 |<---------- ChannelBind succ resp --| | | 661 | | | | 662 |-- [0x4001] data ------------------>| | | 663 | |=== data ===>| | 664 | | | | 665 | |<== data ====| | 666 |<------------------ (0x4001) data --| | | 667 | | | | 668 |--- Send ind (Peer A)-------------->| | | 669 | |=== data ===>| | 670 | | | | 671 | |<== data ====| | 672 |<------------------ (0x4001) data --| | | 673 | | | | 675 Figure 4 677 Figure 4 shows the channel mechanism in use. The client has already 678 created an allocation and now wishes to bind a channel to Peer A. To 679 do this, the client sends a ChannelBind request to the server, 680 specifying the transport address of Peer A and a channel number 681 (0x4001). After that, the client can send application data 682 encapsulated inside ChannelData messages to Peer A: this is shown as 683 "(0x4001) data" where 0x4001 is the channel number. When the 684 ChannelData message arrives at the server, the server transfers the 685 data to a UDP datagram and sends it to Peer A (which is the peer 686 bound to channel number 0x4001). 688 In the reverse direction, when Peer A sends a UDP datagram to the 689 relayed transport address, this UDP datagram arrives at the server on 690 the relayed transport address assigned to the allocation. Since the 691 UDP datagram was received from Peer A, which has a channel number 692 assigned to it, the server encapsulates the data into a ChannelData 693 message when sending the data to the client. 695 Once a channel has been bound, the client is free to intermix 696 ChannelData messages and Send indications. In the figure, the client 697 later decides to use a Send indication rather than a ChannelData 698 message to send additional data to Peer A. The client might decide 699 to do this, for example, so it can use the DONT-FRAGMENT attribute 700 (see the next section). However, once a channel is bound, the server 701 will always use a ChannelData message, as shown in the call flow. 703 Note that ChannelData messages can only be used for peers to which 704 the client has bound a channel. In the example above, Peer A has 705 been bound to a channel, but Peer B has not, so application data to 706 and from Peer B would use the Send mechanism. 708 2.6. Unprivileged TURN Servers 710 This version of TURN is designed so that the server can be 711 implemented as an application that runs in user space under commonly 712 available operating systems without requiring special privileges. 713 This design decision was made to make it easy to deploy a TURN 714 server: for example, to allow a TURN server to be integrated into a 715 peer-to-peer application so that one peer can offer NAT traversal 716 services to another peer. 718 This design decision has the following implications for data relayed 719 by a TURN server: 721 o The value of the Diffserv field may not be preserved across the 722 server; 724 o The Time to Live (TTL) field may be reset, rather than 725 decremented, across the server; 727 o The Explicit Congestion Notification (ECN) field may be reset by 728 the server; 730 o There is no end-to-end fragmentation, since the packet is re- 731 assembled at the server. 733 Future work may specify alternate TURN semantics that address these 734 limitations. 736 2.7. Avoiding IP Fragmentation 738 For reasons described in [Frag-Harmful], applications, especially 739 those sending large volumes of data, should try hard to avoid having 740 their packets fragmented. Applications using TCP can more or less 741 ignore this issue because fragmentation avoidance is now a standard 742 part of TCP, but applications using UDP (and thus any application 743 using this version of TURN) must handle fragmentation avoidance 744 themselves. 746 The application running on the client and the peer can take one of 747 two approaches to avoid IP fragmentation. 749 The first approach is to avoid sending large amounts of application 750 data in the TURN messages/UDP datagrams exchanged between the client 751 and the peer. This is the approach taken by most VoIP (Voice-over- 752 IP) applications. In this approach, the application exploits the 753 fact that the IP specification [RFC0791] specifies that IP packets up 754 to 576 bytes should never need to be fragmented. 756 The exact amount of application data that can be included while 757 avoiding fragmentation depends on the details of the TURN session 758 between the client and the server: whether UDP, TCP, or (D)TLS 759 transport is used, whether ChannelData messages or Send/Data 760 indications are used, and whether any additional attributes (such as 761 the DONT-FRAGMENT attribute) are included. Another factor, which is 762 hard to determine, is whether the MTU is reduced somewhere along the 763 path for other reasons, such as the use of IP-in-IP tunneling. 765 As a guideline, sending a maximum of 500 bytes of application data in 766 a single TURN message (by the client on the client-to-server leg) or 767 a UDP datagram (by the peer on the peer-to-server leg) will generally 768 avoid IP fragmentation. To further reduce the chance of 769 fragmentation, it is recommended that the client use ChannelData 770 messages when transferring significant volumes of data, since the 771 overhead of the ChannelData message is less than Send and Data 772 indications. 774 The second approach the client and peer can take to avoid 775 fragmentation is to use a path MTU discovery algorithm to determine 776 the maximum amount of application data that can be sent without 777 fragmentation. The classic path MTU discovery algorithm defined in 778 [RFC1191] may not be able to discover the MTU of the transmission 779 path between the client and the peer since: 781 - a probe packet with DF bit set to test a path for a larger MTU 782 can be dropped by routers, or 784 - ICMP error messages can be dropped by middle boxes. 786 As a result, the client and server need to use a path MTU discovery 787 algorithm that does not require ICMP messages. The Packetized Path 788 MTU Discovery algorithm defined in [RFC4821] is one such algorithm. 790 [I-D.ietf-tram-stun-pmtud] is an implementation of [RFC4821] that 791 uses STUN to discover the path MTU, and so might be a suitable 792 approach to be used in conjunction with a TURN server that supports 793 the DONT-FRAGMENT attribute. When the client includes the DONT- 794 FRAGMENT attribute in a Send indication, this tells the server to set 795 the DF bit in the resulting UDP datagram that it sends to the peer. 796 Since some servers may be unable to set the DF bit, the client should 797 also include this attribute in the Allocate request -- any server 798 that does not support the DONT-FRAGMENT attribute will indicate this 799 by rejecting the Allocate request. 801 2.8. RTP Support 803 One of the envisioned uses of TURN is as a relay for clients and 804 peers wishing to exchange real-time data (e.g., voice or video) using 805 RTP. To facilitate the use of TURN for this purpose, TURN includes 806 some special support for older versions of RTP. 808 Old versions of RTP [RFC3550] required that the RTP stream be on an 809 even port number and the associated RTP Control Protocol (RTCP) 810 stream, if present, be on the next highest port. To allow clients to 811 work with peers that still require this, TURN allows the client to 812 request that the server allocate a relayed transport address with an 813 even port number, and to optionally request the server reserve the 814 next-highest port number for a subsequent allocation. 816 2.9. Happy Eyeballs for TURN 818 If an IPv4 path to reach a TURN server is found, but the TURN 819 server's IPv6 path is not working, a dual-stack TURN client can 820 experience a significant connection delay compared to an IPv4-only 821 TURN client. To overcome these connection setup problems, the TURN 822 client MUST query both A and AAAA records for the TURN server 823 specified using a domain name and try connecting to the TURN server 824 using both IPv6 and IPv4 addresses in a fashion similar to the Happy 825 Eyeballs mechanism defined in [RFC6555]. The TURN client performs 826 the following steps based on the transport protocol being used to 827 connect to the TURN server. 829 o For TCP or TLS-over-TCP, initiate TCP connection to both IP 830 address families as discussed in [RFC6555], and use the first TCP 831 connection that is established. If connections are established on 832 both IP address families then terminate the TCP connection using 833 the IP address family with lower precedence [RFC6724]. 835 o For clear text UDP, send TURN Allocate requests to both IP address 836 families as discussed in [RFC6555], without authentication 837 information. If the TURN server requires authentication, it will 838 send back a 401 unauthenticated response and the TURN client uses 839 the first UDP connection on which a 401 error response is 840 received. If a 401 error response is received from both IP 841 address families then the TURN client can silently abandon the UDP 842 connection on the IP address family with lower precedence. If the 843 TURN server does not require authentication (as described in 844 Section 9 of [RFC8155]), it is possible for both Allocate requests 845 to succeed. In this case, the TURN client sends a Refresh with 846 LIFETIME value of 0 on the allocation using the IP address family 847 with lower precedence to delete the allocation. 849 o For DTLS over UDP, initiate DTLS handshake to both IP address 850 families as discussed in [RFC6555] and use the first DTLS session 851 that is established. If the DTLS session is established on both 852 IP address families then the client sends DTLS close_notify alert 853 to terminate the DTLS session using the IP address family with 854 lower precedence. If TURN over DTLS server has been configured to 855 require a cookie exchange (Section 4.2 in [RFC6347]) and 856 HelloVerifyRequest is received from the TURN servers on both IP 857 address families then the client can silently abandon the 858 connection on the IP address family with lower precedence. 860 3. Terminology 862 The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", 863 "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this 864 document are to be interpreted as described in RFC 2119 [RFC2119]. 866 Readers are expected to be familiar with [I-D.ietf-tram-stunbis] and 867 the terms defined there. 869 The following terms are used in this document: 871 TURN: The protocol spoken between a TURN client and a TURN server. 872 It is an extension to the STUN protocol [I-D.ietf-tram-stunbis]. 873 The protocol allows a client to allocate and use a relayed 874 transport address. 876 TURN client: A STUN client that implements this specification. 878 TURN server: A STUN server that implements this specification. It 879 relays data between a TURN client and its peer(s). 881 Peer: A host with which the TURN client wishes to communicate. The 882 TURN server relays traffic between the TURN client and its 883 peer(s). The peer does not interact with the TURN server using 884 the protocol defined in this document; rather, the peer receives 885 data sent by the TURN server and the peer sends data towards the 886 TURN server. 888 Transport Address: The combination of an IP address and a port. 890 Host Transport Address: A transport address on a client or a peer. 892 Server-Reflexive Transport Address: A transport address on the 893 "public side" of a NAT. This address is allocated by the NAT to 894 correspond to a specific host transport address. 896 Relayed Transport Address: A transport address on the TURN server 897 that is used for relaying packets between the client and a peer. 898 A peer sends to this address on the TURN server, and the packet is 899 then relayed to the client. 901 TURN Server Transport Address: A transport address on the TURN 902 server that is used for sending TURN messages to the server. This 903 is the transport address that the client uses to communicate with 904 the server. 906 Peer Transport Address: The transport address of the peer as seen by 907 the server. When the peer is behind a NAT, this is the peer's 908 server-reflexive transport address. 910 Allocation: The relayed transport address granted to a client 911 through an Allocate request, along with related state, such as 912 permissions and expiration timers. 914 5-tuple: The combination (client IP address and port, server IP 915 address and port, and transport protocol (currently one of UDP, 916 TCP, or (D)TLS)) used to communicate between the client and the 917 server. The 5-tuple uniquely identifies this communication 918 stream. The 5-tuple also uniquely identifies the Allocation on 919 the server. 921 Channel: A channel number and associated peer transport address. 922 Once a channel number is bound to a peer's transport address, the 923 client and server can use the more bandwidth-efficient ChannelData 924 message to exchange data. 926 Permission: The IP address and transport protocol (but not the port) 927 of a peer that is permitted to send traffic to the TURN server and 928 have that traffic relayed to the TURN client. The TURN server 929 will only forward traffic to its client from peers that match an 930 existing permission. 932 Realm: A string used to describe the server or a context within the 933 server. The realm tells the client which username and password 934 combination to use to authenticate requests. 936 Nonce: A string chosen at random by the server and included in the 937 message-digest. To prevent replay attacks, the server should 938 change the nonce regularly. 940 (D)TLS: This term is used for statements that apply to both 941 Transport Layer Security [RFC5246] and Datagram Transport Layer 942 Security [RFC6347]. 944 4. Discovery of TURN server 946 Methods of TURN server discovery, including using anycast, are 947 described in [RFC8155]. The syntax of the "turn" and "turns" URIs 948 are defined in Section 3.1 of [RFC7065]. 950 4.1. TURN URI Scheme Semantics 952 The "turn" and "turns" URI schemes are used to designate a TURN 953 server (also known as a relay) on Internet hosts accessible using the 954 TURN protocol. The TURN protocol supports sending messages over UDP, 955 TCP, TLS-over-TCP or DTLS-over-UDP. The "turns" URI scheme MUST be 956 used when TURN is run over TLS-over-TCP or in DTLS-over-UDP, and the 957 "turn" scheme MUST be used otherwise. The required part of 958 the "turn" URI denotes the TURN server host. The part, if 959 present, denotes the port on which the TURN server is awaiting 960 connection requests. If it is absent, the default port is 3478 for 961 both UDP and TCP. The default port for TURN over TLS and TURN over 962 DTLS is 5349. 964 5. General Behavior 966 This section contains general TURN processing rules that apply to all 967 TURN messages. 969 TURN is an extension to STUN. All TURN messages, with the exception 970 of the ChannelData message, are STUN-formatted messages. All the 971 base processing rules described in [I-D.ietf-tram-stunbis] apply to 972 STUN-formatted messages. This means that all the message-forming and 973 message-processing descriptions in this document are implicitly 974 prefixed with the rules of [I-D.ietf-tram-stunbis]. 976 [I-D.ietf-tram-stunbis] specifies an authentication mechanism called 977 the long-term credential mechanism. TURN servers and clients MUST 978 implement this mechanism. The server MUST demand that all requests 979 from the client be authenticated using this mechanism, or that a 980 equally strong or stronger mechanism for client authentication is 981 used. 983 Note that the long-term credential mechanism applies only to requests 984 and cannot be used to authenticate indications; thus, indications in 985 TURN are never authenticated. If the server requires requests to be 986 authenticated, then the server's administrator MUST choose a realm 987 value that will uniquely identify the username and password 988 combination that the client must use, even if the client uses 989 multiple servers under different administrations. The server's 990 administrator MAY choose to allocate a unique username to each 991 client, or MAY choose to allocate the same username to more than one 992 client (for example, to all clients from the same department or 993 company). For each Allocate request, the server SHOULD generate a 994 new random nonce when the allocation is first attempted following the 995 randomness recommendations in [RFC4086] and SHOULD expire the nonce 996 at least once every hour during the lifetime of the allocation. 998 All requests after the initial Allocate must use the same username as 999 that used to create the allocation, to prevent attackers from 1000 hijacking the client's allocation. Specifically, if the server 1001 requires the use of the long-term credential mechanism, and if a non- 1002 Allocate request passes authentication under this mechanism, and if 1003 the 5-tuple identifies an existing allocation, but the request does 1004 not use the same username as used to create the allocation, then the 1005 request MUST be rejected with a 441 (Wrong Credentials) error. 1007 When a TURN message arrives at the server from the client, the server 1008 uses the 5-tuple in the message to identify the associated 1009 allocation. For all TURN messages (including ChannelData) EXCEPT an 1010 Allocate request, if the 5-tuple does not identify an existing 1011 allocation, then the message MUST either be rejected with a 437 1012 Allocation Mismatch error (if it is a request) or silently ignored 1013 (if it is an indication or a ChannelData message). A client 1014 receiving a 437 error response to a request other than Allocate MUST 1015 assume the allocation no longer exists. 1017 [I-D.ietf-tram-stunbis] defines a number of attributes, including the 1018 SOFTWARE and FINGERPRINT attributes. The client SHOULD include the 1019 SOFTWARE attribute in all Allocate and Refresh requests and MAY 1020 include it in any other requests or indications. The server SHOULD 1021 include the SOFTWARE attribute in all Allocate and Refresh responses 1022 (either success or failure) and MAY include it in other responses or 1023 indications. The client and the server MAY include the FINGERPRINT 1024 attribute in any STUN-formatted messages defined in this document. 1026 TURN does not use the backwards-compatibility mechanism described in 1027 [I-D.ietf-tram-stunbis]. 1029 TURN, as defined in this specification, supports both IPv4 and IPv6. 1030 IPv6 support in TURN includes IPv4-to-IPv6, IPv6-to-IPv6, and IPv6- 1031 to-IPv4 relaying. The REQUESTED-ADDRESS-FAMILY attribute allows a 1032 client to explicitly request the address type the TURN server will 1033 allocate (e.g., an IPv4-only node may request the TURN server to 1034 allocate an IPv6 address). The ADDITIONAL-ADDRESS-FAMILY attribute 1035 allows a client to request the server to allocate one IPv4 and one 1036 IPv6 relay address in a single Allocate request. This saves local 1037 ports on the client and reduces the number of messages sent between 1038 the client and the TURN server. 1040 By default, TURN runs on the same ports as STUN: 3478 for TURN over 1041 UDP and TCP, and 5349 for TURN over (D)TLS. However, TURN has its 1042 own set of Service Record (SRV) names: "turn" for UDP and TCP, and 1043 "turns" for (D)TLS. Either the DNS resolution procedures or the 1044 ALTERNATE-SERVER procedures, both described in Section 7, can be used 1045 to run TURN on a different port. 1047 To ensure interoperability, a TURN server MUST support the use of UDP 1048 transport between the client and the server, and SHOULD support the 1049 use of TCP, TLS-over-TCP and DTLS-over-UDP transports. 1051 When UDP transport is used between the client and the server, the 1052 client will retransmit a request if it does not receive a response 1053 within a certain timeout period. Because of this, the server may 1054 receive two (or more) requests with the same 5-tuple and same 1055 transaction id. STUN requires that the server recognize this case 1056 and treat the request as idempotent (see [I-D.ietf-tram-stunbis]). 1057 Some implementations may choose to meet this requirement by 1058 remembering all received requests and the corresponding responses for 1059 40 seconds. Other implementations may choose to reprocess the 1060 request and arrange that such reprocessing returns essentially the 1061 same response. To aid implementors who choose the latter approach 1062 (the so-called "stateless stack approach"), this specification 1063 includes some implementation notes on how this might be done. 1064 Implementations are free to choose either approach or choose some 1065 other approach that gives the same results. 1067 When TCP transport is used between the client and the server, it is 1068 possible that a bit error will cause a length field in a TURN packet 1069 to become corrupted, causing the receiver to lose synchronization 1070 with the incoming stream of TURN messages. A client or server that 1071 detects a long sequence of invalid TURN messages over TCP transport 1072 SHOULD close the corresponding TCP connection to help the other end 1073 detect this situation more rapidly. 1075 To mitigate either intentional or unintentional denial-of-service 1076 attacks against the server by clients with valid usernames and 1077 passwords, it is RECOMMENDED that the server impose limits on both 1078 the number of allocations active at one time for a given username and 1079 on the amount of bandwidth those allocations can use. The server 1080 should reject new allocations that would exceed the limit on the 1081 allowed number of allocations active at one time with a 486 1082 (Allocation Quota Exceeded) (see Section 7.2), and should discard 1083 application data traffic that exceeds the bandwidth quota. 1085 6. Allocations 1087 All TURN operations revolve around allocations, and all TURN messages 1088 are associated with either a single or dual allocation. An 1089 allocation conceptually consists of the following state data: 1091 o the relayed transport address or addresses; 1093 o the 5-tuple: (client's IP address, client's port, server IP 1094 address, server port, transport protocol); 1096 o the authentication information; 1098 o the time-to-expiry for each relayed transport address; 1100 o a list of permissions for each relayed transport address; 1102 o a list of channel to peer bindings for each relayed transport 1103 address. 1105 The relayed transport address is the transport address allocated by 1106 the server for communicating with peers, while the 5-tuple describes 1107 the communication path between the client and the server. On the 1108 client, the 5-tuple uses the client's host transport address; on the 1109 server, the 5-tuple uses the client's server-reflexive transport 1110 address. The relayed transport address MUST be unique across all 1111 allocations, so it can be used to uniquely identify the allocation. 1113 The authentication information (e.g., username, password, realm, and 1114 nonce) is used to both verify subsequent requests and to compute the 1115 message integrity of responses. The username, realm, and nonce 1116 values are initially those used in the authenticated Allocate request 1117 that creates the allocation, though the server can change the nonce 1118 value during the lifetime of the allocation using a 438 (Stale Nonce) 1119 reply. Note that, rather than storing the password explicitly, for 1120 security reasons, it may be desirable for the server to store the key 1121 value, which is a secure hash over the username, realm, and password 1122 (see [I-D.ietf-tram-stunbis]). 1124 The time-to-expiry is the time in seconds left until the allocation 1125 expires. Each Allocate or Refresh transaction sets this timer, which 1126 then ticks down towards 0. By default, each Allocate or Refresh 1127 transaction resets this timer to the default lifetime value of 600 1128 seconds (10 minutes), but the client can request a different value in 1129 the Allocate and Refresh request. Allocations can only be refreshed 1130 using the Refresh request; sending data to a peer does not refresh an 1131 allocation. When an allocation expires, the state data associated 1132 with the allocation can be freed. 1134 The list of permissions is described in Section 9 and the list of 1135 channels is described in Section 12. 1137 7. Creating an Allocation 1139 An allocation on the server is created using an Allocate transaction. 1141 7.1. Sending an Allocate Request 1143 The client forms an Allocate request as follows. 1145 The client first picks a host transport address. It is RECOMMENDED 1146 that the client pick a currently unused transport address, typically 1147 by allowing the underlying OS to pick a currently unused port for a 1148 new socket. 1150 The client then picks a transport protocol to use between the client 1151 and the server. The transport protocol MUST be one of UDP, TCP, TLS- 1152 over-TCP or DTLS-over-UDP. Since this specification only allows UDP 1153 between the server and the peers, it is RECOMMENDED that the client 1154 pick UDP unless it has a reason to use a different transport. One 1155 reason to pick a different transport would be that the client 1156 believes, either through configuration or by experiment, that it is 1157 unable to contact any TURN server using UDP. See Section 2.1 for 1158 more discussion. 1160 The client also picks a server transport address, which SHOULD be 1161 done as follows. The client uses one or more procedures described in 1162 [RFC8155] to discover a TURN server and uses the TURN server 1163 resolution mechanism defined in [RFC5928] to get a list of server 1164 transport addresses that can be tried to create a TURN allocation. 1166 The client MUST include a REQUESTED-TRANSPORT attribute in the 1167 request. This attribute specifies the transport protocol between the 1168 server and the peers (note that this is NOT the transport protocol 1169 that appears in the 5-tuple). In this specification, the REQUESTED- 1170 TRANSPORT type is always UDP. This attribute is included to allow 1171 future extensions to specify other protocols. 1173 If the client wishes to obtain a relayed transport address of a 1174 specific address type then it includes a REQUESTED-ADDRESS-FAMILY 1175 attribute in the request. This attribute indicates the specific 1176 address type the client wishes the TURN server to allocate. Clients 1177 MUST NOT include more than one REQUESTED-ADDRESS-FAMILY attribute in 1178 an Allocate request. Clients MUST NOT include a REQUESTED-ADDRESS- 1179 FAMILY attribute in an Allocate request that contains a RESERVATION- 1180 TOKEN attribute, for the reasons outlined in [RFC6156]. 1182 If the client wishes to obtain one IPv6 and one IPv4 relayed 1183 transport address then it includes an ADDITIONAL-ADDRESS-FAMILY 1184 attribute in the request. This attribute specifies that the server 1185 must allocate both address types. The attribute value in the 1186 ADDITIONAL-ADDRESS-FAMILY MUST be set to 0x02 (IPv6 address family). 1187 Clients MUST NOT include REQUESTED-ADDRESS-FAMILY and ADDITIONAL- 1188 ADDRESS-FAMILY attributes in the same request. Clients MUST NOT 1189 include ADDITIONAL-ADDRESS-FAMILY attribute in a Allocate request 1190 that contains a RESERVATION-TOKEN attribute. Clients MUST NOT 1191 include ADDITIONAL-ADDRESS-FAMILY attribute in a Allocate request 1192 that contains an EVEN-PORT attribute with the R bit set to 1. 1194 If the client wishes the server to initialize the time-to-expiry 1195 field of the allocation to some value other than the default 1196 lifetime, then it MAY include a LIFETIME attribute specifying its 1197 desired value. This is just a hint, and the server may elect to use 1198 a different value. Note that the server will ignore requests to 1199 initialize the field to less than the default value. 1201 If the client wishes to later use the DONT-FRAGMENT attribute in one 1202 or more Send indications on this allocation, then the client SHOULD 1203 include the DONT-FRAGMENT attribute in the Allocate request. This 1204 allows the client to test whether this attribute is supported by the 1205 server. 1207 If the client requires the port number of the relayed transport 1208 address be even, the client includes the EVEN-PORT attribute. If 1209 this attribute is not included, then the port can be even or odd. By 1210 setting the R bit in the EVEN-PORT attribute to 1, the client can 1211 request that the server reserve the next highest port number (on the 1212 same IP address) for a subsequent allocation. If the R bit is 0, no 1213 such request is made. 1215 The client MAY also include a RESERVATION-TOKEN attribute in the 1216 request to ask the server to use a previously reserved port for the 1217 allocation. If the RESERVATION-TOKEN attribute is included, then the 1218 client MUST omit the EVEN-PORT attribute. 1220 Once constructed, the client sends the Allocate request on the 1221 5-tuple. 1223 7.2. Receiving an Allocate Request 1225 When the server receives an Allocate request, it performs the 1226 following checks: 1228 1. The server MUST require that the request be authenticated. This 1229 authentication MUST be done using the long-term credential 1230 mechanism of [I-D.ietf-tram-stunbis] unless the client and 1231 server agree to use another mechanism through some procedure 1232 outside the scope of this document. 1234 2. The server checks if the 5-tuple is currently in use by an 1235 existing allocation. If yes, the server rejects the request 1236 with a 437 (Allocation Mismatch) error. 1238 3. The server checks if the request contains a REQUESTED-TRANSPORT 1239 attribute. If the REQUESTED-TRANSPORT attribute is not included 1240 or is malformed, the server rejects the request with a 400 (Bad 1241 Request) error. Otherwise, if the attribute is included but 1242 specifies a protocol other that UDP, the server rejects the 1243 request with a 442 (Unsupported Transport Protocol) error. 1245 4. The request may contain a DONT-FRAGMENT attribute. If it does, 1246 but the server does not support sending UDP datagrams with the 1247 DF bit set to 1 (see Section 14), then the server treats the 1248 DONT-FRAGMENT attribute in the Allocate request as an unknown 1249 comprehension-required attribute. 1251 5. The server checks if the request contains a RESERVATION-TOKEN 1252 attribute. If yes, and the request also contains an EVEN-PORT 1253 or REQUESTED-ADDRESS-FAMILY or ADDITIONAL-ADDRESS-FAMILY 1254 attribute, the server rejects the request with a 400 (Bad 1255 Request) error. Otherwise, it checks to see if the token is 1256 valid (i.e., the token is in range and has not expired and the 1257 corresponding relayed transport address is still available). If 1258 the token is not valid for some reason, the server rejects the 1259 request with a 508 (Insufficient Capacity) error. 1261 6. The server checks if the request contains both REQUESTED- 1262 ADDRESS-FAMILY and ADDITIONAL-ADDRESS-FAMILY attributes. If 1263 yes, then the server rejects the request with a 400 (Bad 1264 Request) error. 1266 7. If the server does not support the address family requested by 1267 the client in REQUESTED-ADDRESS-FAMILY or is disabled by local 1268 policy, it MUST generate an Allocate error response, and it MUST 1269 include an ERROR-CODE attribute with the 440 (Address Family not 1270 Supported) response code. If the REQUESTED-ADDRESS-FAMILY 1271 attribute is absent and the server does not support IPv4 address 1272 family, the server MUST include an ERROR-CODE attribute with the 1273 440 (Address Family not Supported) response code. If the 1274 REQUESTED-ADDRESS-FAMILY attribute is absent and the server 1275 supports IPv4 address family, the server MUST allocate an IPv4 1276 relayed transport address for the TURN client. 1278 8. The server checks if the request contains an EVEN-PORT attribute 1279 with the R bit set to 1. If yes, and the request also contains 1280 an ADDITIONAL-ADDRESS-FAMILY attribute, the server rejects the 1281 request with a 400 (Bad Request) error. Otherwise, the server 1282 checks if it can satisfy the request (i.e., can allocate a 1283 relayed transport address as described below). If the server 1284 cannot satisfy the request, then the server rejects the request 1285 with a 508 (Insufficient Capacity) error. 1287 9. The server checks if the request contains an ADDITIONAL-ADDRESS- 1288 FAMILY attribute. If yes, and the attribute value is 0x01 (IPv4 1289 address family), then the server rejects the request with a 400 1290 (Bad Request) error. Otherwise, the server checks if it can 1291 allocate relayed transport addresses of both address types. If 1292 the server cannot satisfy the request, then the server rejects 1293 the request with a 508 (Insufficient Capacity) error. If the 1294 server can partially meet the request, i.e. if it can only 1295 allocate one relayed transport address of a specific address 1296 type, then it includes ADDRESS-ERROR-CODE attribute in the 1297 response to inform the client the reason for partial failure of 1298 the request. The error code value signaled in the ADDRESS- 1299 ERROR-CODE attribute could be 440 (Address Family not Supported) 1300 or 508 (Insufficient Capacity). If the server can fully meet 1301 the request, then the server allocates one IPv4 and one IPv6 1302 relay address, and returns an Allocate success response 1303 containing the relayed transport addresses assigned to the dual 1304 allocation. 1306 10. At any point, the server MAY choose to reject the request with a 1307 486 (Allocation Quota Reached) error if it feels the client is 1308 trying to exceed some locally defined allocation quota. The 1309 server is free to define this allocation quota any way it 1310 wishes, but SHOULD define it based on the username used to 1311 authenticate the request, and not on the client's transport 1312 address. 1314 11. Also at any point, the server MAY choose to reject the request 1315 with a 300 (Try Alternate) error if it wishes to redirect the 1316 client to a different server. The use of this error code and 1317 attribute follow the specification in [I-D.ietf-tram-stunbis]. 1319 If all the checks pass, the server creates the allocation. The 1320 5-tuple is set to the 5-tuple from the Allocate request, while the 1321 list of permissions and the list of channels are initially empty. 1323 The server chooses a relayed transport address for the allocation as 1324 follows: 1326 o If the request contains a RESERVATION-TOKEN attribute, the server 1327 uses the previously reserved transport address corresponding to 1328 the included token (if it is still available). Note that the 1329 reservation is a server-wide reservation and is not specific to a 1330 particular allocation, since the Allocate request containing the 1331 RESERVATION-TOKEN uses a different 5-tuple than the Allocate 1332 request that made the reservation. The 5-tuple for the Allocate 1333 request containing the RESERVATION-TOKEN attribute can be any 1334 allowed 5-tuple; it can use a different client IP address and 1335 port, a different transport protocol, and even different server IP 1336 address and port (provided, of course, that the server IP address 1337 and port are ones on which the server is listening for TURN 1338 requests). 1340 o If the request contains an EVEN-PORT attribute with the R bit set 1341 to 0, then the server allocates a relayed transport address with 1342 an even port number. 1344 o If the request contains an EVEN-PORT attribute with the R bit set 1345 to 1, then the server looks for a pair of port numbers N and N+1 1346 on the same IP address, where N is even. Port N is used in the 1347 current allocation, while the relayed transport address with port 1348 N+1 is assigned a token and reserved for a future allocation. The 1349 server MUST hold this reservation for at least 30 seconds, and MAY 1350 choose to hold longer (e.g., until the allocation with port N 1351 expires). The server then includes the token in a RESERVATION- 1352 TOKEN attribute in the success response. 1354 o Otherwise, the server allocates any available relayed transport 1355 address. 1357 In all cases, the server SHOULD only allocate ports from the range 1358 49152 - 65535 (the Dynamic and/or Private Port range [Port-Numbers]), 1359 unless the TURN server application knows, through some means not 1360 specified here, that other applications running on the same host as 1361 the TURN server application will not be impacted by allocating ports 1362 outside this range. This condition can often be satisfied by running 1363 the TURN server application on a dedicated machine and/or by 1364 arranging that any other applications on the machine allocate ports 1365 before the TURN server application starts. In any case, the TURN 1366 server SHOULD NOT allocate ports in the range 0 - 1023 (the Well- 1367 Known Port range) to discourage clients from using TURN to run 1368 standard services. 1370 NOTE: The use of randomized port assignments to avoid certain 1371 types of attacks is described in [RFC6056]. It is RECOMMENDED 1372 that a TURN server implement a randomized port assignment 1373 algorithm from [RFC6056]. This is especially applicable to 1374 servers that choose to pre-allocate a number of ports from the 1375 underlying OS and then later assign them to allocations; for 1376 example, a server may choose this technique to implement the EVEN- 1377 PORT attribute. 1379 The server determines the initial value of the time-to-expiry field 1380 as follows. If the request contains a LIFETIME attribute, then the 1381 server computes the minimum of the client's proposed lifetime and the 1382 server's maximum allowed lifetime. If this computed value is greater 1383 than the default lifetime, then the server uses the computed lifetime 1384 as the initial value of the time-to-expiry field. Otherwise, the 1385 server uses the default lifetime. It is RECOMMENDED that the server 1386 use a maximum allowed lifetime value of no more than 3600 seconds (1 1387 hour). Servers that implement allocation quotas or charge users for 1388 allocations in some way may wish to use a smaller maximum allowed 1389 lifetime (perhaps as small as the default lifetime) to more quickly 1390 remove orphaned allocations (that is, allocations where the 1391 corresponding client has crashed or terminated or the client 1392 connection has been lost for some reason). Also, note that the time- 1393 to-expiry is recomputed with each successful Refresh request, and 1394 thus the value computed here applies only until the first refresh. 1396 Once the allocation is created, the server replies with a success 1397 response. The success response contains: 1399 o An XOR-RELAYED-ADDRESS attribute containing the relayed transport 1400 address. 1402 o A LIFETIME attribute containing the current value of the time-to- 1403 expiry timer. 1405 o A RESERVATION-TOKEN attribute (if a second relayed transport 1406 address was reserved). 1408 o An XOR-MAPPED-ADDRESS attribute containing the client's IP address 1409 and port (from the 5-tuple). 1411 NOTE: The XOR-MAPPED-ADDRESS attribute is included in the response 1412 as a convenience to the client. TURN itself does not make use of 1413 this value, but clients running ICE can often need this value and 1414 can thus avoid having to do an extra Binding transaction with some 1415 STUN server to learn it. 1417 The response (either success or error) is sent back to the client on 1418 the 5-tuple. 1420 NOTE: When the Allocate request is sent over UDP, 1421 [I-D.ietf-tram-stunbis] requires that the server handle the 1422 possible retransmissions of the request so that retransmissions do 1423 not cause multiple allocations to be created. Implementations may 1424 achieve this using the so-called "stateless stack approach" as 1425 follows. To detect retransmissions when the original request was 1426 successful in creating an allocation, the server can store the 1427 transaction id that created the request with the allocation data 1428 and compare it with incoming Allocate requests on the same 1429 5-tuple. Once such a request is detected, the server can stop 1430 parsing the request and immediately generate a success response. 1431 When building this response, the value of the LIFETIME attribute 1432 can be taken from the time-to-expiry field in the allocate state 1433 data, even though this value may differ slightly from the LIFETIME 1434 value originally returned. In addition, the server may need to 1435 store an indication of any reservation token returned in the 1436 original response, so that this may be returned in any 1437 retransmitted responses. 1439 For the case where the original request was unsuccessful in 1440 creating an allocation, the server may choose to do nothing 1441 special. Note, however, that there is a rare case where the 1442 server rejects the original request but accepts the retransmitted 1443 request (because conditions have changed in the brief intervening 1444 time period). If the client receives the first failure response, 1445 it will ignore the second (success) response and believe that an 1446 allocation was not created. An allocation created in this matter 1447 will eventually timeout, since the client will not refresh it. 1448 Furthermore, if the client later retries with the same 5-tuple but 1449 different transaction id, it will receive a 437 (Allocation 1450 Mismatch), which will cause it to retry with a different 5-tuple. 1451 The server may use a smaller maximum lifetime value to minimize 1452 the lifetime of allocations "orphaned" in this manner. 1454 7.3. Receiving an Allocate Success Response 1456 If the client receives an Allocate success response, then it MUST 1457 check that the mapped address and the relayed transport address or 1458 addresses are part of an address family or families that the client 1459 understands and is prepared to handle. If these addresses are not 1460 part of an address family or families which the client is prepared to 1461 handle, then the client MUST delete the allocation (Section 8) and 1462 MUST NOT attempt to create another allocation on that server until it 1463 believes the mismatch has been fixed. 1465 Otherwise, the client creates its own copy of the allocation data 1466 structure to track what is happening on the server. In particular, 1467 the client needs to remember the actual lifetime received back from 1468 the server, rather than the value sent to the server in the request. 1469 The client must also remember the 5-tuple used for the request and 1470 the username and password it used to authenticate the request to 1471 ensure that it reuses them for subsequent messages. The client also 1472 needs to track the channels and permissions it establishes on the 1473 server. 1475 If the client receives an Allocate success response but with ADDRESS- 1476 ERROR-CODE attribute in the response and the error code value 1477 signaled in the ADDRESS-ERROR-CODE attribute is 440 (Address Family 1478 not Supported), the client MUST NOT retry its request for the 1479 rejected address type. If the client receives an ADDRESS-ERROR-CODE 1480 attribute in the response and the error code value signaled in the 1481 ADDRESS-ERROR-CODE attribute is 508 (Insufficient Capacity), the 1482 client SHOULD wait at least 1 minute before trying to request any 1483 more allocations on this server for the rejected address type. 1485 The client will probably wish to send the relayed transport address 1486 to peers (using some method not specified here) so the peers can 1487 communicate with it. The client may also wish to use the server- 1488 reflexive address it receives in the XOR-MAPPED-ADDRESS attribute in 1489 its ICE processing. 1491 7.4. Receiving an Allocate Error Response 1493 If the client receives an Allocate error response, then the 1494 processing depends on the actual error code returned: 1496 o (Request timed out): There is either a problem with the server, or 1497 a problem reaching the server with the chosen transport. The 1498 client considers the current transaction as having failed but MAY 1499 choose to retry the Allocate request using a different transport 1500 (e.g., TCP instead of UDP). 1502 o 300 (Try Alternate): The server would like the client to use the 1503 server specified in the ALTERNATE-SERVER attribute instead. The 1504 client considers the current transaction as having failed, but 1505 SHOULD try the Allocate request with the alternate server before 1506 trying any other servers (e.g., other servers discovered using the 1507 DNS resolution procedures). When trying the Allocate request with 1508 the alternate server, the client follows the ALTERNATE-SERVER 1509 procedures specified in [I-D.ietf-tram-stunbis]. 1511 o 400 (Bad Request): The server believes the client's request is 1512 malformed for some reason. The client considers the current 1513 transaction as having failed. The client MAY notify the user or 1514 operator and SHOULD NOT retry the request with this server until 1515 it believes the problem has been fixed. 1517 o 401 (Unauthorized): If the client has followed the procedures of 1518 the long-term credential mechanism and still gets this error, then 1519 the server is not accepting the client's credentials. In this 1520 case, the client considers the current transaction as having 1521 failed and SHOULD notify the user or operator. The client SHOULD 1522 NOT send any further requests to this server until it believes the 1523 problem has been fixed. 1525 o 403 (Forbidden): The request is valid, but the server is refusing 1526 to perform it, likely due to administrative restrictions. The 1527 client considers the current transaction as having failed. The 1528 client MAY notify the user or operator and SHOULD NOT retry the 1529 same request with this server until it believes the problem has 1530 been fixed. 1532 o 420 (Unknown Attribute): If the client included a DONT-FRAGMENT 1533 attribute in the request and the server rejected the request with 1534 a 420 error code and listed the DONT-FRAGMENT attribute in the 1535 UNKNOWN-ATTRIBUTES attribute in the error response, then the 1536 client now knows that the server does not support the DONT- 1537 FRAGMENT attribute. The client considers the current transaction 1538 as having failed but MAY choose to retry the Allocate request 1539 without the DONT-FRAGMENT attribute. 1541 o 437 (Allocation Mismatch): This indicates that the client has 1542 picked a 5-tuple that the server sees as already in use. One way 1543 this could happen is if an intervening NAT assigned a mapped 1544 transport address that was used by another client that recently 1545 crashed. The client considers the current transaction as having 1546 failed. The client SHOULD pick another client transport address 1547 and retry the Allocate request (using a different transaction id). 1548 The client SHOULD try three different client transport addresses 1549 before giving up on this server. Once the client gives up on the 1550 server, it SHOULD NOT try to create another allocation on the 1551 server for 2 minutes. 1553 o 438 (Stale Nonce): See the procedures for the long-term credential 1554 mechanism [I-D.ietf-tram-stunbis]. 1556 o 440 (Address Family not Supported): The server does not support 1557 the address family requested by the client. If the client 1558 receives an Allocate error response with the 440 (Unsupported 1559 Address Family) error code, the client MUST NOT retry the request. 1561 o 441 (Wrong Credentials): The client should not receive this error 1562 in response to a Allocate request. The client MAY notify the user 1563 or operator and SHOULD NOT retry the same request with this server 1564 until it believes the problem has been fixed. 1566 o 442 (Unsupported Transport Address): The client should not receive 1567 this error in response to a request for a UDP allocation. The 1568 client MAY notify the user or operator and SHOULD NOT reattempt 1569 the request with this server until it believes the problem has 1570 been fixed. 1572 o 486 (Allocation Quota Reached): The server is currently unable to 1573 create any more allocations with this username. The client 1574 considers the current transaction as having failed. The client 1575 SHOULD wait at least 1 minute before trying to create any more 1576 allocations on the server. 1578 o 508 (Insufficient Capacity): The server has no more relayed 1579 transport addresses available, or has none with the requested 1580 properties, or the one that was reserved is no longer available. 1581 The client considers the current operation as having failed. If 1582 the client is using either the EVEN-PORT or the RESERVATION-TOKEN 1583 attribute, then the client MAY choose to remove or modify this 1584 attribute and try again immediately. Otherwise, the client SHOULD 1585 wait at least 1 minute before trying to create any more 1586 allocations on this server. 1588 An unknown error response MUST be handled as described in 1589 [I-D.ietf-tram-stunbis]. 1591 8. Refreshing an Allocation 1593 A Refresh transaction can be used to either (a) refresh an existing 1594 allocation and update its time-to-expiry or (b) delete an existing 1595 allocation. 1597 If a client wishes to continue using an allocation, then the client 1598 MUST refresh it before it expires. It is suggested that the client 1599 refresh the allocation roughly 1 minute before it expires. If a 1600 client no longer wishes to use an allocation, then it SHOULD 1601 explicitly delete the allocation. A client MAY refresh an allocation 1602 at any time for other reasons. 1604 8.1. Sending a Refresh Request 1606 If the client wishes to immediately delete an existing allocation, it 1607 includes a LIFETIME attribute with a value of 0. All other forms of 1608 the request refresh the allocation. 1610 When refreshing a dual allocation, the client includes REQUESTED- 1611 ADDRESS-FAMILY attribute indicating the address family type that 1612 should be refreshed. If no REQUESTED-ADDRESS-FAMILY is included then 1613 the request should be treated as applying to all current allocations. 1615 The client MUST only include family types it previously allocated and 1616 has not yet deleted. This process can also be used to delete an 1617 allocation of a specific address type, by setting the lifetime of 1618 that refresh request to 0. Deleting a single allocation destroys any 1619 permissions or channels associated with that particular allocation; 1620 it MUST NOT affect any permissions or channels associated with 1621 allocations for the other address family. 1623 The Refresh transaction updates the time-to-expiry timer of an 1624 allocation. If the client wishes the server to set the time-to- 1625 expiry timer to something other than the default lifetime, it 1626 includes a LIFETIME attribute with the requested value. The server 1627 then computes a new time-to-expiry value in the same way as it does 1628 for an Allocate transaction, with the exception that a requested 1629 lifetime of 0 causes the server to immediately delete the allocation. 1631 8.2. Receiving a Refresh Request 1633 When the server receives a Refresh request, it processes the request 1634 as per Section 5 plus the specific rules mentioned here. 1636 If the server receives a Refresh Request with a REQUESTED-ADDRESS- 1637 FAMILY attribute and the attribute value does not match the address 1638 family of the allocation, the server MUST reply with a 443 (Peer 1639 Address Family Mismatch) Refresh error response. 1641 The server computes a value called the "desired lifetime" as follows: 1642 if the request contains a LIFETIME attribute and the attribute value 1643 is 0, then the "desired lifetime" is 0. Otherwise, if the request 1644 contains a LIFETIME attribute, then the server computes the minimum 1645 of the client's requested lifetime and the server's maximum allowed 1646 lifetime. If this computed value is greater than the default 1647 lifetime, then the "desired lifetime" is the computed value. 1648 Otherwise, the "desired lifetime" is the default lifetime. 1650 Subsequent processing depends on the "desired lifetime" value: 1652 o If the "desired lifetime" is 0, then the request succeeds and the 1653 allocation is deleted. 1655 o If the "desired lifetime" is non-zero, then the request succeeds 1656 and the allocation's time-to-expiry is set to the "desired 1657 lifetime". 1659 If the request succeeds, then the server sends a success response 1660 containing: 1662 o A LIFETIME attribute containing the current value of the time-to- 1663 expiry timer. 1665 NOTE: A server need not do anything special to implement 1666 idempotency of Refresh requests over UDP using the "stateless 1667 stack approach". Retransmitted Refresh requests with a non-zero 1668 "desired lifetime" will simply refresh the allocation. A 1669 retransmitted Refresh request with a zero "desired lifetime" will 1670 cause a 437 (Allocation Mismatch) response if the allocation has 1671 already been deleted, but the client will treat this as equivalent 1672 to a success response (see below). 1674 8.3. Receiving a Refresh Response 1676 If the client receives a success response to its Refresh request with 1677 a non-zero lifetime, it updates its copy of the allocation data 1678 structure with the time-to-expiry value contained in the response. 1680 If the client receives a 437 (Allocation Mismatch) error response to 1681 a request to delete the allocation, then the allocation no longer 1682 exists and it should consider its request as having effectively 1683 succeeded. 1685 9. Permissions 1687 For each allocation, the server keeps a list of zero or more 1688 permissions. Each permission consists of an IP address and an 1689 associated time-to-expiry. While a permission exists, all peers 1690 using the IP address in the permission are allowed to send data to 1691 the client. The time-to-expiry is the number of seconds until the 1692 permission expires. Within the context of an allocation, a 1693 permission is uniquely identified by its associated IP address. 1695 By sending either CreatePermission requests or ChannelBind requests, 1696 the client can cause the server to install or refresh a permission 1697 for a given IP address. This causes one of two things to happen: 1699 o If no permission for that IP address exists, then a permission is 1700 created with the given IP address and a time-to-expiry equal to 1701 Permission Lifetime. 1703 o If a permission for that IP address already exists, then the time- 1704 to-expiry for that permission is reset to Permission Lifetime. 1706 The Permission Lifetime MUST be 300 seconds (= 5 minutes). 1708 Each permission's time-to-expiry decreases down once per second until 1709 it reaches 0; at which point, the permission expires and is deleted. 1711 CreatePermission and ChannelBind requests may be freely intermixed on 1712 a permission. A given permission may be initially installed and/or 1713 refreshed with a CreatePermission request, and then later refreshed 1714 with a ChannelBind request, or vice versa. 1716 When a UDP datagram arrives at the relayed transport address for the 1717 allocation, the server extracts the source IP address from the IP 1718 header. The server then compares this address with the IP address 1719 associated with each permission in the list of permissions for the 1720 allocation. If no match is found, relaying is not permitted, and the 1721 server silently discards the UDP datagram. If an exact match is 1722 found, then the permission check is considered to have succeeded and 1723 the server continues to process the UDP datagram as specified 1724 elsewhere (Section 11.3). Note that only addresses are compared and 1725 port numbers are not considered. 1727 The permissions for one allocation are totally unrelated to the 1728 permissions for a different allocation. If an allocation expires, 1729 all its permissions expire with it. 1731 NOTE: Though TURN permissions expire after 5 minutes, many NATs 1732 deployed at the time of publication expire their UDP bindings 1733 considerably faster. Thus, an application using TURN will 1734 probably wish to send some sort of keep-alive traffic at a much 1735 faster rate. Applications using ICE should follow the keep-alive 1736 guidelines of ICE [RFC5245], and applications not using ICE are 1737 advised to do something similar. 1739 10. CreatePermission 1741 TURN supports two ways for the client to install or refresh 1742 permissions on the server. This section describes one way: the 1743 CreatePermission request. 1745 A CreatePermission request may be used in conjunction with either the 1746 Send mechanism in Section 11 or the Channel mechanism in Section 12. 1748 10.1. Forming a CreatePermission Request 1750 The client who wishes to install or refresh one or more permissions 1751 can send a CreatePermission request to the server. 1753 When forming a CreatePermission request, the client MUST include at 1754 least one XOR-PEER-ADDRESS attribute, and MAY include more than one 1755 such attribute. The IP address portion of each XOR-PEER-ADDRESS 1756 attribute contains the IP address for which a permission should be 1757 installed or refreshed. The port portion of each XOR-PEER-ADDRESS 1758 attribute will be ignored and can be any arbitrary value. The 1759 various XOR-PEER-ADDRESS attributes MAY appear in any order. The 1760 client MUST only include XOR-PEER-ADDRESS attributes with addresses 1761 of the same address family as that of the relayed transport address 1762 for the allocation. For dual allocations obtained using the 1763 ADDITIONAL-ADDRESS-FAMILY attribute, the client MAY include XOR-PEER- 1764 ADDRESS attributes with addresses of IPv4 and IPv6 address families. 1766 10.2. Receiving a CreatePermission Request 1768 When the server receives the CreatePermission request, it processes 1769 as per Section 5 plus the specific rules mentioned here. 1771 The message is checked for validity. The CreatePermission request 1772 MUST contain at least one XOR-PEER-ADDRESS attribute and MAY contain 1773 multiple such attributes. If no such attribute exists, or if any of 1774 these attributes are invalid, then a 400 (Bad Request) error is 1775 returned. If the request is valid, but the server is unable to 1776 satisfy the request due to some capacity limit or similar, then a 508 1777 (Insufficient Capacity) error is returned. 1779 If an XOR-PEER-ADDRESS attribute contains an address of an address 1780 family that is not the same as that of a relayed transport address 1781 for the allocation, the server MUST generate an error response with 1782 the 443 (Peer Address Family Mismatch) response code. 1784 The server MAY impose restrictions on the IP address allowed in the 1785 XOR-PEER-ADDRESS attribute -- if a value is not allowed, the server 1786 rejects the request with a 403 (Forbidden) error. 1788 If the message is valid and the server is capable of carrying out the 1789 request, then the server installs or refreshes a permission for the 1790 IP address contained in each XOR-PEER-ADDRESS attribute as described 1791 in Section 9. The port portion of each attribute is ignored and may 1792 be any arbitrary value. 1794 The server then responds with a CreatePermission success response. 1795 There are no mandatory attributes in the success response. 1797 NOTE: A server need not do anything special to implement 1798 idempotency of CreatePermission requests over UDP using the 1799 "stateless stack approach". Retransmitted CreatePermission 1800 requests will simply refresh the permissions. 1802 10.3. Receiving a CreatePermission Response 1804 If the client receives a valid CreatePermission success response, 1805 then the client updates its data structures to indicate that the 1806 permissions have been installed or refreshed. 1808 11. Send and Data Methods 1810 TURN supports two mechanisms for sending and receiving data from 1811 peers. This section describes the use of the Send and Data 1812 mechanisms, while Section 12 describes the use of the Channel 1813 mechanism. 1815 11.1. Forming a Send Indication 1817 The client can use a Send indication to pass data to the server for 1818 relaying to a peer. A client may use a Send indication even if a 1819 channel is bound to that peer. However, the client MUST ensure that 1820 there is a permission installed for the IP address of the peer to 1821 which the Send indication is being sent; this prevents a third party 1822 from using a TURN server to send data to arbitrary destinations. 1824 When forming a Send indication, the client MUST include an XOR-PEER- 1825 ADDRESS attribute and a DATA attribute. The XOR-PEER-ADDRESS 1826 attribute contains the transport address of the peer to which the 1827 data is to be sent, and the DATA attribute contains the actual 1828 application data to be sent to the peer. 1830 The client MAY include a DONT-FRAGMENT attribute in the Send 1831 indication if it wishes the server to set the DF bit on the UDP 1832 datagram sent to the peer. 1834 11.2. Receiving a Send Indication 1836 When the server receives a Send indication, it processes as per 1837 Section 5 plus the specific rules mentioned here. 1839 The message is first checked for validity. The Send indication MUST 1840 contain both an XOR-PEER-ADDRESS attribute and a DATA attribute. If 1841 one of these attributes is missing or invalid, then the message is 1842 discarded. Note that the DATA attribute is allowed to contain zero 1843 bytes of data. 1845 The Send indication may also contain the DONT-FRAGMENT attribute. If 1846 the server is unable to set the DF bit on outgoing UDP datagrams when 1847 this attribute is present, then the server acts as if the DONT- 1848 FRAGMENT attribute is an unknown comprehension-required attribute 1849 (and thus the Send indication is discarded). 1851 The server also checks that there is a permission installed for the 1852 IP address contained in the XOR-PEER-ADDRESS attribute. If no such 1853 permission exists, the message is discarded. Note that a Send 1854 indication never causes the server to refresh the permission. 1856 The server MAY impose restrictions on the IP address and port values 1857 allowed in the XOR-PEER-ADDRESS attribute -- if a value is not 1858 allowed, the server silently discards the Send indication. 1860 If everything is OK, then the server forms a UDP datagram as follows: 1862 o the source transport address is the relayed transport address of 1863 the allocation, where the allocation is determined by the 5-tuple 1864 on which the Send indication arrived; 1866 o the destination transport address is taken from the XOR-PEER- 1867 ADDRESS attribute; 1869 o the data following the UDP header is the contents of the value 1870 field of the DATA attribute. 1872 The handling of the DONT-FRAGMENT attribute (if present), is 1873 described in Section 14. 1875 The resulting UDP datagram is then sent to the peer. 1877 11.3. Receiving a UDP Datagram 1879 When the server receives a UDP datagram at a currently allocated 1880 relayed transport address, the server looks up the allocation 1881 associated with the relayed transport address. The server then 1882 checks to see whether the set of permissions for the allocation allow 1883 the relaying of the UDP datagram as described in Section 9. 1885 If relaying is permitted, then the server checks if there is a 1886 channel bound to the peer that sent the UDP datagram (see 1887 Section 12). If a channel is bound, then processing proceeds as 1888 described in Section 12.7. 1890 If relaying is permitted but no channel is bound to the peer, then 1891 the server forms and sends a Data indication. The Data indication 1892 MUST contain both an XOR-PEER-ADDRESS and a DATA attribute. The DATA 1893 attribute is set to the value of the 'data octets' field from the 1894 datagram, and the XOR-PEER-ADDRESS attribute is set to the source 1895 transport address of the received UDP datagram. The Data indication 1896 is then sent on the 5-tuple associated with the allocation. 1898 11.4. Receiving a Data Indication 1900 When the client receives a Data indication, it checks that the Data 1901 indication contains an XOR-PEER-ADDRESS attribute, and discards the 1902 indication if it does not. The client SHOULD also check that the 1903 XOR-PEER-ADDRESS attribute value contains an IP address with which 1904 the client believes there is an active permission, and discard the 1905 Data indication otherwise. 1907 NOTE: The latter check protects the client against an attacker who 1908 somehow manages to trick the server into installing permissions 1909 not desired by the client. 1911 If the XOR-PEER-ADDRESS is present and valid, the client checks that 1912 the Data indication contains either a DATA attribute or an ICMP 1913 attribute and discards the indication if it does not. Note that a 1914 DATA attribute is allowed to contain zero bytes of data. Processing 1915 of Data indications with an ICMP attribute is described in 1916 Section 11.6. 1918 If the Data indication passes the above checks, the client delivers 1919 the data octets inside the DATA attribute to the application, along 1920 with an indication that they were received from the peer whose 1921 transport address is given by the XOR-PEER-ADDRESS attribute. 1923 11.5. Receiving an ICMP Packet 1925 When the server receives an ICMP packet, the server verifies that the 1926 type is either 3, 11 or 12 for an ICMPv4 [RFC0792] packet or either 1927 1, 2, or 3 for an ICMPv6 [RFC4443] packet. It also verifies that the 1928 IP packet in the ICMP packet payload contains a UDP header. If 1929 either of these conditions fail, then the ICMP packet is silently 1930 dropped. 1932 The server looks up the allocation whose relayed transport address 1933 corresponds to the encapsulated packet's source IP address and UDP 1934 port. If no such allocation exists, the packet is silently dropped. 1935 The server then checks to see whether the set of permissions for the 1936 allocation allows the relaying of the ICMP packet. For ICMP packets, 1937 the source IP address MUST NOT be checked against the permissions 1938 list as it would be for UDP packets. Instead, the server extracts 1939 the destination IP address from the encapsulated IP header. The 1940 server then compares this address with the IP address associated with 1941 each permission in the list of permissions for the allocation. If no 1942 match is found, relaying is not permitted, and the server silently 1943 discards the ICMP packet. Note that only addresses are compared and 1944 port numbers are not considered. 1946 If relaying is permitted then the server forms and sends a Data 1947 indication. The Data indication MUST contain both an XOR-PEER- 1948 ADDRESS and an ICMP attribute. The ICMP attribute is set to the 1949 value of the type and code fields from the ICMP packet. The IP 1950 address portion of XOR-PEER-ADDRESS attribute is set to the 1951 destination IP address in the encapsulated IP header. At the time of 1952 writing of this specification, Socket APIs on some operating systems 1953 do not deliver the destination port in the encapsulated UDP header to 1954 applications without superuser privileges. If destination port in 1955 the encapsulated UDP header is available to the server then the port 1956 portion of XOR-PEER-ADDRESS attribute is set to the destination port 1957 otherwise the port portion is set to 0. The Data indication is then 1958 sent on the 5-tuple associated with the allocation. 1960 11.6. Receiving a Data Indication with an ICMP attribute 1962 When the client receives a Data indication with an ICMP attribute, it 1963 checks that the Data indication contains an XOR-PEER-ADDRESS 1964 attribute, and discards the indication if it does not. The client 1965 SHOULD also check that the XOR-PEER-ADDRESS attribute value contains 1966 an IP address with an active permission, and discard the Data 1967 indication otherwise. 1969 If the Data indication passes the above checks, the client signals 1970 the application of the error condition, along with an indication that 1971 it was received from the peer whose transport address is given by the 1972 XOR-PEER-ADDRESS attribute. The application can make sense of the 1973 meaning of the type and code values in the ICMP attribute by using 1974 the family field in the XOR-PEER-ADDRESS attribute. 1976 12. Channels 1978 Channels provide a way for the client and server to send application 1979 data using ChannelData messages, which have less overhead than Send 1980 and Data indications. 1982 The ChannelData message (see Section 12.4) starts with a two-byte 1983 field that carries the channel number. The values of this field are 1984 allocated as follows: 1986 0x0000 through 0x3FFF: These values can never be used for channel 1987 numbers. 1989 0x4000 through 0x7FFF: These values are the allowed channel 1990 numbers (16,384 possible values). 1992 0x8000 through 0xFFFF: These values are reserved for future use. 1994 Because of this division, ChannelData messages can be distinguished 1995 from STUN-formatted messages (e.g., Allocate request, Send 1996 indication, etc.) by examining the first two bits of the message: 1998 0b00: STUN-formatted message (since the first two bits of a STUN- 1999 formatted message are always zero). 2001 0b01: ChannelData message (since the channel number is the first 2002 field in the ChannelData message and channel numbers fall in the 2003 range 0x4000 - 0x7FFF). 2005 0b10: Reserved 2007 0b11: Reserved 2009 The reserved values may be used in the future to extend the range of 2010 channel numbers. Thus, an implementation MUST NOT assume that a TURN 2011 message always starts with a 0 bit. 2013 Channel bindings are always initiated by the client. The client can 2014 bind a channel to a peer at any time during the lifetime of the 2015 allocation. The client may bind a channel to a peer before 2016 exchanging data with it, or after exchanging data with it (using Send 2017 and Data indications) for some time, or may choose never to bind a 2018 channel to it. The client can also bind channels to some peers while 2019 not binding channels to other peers. 2021 Channel bindings are specific to an allocation, so that the use of a 2022 channel number or peer transport address in a channel binding in one 2023 allocation has no impact on their use in a different allocation. If 2024 an allocation expires, all its channel bindings expire with it. 2026 A channel binding consists of: 2028 o a channel number; 2030 o a transport address (of the peer); and 2032 o A time-to-expiry timer. 2034 Within the context of an allocation, a channel binding is uniquely 2035 identified either by the channel number or by the peer's transport 2036 address. Thus, the same channel cannot be bound to two different 2037 transport addresses, nor can the same transport address be bound to 2038 two different channels. 2040 A channel binding lasts for 10 minutes unless refreshed. Refreshing 2041 the binding (by the server receiving a ChannelBind request rebinding 2042 the channel to the same peer) resets the time-to-expiry timer back to 2043 10 minutes. 2045 When the channel binding expires, the channel becomes unbound. Once 2046 unbound, the channel number can be bound to a different transport 2047 address, and the transport address can be bound to a different 2048 channel number. To prevent race conditions, the client MUST wait 5 2049 minutes after the channel binding expires before attempting to bind 2050 the channel number to a different transport address or the transport 2051 address to a different channel number. 2053 When binding a channel to a peer, the client SHOULD be prepared to 2054 receive ChannelData messages on the channel from the server as soon 2055 as it has sent the ChannelBind request. Over UDP, it is possible for 2056 the client to receive ChannelData messages from the server before it 2057 receives a ChannelBind success response. 2059 In the other direction, the client MAY elect to send ChannelData 2060 messages before receiving the ChannelBind success response. Doing 2061 so, however, runs the risk of having the ChannelData messages dropped 2062 by the server if the ChannelBind request does not succeed for some 2063 reason (e.g., packet lost if the request is sent over UDP, or the 2064 server being unable to fulfill the request). A client that wishes to 2065 be safe should either queue the data or use Send indications until 2066 the channel binding is confirmed. 2068 12.1. Sending a ChannelBind Request 2070 A channel binding is created or refreshed using a ChannelBind 2071 transaction. A ChannelBind transaction also creates or refreshes a 2072 permission towards the peer (see Section 9). 2074 To initiate the ChannelBind transaction, the client forms a 2075 ChannelBind request. The channel to be bound is specified in a 2076 CHANNEL-NUMBER attribute, and the peer's transport address is 2077 specified in an XOR-PEER-ADDRESS attribute. Section 12.2 describes 2078 the restrictions on these attributes. The client MUST only include 2079 an XOR-PEER-ADDRESS attribute with an address of the same address 2080 family as that of a relayed transport address for the allocation. 2082 Rebinding a channel to the same transport address that it is already 2083 bound to provides a way to refresh a channel binding and the 2084 corresponding permission without sending data to the peer. Note 2085 however, that permissions need to be refreshed more frequently than 2086 channels. 2088 12.2. Receiving a ChannelBind Request 2090 When the server receives a ChannelBind request, it processes as per 2091 Section 5 plus the specific rules mentioned here. 2093 The server checks the following: 2095 o The request contains both a CHANNEL-NUMBER and an XOR-PEER-ADDRESS 2096 attribute; 2098 o The channel number is in the range 0x4000 through 0x7FFE 2099 (inclusive); 2101 o The channel number is not currently bound to a different transport 2102 address (same transport address is OK); 2104 o The transport address is not currently bound to a different 2105 channel number. 2107 o If the XOR-PEER-ADDRESS attribute contains an address of an 2108 address family that is not the same as that of a relayed transport 2109 address for the allocation, the server MUST generate an error 2110 response with the 443 (Peer Address Family Mismatch) response 2111 code. 2113 If any of these tests fail, the server replies with a 400 (Bad 2114 Request) error. 2116 The server MAY impose restrictions on the IP address and port values 2117 allowed in the XOR-PEER-ADDRESS attribute -- if a value is not 2118 allowed, the server rejects the request with a 403 (Forbidden) error. 2120 If the request is valid, but the server is unable to fulfill the 2121 request due to some capacity limit or similar, the server replies 2122 with a 508 (Insufficient Capacity) error. 2124 Otherwise, the server replies with a ChannelBind success response. 2125 There are no required attributes in a successful ChannelBind 2126 response. 2128 If the server can satisfy the request, then the server creates or 2129 refreshes the channel binding using the channel number in the 2130 CHANNEL-NUMBER attribute and the transport address in the XOR-PEER- 2131 ADDRESS attribute. The server also installs or refreshes a 2132 permission for the IP address in the XOR-PEER-ADDRESS attribute as 2133 described in Section 9. 2135 NOTE: A server need not do anything special to implement 2136 idempotency of ChannelBind requests over UDP using the "stateless 2137 stack approach". Retransmitted ChannelBind requests will simply 2138 refresh the channel binding and the corresponding permission. 2139 Furthermore, the client must wait 5 minutes before binding a 2140 previously bound channel number or peer address to a different 2141 channel, eliminating the possibility that the transaction would 2142 initially fail but succeed on a retransmission. 2144 12.3. Receiving a ChannelBind Response 2146 When the client receives a ChannelBind success response, it updates 2147 its data structures to record that the channel binding is now active. 2148 It also updates its data structures to record that the corresponding 2149 permission has been installed or refreshed. 2151 If the client receives a ChannelBind failure response that indicates 2152 that the channel information is out-of-sync between the client and 2153 the server (e.g., an unexpected 400 "Bad Request" response), then it 2154 is RECOMMENDED that the client immediately delete the allocation and 2155 start afresh with a new allocation. 2157 12.4. The ChannelData Message 2159 The ChannelData message is used to carry application data between the 2160 client and the server. It has the following format: 2162 0 1 2 3 2163 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2164 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2165 | Channel Number | Length | 2166 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2167 | | 2168 / Application Data / 2169 / / 2170 | | 2171 | +-------------------------------+ 2172 | | 2173 +-------------------------------+ 2175 The Channel Number field specifies the number of the channel on which 2176 the data is traveling, and thus the address of the peer that is 2177 sending or is to receive the data. 2179 The Length field specifies the length in bytes of the application 2180 data field (i.e., it does not include the size of the ChannelData 2181 header). Note that 0 is a valid length. 2183 The Application Data field carries the data the client is trying to 2184 send to the peer, or that the peer is sending to the client. 2186 12.5. Sending a ChannelData Message 2188 Once a client has bound a channel to a peer, then when the client has 2189 data to send to that peer it may use either a ChannelData message or 2190 a Send indication; that is, the client is not obligated to use the 2191 channel when it exists and may freely intermix the two message types 2192 when sending data to the peer. The server, on the other hand, MUST 2193 use the ChannelData message if a channel has been bound to the peer. 2194 The server uses a Data indication to signal the XOR-PEER-ADDRESS and 2195 ICMP attributes to the client even if a channel has been bound to the 2196 peer. 2198 The fields of the ChannelData message are filled in as described in 2199 Section 12.4. 2201 Over TCP and TLS-over-TCP, the ChannelData message MUST be padded to 2202 a multiple of four bytes in order to ensure the alignment of 2203 subsequent messages. The padding is not reflected in the length 2204 field of the ChannelData message, so the actual size of a ChannelData 2205 message (including padding) is (4 + Length) rounded up to the nearest 2206 multiple of 4. Over UDP, the padding is not required but MAY be 2207 included. 2209 The ChannelData message is then sent on the 5-tuple associated with 2210 the allocation. 2212 12.6. Receiving a ChannelData Message 2214 The receiver of the ChannelData message uses the first two bits to 2215 distinguish it from STUN-formatted messages, as described above. If 2216 the message uses a value in the reserved range (0x8000 through 2217 0xFFFF), then the message is silently discarded. 2219 If the ChannelData message is received in a UDP datagram, and if the 2220 UDP datagram is too short to contain the claimed length of the 2221 ChannelData message (i.e., the UDP header length field value is less 2222 than the ChannelData header length field value + 4 + 8), then the 2223 message is silently discarded. 2225 If the ChannelData message is received over TCP or over TLS-over-TCP, 2226 then the actual length of the ChannelData message is as described in 2227 Section 12.5. 2229 If the ChannelData message is received on a channel that is not bound 2230 to any peer, then the message is silently discarded. 2232 On the client, it is RECOMMENDED that the client discard the 2233 ChannelData message if the client believes there is no active 2234 permission towards the peer. On the server, the receipt of a 2235 ChannelData message MUST NOT refresh either the channel binding or 2236 the permission towards the peer. 2238 On the server, if no errors are detected, the server relays the 2239 application data to the peer by forming a UDP datagram as follows: 2241 o the source transport address is the relayed transport address of 2242 the allocation, where the allocation is determined by the 5-tuple 2243 on which the ChannelData message arrived; 2245 o the destination transport address is the transport address to 2246 which the channel is bound; 2248 o the data following the UDP header is the contents of the data 2249 field of the ChannelData message. 2251 The resulting UDP datagram is then sent to the peer. Note that if 2252 the Length field in the ChannelData message is 0, then there will be 2253 no data in the UDP datagram, but the UDP datagram is still formed and 2254 sent. 2256 12.7. Relaying Data from the Peer 2258 When the server receives a UDP datagram on the relayed transport 2259 address associated with an allocation, the server processes it as 2260 described in Section 11.3. If that section indicates that a 2261 ChannelData message should be sent (because there is a channel bound 2262 to the peer that sent to the UDP datagram), then the server forms and 2263 sends a ChannelData message as described in Section 12.5. 2265 When the server receives an ICMP packet, the server processes it as 2266 described in Section 11.5. A Data indication MUST be sent regardless 2267 of whether there is a channel bound to the peer that was the 2268 destination of the UDP datagram that triggered the reception of the 2269 ICMP packet. 2271 13. Packet Translations 2273 This section addresses IPv4-to-IPv6, IPv6-to-IPv4, and IPv6-to-IPv6 2274 translations. Requirements for translation of the IP addresses and 2275 port numbers of the packets are described above. The following 2276 sections specify how to translate other header fields. 2278 As discussed in Section 2.6, translations in TURN are designed so 2279 that a TURN server can be implemented as an application that runs in 2280 userland under commonly available operating systems and that does not 2281 require special privileges. The translations specified in the 2282 following sections follow this principle. 2284 The descriptions below have two parts: a preferred behavior and an 2285 alternate behavior. The server SHOULD implement the preferred 2286 behavior. Otherwise, the server MUST implement the alternate 2287 behavior and MUST NOT do anything else for the reasons detailed in 2288 [RFC7915]. 2290 13.1. IPv4-to-IPv6 Translations 2292 Traffic Class 2294 Preferred behavior: As specified in Section 4 of [RFC7915]. 2296 Alternate behavior: The relay sets the Traffic Class to the 2297 default value for outgoing packets. 2299 Flow Label 2301 Preferred behavior: The relay sets the Flow label to 0. The relay 2302 can choose to set the Flow label to a different value if it 2303 supports the IPv6 Flow Label field [RFC6437]. 2305 Alternate behavior: The relay sets the Flow label to the default 2306 value for outgoing packets. 2308 Hop Limit 2310 Preferred behavior: As specified in Section 4 of [RFC7915]. 2312 Alternate behavior: The relay sets the Hop Limit to the default 2313 value for outgoing packets. 2315 Fragmentation 2317 Preferred behavior: As specified in Section 4 of [RFC7915]. 2319 Alternate behavior: The relay assembles incoming fragments. The 2320 relay follows its default behavior to send outgoing packets. 2322 For both preferred and alternate behavior, the DONT-FRAGMENT 2323 attribute MUST be ignored by the server. 2325 Extension Headers 2327 Preferred behavior: The relay sends outgoing packet without any 2328 IPv6 extension headers, with the exception of the Fragmentation 2329 header as described above. 2331 Alternate behavior: Same as preferred. 2333 13.2. IPv6-to-IPv6 Translations 2335 Flow Label 2336 The relay should consider that it is handling two different IPv6 2337 flows. Therefore, the Flow label [RFC6437] SHOULD NOT be copied as 2338 part of the translation. 2340 Preferred behavior: The relay sets the Flow label to 0. The relay 2341 can choose to set the Flow label to a different value if it 2342 supports the IPv6 Flow Label field [RFC6437]. 2344 Alternate behavior: The relay sets the Flow label to the default 2345 value for outgoing packets. 2347 Hop Limit 2349 Preferred behavior: The relay acts as a regular router with 2350 respect to decrementing the Hop Limit and generating an ICMPv6 2351 error if it reaches zero. 2353 Alternate behavior: The relay sets the Hop Limit to the default 2354 value for outgoing packets. 2356 Fragmentation 2358 Preferred behavior: If the incoming packet did not include a 2359 Fragment header and the outgoing packet size does not exceed the 2360 outgoing link's MTU, the relay sends the outgoing packet without a 2361 Fragment header. 2363 If the incoming packet did not include a Fragment header and the 2364 outgoing packet size exceeds the outgoing link's MTU, the relay 2365 drops the outgoing packet and send an ICMP message of type 2 code 2366 0 ("Packet too big") to the sender of the incoming packet. If 2367 the packet is being sent to the peer, the relay reduces the MTU 2368 reported in the ICMP message by 48 bytes to allow room for the 2369 overhead of a Data indication. 2371 If the incoming packet included a Fragment header and the outgoing 2372 packet size (with a Fragment header included) does not exceed the 2373 outgoing link's MTU, the relay sends the outgoing packet with a 2374 Fragment header. The relay sets the fields of the Fragment header 2375 as appropriate for a packet originating from the server. 2377 If the incoming packet included a Fragment header and the outgoing 2378 packet size exceeds the outgoing link's MTU, the relay MUST 2379 fragment the outgoing packet into fragments of no more than 1280 2380 bytes. The relay sets the fields of the Fragment header as 2381 appropriate for a packet originating from the server. 2383 Alternate behavior: The relay assembles incoming fragments. The 2384 relay follows its default behavior to send outgoing packets. 2386 For both preferred and alternate behavior, the DONT-FRAGMENT 2387 attribute MUST be ignored by the server. 2389 Extension Headers 2391 Preferred behavior: The relay sends outgoing packet without any 2392 IPv6 extension headers, with the exception of the Fragmentation 2393 header as described above. 2395 Alternate behavior: Same as preferred. 2397 13.3. IPv6-to-IPv4 Translations 2399 Type of Service and Precedence 2401 Preferred behavior: As specified in Section 5 of [RFC7915]. 2403 Alternate behavior: The relay sets the Type of Service and 2404 Precedence to the default value for outgoing packets. 2406 Time to Live 2408 Preferred behavior: As specified in Section 5 of [RFC7915]. 2410 Alternate behavior: The relay sets the Time to Live to the default 2411 value for outgoing packets. 2413 Fragmentation 2415 Preferred behavior: As specified in Section 5 of [RFC7915]. 2416 Additionally, when the outgoing packet's size exceeds the outgoing 2417 link's MTU, the relay needs to generate an ICMP error (ICMPv6 2418 Packet Too Big) reporting the MTU size. If the packet is being 2419 sent to the peer, the relay SHOULD reduce the MTU reported in the 2420 ICMP message by 48 bytes to allow room for the overhead of a Data 2421 indication. 2423 Alternate behavior: The relay assembles incoming fragments. The 2424 relay follows its default behavior to send outgoing packets. 2426 For both preferred and alternate behavior, the DONT-FRAGMENT 2427 attribute MUST be ignored by the server. 2429 14. IP Header Fields 2431 This section describes how the server sets various fields in the IP 2432 header when relaying between the client and the peer or vice versa. 2433 The descriptions in this section apply: (a) when the server sends a 2434 UDP datagram to the peer, or (b) when the server sends a Data 2435 indication or ChannelData message to the client over UDP transport. 2436 The descriptions in this section do not apply to TURN messages sent 2437 over TCP or TLS transport from the server to the client. 2439 The descriptions below have two parts: a preferred behavior and an 2440 alternate behavior. The server SHOULD implement the preferred 2441 behavior, but if that is not possible for a particular field, then it 2442 SHOULD implement the alternative behavior. 2444 Time to Live (TTL) field 2446 Preferred Behavior: If the incoming value is 0, then the drop the 2447 incoming packet. Otherwise, set the outgoing Time to Live/Hop 2448 Count to one less than the incoming value. 2450 Alternate Behavior: Set the outgoing value to the default for 2451 outgoing packets. 2453 Differentiated Services Code Point (DSCP) field [RFC2474] 2455 Preferred Behavior: Set the outgoing value to the incoming value, 2456 unless the server includes a differentiated services classifier 2457 and marker [RFC2474]. 2459 Alternate Behavior: Set the outgoing value to a fixed value, which 2460 by default is Best Effort unless configured otherwise. 2462 In both cases, if the server is immediately adjacent to a 2463 differentiated services classifier and marker, then DSCP MAY be 2464 set to any arbitrary value in the direction towards the 2465 classifier. 2467 Explicit Congestion Notification (ECN) field [RFC3168] 2469 Preferred Behavior: Set the outgoing value to the incoming value, 2470 UNLESS the server is doing Active Queue Management, the incoming 2471 ECN field is ECT(1) (=0b01) or ECT(0) (=0b10), and the server 2472 wishes to indicate that congestion has been experienced, in which 2473 case set the outgoing value to CE (=0b11). 2475 Alternate Behavior: Set the outgoing value to Not-ECT (=0b00). 2477 IPv4 Fragmentation fields 2479 Preferred Behavior: When the server sends a packet to a peer in 2480 response to a Send indication containing the DONT-FRAGMENT 2481 attribute, then set the DF bit in the outgoing IP header to 1. In 2482 all other cases when sending an outgoing packet containing 2483 application data (e.g., Data indication, ChannelData message, or 2484 DONT-FRAGMENT attribute not included in the Send indication), copy 2485 the DF bit from the DF bit of the incoming packet that contained 2486 the application data. 2488 Set the other fragmentation fields (Identification, More 2489 Fragments, Fragment Offset) as appropriate for a packet 2490 originating from the server. 2492 Alternate Behavior: As described in the Preferred Behavior, except 2493 always assume the incoming DF bit is 0. 2495 In both the Preferred and Alternate Behaviors, the resulting 2496 packet may be too large for the outgoing link. If this is the 2497 case, then the normal fragmentation rules apply [RFC1122]. 2499 IPv4 Options 2501 Preferred Behavior: The outgoing packet is sent without any IPv4 2502 options. 2504 Alternate Behavior: Same as preferred. 2506 15. STUN Methods 2508 This section lists the codepoints for the STUN methods defined in 2509 this specification. See elsewhere in this document for the semantics 2510 of these methods. 2512 0x003 : Allocate (only request/response semantics defined) 2513 0x004 : Refresh (only request/response semantics defined) 2514 0x006 : Send (only indication semantics defined) 2515 0x007 : Data (only indication semantics defined) 2516 0x008 : CreatePermission (only request/response semantics defined 2517 0x009 : ChannelBind (only request/response semantics defined) 2519 16. STUN Attributes 2521 This STUN extension defines the following attributes: 2523 0x000C: CHANNEL-NUMBER 2524 0x000D: LIFETIME 2525 0x0010: Reserved (was BANDWIDTH) 2526 0x0012: XOR-PEER-ADDRESS 2527 0x0013: DATA 2528 0x0016: XOR-RELAYED-ADDRESS 2529 0x0017: REQUESTED-ADDRESS-FAMILY 2530 0x0018: EVEN-PORT 2531 0x0019: REQUESTED-TRANSPORT 2532 0x001A: DONT-FRAGMENT 2533 0x0021: Reserved (was TIMER-VAL) 2534 0x0022: RESERVATION-TOKEN 2535 TBD-CA: ADDITIONAL-ADDRESS-FAMILY 2536 TBD-CA: ADDRESS-ERROR-CODE 2537 TBD-CA: ICMP 2539 Some of these attributes have lengths that are not multiples of 4. 2540 By the rules of STUN, any attribute whose length is not a multiple of 2541 4 bytes MUST be immediately followed by 1 to 3 padding bytes to 2542 ensure the next attribute (if any) would start on a 4-byte boundary 2543 (see [I-D.ietf-tram-stunbis]). 2545 16.1. CHANNEL-NUMBER 2547 The CHANNEL-NUMBER attribute contains the number of the channel. The 2548 value portion of this attribute is 4 bytes long and consists of a 2549 16-bit unsigned integer, followed by a two-octet RFFU (Reserved For 2550 Future Use) field, which MUST be set to 0 on transmission and MUST be 2551 ignored on reception. 2553 0 1 2 3 2554 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2555 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2556 | Channel Number | RFFU = 0 | 2557 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2559 16.2. LIFETIME 2561 The LIFETIME attribute represents the duration for which the server 2562 will maintain an allocation in the absence of a refresh. The value 2563 portion of this attribute is 4-bytes long and consists of a 32-bit 2564 unsigned integral value representing the number of seconds remaining 2565 until expiration. 2567 16.3. XOR-PEER-ADDRESS 2569 The XOR-PEER-ADDRESS specifies the address and port of the peer as 2570 seen from the TURN server. (For example, the peer's server-reflexive 2571 transport address if the peer is behind a NAT.) It is encoded in the 2572 same way as XOR-MAPPED-ADDRESS [I-D.ietf-tram-stunbis]. 2574 16.4. DATA 2576 The DATA attribute is present in all Send and Data indications. The 2577 value portion of this attribute is variable length and consists of 2578 the application data (that is, the data that would immediately follow 2579 the UDP header if the data was been sent directly between the client 2580 and the peer). If the length of this attribute is not a multiple of 2581 4, then padding must be added after this attribute. 2583 16.5. XOR-RELAYED-ADDRESS 2585 The XOR-RELAYED-ADDRESS is present in Allocate responses. It 2586 specifies the address and port that the server allocated to the 2587 client. It is encoded in the same way as XOR-MAPPED-ADDRESS 2588 [I-D.ietf-tram-stunbis]. 2590 16.6. REQUESTED-ADDRESS-FAMILY 2592 This attribute is used by clients to request the allocation or 2593 refresh of a specific address type from a server. The value of this 2594 attribute is 4 bytes with the following format: 2596 0 1 2 3 2597 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2598 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2599 | Family | Reserved | 2600 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2602 Family: there are two values defined for this field and specified in 2603 [I-D.ietf-tram-stunbis], Section 14.1: 0x01 for IPv4 addresses and 2604 0x02 for IPv6 addresses. 2606 Reserved: at this point, the 24 bits in the Reserved field MUST be 2607 set to zero by the client and MUST be ignored by the server. 2609 The REQUEST-ADDRESS-TYPE attribute MAY only be present in Allocate 2610 requests. 2612 16.7. EVEN-PORT 2614 This attribute allows the client to request that the port in the 2615 relayed transport address be even, and (optionally) that the server 2616 reserve the next-higher port number. The value portion of this 2617 attribute is 1 byte long. Its format is: 2619 0 2620 0 1 2 3 4 5 6 7 2621 +-+-+-+-+-+-+-+-+ 2622 |R| RFFU | 2623 +-+-+-+-+-+-+-+-+ 2625 The value contains a single 1-bit flag: 2627 R: If 1, the server is requested to reserve the next-higher port 2628 number (on the same IP address) for a subsequent allocation. If 2629 0, no such reservation is requested. 2631 The other 7 bits of the attribute's value must be set to zero on 2632 transmission and ignored on reception. 2634 Since the length of this attribute is not a multiple of 4, padding 2635 must immediately follow this attribute. 2637 16.8. REQUESTED-TRANSPORT 2639 This attribute is used by the client to request a specific transport 2640 protocol for the allocated transport address. The value of this 2641 attribute is 4 bytes with the following format: 2643 0 1 2 3 2644 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2645 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2646 | Protocol | RFFU | 2647 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2649 The Protocol field specifies the desired protocol. The codepoints 2650 used in this field are taken from those allowed in the Protocol field 2651 in the IPv4 header and the NextHeader field in the IPv6 header 2652 [Protocol-Numbers]. This specification only allows the use of 2653 codepoint 17 (User Datagram Protocol). 2655 The RFFU field MUST be set to zero on transmission and MUST be 2656 ignored on reception. It is reserved for future uses. 2658 16.9. DONT-FRAGMENT 2660 This attribute is used by the client to request that the server set 2661 the DF (Don't Fragment) bit in the IP header when relaying the 2662 application data onward to the peer. This attribute has no value 2663 part and thus the attribute length field is 0. 2665 16.10. RESERVATION-TOKEN 2667 The RESERVATION-TOKEN attribute contains a token that uniquely 2668 identifies a relayed transport address being held in reserve by the 2669 server. The server includes this attribute in a success response to 2670 tell the client about the token, and the client includes this 2671 attribute in a subsequent Allocate request to request the server use 2672 that relayed transport address for the allocation. 2674 The attribute value is 8 bytes and contains the token value. 2676 16.11. ADDITIONAL-ADDRESS-FAMILY 2678 This attribute is used by clients to request the allocation of a IPv4 2679 and IPv6 address type from a server. It is encoded in the same way 2680 as REQUESTED-ADDRESS-FAMILY Section 16.6. The ADDITIONAL-ADDRESS- 2681 FAMILY attribute MAY be present in Allocate request. The attribute 2682 value of 0x02 (IPv6 address) is the only valid value in Allocate 2683 request. 2685 16.12. ADDRESS-ERROR-CODE Attribute 2687 This attribute is used by servers to signal the reason for not 2688 allocating the requested address family. The value portion of this 2689 attribute is variable length with the following format: 2691 0 1 2 3 2692 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2693 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2694 | Family | Rsvd |Class| Number | 2695 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2696 | Reason Phrase (variable) .. 2697 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2699 Family: there are two values defined for this field and specified in 2700 [I-D.ietf-tram-stunbis], Section 14.1: 0x01 for IPv4 addresses and 2701 0x02 for IPv6 addresses. 2703 Reserved: at this point, the 13 bits in the Reserved field MUST be 2704 set to zero by the client and MUST be ignored by the server. 2706 Class: The Class represents the hundreds digit of the error code and 2707 is defined in section 14.8 of [I-D.ietf-tram-stunbis]. 2709 Number: this 8-bit field contains the reason server cannot allocate 2710 one of the requested address types. The error code values could 2711 be either 440 (unsupported address family) or 508 (insufficient 2712 capacity). The number representation is defined in section 14.8 2713 of [I-D.ietf-tram-stunbis]. 2715 Reason Phrase: The recommended reason phrases for error codes 440 2716 and 508 are explained in Section 17. 2718 The ADDRESS-ERROR-CODE attribute MAY only be present in Allocate 2719 responses. 2721 16.13. ICMP Attribute 2723 This attribute is used by servers to signal the reason an UDP packet 2724 was dropped. The following is the format of the ICMP attribute. 2726 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2727 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2728 | Reserved | ICMP Type | ICMP Code | 2729 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2731 Reserved: This field MUST be set to 0 when sent, and MUST be ignored 2732 when received. 2734 ICMP Type: The field contains the value in the ICMP type. Its 2735 interpretation depends whether the ICMP was received over IPv4 or 2736 IPv6. 2738 ICMP Code: The field contains the value in the ICMP code. Its 2739 interpretation depends whether the ICMP was received over IPv4 or 2740 IPv6. 2742 17. STUN Error Response Codes 2744 This document defines the following error response codes: 2746 403 (Forbidden): The request was valid but cannot be performed due 2747 to administrative or similar restrictions. 2749 437 (Allocation Mismatch): A request was received by the server that 2750 requires an allocation to be in place, but no allocation exists, 2751 or a request was received that requires no allocation, but an 2752 allocation exists. 2754 440 (Address Family not Supported): The server does not support the 2755 address family requested by the client. 2757 441 (Wrong Credentials): The credentials in the (non-Allocate) 2758 request do not match those used to create the allocation. 2760 442 (Unsupported Transport Protocol): The Allocate request asked the 2761 server to use a transport protocol between the server and the peer 2762 that the server does not support. NOTE: This does NOT refer to 2763 the transport protocol used in the 5-tuple. 2765 443 (Peer Address Family Mismatch). A peer address is part of a 2766 different address family than that of the relayed transport 2767 address of the allocation. 2769 486 (Allocation Quota Reached): No more allocations using this 2770 username can be created at the present time. 2772 508 (Insufficient Capacity): The server is unable to carry out the 2773 request due to some capacity limit being reached. In an Allocate 2774 response, this could be due to the server having no more relayed 2775 transport addresses available at that time, having none with the 2776 requested properties, or the one that corresponds to the specified 2777 reservation token is not available. 2779 18. Detailed Example 2781 This section gives an example of the use of TURN, showing in detail 2782 the contents of the messages exchanged. The example uses the network 2783 diagram shown in the Overview (Figure 1). 2785 For each message, the attributes included in the message and their 2786 values are shown. For convenience, values are shown in a human- 2787 readable format rather than showing the actual octets; for example, 2788 "XOR-RELAYED-ADDRESS=192.0.2.15:9000" shows that the XOR-RELAYED- 2789 ADDRESS attribute is included with an address of 192.0.2.15 and a 2790 port of 9000, here the address and port are shown before the xor-ing 2791 is done. For attributes with string-like values (e.g., 2792 SOFTWARE="Example client, version 1.03" and 2793 NONCE="obMatJos2AAABadl7W7PeDU4hKE72jda"), the value of the attribute 2794 is shown in quotes for readability, but these quotes do not appear in 2795 the actual value. 2797 TURN TURN Peer Peer 2798 client server A B 2799 | | | | 2800 |--- Allocate request -------------->| | | 2801 | Transaction-Id=0xA56250D3F17ABE679422DE85 | | 2802 | SOFTWARE="Example client, version 1.03" | | 2803 | LIFETIME=3600 (1 hour) | | | 2804 | REQUESTED-TRANSPORT=17 (UDP) | | | 2805 | DONT-FRAGMENT | | | 2806 | | | | 2807 |<-- Allocate error response --------| | | 2808 | Transaction-Id=0xA56250D3F17ABE679422DE85 | | 2809 | SOFTWARE="Example server, version 1.17" | | 2810 | ERROR-CODE=401 (Unauthorized) | | | 2811 | REALM="example.com" | | | 2812 | NONCE="obMatJos2AAABadl7W7PeDU4hKE72jda" | | 2813 | PASSWORD-ALGORITHMS=MD5 and SHA256 | | 2814 | | | | 2815 |--- Allocate request -------------->| | | 2816 | Transaction-Id=0xC271E932AD7446A32C234492 | | 2817 | SOFTWARE="Example client 1.03" | | | 2818 | LIFETIME=3600 (1 hour) | | | 2819 | REQUESTED-TRANSPORT=17 (UDP) | | | 2820 | DONT-FRAGMENT | | | 2821 | USERNAME="George" | | | 2822 | REALM="example.com" | | | 2823 | NONCE="obMatJos2AAABadl7W7PeDU4hKE72jda" | | 2824 | PASSWORD-ALGORITHM=SHA256 | | | 2825 | MESSAGE-INTEGRITY=... | | | 2826 | MESSAGE-INTEGRITY-SHA256=... | | | 2827 | | | | 2828 |<-- Allocate success response ------| | | 2829 | Transaction-Id=0xC271E932AD7446A32C234492 | | 2830 | SOFTWARE="Example server, version 1.17" | | 2831 | LIFETIME=1200 (20 minutes) | | | 2832 | XOR-RELAYED-ADDRESS=192.0.2.15:50000 | | 2833 | XOR-MAPPED-ADDRESS=192.0.2.1:7000 | | 2834 | MESSAGE-INTEGRITY=... | | | 2836 The client begins by selecting a host transport address to use for 2837 the TURN session; in this example, the client has selected 2838 198.51.100.2:49721 as shown in Figure 1. The client then sends an 2839 Allocate request to the server at the server transport address. The 2840 client randomly selects a 96-bit transaction id of 2841 0xA56250D3F17ABE679422DE85 for this transaction; this is encoded in 2842 the transaction id field in the fixed header. The client includes a 2843 SOFTWARE attribute that gives information about the client's 2844 software; here the value is "Example client, version 1.03" to 2845 indicate that this is version 1.03 of something called the Example 2846 client. The client includes the LIFETIME attribute because it wishes 2847 the allocation to have a longer lifetime than the default of 10 2848 minutes; the value of this attribute is 3600 seconds, which 2849 corresponds to 1 hour. The client must always include a REQUESTED- 2850 TRANSPORT attribute in an Allocate request and the only value allowed 2851 by this specification is 17, which indicates UDP transport between 2852 the server and the peers. The client also includes the DONT-FRAGMENT 2853 attribute because it wishes to use the DONT-FRAGMENT attribute later 2854 in Send indications; this attribute consists of only an attribute 2855 header, there is no value part. We assume the client has not 2856 recently interacted with the server, thus the client does not include 2857 USERNAME, USERHASH, REALM, NONCE, PASSWORD-ALGORITHMS, PASSWORD- 2858 ALGORITHM, MESSAGE-INTEGRITY or MESSAGE-INTEGRITY-SHA256 attribute. 2859 Finally, note that the order of attributes in a message is arbitrary 2860 (except for the MESSAGE-INTEGRITY, MESSAGE-INTEGRITY-SHA256 and 2861 FINGERPRINT attributes) and the client could have used a different 2862 order. 2864 Servers require any request to be authenticated. Thus, when the 2865 server receives the initial Allocate request, it rejects the request 2866 because the request does not contain the authentication attributes. 2867 Following the procedures of the long-term credential mechanism of 2868 STUN [I-D.ietf-tram-stunbis], the server includes an ERROR-CODE 2869 attribute with a value of 401 (Unauthorized), a REALM attribute that 2870 specifies the authentication realm used by the server (in this case, 2871 the server's domain "example.com"), and a nonce value in a NONCE 2872 attribute. The NONCE attribute starts with the "nonce cookie" with 2873 the STUN Security Feature "Password algorithm" bit set to 1. The 2874 server includes a PASSWORD-ALGORITHMS attribute that specifies the 2875 list of algorithms that the server can use to derive the long-term 2876 password. If the server sets the STUN Security Feature "Username 2877 anonymity" bit to 1 then the client uses the USERHASH attribute 2878 instead of the USERNAME attribute in the Allocate request to 2879 anonymise the username. The server also includes a SOFTWARE 2880 attribute that gives information about the server's software. 2882 The client, upon receipt of the 401 error, re-attempts the Allocate 2883 request, this time including the authentication attributes. The 2884 client selects a new transaction id, and then populates the new 2885 Allocate request with the same attributes as before. The client 2886 includes a USERNAME attribute and uses the realm value received from 2887 the server to help it determine which value to use; here the client 2888 is configured to use the username "George" for the realm 2889 "example.com". The client includes the PASSWORD-ALGORITHM attribute 2890 indicating the algorithm that the server must use to derive the long- 2891 term password. The client also includes the REALM and NONCE 2892 attributes, which are just copied from the 401 error response. 2894 Finally, the client includes MESSAGE-INTEGRITY and MESSAGE-INTEGRITY- 2895 SHA256 attributes as the last attributes in the message, whose values 2896 are Hashed Message Authentication Code - Secure Hash Algorithm 1 2897 (HMAC-SHA1) hash and Hashed Message Authentication Code - Secure Hash 2898 Algorithm 2 (HMAC-SHA2) hash over the contents of the message (shown 2899 as just "..." above); this HMAC-SHA1 and HMAC-SHA2 computation 2900 includes a password value. Thus, an attacker cannot compute the 2901 message integrity value without somehow knowing the secret password. 2903 The server, upon receipt of the authenticated Allocate request, 2904 checks that everything is OK, then creates an allocation. The server 2905 replies with an Allocate success response. The server includes a 2906 LIFETIME attribute giving the lifetime of the allocation; here, the 2907 server has reduced the client's requested 1-hour lifetime to just 20 2908 minutes, because this particular server doesn't allow lifetimes 2909 longer than 20 minutes. The server includes an XOR-RELAYED-ADDRESS 2910 attribute whose value is the relayed transport address of the 2911 allocation. The server includes an XOR-MAPPED-ADDRESS attribute 2912 whose value is the server-reflexive address of the client; this value 2913 is not used otherwise in TURN but is returned as a convenience to the 2914 client. The server includes either a MESSAGE-INTEGRITY or MESSAGE- 2915 INTEGRITY-SHA256 attribute to authenticate the response and to ensure 2916 its integrity; note that the response does not contain the USERNAME, 2917 REALM, and NONCE attributes. The server also includes a SOFTWARE 2918 attribute. 2920 TURN TURN Peer Peer 2921 client server A B 2922 |--- CreatePermission request ------>| | | 2923 | Transaction-Id=0xE5913A8F460956CA277D3319 | | 2924 | XOR-PEER-ADDRESS=192.0.2.150:0 | | | 2925 | USERNAME="George" | | | 2926 | REALM="example.com" | | | 2927 | NONCE="obMatJos2AAABadl7W7PeDU4hKE72jda" | | 2928 | MESSAGE-INTEGRITY=... | | | 2929 | | | | 2930 |<-- CreatePermission success resp.--| | | 2931 | Transaction-Id=0xE5913A8F460956CA277D3319 | | 2932 | MESSAGE-INTEGRITY=... | | | 2934 The client then creates a permission towards Peer A in preparation 2935 for sending it some application data. This is done through a 2936 CreatePermission request. The XOR-PEER-ADDRESS attribute contains 2937 the IP address for which a permission is established (the IP address 2938 of peer A); note that the port number in the attribute is ignored 2939 when used in a CreatePermission request, and here it has been set to 2940 0; also, note how the client uses Peer A's server-reflexive IP 2941 address and not its (private) host address. The client uses the same 2942 username, realm, and nonce values as in the previous request on the 2943 allocation. Though it is allowed to do so, the client has chosen not 2944 to include a SOFTWARE attribute in this request. 2946 The server receives the CreatePermission request, creates the 2947 corresponding permission, and then replies with a CreatePermission 2948 success response. Like the client, the server chooses not to include 2949 the SOFTWARE attribute in its reply. Again, note how success 2950 responses contain a MESSAGE-INTEGRITY or MESSAGE-INTEGRITY-SHA256 2951 attribute (assuming the server uses the long-term credential 2952 mechanism), but no USERNAME, REALM, and NONCE attributes. 2954 TURN TURN Peer Peer 2955 client server A B 2956 |--- Send indication --------------->| | | 2957 | Transaction-Id=0x1278E9ACA2711637EF7D3328 | | 2958 | XOR-PEER-ADDRESS=192.0.2.150:32102 | | 2959 | DONT-FRAGMENT | | | 2960 | DATA=... | | | 2961 | |-- UDP dgm ->| | 2962 | | data=... | | 2963 | | | | 2964 | |<- UDP dgm --| | 2965 | | data=... | | 2966 |<-- Data indication ----------------| | | 2967 | Transaction-Id=0x8231AE8F9242DA9FF287FEFF | | 2968 | XOR-PEER-ADDRESS=192.0.2.150:32102 | | 2969 | DATA=... | | | 2971 The client now sends application data to Peer A using a Send 2972 indication. Peer A's server-reflexive transport address is specified 2973 in the XOR-PEER-ADDRESS attribute, and the application data (shown 2974 here as just "...") is specified in the DATA attribute. The client 2975 is doing a form of path MTU discovery at the application layer and 2976 thus specifies (by including the DONT-FRAGMENT attribute) that the 2977 server should set the DF bit in the UDP datagram to send to the peer. 2978 Indications cannot be authenticated using the long-term credential 2979 mechanism of STUN, so no MESSAGE-INTEGRITY or MESSAGE-INTEGRITY- 2980 SHA256 attribute is included in the message. An application wishing 2981 to ensure that its data is not altered or forged must integrity- 2982 protect its data at the application level. 2984 Upon receipt of the Send indication, the server extracts the 2985 application data and sends it in a UDP datagram to Peer A, with the 2986 relayed transport address as the source transport address of the 2987 datagram, and with the DF bit set as requested. Note that, had the 2988 client not previously established a permission for Peer A's server- 2989 reflexive IP address, then the server would have silently discarded 2990 the Send indication instead. 2992 Peer A then replies with its own UDP datagram containing application 2993 data. The datagram is sent to the relayed transport address on the 2994 server. When this arrives, the server creates a Data indication 2995 containing the source of the UDP datagram in the XOR-PEER-ADDRESS 2996 attribute, and the data from the UDP datagram in the DATA attribute. 2997 The resulting Data indication is then sent to the client. 2999 TURN TURN Peer Peer 3000 client server A B 3001 |--- ChannelBind request ----------->| | | 3002 | Transaction-Id=0x6490D3BC175AFF3D84513212 | | 3003 | CHANNEL-NUMBER=0x4000 | | | 3004 | XOR-PEER-ADDRESS=192.0.2.210:49191 | | 3005 | USERNAME="George" | | | 3006 | REALM="example.com" | | | 3007 | NONCE="obMatJos2AAABadl7W7PeDU4hKE72jda" | | 3008 | MESSAGE-INTEGRITY=... | | | 3009 | | | | 3010 |<-- ChannelBind success response ---| | | 3011 | Transaction-Id=0x6490D3BC175AFF3D84513212 | | 3012 | MESSAGE-INTEGRITY=... | | | 3014 The client now binds a channel to Peer B, specifying a free channel 3015 number (0x4000) in the CHANNEL-NUMBER attribute, and Peer B's 3016 transport address in the XOR-PEER-ADDRESS attribute. As before, the 3017 client re-uses the username, realm, and nonce from its last request 3018 in the message. 3020 Upon receipt of the request, the server binds the channel number to 3021 the peer, installs a permission for Peer B's IP address, and then 3022 replies with ChannelBind success response. 3024 TURN TURN Peer Peer 3025 client server A B 3026 |--- ChannelData ------------------->| | | 3027 | Channel-number=0x4000 |--- UDP datagram --------->| 3028 | Data=... | Data=... | 3029 | | | | 3030 | |<-- UDP datagram ----------| 3031 | | Data=... | | 3032 |<-- ChannelData --------------------| | | 3033 | Channel-number=0x4000 | | | 3034 | Data=... | | | 3036 The client now sends a ChannelData message to the server with data 3037 destined for Peer B. The ChannelData message is not a STUN message, 3038 and thus has no transaction id. Instead, it has only three fields: a 3039 channel number, data, and data length; here the channel number field 3040 is 0x4000 (the channel the client just bound to Peer B). When the 3041 server receives the ChannelData message, it checks that the channel 3042 is currently bound (which it is) and then sends the data onward to 3043 Peer B in a UDP datagram, using the relayed transport address as the 3044 source transport address and 192.0.2.210:49191 (the value of the XOR- 3045 PEER-ADDRESS attribute in the ChannelBind request) as the destination 3046 transport address. 3048 Later, Peer B sends a UDP datagram back to the relayed transport 3049 address. This causes the server to send a ChannelData message to the 3050 client containing the data from the UDP datagram. The server knows 3051 to which client to send the ChannelData message because of the 3052 relayed transport address at which the UDP datagram arrived, and 3053 knows to use channel 0x4000 because this is the channel bound to 3054 192.0.2.210:49191. Note that if there had not been any channel 3055 number bound to that address, the server would have used a Data 3056 indication instead. 3058 TURN TURN Peer Peer 3059 client server A B 3060 |--- Refresh request --------------->| | | 3061 | Transaction-Id=0x0864B3C27ADE9354B4312414 | | 3062 | SOFTWARE="Example client 1.03" | | | 3063 | USERNAME="George" | | | 3064 | REALM="example.com" | | | 3065 | NONCE="obMatJos2AAABadl7W7PeDU4hKE72jda" | | 3066 | MESSAGE-INTEGRITY=... | | | 3067 | | | | 3068 |<-- Refresh error response ---------| | | 3069 | Transaction-Id=0x0864B3C27ADE9354B4312414 | | 3070 | SOFTWARE="Example server, version 1.17" | | 3071 | ERROR-CODE=438 (Stale Nonce) | | | 3072 | REALM="example.com" | | | 3073 | NONCE="obMatJos2AAABnpSw1Xw239bBwGYhjN" | | 3074 | PASSWORD-ALGORITHMS=MD5 and SHA256 | | 3075 | | | | 3076 |--- Refresh request --------------->| | | 3077 | Transaction-Id=0x427BD3E625A85FC731DC4191 | | 3078 | SOFTWARE="Example client 1.03" | | | 3079 | USERNAME="George" | | | 3080 | REALM="example.com" | | | 3081 | NONCE="obMatJos2AAABnpSw1Xw239bBwGYhjNj" | | 3082 | PASSWORD-ALGORITHM=SHA256 | | | 3083 | MESSAGE-INTEGRITY=... | | | 3084 | | | | 3085 |<-- Refresh success response -------| | | 3086 | Transaction-Id=0x427BD3E625A85FC731DC4191 | | 3087 | SOFTWARE="Example server, version 1.17" | | 3088 | LIFETIME=600 (10 minutes) | | | 3090 Sometime before the 20 minute lifetime is up, the client refreshes 3091 the allocation. This is done using a Refresh request. As before, 3092 the client includes the latest username, realm, and nonce values in 3093 the request. The client also includes the SOFTWARE attribute, 3094 following the recommended practice of always including this attribute 3095 in Allocate and Refresh messages. When the server receives the 3096 Refresh request, it notices that the nonce value has expired, and so 3097 replies with 438 (Stale Nonce) error given a new nonce value. The 3098 client then reattempts the request, this time with the new nonce 3099 value. This second attempt is accepted, and the server replies with 3100 a success response. Note that the client did not include a LIFETIME 3101 attribute in the request, so the server refreshes the allocation for 3102 the default lifetime of 10 minutes (as can be seen by the LIFETIME 3103 attribute in the success response). 3105 19. Security Considerations 3107 This section considers attacks that are possible in a TURN 3108 deployment, and discusses how they are mitigated by mechanisms in the 3109 protocol or recommended practices in the implementation. 3111 Most of the attacks on TURN are mitigated by the server requiring 3112 requests be authenticated. Thus, this specification requires the use 3113 of authentication. The mandatory-to-implement mechanism is the long- 3114 term credential mechanism of STUN. Other authentication mechanisms 3115 of equal or stronger security properties may be used. However, it is 3116 important to ensure that they can be invoked in an inter-operable 3117 way. 3119 19.1. Outsider Attacks 3121 Outsider attacks are ones where the attacker has no credentials in 3122 the system, and is attempting to disrupt the service seen by the 3123 client or the server. 3125 19.1.1. Obtaining Unauthorized Allocations 3127 An attacker might wish to obtain allocations on a TURN server for any 3128 number of nefarious purposes. A TURN server provides a mechanism for 3129 sending and receiving packets while cloaking the actual IP address of 3130 the client. This makes TURN servers an attractive target for 3131 attackers who wish to use it to mask their true identity. 3133 An attacker might also wish to simply utilize the services of a TURN 3134 server without paying for them. Since TURN services require 3135 resources from the provider, it is anticipated that their usage will 3136 come with a cost. 3138 These attacks are prevented using the long-term credential mechanism, 3139 which allows the TURN server to determine the identity of the 3140 requestor and whether the requestor is allowed to obtain the 3141 allocation. 3143 19.1.2. Offline Dictionary Attacks 3145 The long-term credential mechanism used by TURN is subject to offline 3146 dictionary attacks. An attacker that is capable of eavesdropping on 3147 a message exchange between a client and server can determine the 3148 password by trying a number of candidate passwords and seeing if one 3149 of them is correct. This attack works when the passwords are low 3150 entropy, such as a word from the dictionary. This attack can be 3151 mitigated by using strong passwords with large entropy. In 3152 situations where even stronger mitigation is required, (D)TLS 3153 transport between the client and the server can be used. 3155 19.1.3. Faked Refreshes and Permissions 3157 An attacker might wish to attack an active allocation by sending it a 3158 Refresh request with an immediate expiration, in order to delete it 3159 and disrupt service to the client. This is prevented by 3160 authentication of refreshes. Similarly, an attacker wishing to send 3161 CreatePermission requests to create permissions to undesirable 3162 destinations is prevented from doing so through authentication. The 3163 motivations for such an attack are described in Section 19.2. 3165 19.1.4. Fake Data 3167 An attacker might wish to send data to the client or the peer, as if 3168 they came from the peer or client, respectively. To do that, the 3169 attacker can send the client a faked Data Indication or ChannelData 3170 message, or send the TURN server a faked Send Indication or 3171 ChannelData message. 3173 Since indications and ChannelData messages are not authenticated, 3174 this attack is not prevented by TURN. However, this attack is 3175 generally present in IP-based communications and is not substantially 3176 worsened by TURN. Consider a normal, non-TURN IP session between 3177 hosts A and B. An attacker can send packets to B as if they came 3178 from A by sending packets towards A with a spoofed IP address of B. 3179 This attack requires the attacker to know the IP addresses of A and 3180 B. With TURN, an attacker wishing to send packets towards a client 3181 using a Data indication needs to know its IP address (and port), the 3182 IP address and port of the TURN server, and the IP address and port 3183 of the peer (for inclusion in the XOR-PEER-ADDRESS attribute). To 3184 send a fake ChannelData message to a client, an attacker needs to 3185 know the IP address and port of the client, the IP address and port 3186 of the TURN server, and the channel number. This particular 3187 combination is mildly more guessable than in the non-TURN case. 3189 These attacks are more properly mitigated by application-layer 3190 authentication techniques. In the case of real-time traffic, usage 3191 of SRTP [RFC3711] prevents these attacks. 3193 In some situations, the TURN server may be situated in the network 3194 such that it is able to send to hosts to which the client cannot 3195 directly send. This can happen, for example, if the server is 3196 located behind a firewall that allows packets from outside the 3197 firewall to be delivered to the server, but not to other hosts behind 3198 the firewall. In these situations, an attacker could send the server 3199 a Send indication with an XOR-PEER-ADDRESS attribute containing the 3200 transport address of one of the other hosts behind the firewall. If 3201 the server was to allow relaying of traffic to arbitrary peers, then 3202 this would provide a way for the attacker to attack arbitrary hosts 3203 behind the firewall. 3205 To mitigate this attack, TURN requires that the client establish a 3206 permission to a host before sending it data. Thus, an attacker can 3207 only attack hosts with which the client is already communicating, 3208 unless the attacker is able to create authenticated requests. 3209 Furthermore, the server administrator may configure the server to 3210 restrict the range of IP addresses and ports to which it will relay 3211 data. To provide even greater security, the server administrator can 3212 require that the client use (D)TLS for all communication between the 3213 client and the server. 3215 19.1.5. Impersonating a Server 3217 When a client learns a relayed address from a TURN server, it uses 3218 that relayed address in application protocols to receive traffic. 3219 Therefore, an attacker wishing to intercept or redirect that traffic 3220 might try to impersonate a TURN server and provide the client with a 3221 faked relayed address. 3223 This attack is prevented through the long-term credential mechanism, 3224 which provides message integrity for responses in addition to 3225 verifying that they came from the server. Furthermore, an attacker 3226 cannot replay old server responses as the transaction id in the STUN 3227 header prevents this. Replay attacks are further thwarted through 3228 frequent changes to the nonce value. 3230 19.1.6. Eavesdropping Traffic 3232 TURN concerns itself primarily with authentication and message 3233 integrity. Confidentiality is only a secondary concern, as TURN 3234 control messages do not include information that is particularly 3235 sensitive. The primary protocol content of the messages is the IP 3236 address of the peer. If it is important to prevent an eavesdropper 3237 on a TURN connection from learning this, TURN can be run over (D)TLS. 3239 Confidentiality for the application data relayed by TURN is best 3240 provided by the application protocol itself, since running TURN over 3241 (D)TLS does not protect application data between the server and the 3242 peer. If confidentiality of application data is important, then the 3243 application should encrypt or otherwise protect its data. For 3244 example, for real-time media, confidentiality can be provided by 3245 using SRTP. 3247 19.1.7. TURN Loop Attack 3249 An attacker might attempt to cause data packets to loop indefinitely 3250 between two TURN servers. The attack goes as follows. First, the 3251 attacker sends an Allocate request to server A, using the source 3252 address of server B. Server A will send its response to server B, 3253 and for the attack to succeed, the attacker must have the ability to 3254 either view or guess the contents of this response, so that the 3255 attacker can learn the allocated relayed transport address. The 3256 attacker then sends an Allocate request to server B, using the source 3257 address of server A. Again, the attacker must be able to view or 3258 guess the contents of the response, so it can send learn the 3259 allocated relayed transport address. Using the same spoofed source 3260 address technique, the attacker then binds a channel number on server 3261 A to the relayed transport address on server B, and similarly binds 3262 the same channel number on server B to the relayed transport address 3263 on server A. Finally, the attacker sends a ChannelData message to 3264 server A. 3266 The result is a data packet that loops from the relayed transport 3267 address on server A to the relayed transport address on server B, 3268 then from server B's transport address to server A's transport 3269 address, and then around the loop again. 3271 This attack is mitigated as follows. By requiring all requests to be 3272 authenticated and/or by randomizing the port number allocated for the 3273 relayed transport address, the server forces the attacker to either 3274 intercept or view responses sent to a third party (in this case, the 3275 other server) so that the attacker can authenticate the requests and 3276 learn the relayed transport address. Without one of these two 3277 measures, an attacker can guess the contents of the responses without 3278 needing to see them, which makes the attack much easier to perform. 3279 Furthermore, by requiring authenticated requests, the server forces 3280 the attacker to have credentials acceptable to the server, which 3281 turns this from an outsider attack into an insider attack and allows 3282 the attack to be traced back to the client initiating it. 3284 The attack can be further mitigated by imposing a per-username limit 3285 on the bandwidth used to relay data by allocations owned by that 3286 username, to limit the impact of this attack on other allocations. 3287 More mitigation can be achieved by decrementing the TTL when relaying 3288 data packets (if the underlying OS allows this). 3290 19.2. Firewall Considerations 3292 A key security consideration of TURN is that TURN should not weaken 3293 the protections afforded by firewalls deployed between a client and a 3294 TURN server. It is anticipated that TURN servers will often be 3295 present on the public Internet, and clients may often be inside 3296 enterprise networks with corporate firewalls. If TURN servers 3297 provide a 'backdoor' for reaching into the enterprise, TURN will be 3298 blocked by these firewalls. 3300 TURN servers therefore emulate the behavior of NAT devices that 3301 implement address-dependent filtering [RFC4787], a property common in 3302 many firewalls as well. When a NAT or firewall implements this 3303 behavior, packets from an outside IP address are only allowed to be 3304 sent to an internal IP address and port if the internal IP address 3305 and port had recently sent a packet to that outside IP address. TURN 3306 servers introduce the concept of permissions, which provide exactly 3307 this same behavior on the TURN server. An attacker cannot send a 3308 packet to a TURN server and expect it to be relayed towards the 3309 client, unless the client has tried to contact the attacker first. 3311 It is important to note that some firewalls have policies that are 3312 even more restrictive than address-dependent filtering. Firewalls 3313 can also be configured with address- and port-dependent filtering, or 3314 can be configured to disallow inbound traffic entirely. In these 3315 cases, if a client is allowed to connect the TURN server, 3316 communications to the client will be less restrictive than what the 3317 firewall would normally allow. 3319 19.2.1. Faked Permissions 3321 In firewalls and NAT devices, permissions are granted implicitly 3322 through the traversal of a packet from the inside of the network 3323 towards the outside peer. Thus, a permission cannot, by definition, 3324 be created by any entity except one inside the firewall or NAT. With 3325 TURN, this restriction no longer holds. Since the TURN server sits 3326 outside the firewall, at attacker outside the firewall can now send a 3327 message to the TURN server and try to create a permission for itself. 3329 This attack is prevented because all messages that create permissions 3330 (i.e., ChannelBind and CreatePermission) are authenticated. 3332 19.2.2. Blacklisted IP Addresses 3334 Many firewalls can be configured with blacklists that prevent a 3335 client behind the firewall from sending packets to, or receiving 3336 packets from, ranges of blacklisted IP addresses. This is 3337 accomplished by inspecting the source and destination addresses of 3338 packets entering and exiting the firewall, respectively. 3340 This feature is also present in TURN, since TURN servers are allowed 3341 to arbitrarily restrict the range of addresses of peers that they 3342 will relay to. 3344 19.2.3. Running Servers on Well-Known Ports 3346 A malicious client behind a firewall might try to connect to a TURN 3347 server and obtain an allocation which it then uses to run a server. 3348 For example, a client might try to run a DNS server or FTP server. 3350 This is not possible in TURN. A TURN server will never accept 3351 traffic from a peer for which the client has not installed a 3352 permission. Thus, peers cannot just connect to the allocated port in 3353 order to obtain the service. 3355 19.3. Insider Attacks 3357 In insider attacks, a client has legitimate credentials but defies 3358 the trust relationship that goes with those credentials. These 3359 attacks cannot be prevented by cryptographic means but need to be 3360 considered in the design of the protocol. 3362 19.3.1. DoS against TURN Server 3364 A client wishing to disrupt service to other clients might obtain an 3365 allocation and then flood it with traffic, in an attempt to swamp the 3366 server and prevent it from servicing other legitimate clients. This 3367 is mitigated by the recommendation that the server limit the amount 3368 of bandwidth it will relay for a given username. This won't prevent 3369 a client from sending a large amount of traffic, but it allows the 3370 server to immediately discard traffic in excess. 3372 Since each allocation uses a port number on the IP address of the 3373 TURN server, the number of allocations on a server is finite. An 3374 attacker might attempt to consume all of them by requesting a large 3375 number of allocations. This is prevented by the recommendation that 3376 the server impose a limit of the number of allocations active at a 3377 time for a given username. 3379 19.3.2. Anonymous Relaying of Malicious Traffic 3381 TURN servers provide a degree of anonymization. A client can send 3382 data to peers without revealing its own IP address. TURN servers may 3383 therefore become attractive vehicles for attackers to launch attacks 3384 against targets without fear of detection. Indeed, it is possible 3385 for a client to chain together multiple TURN servers, such that any 3386 number of relays can be used before a target receives a packet. 3388 Administrators who are worried about this attack can maintain logs 3389 that capture the actual source IP and port of the client, and perhaps 3390 even every permission that client installs. This will allow for 3391 forensic tracing to determine the original source, should it be 3392 discovered that an attack is being relayed through a TURN server. 3394 19.3.3. Manipulating Other Allocations 3396 An attacker might attempt to disrupt service to other users of the 3397 TURN server by sending Refresh requests or CreatePermission requests 3398 that (through source address spoofing) appear to be coming from 3399 another user of the TURN server. TURN prevents this by requiring 3400 that the credentials used in CreatePermission, Refresh, and 3401 ChannelBind messages match those used to create the initial 3402 allocation. Thus, the fake requests from the attacker will be 3403 rejected. 3405 19.4. Tunnel Amplification Attack 3407 An attacker might attempt to cause data packets to loop numerous 3408 times between a TURN server and a tunnel between IPv4 and IPv6. The 3409 attack goes as follows. 3411 Suppose an attacker knows that a tunnel endpoint will forward 3412 encapsulated packets from a given IPv6 address (this doesn't 3413 necessarily need to be the tunnel endpoint's address). Suppose he 3414 then spoofs two packets from this address: 3416 1. An Allocate request asking for a v4 address, and 3418 2. A ChannelBind request establishing a channel to the IPv4 address 3419 of the tunnel endpoint 3421 Then he has set up an amplification attack: 3423 o The TURN relay will re-encapsulate IPv6 UDP data in v4 and send it 3424 to the tunnel endpoint 3426 o The tunnel endpoint will de-encapsulate packets from the v4 3427 interface and send them to v6 3429 So if the attacker sends a packet of the following form... 3431 IPv6: src=2001:DB9::1 dst=2001:DB8::2 3432 UDP: 3433 TURN: 3434 IPv6: src=2001:DB9::1 dst=2001:DB8::2 3435 UDP: 3436 TURN: 3437 IPv6: src=2001:DB9::1 dst=2001:DB8::2 3438 UDP: 3439 TURN: 3440 ... 3442 Then the TURN relay and the tunnel endpoint will send it back and 3443 forth until the last TURN header is consumed, at which point the TURN 3444 relay will send an empty packet, which the tunnel endpoint will drop. 3446 The amplification potential here is limited by the MTU, so it's not 3447 huge: IPv6+UDP+TURN takes 334 bytes, so a four-to-one amplification 3448 out of a 1500-byte packet is possible. But the attacker could still 3449 increase traffic volume by sending multiple packets or by 3450 establishing multiple channels spoofed from different addresses 3451 behind the same tunnel endpoint. 3453 The attack is mitigated as follows. It is RECOMMENDED that TURN 3454 relays not accept allocation or channel binding requests from 3455 addresses known to be tunneled, and that they not forward data to 3456 such addresses. In particular, a TURN relay MUST NOT accept Teredo 3457 or 6to4 addresses in these requests. 3459 19.5. Other Considerations 3461 Any relay addresses learned through an Allocate request will not 3462 operate properly with IPsec Authentication Header (AH) [RFC4302] in 3463 transport or tunnel mode. However, tunnel-mode IPsec Encapsulating 3464 Security Payload (ESP) [RFC4303] should still operate. 3466 20. IANA Considerations 3468 [Paragraphs in braces should be removed by the RFC Editor upon 3469 publication] 3471 The codepoints for the STUN methods defined in this specification are 3472 listed in Section 15. [IANA is requested to update the reference 3473 from [RFC5766] to RFC-to-be for the STUN methods listed in 3474 Section 15.] 3476 The codepoints for the STUN attributes defined in this specification 3477 are listed in Section 16. [IANA is requested to update the reference 3478 from [RFC5766] to RFC-to-be for the STUN attributes CHANNEL-NUMBER, 3479 LIFETIME, Reserved (was BANDWIDTH), XOR-PEER-ADDRESS, DATA, XOR- 3480 RELAYED-ADDRESS, REQUESTED-ADDRESS-FAMILY, EVEN-PORT, REQUESTED- 3481 TRANSPORT, DONT-FRAGMENT, Reserved (was TIMER-VAL) and RESERVATION- 3482 TOKEN listed in Section 16.] 3484 [The ADDITIONAL-ADDRESS-FAMILY, ADDRESS-ERROR-CODE and ICMP 3485 attributes requires that IANA allocate a value in the "STUN 3486 attributes Registry" from the comprehension-optional range 3487 (0x8000-0xFFFF), to be replaced for TBD-CA throughout this document] 3489 The codepoints for the STUN error codes defined in this specification 3490 are listed in Section 17. [IANA is requested to update the reference 3491 from [RFC5766] to RFC-to-be for the STUN error codes listed in 3492 Section 17.] 3494 IANA has allocated the SRV service name of "turn" for TURN over UDP 3495 or TCP, and the service name of "turns" for TURN over (D)TLS. 3497 IANA has created a registry for TURN channel numbers, initially 3498 populated as follows: 3500 o 0x0000 through 0x3FFF: Reserved and not available for use, since 3501 they conflict with the STUN header. 3503 o 0x4000 through 0x7FFF: A TURN implementation is free to use 3504 channel numbers in this range. 3506 o 0x8000 through 0xFFFF: Unassigned. 3508 Any change to this registry must be made through an IETF Standards 3509 Action. 3511 21. IAB Considerations 3513 The IAB has studied the problem of "Unilateral Self Address Fixing" 3514 (UNSAF), which is the general process by which a client attempts to 3515 determine its address in another realm on the other side of a NAT 3516 through a collaborative protocol-reflection mechanism [RFC3424]. The 3517 TURN extension is an example of a protocol that performs this type of 3518 function. The IAB has mandated that any protocols developed for this 3519 purpose document a specific set of considerations. These 3520 considerations and the responses for TURN are documented in this 3521 section. 3523 Consideration 1: Precise definition of a specific, limited-scope 3524 problem that is to be solved with the UNSAF proposal. A short-term 3525 fix should not be generalized to solve other problems. Such 3526 generalizations lead to the prolonged dependence on and usage of the 3527 supposed short-term fix -- meaning that it is no longer accurate to 3528 call it "short-term". 3530 Response: TURN is a protocol for communication between a relay (= 3531 TURN server) and its client. The protocol allows a client that is 3532 behind a NAT to obtain and use a public IP address on the relay. As 3533 a convenience to the client, TURN also allows the client to determine 3534 its server-reflexive transport address. 3536 Consideration 2: Description of an exit strategy/transition plan. 3537 The better short-term fixes are the ones that will naturally see less 3538 and less use as the appropriate technology is deployed. 3540 Response: TURN will no longer be needed once there are no longer any 3541 NATs. Unfortunately, as of the date of publication of this document, 3542 it no longer seems very likely that NATs will go away any time soon. 3543 However, the need for TURN will also decrease as the number of NATs 3544 with the mapping property of Endpoint-Independent Mapping [RFC4787] 3545 increases. 3547 Consideration 3: Discussion of specific issues that may render 3548 systems more "brittle". For example, approaches that involve using 3549 data at multiple network layers create more dependencies, increase 3550 debugging challenges, and make it harder to transition. 3552 Response: TURN is "brittle" in that it requires the NAT bindings 3553 between the client and the server to be maintained unchanged for the 3554 lifetime of the allocation. This is typically done using keep- 3555 alives. If this is not done, then the client will lose its 3556 allocation and can no longer exchange data with its peers. 3558 Consideration 4: Identify requirements for longer-term, sound 3559 technical solutions; contribute to the process of finding the right 3560 longer-term solution. 3562 Response: The need for TURN will be reduced once NATs implement the 3563 recommendations for NAT UDP behavior documented in [RFC4787]. 3564 Applications are also strongly urged to use ICE [RFC5245] to 3565 communicate with peers; though ICE uses TURN, it does so only as a 3566 last resort, and uses it in a controlled manner. 3568 Consideration 5: Discussion of the impact of the noted practical 3569 issues with existing deployed NATs and experience reports. 3571 Response: Some NATs deployed today exhibit a mapping behavior other 3572 than Endpoint-Independent mapping. These NATs are difficult to work 3573 with, as they make it difficult or impossible for protocols like ICE 3574 to use server-reflexive transport addresses on those NATs. A client 3575 behind such a NAT is often forced to use a relay protocol like TURN 3576 because "UDP hole punching" techniques [RFC5128] do not work. 3578 22. Changes since RFC 5766 3580 This section lists the major changes in the TURN protocol from the 3581 original [RFC5766] specification. 3583 o IPv6 support. 3585 o REQUESTED-ADDRESS-FAMILY, ADDITIONAL-ADDRESS-FAMILY, AND ADDRESS- 3586 ERR-CODE attributes. 3588 o 440 (Address Family not Supported) and 443 (Peer Address Family 3589 Mismatch) responses. 3591 o Description of the tunnel amplification attack. 3593 o DTLS support. 3595 o More details on packet translations. 3597 o Add support for receiving ICMP packets. 3599 o Updates PMTUD. 3601 23. Acknowledgements 3603 Most of the text in this note comes from the original TURN 3604 specification, [RFC5766]. The authors would like to thank Rohan Mahy 3605 co-author of original TURN specification and everyone who had 3606 contributed to that document. The authors would also like to 3607 acknowledge that this document inherits material from [RFC6156]. 3609 Thanks to Justin Uberti, Pal Martinsen, Oleg Moskalenko, Aijun Wang 3610 and Simon Perreault for their help on SSODA mechanism. Authors would 3611 like to thank Gonzalo Salgueiro, Simon Perreault, Jonathan Lennox and 3612 Oleg Moskalenko for comments and review. The authors would like to 3613 thank Marc for his contributions to the text. 3615 24. References 3617 24.1. Normative References 3619 [I-D.ietf-tram-stunbis] 3620 Petit-Huguenin, M., Salgueiro, G., Rosenberg, J., Wing, 3621 D., Mahy, R., and P. Matthews, "Session Traversal 3622 Utilities for NAT (STUN)", draft-ietf-tram-stunbis-15 3623 (work in progress), January 2018. 3625 [RFC0792] Postel, J., "Internet Control Message Protocol", STD 5, 3626 RFC 792, DOI 10.17487/RFC0792, September 1981, 3627 . 3629 [RFC1122] Braden, R., Ed., "Requirements for Internet Hosts - 3630 Communication Layers", STD 3, RFC 1122, 3631 DOI 10.17487/RFC1122, October 1989, 3632 . 3634 [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate 3635 Requirement Levels", BCP 14, RFC 2119, 3636 DOI 10.17487/RFC2119, March 1997, 3637 . 3639 [RFC2474] Nichols, K., Blake, S., Baker, F., and D. Black, 3640 "Definition of the Differentiated Services Field (DS 3641 Field) in the IPv4 and IPv6 Headers", RFC 2474, 3642 DOI 10.17487/RFC2474, December 1998, 3643 . 3645 [RFC3168] Ramakrishnan, K., Floyd, S., and D. Black, "The Addition 3646 of Explicit Congestion Notification (ECN) to IP", 3647 RFC 3168, DOI 10.17487/RFC3168, September 2001, 3648 . 3650 [RFC4443] Conta, A., Deering, S., and M. Gupta, Ed., "Internet 3651 Control Message Protocol (ICMPv6) for the Internet 3652 Protocol Version 6 (IPv6) Specification", STD 89, 3653 RFC 4443, DOI 10.17487/RFC4443, March 2006, 3654 . 3656 [RFC5246] Dierks, T. and E. Rescorla, "The Transport Layer Security 3657 (TLS) Protocol Version 1.2", RFC 5246, 3658 DOI 10.17487/RFC5246, August 2008, 3659 . 3661 [RFC6347] Rescorla, E. and N. Modadugu, "Datagram Transport Layer 3662 Security Version 1.2", RFC 6347, DOI 10.17487/RFC6347, 3663 January 2012, . 3665 [RFC6437] Amante, S., Carpenter, B., Jiang, S., and J. Rajahalme, 3666 "IPv6 Flow Label Specification", RFC 6437, 3667 DOI 10.17487/RFC6437, November 2011, 3668 . 3670 [RFC6555] Wing, D. and A. Yourtchenko, "Happy Eyeballs: Success with 3671 Dual-Stack Hosts", RFC 6555, DOI 10.17487/RFC6555, April 3672 2012, . 3674 [RFC6724] Thaler, D., Ed., Draves, R., Matsumoto, A., and T. Chown, 3675 "Default Address Selection for Internet Protocol Version 6 3676 (IPv6)", RFC 6724, DOI 10.17487/RFC6724, September 2012, 3677 . 3679 [RFC7065] Petit-Huguenin, M., Nandakumar, S., Salgueiro, G., and P. 3680 Jones, "Traversal Using Relays around NAT (TURN) Uniform 3681 Resource Identifiers", RFC 7065, DOI 10.17487/RFC7065, 3682 November 2013, . 3684 [RFC7915] Bao, C., Li, X., Baker, F., Anderson, T., and F. Gont, 3685 "IP/ICMP Translation Algorithm", RFC 7915, 3686 DOI 10.17487/RFC7915, June 2016, 3687 . 3689 24.2. Informative References 3691 [Frag-Harmful] 3692 "Fragmentation Considered Harmful", . 3695 [I-D.ietf-tram-stun-pmtud] 3696 Petit-Huguenin, M. and G. Salgueiro, "Path MTU Discovery 3697 Using Session Traversal Utilities for NAT (STUN)", draft- 3698 ietf-tram-stun-pmtud-06 (work in progress), September 3699 2017. 3701 [I-D.rosenberg-mmusic-ice-nonsip] 3702 Rosenberg, J., "Guidelines for Usage of Interactive 3703 Connectivity Establishment (ICE) by non Session Initiation 3704 Protocol (SIP) Protocols", draft-rosenberg-mmusic-ice- 3705 nonsip-01 (work in progress), July 2008. 3707 [Port-Numbers] 3708 "IANA Port Numbers Registry", 2005, 3709 . 3711 [Protocol-Numbers] 3712 "IANA Protocol Numbers Registry", 2005, 3713 . 3715 [RFC0791] Postel, J., "Internet Protocol", STD 5, RFC 791, 3716 DOI 10.17487/RFC0791, September 1981, 3717 . 3719 [RFC1191] Mogul, J. and S. Deering, "Path MTU discovery", RFC 1191, 3720 DOI 10.17487/RFC1191, November 1990, 3721 . 3723 [RFC1918] Rekhter, Y., Moskowitz, B., Karrenberg, D., de Groot, G., 3724 and E. Lear, "Address Allocation for Private Internets", 3725 BCP 5, RFC 1918, DOI 10.17487/RFC1918, February 1996, 3726 . 3728 [RFC1928] Leech, M., Ganis, M., Lee, Y., Kuris, R., Koblas, D., and 3729 L. Jones, "SOCKS Protocol Version 5", RFC 1928, 3730 DOI 10.17487/RFC1928, March 1996, 3731 . 3733 [RFC3261] Rosenberg, J., Schulzrinne, H., Camarillo, G., Johnston, 3734 A., Peterson, J., Sparks, R., Handley, M., and E. 3735 Schooler, "SIP: Session Initiation Protocol", RFC 3261, 3736 DOI 10.17487/RFC3261, June 2002, 3737 . 3739 [RFC3424] Daigle, L., Ed. and IAB, "IAB Considerations for 3740 UNilateral Self-Address Fixing (UNSAF) Across Network 3741 Address Translation", RFC 3424, DOI 10.17487/RFC3424, 3742 November 2002, . 3744 [RFC3550] Schulzrinne, H., Casner, S., Frederick, R., and V. 3745 Jacobson, "RTP: A Transport Protocol for Real-Time 3746 Applications", STD 64, RFC 3550, DOI 10.17487/RFC3550, 3747 July 2003, . 3749 [RFC3711] Baugher, M., McGrew, D., Naslund, M., Carrara, E., and K. 3750 Norrman, "The Secure Real-time Transport Protocol (SRTP)", 3751 RFC 3711, DOI 10.17487/RFC3711, March 2004, 3752 . 3754 [RFC4086] Eastlake 3rd, D., Schiller, J., and S. Crocker, 3755 "Randomness Requirements for Security", BCP 106, RFC 4086, 3756 DOI 10.17487/RFC4086, June 2005, 3757 . 3759 [RFC4302] Kent, S., "IP Authentication Header", RFC 4302, 3760 DOI 10.17487/RFC4302, December 2005, 3761 . 3763 [RFC4303] Kent, S., "IP Encapsulating Security Payload (ESP)", 3764 RFC 4303, DOI 10.17487/RFC4303, December 2005, 3765 . 3767 [RFC4787] Audet, F., Ed. and C. Jennings, "Network Address 3768 Translation (NAT) Behavioral Requirements for Unicast 3769 UDP", BCP 127, RFC 4787, DOI 10.17487/RFC4787, January 3770 2007, . 3772 [RFC4821] Mathis, M. and J. Heffner, "Packetization Layer Path MTU 3773 Discovery", RFC 4821, DOI 10.17487/RFC4821, March 2007, 3774 . 3776 [RFC5128] Srisuresh, P., Ford, B., and D. Kegel, "State of Peer-to- 3777 Peer (P2P) Communication across Network Address 3778 Translators (NATs)", RFC 5128, DOI 10.17487/RFC5128, March 3779 2008, . 3781 [RFC5245] Rosenberg, J., "Interactive Connectivity Establishment 3782 (ICE): A Protocol for Network Address Translator (NAT) 3783 Traversal for Offer/Answer Protocols", RFC 5245, 3784 DOI 10.17487/RFC5245, April 2010, 3785 . 3787 [RFC5766] Mahy, R., Matthews, P., and J. Rosenberg, "Traversal Using 3788 Relays around NAT (TURN): Relay Extensions to Session 3789 Traversal Utilities for NAT (STUN)", RFC 5766, 3790 DOI 10.17487/RFC5766, April 2010, 3791 . 3793 [RFC5928] Petit-Huguenin, M., "Traversal Using Relays around NAT 3794 (TURN) Resolution Mechanism", RFC 5928, 3795 DOI 10.17487/RFC5928, August 2010, 3796 . 3798 [RFC6056] Larsen, M. and F. Gont, "Recommendations for Transport- 3799 Protocol Port Randomization", BCP 156, RFC 6056, 3800 DOI 10.17487/RFC6056, January 2011, 3801 . 3803 [RFC6062] Perreault, S., Ed. and J. Rosenberg, "Traversal Using 3804 Relays around NAT (TURN) Extensions for TCP Allocations", 3805 RFC 6062, DOI 10.17487/RFC6062, November 2010, 3806 . 3808 [RFC6156] Camarillo, G., Novo, O., and S. Perreault, Ed., "Traversal 3809 Using Relays around NAT (TURN) Extension for IPv6", 3810 RFC 6156, DOI 10.17487/RFC6156, April 2011, 3811 . 3813 [RFC7635] Reddy, T., Patil, P., Ravindranath, R., and J. Uberti, 3814 "Session Traversal Utilities for NAT (STUN) Extension for 3815 Third-Party Authorization", RFC 7635, 3816 DOI 10.17487/RFC7635, August 2015, 3817 . 3819 [RFC7983] Petit-Huguenin, M. and G. Salgueiro, "Multiplexing Scheme 3820 Updates for Secure Real-time Transport Protocol (SRTP) 3821 Extension for Datagram Transport Layer Security (DTLS)", 3822 RFC 7983, DOI 10.17487/RFC7983, September 2016, 3823 . 3825 [RFC8155] Patil, P., Reddy, T., and D. Wing, "Traversal Using Relays 3826 around NAT (TURN) Server Auto Discovery", RFC 8155, 3827 DOI 10.17487/RFC8155, April 2017, 3828 . 3830 Authors' Addresses 3832 Tirumaleswar Reddy (editor) 3833 McAfee, Inc. 3834 Embassy Golf Link Business Park 3835 Bangalore, Karnataka 560071 3836 India 3838 Email: kondtir@gmail.com 3840 Alan Johnston (editor) 3841 Rowan University 3842 Glassboro, NJ 3843 USA 3845 Email: alan.b.johnston@gmail.com 3847 Philip Matthews 3848 Alcatel-Lucent 3849 600 March Road 3850 Ottawa, Ontario 3851 Canada 3853 Email: philip_matthews@magma.ca 3854 Jonathan Rosenberg 3855 jdrosen.net 3856 Edison, NJ 3857 USA 3859 Email: jdrosen@jdrosen.net 3860 URI: http://www.jdrosen.net