idnits 2.17.1 draft-ietf-behave-turn-12.txt: Checking boilerplate required by RFC 5378 and the IETF Trust (see https://trustee.ietf.org/license-info): ---------------------------------------------------------------------------- ** It looks like you're using RFC 3978 boilerplate. You should update this to the boilerplate described in the IETF Trust License Policy document (see https://trustee.ietf.org/license-info), which is required now. -- Found old boilerplate from RFC 3978, Section 5.1 on line 19. -- Found old boilerplate from RFC 3978, Section 5.5, updated by RFC 4748 on line 3445. -- Found old boilerplate from RFC 3979, Section 5, paragraph 1 on line 3456. -- Found old boilerplate from RFC 3979, Section 5, paragraph 2 on line 3463. -- Found old boilerplate from RFC 3979, Section 5, paragraph 3 on line 3469. 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 : ---------------------------------------------------------------------------- == There are 4 instances of lines with private range IPv4 addresses in the document. If these are generic example addresses, they should be changed to use any of the ranges defined in RFC 6890 (or successor): 192.0.2.x, 198.51.100.x or 203.0.113.x. -- 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? Miscellaneous warnings: ---------------------------------------------------------------------------- == The copyright year in the IETF Trust Copyright Line does not match the current year -- The document seems to lack a disclaimer for pre-RFC5378 work, but may have content which was first submitted before 10 November 2008. If you have contacted all the original authors and they are all willing to grant the BCP78 rights to the IETF Trust, then this is fine, and you can ignore this comment. If not, you may need to add the pre-RFC5378 disclaimer. (See the Legal Provisions document at https://trustee.ietf.org/license-info for more information.) -- The document date (November 30, 2008) is 5625 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 633, but not defined ** Obsolete normative reference: RFC 5389 (Obsoleted by RFC 8489) == Outdated reference: A later version (-07) exists of draft-ietf-behave-turn-tcp-01 == Outdated reference: A later version (-11) exists of draft-ietf-behave-turn-ipv6-05 == Outdated reference: A later version (-09) exists of draft-ietf-tsvwg-port-randomization-02 Summary: 2 errors (**), 0 flaws (~~), 6 warnings (==), 8 comments (--). Run idnits with the --verbose option for more detailed information about the items above. -------------------------------------------------------------------------------- 2 BEHAVE WG J. Rosenberg 3 Internet-Draft Cisco 4 Intended status: Standards Track R. Mahy 5 Expires: June 3, 2009 (Unaffiliated) 6 P. Matthews 7 Alcatel-Lucent 8 November 30, 2008 10 Traversal Using Relays around NAT (TURN): Relay Extensions to Session 11 Traversal Utilities for NAT (STUN) 12 draft-ietf-behave-turn-12 14 Status of this Memo 16 By submitting this Internet-Draft, each author represents that any 17 applicable patent or other IPR claims of which he or she is aware 18 have been or will be disclosed, and any of which he or she becomes 19 aware will be disclosed, in accordance with Section 6 of BCP 79. 21 Internet-Drafts are working documents of the Internet Engineering 22 Task Force (IETF), its areas, and its working groups. Note that 23 other groups may also distribute working documents as Internet- 24 Drafts. 26 Internet-Drafts are draft documents valid for a maximum of six months 27 and may be updated, replaced, or obsoleted by other documents at any 28 time. It is inappropriate to use Internet-Drafts as reference 29 material or to cite them other than as "work in progress." 31 The list of current Internet-Drafts can be accessed at 32 http://www.ietf.org/ietf/1id-abstracts.txt. 34 The list of Internet-Draft Shadow Directories can be accessed at 35 http://www.ietf.org/shadow.html. 37 This Internet-Draft will expire on June 3, 2009. 39 Abstract 41 If a host is located behind a NAT, then in certain situations it can 42 be impossible for that host to communicate directly with other hosts 43 (peers). In these situations, it is necessary for the host to use 44 the services of an intermediate node that acts as a communication 45 relay. This specification defines a protocol, called TURN (Traversal 46 Using Relays around NAT), that allows the host to control the 47 operation of the relay and to exchange packets with its peers using 48 the relay. TURN differs from some other relay control protocols in 49 that it allows a client to communicate with multiple peers using a 50 single relay address. 52 The TURN protocol was designed to be used as part of the ICE 53 (Interactive Connectivity Establishment) approach to NAT traversal, 54 though it can be also used without ICE. 56 Table of Contents 58 1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . . 5 59 2. Overview of Operation . . . . . . . . . . . . . . . . . . . . 6 60 2.1. Transports . . . . . . . . . . . . . . . . . . . . . . . . 8 61 2.2. Allocations . . . . . . . . . . . . . . . . . . . . . . . 10 62 2.3. Permissions . . . . . . . . . . . . . . . . . . . . . . . 11 63 2.4. Send Mechanism . . . . . . . . . . . . . . . . . . . . . . 12 64 2.5. Channels . . . . . . . . . . . . . . . . . . . . . . . . . 14 65 2.6. Other Features . . . . . . . . . . . . . . . . . . . . . . 16 66 3. Terminology . . . . . . . . . . . . . . . . . . . . . . . . . 17 67 4. General Behavior . . . . . . . . . . . . . . . . . . . . . . . 18 68 5. Allocations . . . . . . . . . . . . . . . . . . . . . . . . . 20 69 6. Creating an Allocation . . . . . . . . . . . . . . . . . . . . 21 70 6.1. Sending an Allocate Request . . . . . . . . . . . . . . . 22 71 6.2. Receiving an Allocate Request . . . . . . . . . . . . . . 23 72 6.3. Receiving an Allocate Success Response . . . . . . . . . . 27 73 6.4. Receiving an Allocate Error Response . . . . . . . . . . . 27 74 7. Refreshing an Allocation . . . . . . . . . . . . . . . . . . . 29 75 7.1. Sending a Refresh Request . . . . . . . . . . . . . . . . 30 76 7.2. Receiving a Refresh Request . . . . . . . . . . . . . . . 30 77 7.3. Receiving a Refresh Response . . . . . . . . . . . . . . . 31 78 8. Permissions . . . . . . . . . . . . . . . . . . . . . . . . . 31 79 9. CreatePermission . . . . . . . . . . . . . . . . . . . . . . . 32 80 9.1. Forming a CreatePermission request . . . . . . . . . . . . 32 81 9.2. Receiving a CreatePermission request . . . . . . . . . . . 33 82 9.3. Receiving a CreatePermission response . . . . . . . . . . 33 83 10. Send and Data Methods . . . . . . . . . . . . . . . . . . . . 33 84 10.1. Forming a Send Indication . . . . . . . . . . . . . . . . 34 85 10.2. Receiving a Send Indication . . . . . . . . . . . . . . . 34 86 10.3. Receiving a UDP Datagram . . . . . . . . . . . . . . . . . 35 87 10.4. Receiving a Data Indication . . . . . . . . . . . . . . . 35 88 11. Channels . . . . . . . . . . . . . . . . . . . . . . . . . . . 36 89 11.1. Sending a ChannelBind Request . . . . . . . . . . . . . . 38 90 11.2. Receiving a ChannelBind Request . . . . . . . . . . . . . 38 91 11.3. Receiving a ChannelBind Response . . . . . . . . . . . . . 39 92 11.4. The ChannelData Message . . . . . . . . . . . . . . . . . 39 93 11.5. Sending a ChannelData Message . . . . . . . . . . . . . . 40 94 11.6. Receiving a ChannelData Message . . . . . . . . . . . . . 40 95 11.7. Relaying Data from the Peer . . . . . . . . . . . . . . . 41 97 12. IP Header Fields . . . . . . . . . . . . . . . . . . . . . . . 41 98 13. New STUN Methods . . . . . . . . . . . . . . . . . . . . . . . 43 99 14. New STUN Attributes . . . . . . . . . . . . . . . . . . . . . 44 100 14.1. CHANNEL-NUMBER . . . . . . . . . . . . . . . . . . . . . . 44 101 14.2. LIFETIME . . . . . . . . . . . . . . . . . . . . . . . . . 44 102 14.3. XOR-PEER-ADDRESS . . . . . . . . . . . . . . . . . . . . . 44 103 14.4. DATA . . . . . . . . . . . . . . . . . . . . . . . . . . . 44 104 14.5. XOR-RELAYED-ADDRESS . . . . . . . . . . . . . . . . . . . 45 105 14.6. EVEN-PORT . . . . . . . . . . . . . . . . . . . . . . . . 45 106 14.7. REQUESTED-TRANSPORT . . . . . . . . . . . . . . . . . . . 45 107 14.8. DONT-FRAGMENT . . . . . . . . . . . . . . . . . . . . . . 46 108 14.9. RESERVATION-TOKEN . . . . . . . . . . . . . . . . . . . . 46 109 15. New STUN Error Response Codes . . . . . . . . . . . . . . . . 46 110 16. Detailed Example . . . . . . . . . . . . . . . . . . . . . . . 47 111 17. Security Considerations . . . . . . . . . . . . . . . . . . . 54 112 17.1. Outsider Attacks . . . . . . . . . . . . . . . . . . . . . 54 113 17.1.1. Obtaining Unauthorized Allocations . . . . . . . . . 54 114 17.1.2. Offline Dictionary Attacks . . . . . . . . . . . . . 54 115 17.1.3. Faked Refreshes and Permissions . . . . . . . . . . . 55 116 17.1.4. Fake Data . . . . . . . . . . . . . . . . . . . . . . 55 117 17.1.5. Impersonating a Server . . . . . . . . . . . . . . . 56 118 17.1.6. Eavesdropping Traffic . . . . . . . . . . . . . . . . 56 119 17.1.7. TURN loop attack . . . . . . . . . . . . . . . . . . 56 120 17.2. Firewall Considerations . . . . . . . . . . . . . . . . . 57 121 17.2.1. Faked Permissions . . . . . . . . . . . . . . . . . . 58 122 17.2.2. Blacklisted IP Addresses . . . . . . . . . . . . . . 58 123 17.2.3. Running Servers on Well-Known Ports . . . . . . . . . 59 124 17.3. Insider Attacks . . . . . . . . . . . . . . . . . . . . . 59 125 17.3.1. DoS Against TURN Server . . . . . . . . . . . . . . . 59 126 17.3.2. Anonymous Relaying of Malicious Traffic . . . . . . . 59 127 17.3.3. Manipulating other Allocations . . . . . . . . . . . 60 128 17.4. Other Considerations . . . . . . . . . . . . . . . . . . . 60 129 18. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 60 130 19. IAB Considerations . . . . . . . . . . . . . . . . . . . . . . 60 131 20. Open Issues . . . . . . . . . . . . . . . . . . . . . . . . . 62 132 21. Changes from Previous Versions . . . . . . . . . . . . . . . . 62 133 21.1. Changes from -11 to -12 . . . . . . . . . . . . . . . . . 62 134 21.2. Changes from -10 to -11 . . . . . . . . . . . . . . . . . 63 135 21.3. Changes from -09 to -10 . . . . . . . . . . . . . . . . . 64 136 21.4. Changes from -08 to -09 . . . . . . . . . . . . . . . . . 66 137 21.5. Changes from -07 to -08 . . . . . . . . . . . . . . . . . 67 138 21.6. Changes from -06 to -07 . . . . . . . . . . . . . . . . . 68 139 21.7. Changes from -05 to -06 . . . . . . . . . . . . . . . . . 70 140 21.8. Changes from -04 to -05 . . . . . . . . . . . . . . . . . 70 141 22. Acknowledgements . . . . . . . . . . . . . . . . . . . . . . . 72 142 23. References . . . . . . . . . . . . . . . . . . . . . . . . . . 72 143 23.1. Normative References . . . . . . . . . . . . . . . . . . . 72 144 23.2. Informative References . . . . . . . . . . . . . . . . . . 72 146 Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . . 74 147 Intellectual Property and Copyright Statements . . . . . . . . . . 76 149 1. Introduction 151 A host behind a NAT may wish to exchange packets with other hosts, 152 some of which may also be behind NATs. To do this, the hosts 153 involved can use 'Hole Punching' techniques (see [RFC5128]) in an 154 attempt discover a direct communication path; that is, a 155 communication path that goes from host to another through intervening 156 NATs and routers, but does not traverse any relays. 158 As described in [RFC5128] and [RFC4787], hole punching techniques 159 will fail if both hosts are behind NATs that are not well-behaved. 160 For example, if both hosts are behind NATs that have a mapping 161 behavior of "address dependent mapping" or "address and port 162 dependent mapping", then hole punching techniques generally fail. 164 When a direct communication path cannot be found, it is necessary to 165 use the services of an intermediate host that acts as a relay for the 166 packets. This relay typically sits in the public Internet and relays 167 packets between two hosts that both sit behind NATs. 169 This specification defines a protocol, called TURN, that allows a 170 host behind a NAT (called the TURN client) to request that another 171 host (called the TURN server) act as a relay. The client can arrange 172 for the server to relay packets to and from certain other hosts 173 (called peers) and can control aspects of how the relaying is done. 174 The client does this by allocating an IP address and port on the 175 server, called the relayed-transport-address. When a peer sends a 176 packet to the relayed-transport-address, the server relays the packet 177 to the client. When the client send a data packet to the server, the 178 server relays it to the appropriate peer using the relayed-transport- 179 address as the source. 181 A client using TURN must have some way to communicate the relayed- 182 transport-address to its peers, and to learn each peer's IP address 183 and port (more precisely, each peer's server-reflexive transport 184 address, see Section 2). How this is done is out of the scope of the 185 TURN protocol. One way this might be done is for the client and 186 peers to exchange e-mail messages. Another way is for the client and 187 its peers to use a special-purpose 'introduction' or 'rendezvous' 188 protocol (see [RFC5128] for more details). 190 If TURN is used with ICE [I-D.ietf-mmusic-ice], then the relayed- 191 transport-address and the IP addresses and ports of the peers are 192 included in the ICE candidate information which the rendezvous 193 protocol must carry. For example, if TURN and ICE are used as part 194 of a multimedia solution using SIP [RFC3261], then SIP serves the 195 role of the rendezvous protocol, carrying the ICE candidate 196 information inside the body of SIP messages. If TURN and ICE are 197 used with some other rendezvous protocol, then 198 [I-D.rosenberg-mmusic-ice-nonsip] provides guidance on the services 199 the rendezvous protocol must perform. 201 Though the use of a TURN server to enable communication between two 202 hosts behind NATs is very likely to work, it comes at a high cost to 203 the provider of the TURN server, since the server typically needs a 204 high bandwidth connection to the Internet . As a consequence, it is 205 best to use a TURN server only when a direct communication path 206 cannot be found. When the client and a peer use ICE to determine the 207 communication path, ICE will use hole punching techniques to search 208 for a direct path first and only use a TURN server when a direct path 209 cannot be found. 211 TURN was originally invented to support multimedia sessions signaled 212 using SIP. Since SIP supports forking, TURN supports multiple peers 213 per relayed-transport-address; a feature not supported by other 214 approaches (e.g., SOCKS [RFC1928]). However, care has been taken to 215 make sure that TURN is suitable for other types of applications. 217 TURN was designed as one piece in the larger ICE approach to NAT 218 traversal. Implementors of TURN are urged to investigate ICE and 219 seriously consider using it for their application. However, it is 220 possible to use TURN without ICE. 222 TURN is an extension to the STUN (Session Traversal Utilities for NAT 223 [RFC5389]) protocol. Most, though not all, TURN messages are STUN- 224 formatted messages. A reader of this document should be familiar 225 with STUN. 227 2. Overview of Operation 229 This section gives an overview of the operation of TURN. It is non- 230 normative. 232 In a typical configuration, a TURN client is connected to a private 233 network [RFC1918] and through one or more NATs to the public 234 Internet. On the public Internet is a TURN server. Elsewhere in the 235 Internet are one or more peers that the TURN client wishes to 236 communicate with. These peers may or may not be behind one or more 237 NATs. The client uses the server as a relay to send packets to these 238 peers and to receive packets from these peers. 240 Peer A 241 Server-Reflexive +---------+ 242 Transport Address | | 243 192.0.2.150:32102 | | 244 | /| | 245 TURN | / ^| Peer A | 246 Client's Server | / || | 247 Host Transport Transport | // || | 248 Address Address | // |+---------+ 249 10.1.1.2:49721 192.0.2.15:3478 |+-+ // Peer A 250 | | ||N| / Host Transport 251 | +-+ | ||A|/ Address 252 | | | | v|T| 192.168.100.2:49582 253 | | | | /+-+ 254 +---------+| | | |+---------+ / +---------+ 255 | || |N| || | // | | 256 | TURN |v | | v| TURN |/ | | 257 | Client |----|A|----------| Server |------------------| Peer B | 258 | | | |^ | |^ ^| | 259 | | |T|| | || || | 260 +---------+ | || +---------+| |+---------+ 261 | || | | 262 | || | | 263 +-+| | | 264 | | | 265 | | | 266 Client's | Peer B 267 Server-Reflexive Relayed Transport 268 Transport Address Transport Address Address 269 192.0.2.1:7000 192.0.2.15:50000 192.0.2.210:49191 271 Figure 1 273 Figure 1 shows a typical deployment. In this figure, the TURN client 274 and the TURN server are separated by a NAT, with the client on the 275 private side and the server on the public side of the NAT. This NAT 276 is assumed to be a "bad" NAT; for example, it might have a mapping 277 property of address-and-port-dependent mapping (see [RFC4787] for a 278 description of what this means). 280 The client talks to the server from a (IP address, port) combination 281 called the client's HOST TRANSPORT ADDRESS. (The combination of an 282 IP address and port is called a TRANSPORT ADDRESS). 284 The client sends TURN messages from its host transport address to a 285 transport address on the TURN server which is known as the TURN 286 SERVER TRANSPORT ADDRESS. The client learns the server's transport 287 address through some unspecified means (e.g., configuration), and 288 this address is typically used by many clients simultaneously. 290 Since the client is behind a NAT, the server sees packets from the 291 client as coming from a transport address on the NAT itself. This 292 address is known as the client's SERVER-REFLEXIVE transport address; 293 packets sent by the server to the client's server-reflexive transport 294 address will be forwarded by the NAT to the client's host transport 295 address. 297 The client uses TURN commands to create and manipulate an ALLOCATION 298 on the server. An allocation is a data structure on the server, an 299 important component of which is a RELAYED TRANSPORT ADDRESS. The 300 relayed transport address for the allocation is a transport address 301 on the server which is used to send and receive packets to the peers. 303 Once an allocation is created, the client can send application data 304 to the server along with an indication of which peer the data is to 305 be sent to, and the server will relay this data to the appropriate 306 peer. The client sends the application data to the server inside a 307 TURN message; at the server, the data is extracted from the TURN 308 message and sent to the peer in a UDP datagram. In the reverse 309 direction, a peer can send application data in a UDP datagram to the 310 relayed transport address for the allocation; the server will then 311 encapsulate this data inside a TURN message and send it to the client 312 along with an indication of which peer sent the data. Since the TURN 313 message always contains an indication of which peer the client is 314 communicating with, the client can use a single allocation to 315 communicate with multiple peers. 317 When the peer is behind a NAT, then the client must identify the peer 318 using its server-reflexive transport address rather than its host 319 transport address. For example, to application data to peer A in the 320 example above, the client must specify 192.0.2.150:32102 (peer A's 321 server-reflexive transport address) rather than 192.168.100.2:49582 322 (peer A's host transport address). 324 Each allocation on the server belongs to a single client and has 325 exactly one relayed transport address which is used only by that 326 allocation. Thus when a packet arrives at a relayed transport 327 address on the server, the server knows which client the data is 328 intended for. However, the client may have multiple allocations on a 329 server at the same time. 331 2.1. Transports 333 TURN as defined in this specification always uses UDP between the 334 server and the peer. However, this specification allows the use of 335 any one of UDP, TCP, or TLS over TCP to carry the TURN messages 336 between the client and the server. 338 +----------------------------+---------------------+ 339 | TURN client to TURN server | TURN server to peer | 340 +----------------------------+---------------------+ 341 | UDP | UDP | 342 | TCP | UDP | 343 | TLS over TCP | UDP | 344 +----------------------------+---------------------+ 346 If TCP or TLS over TCP is used between the client and the server, 347 then the server will convert between these transports and UDP 348 transport when relaying data to/from the peer. 350 TURN supports TCP transport between the client and the server because 351 some firewalls are configured to block UDP entirely. These firewalls 352 block UDP but not TCP in part because TCP has properties that make 353 the intention of the nodes being protected by the firewall more 354 obvious to the firewall. For example, TCP has a three-way handshake 355 that makes in clearer that the protected node really wishes to have 356 that particular connection established, while for UDP the best the 357 firewall can do is guess which flows are desired by using filtering 358 rules. Also, TCP has explicit connection teardown, while for UDP the 359 firewall has to use timers to guess when the flow is finished. 361 TURN supports TLS over TCP transport between the client and the 362 server because TLS provides additional security properties not 363 provided by TURN's default digest authentication; properties which 364 some clients may wish to take advantage of. In particular, TLS 365 provides a way for the client to ascertain that it is talking to the 366 server that it intended to, and also provides for confidentiality of 367 TURN control messages. TURN does not require TLS because the 368 overhead of using TLS is higher than that of digest authentication; 369 for example, using TLS likely means that most application data will 370 be doubly encrypted (once by TLS and once to ensure it is still 371 encrypted in the UDP datagram). 373 There is a planned extension to TURN to add support for TCP between 374 the server and the peers [I-D.ietf-behave-turn-tcp]. For this 375 reason, allocations that use UDP between the server and the peers are 376 known as UDP allocations, while allocations that use TCP between the 377 server and the peers are known as TCP allocations. This 378 specification describes only UDP allocations. 380 TURN as defined in this specification only supports IPv4. All IP 381 addresses in this specification must be IPv4 addresses. However, 382 there is a planned extension to TURN to add support for IPv6 and for 383 relaying between IPv4 and IPv6 [I-D.ietf-behave-turn-ipv6]. 385 In some applications for TURN, the client may send and received 386 packets other than TURN packets on the host transport address it uses 387 to communicate with the server. This can happen, for example, when 388 using TURN with ICE. In these cases, the client can distinguish TURN 389 packets from other packets by examining the source address of the 390 arriving packet: those arriving from the TURN server will be TURN 391 packets. 393 2.2. Allocations 395 To create an allocation on the server, the client uses an Allocate 396 transaction. The client sends a Allocate request to the server, and 397 the server replies with an Allocate success response containing the 398 allocated relayed transport address. The client can include 399 attributes in the Allocate request that describe the type of 400 allocation it desires (e.g., the lifetime of the allocation). Since 401 relaying data may require lots of bandwidth, the server typically 402 requires that the client authenticate itself using STUN's long-term 403 credential mechanism, to show that it is authorized to use the 404 server. 406 Once a relayed transport address is allocated, a client must keep the 407 allocation alive. To do this, the client periodically sends a 408 Refresh request to the server. TURN deliberately uses a different 409 method (Refresh rather than Allocate) for refreshes to ensure that 410 the client is informed if the allocation vanishes for some reason. 412 The frequency of the Refresh transaction is determined by the 413 lifetime of the allocation. The client can request a lifetime in the 414 Allocate request and may modify its request in a Refresh request, and 415 the server always indicates the actual lifetime in the response. The 416 client must issue a new Refresh transaction within 'lifetime' seconds 417 of the previous Allocate or Refresh transaction. Once a client no 418 longer wishes to use an Allocation, it should delete the allocation 419 using a Refresh request with a requested lifetime of 0. 421 Both the server and client keep track of a value known as the 422 5-TUPLE. At the client, the 5-tuple consists of the client's host 423 transport address, the server transport address, and the transport 424 protocol used by the client to communicate with the server. At the 425 server, the 5-tuple value is the same except that the client's host 426 transport address is replaced by the client's server-reflexive 427 address, since that is the client's address as seen by the server. 429 Both the client and the server remember the 5-tuple used in the 430 Allocate request. Subsequent messages between the client and the 431 server uses the same 5-tuple. In this way, the client and server 432 know which allocation is being referred to. If the client wishes to 433 allocate a second relayed transport address, it must create a second 434 allocation using a different 5-tuple (e.g., by using a different 435 client host address or port). 437 NOTE: While the terminology used in this document refers to 438 5-tuples, the TURN server can store whatever identifier it likes 439 that yields identical results. Specifically, an implementation 440 may use a file-descriptor in place of a 5-tuple to represent a TCP 441 connection 443 TURN TURN Peer Peer 444 client server A B 445 |-- Allocate request --------------->| | | 446 | | | | 447 |<--------------- Allocate failure --| | | 448 | (401 Unauthorized) | | | 449 | | | | 450 |-- Allocate request --------------->| | | 451 | | | | 452 |<---------- Allocate success resp --| | | 453 | (192.0.2.15:50000) | | | 454 // // // // 455 | | | | 456 |-- Refresh request ---------------->| | | 457 | | | | 458 |<----------- Refresh success resp --| | | 459 | | | | 461 Figure 2 463 In Figure 2, the client sends an Allocate request to the server 464 without credentials. Since the server requires that all requests be 465 authenticated using STUN's long-term credential mechanism, the server 466 rejects the request with a 401 (Unauthorized) error code. The client 467 then tries again, this time including credentials (not shown). This 468 time, the server accepts the Allocate request and returns an Allocate 469 success response containing (amongst other things) the relayed 470 transport address assigned to the allocation. Sometime later the 471 client decides to refresh the allocation and thus sends a Refresh 472 request to the server. The refresh is accepted and the server 473 replies with a Refresh success response. 475 2.3. Permissions 477 To ease concerns amongst enterprise IT administrators that TURN could 478 be used to bypass corporate firewall security, TURN includes the 479 notion of permissions. TURN permissions mimic the address-restricted 480 filtering mechanism of NATs that comply with [RFC4787]. 482 An allocation can have zero or more permissions. Each permission 483 consists of an IP address and a lifetime. When the server receives a 484 UDP datagram on the allocation's relayed transport address, it first 485 checks the list of permissions. If the source IP address of the 486 datagram matches a permission, the application data is relayed to the 487 client, otherwise the UDP datagram is silently discarded. 489 A permission expires after 5 minutes if it is not refreshed. There 490 is no way to explicitly delete a permission. 492 The client can install or refresh a permission using either a 493 CreatePermission request or a ChannelBind request. Using the 494 CreatePermission request, multiple permissions can be installed or 495 refreshed with a single request. For security reasons, permissions 496 can only be installed or refreshed by transactions that can be 497 authenticated; thus Send indications and ChannelData messages (which 498 are used to send data to peers) do not install or refresh any 499 permissions. 501 Note that permissions are within the context of an allocation, so 502 adding or expiring a permission in one allocation does not affect 503 other allocations. 505 2.4. Send Mechanism 507 There are two mechanisms for the client and peers to exchange 508 application data using the TURN server. The first mechanism uses the 509 Send and Data methods, the second way uses channels. Common to both 510 ways is the ability of the client to communicate with multiple peers 511 using a single allocated relayed transport address; thus both ways 512 include a means for the client to indicate to the server which peer 513 to forward the data to, and for the server to indicate which peer 514 sent the data. 516 The Send mechanism uses Send and Data indications. Send indications 517 are used to send application data from the client to the server, 518 while Data indications are used to send application data from the 519 server to the client. 521 When using the Send mechanism, the client sends a Send indication to 522 the TURN server containing (a) an XOR-PEER-ADDRESS attribute specify 523 the (server-reflexive) transport address of the peer and (b) a DATA 524 attribute holding the application data. When the TURN server 525 receives the Send indication, it extracts the application data from 526 the DATA attribute and sends it in a UDP datagram to the peer, using 527 the allocated relay address as the source address. Note that there 528 is no need to specify the relayed transport address, since it is 529 implied by the 5-tuple used for the Send indication. 531 In the reverse direction, UDP datagrams arriving at the relayed 532 transport address on the TURN server are converted into Data 533 indications and sent to the client, with the server-reflexive 534 transport address of the peer included in an XOR-PEER-ADDRESS 535 attribute and the data itself in a DATA attribute. Since the relayed 536 transport address uniquely identified the allocation, the server 537 knows which client to relay the data to. 539 Send and Data indications cannot be authenticated, since the Long- 540 Term Credential Mechanism of STUN does not support authenticating 541 indications. This is not as big an issue as it might first appear, 542 since the client-to-server leg is only half of the total path to the 543 peer; applications that want proper security need to use encryption 544 or similar to protect their data in the UDP datagrams between the 545 server and the peer. However, to prevent attackers from injecting 546 rogue Send indications to arbitrary destinations, TURN requires that 547 a client install a permission to a peer before sending data to it 548 using a Send indication. 549 TURN TURN Peer Peer 550 client server A B 551 | | | | 552 |-- CreatePermission req (Peer A) -->| | | 553 |<-- CreatePermission success resp --| | | 554 | | | | 555 |--- Send ind (Peer A)-------------->| | | 556 | |=== data ===>| | 557 | | | | 558 | |<== data ====| | 559 |<-------------- Data ind (Peer A) --| | | 560 | | | | 561 | | | | 562 |--- Send ind (Peer B)-------------->| | | 563 | | dropped | | 564 | | | | 565 | |<== data ==================| 566 | dropped | | | 567 | | | | 569 Figure 3 571 In Figure 3, the client has already created an allocation and now 572 wishes to send data to its peers. The client first creates a 573 permission by sending the server a CreatePermission request 574 specifying peer A's (server reflexive) IP address in the XOR-PEER- 575 ADDRESS attribute; if this was not done, the server would not relay 576 data between the client and the server. The client then sends data 577 to Peer A using a Send indication; at the server, the application 578 data is extracted and forwarded in a UDP datagram to Peer A, using 579 the relayed transport address as the source transport address. When 580 a UDP datagram from Peer A is received at the relayed transport 581 address, the contents are placed into a Data indication and forwarded 582 to the client. Later, the client attempts to exchange data with Peer 583 B, however no permission has been installed for Peer B, so the Send 584 indication from the client and the UDP datagram from the peer are 585 both dropped by the server. 587 2.5. Channels 589 For some applications (e.g. Voice over IP), the 36 bytes of overhead 590 that a Send indication or Data indication adds to the application 591 data can substantially increase the bandwidth required between the 592 client and the server. To remedy this, TURN offers a second way for 593 the client and server to associate data with a specific peer. 595 This second way uses an alternate packet format known as the 596 ChannelData message. The ChannelData message does not use the STUN 597 header used by other TURN messages, but instead has a 4-byte header 598 that includes a number known as a channel number. Each channel 599 number in use is bound to a specific peer and thus serves as a 600 shorthand for the peer's host transport address. 602 To bind a channel to a peer, the client sends a ChannelBind request 603 to the server, and includes an unbound channel number and the 604 transport address of the peer. Once the channel is bound, the client 605 can use a ChannelData message to send the server data destined for 606 the peer. Similarly, the server can relay data from that peer 607 towards the client using a ChannelData message. 609 Channel bindings last for 10 minutes unless refreshed. Channel 610 bindings are refreshed by sending another ChannelBind request 611 rebinding the channel to the peer. Like permissions (but unlike 612 allocations), there is no way to explicitly delete a channel binding; 613 the client must simply wait for it to time out. 615 TURN TURN Peer Peer 616 client server A B 617 | | | | 618 |-- ChannelBind req ---------------->| | | 619 | (Peer A to 0x4001) | | | 620 | | | | 621 |<---------- ChannelBind succ resp --| | | 622 | | | | 623 |-- [0x4001] data ------------------>| | | 624 | |=== data ===>| | 625 | | | | 626 | |<== data ====| | 627 |<------------------ [0x4001] data --| | | 628 | | | | 629 |--- Send ind (Peer A)-------------->| | | 630 | |=== data ===>| | 631 | | | | 632 | |<== data ====| | 633 |<------------------ [0x4001] data --| | | 634 | | | | 636 Figure 4 638 shows the channel mechanism in use. The client has already created 639 an allocation and now wishes to bind a channel to peer A. To do this, 640 the client sends a ChannelBind request to the server, specifying the 641 transport address of Peer A and a channel number (0x4001). After 642 that, the client can send application data encapsulated inside 643 ChannelData messages to Peer A: this is shown as "[0x4001] data" 644 where 0x4001 is the channel number. When the ChannelData message 645 arrives at the server, the server transfers the data to a UDP 646 datagram and sends it to the peer A, as indicated by the channel 647 number. When peer A sends a UDP datagram to the relayed transport 648 address, the data is placed inside a ChannelData message and sent to 649 the client. 651 Once a channel has been bound, the client is free to intermix 652 ChannelData messages and Send indications. In the figure, the client 653 later decides to use a Send indication rather than a ChannelData 654 message to send additional data to peer A. The client might decide to 655 do this, for example, so it can use the DONT-FRAGMENT attribute (see 656 the next section). However, once a channel is bound, the server will 657 always use a ChannelData message, as shown in the call flow. 659 Note that ChannelData messages can only be used for peers to which 660 the client has bound a channel. In the example above, Peer A has 661 been bound to a channel, but Peer B has not, so application data to 662 and from Peer B would use the Send mechanism. 664 2.6. Other Features 666 This section describes a few other features of TURN. 668 Old versions of RTP [RFC3550] required that the RTP stream be on an 669 even port number and the associated RTCP stream, if present, be on 670 the next highest port. To allow clients to work with nodes that 671 still require this,TURN allows the client to request that the server 672 allocate a relayed-transport-address with an even port number, and to 673 optionally request the server reserve the next-highest port number 674 for a subsequent allocation. 676 If appropriate, a TURN server can reject an Allocate request with the 677 suggestion that the client try an alternative server. 679 TURN is designed so that the server can be implemented as an 680 application that runs in userland under commonly available operating 681 systems and which does not requiring special privileges. This design 682 decision has the following implications: 684 o The value of the Diff-Serv field may not be preserved across the 685 server; 687 o The TTL field may be reset, rather than decremented, across the 688 server; 690 o The ECN field is may be reset by the server; 692 o ICMP messages are not relayed by the server; 694 o Path MTU Discovery does not work, except in the limited way 695 available using the DONT-FRAGMENT attribute (see below); and 697 o There is no end-to-end fragmentation, since the packet is re- 698 assembled at the server. 700 Future work may specify alternate TURN semantics that address these 701 limitations. 703 To provide a limited form of Path MTU discovery, TURN has a DONT- 704 FRAGMENT attribute. The client may include this attribute in a Send 705 indication to specify that the server set the DF (Don't Fragment) bit 706 in the UDP datagram that it sends to the peer. Since some servers 707 may be unable to set the DF bit, the client should also include this 708 attribute in the Allocate request; servers that do not support this 709 feature will reject the Allocate request. Note that, because the 710 server does not relay ICMP messages, the client will have to use a 711 Path MTU discovery algorithm based on the one in [RFC4821]. 713 3. Terminology 715 The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", 716 "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this 717 document are to be interpreted as described in RFC 2119 [RFC2119]. 719 Readers are expected to be familiar with [RFC5389] and the terms 720 defined there. 722 The following terms are used in this document: 724 TURN: The protocol spoken between a TURN client and a TURN server. 725 It is an extension to the STUN protocol [RFC5389]. The protocol 726 allows a client to allocate and use a relayed transport address. 728 TURN client: A STUN client that implements this specification. 730 TURN server: A STUN server that implements this specification. It 731 relays data between a TURN client and its peer(s). 733 Peer: A host with which the TURN client wishes to communicate. The 734 TURN server relays traffic between the TURN client and its 735 peer(s). The peer does not interact with the TURN server using 736 the protocol defined in this document; rather, the peer receives 737 data sent by the TURN server and the peer sends data towards the 738 TURN server. 740 Transport Address: The combination of an IP address and a port. 742 Host Transport Address: A transport address on a client or a peer. 744 Server-Reflexive Transport Address: A transport address on the 745 "public side" of a NAT. This address is allocated by the NAT to 746 correspond to a specific host transport address. 748 Relayed Transport Address: A transport address on the TURN server 749 that is used for relaying packets between the client and a peer. 750 A peer sends to this address on the TURN server, and the packet is 751 then relayed to the client. 753 TURN Server Transport Address: A transport address on the TURN 754 server that is used for sending TURN messages to the server. This 755 is the transport address that the client uses to communicate with 756 the server. 758 Peer Transport Address: The transport address of the peer as seen by 759 the server. When the peer is behind a NAT, this is the peer's 760 server-reflexive transport address. 762 Allocation: The relayed transport address granted to a client 763 through an Allocate request, along with related state, such as 764 permissions and expiration timers. 766 5-tuple: The combination (client IP address and port, server IP 767 address and port, and transport protocol (currently one of UDP, 768 TCP, or TLS)) used to communicate between the client and the 769 server. The 5-tuple uniquely identifies this communication 770 stream. The 5-tuple also uniquely identifies the Allocation on 771 the server. 773 Channel: A channel number and associated peer transport address. 774 Once a channel number is bound to a peer's transport address, the 775 client and server can use the more bandwidth-efficient ChannelData 776 message to exchange data. 778 Permission: The IP address and transport protocol (but not the port) 779 of a peer that is permitted to send traffic to the TURN server and 780 have that traffic relayed to the TURN client. The TURN server 781 will only forward traffic to its client from peers that match an 782 existing permission. 784 4. General Behavior 786 This section contains general TURN processing rules that apply to all 787 TURN messages. 789 TURN is an extension to STUN. All TURN messages, with the exception 790 of the ChannelData message, are STUN-formatted messages. All the 791 base processing rules described in [RFC5389] apply to STUN-formatted 792 messages. This means that all the message-forming and -processing 793 descriptions in this document are implicitly prefixed with the rules 794 of [RFC5389]. 796 In addition, the server SHOULD demand that all requests from the 797 client be authenticated, using the Long-Term Credential mechanism 798 described in [RFC5389], and the client MUST be prepared to 799 authenticate requests if required. Note that this authentication 800 mechanism applies only to requests and cannot be used to authenticate 801 indications, thus indications in TURN are never authenticated. If 802 the server requires requests to be authenticated, then the server's 803 administrator MUST choose a realm value that will uniquely identify 804 the username and password combination that the client must use, even 805 if the client uses multiple servers under different administrations. 806 The server's administrator MAY choose to allocate a unique username 807 to each client, or MAY choose to allocate the same username to more 808 than one client (for example, to all clients from the same department 809 or company). 811 When a TURN message arrives at the server from the client, the server 812 uses the 5-tuple in the message to identify the associated 813 allocation. For all TURN messages (including ChannelData) EXCEPT an 814 Allocate request, if the 5-tuple does not identify an existing 815 allocation, then the message MUST either be rejected with a 437 816 Allocation Mismatch error (if it is a request), or silently ignored 817 (if it is an indication or a ChannelData message). A client 818 receiving a 437 error response to a request other than Allocate MUST 819 assume the allocation no longer exists. 821 All requests after the initial Allocate must use the same username as 822 that used to create the allocation, to prevent attackers from 823 hijacking the client's allocation. Specifically, if the server 824 requires the use of the Long-Term Credential mechanism, and if a non- 825 Allocate request passes authentication under this mechanism, and if 826 the 5-tuple identifies an existing allocation, but the request does 827 not use the same username as used to create the allocation, then the 828 request MUST be rejected with a 441 (Wrong Credentials) error. 830 The client SHOULD include the SOFTWARE attribute in all Allocate and 831 Refresh requests and MAY include it in any other requests or 832 indications. The server SHOULD include the SOFTWARE attribute in all 833 Allocate and Refresh responses (either success or failure) and MAY 834 include it in other responses or indications. The client and the 835 server MAY include the FINGERPRINT attribute in any STUN-formatted 836 messages defined in this document. 838 TURN does not use the backwards-compatibility mechanism described in 839 [RFC5389]. 841 By default, TURN runs on the same ports as STUN: 3478 for TURN over 842 UDP and TCP, and 5349 for TURN over TLS. However, TURN has its own 843 set of SRV service names: "turn" for UDP and TCP, and "turns" for 844 TLS. Either the SRV procedures or the ALTERNATE-SERVER procedures, 845 both described in Section 6, can be used to run TURN on a different 846 port. 848 TURN as defined in this specification only supports IPv4. The 849 client's IP address, the server's IP address and all IP addresses 850 appearing in a relayed-transport-address MUST be IPv4 addresses. 852 When UDP transport is used between the client and the server, the 853 client will retransmit a request if it does not receive a response 854 within a certain timeout period. Because of this, the server may 855 receive two (or more) requests with the same 5-tuple and same 856 transaction id. STUN requires that the server recognize this case 857 and treat the request as idempotent (see [RFC5389]). Some 858 implementations may choose to meet this requirement by remembering 859 all received requests and the corresponding responses for 40 seconds. 860 Other implementations may choose to reprocess the request and arrange 861 that such reprocessing returns essentially the same response. To aid 862 implementors who choose the latter approach (the so-called "stateless 863 stack approach"), this specification includes some implementation 864 notes on how this might be done. Implementations are free to choose 865 either approach or choose some other approach that gives the same 866 results. 868 When TCP transport is used between the client and the server, it is 869 possible that a bit error will cause a length field in a TURN packet 870 to become corrupted, causing the receiver to lose synchronization 871 with the incoming stream of TURN messages. A client or server which 872 detects a long sequence of invalid TURN messages over TCP transport 873 SHOULD close the corresponding TCP connection to help the other end 874 detect this situation more rapidly. 876 To mitigate either intentional or unintentional denial-of-service 877 attacks against the server by clients with valid usernames and 878 passwords, it is RECOMMENDED that the server impose limits on both 879 the number of allocations active at one time for a given username and 880 on the amount of bandwidth those allocations can use. The server 881 should reject new allocations that would exceed the limit on the 882 allowed number of allocations active at one time with a 486 883 (Allocation Quota Exceeded) (see Section 6.2), and should discard 884 application data traffic that exceeds the bandwidth quota. 886 5. Allocations 888 All TURN operations revolve around allocations, and all TURN messages 889 are associated with an allocation. An allocation conceptually 890 consists of the following state data: 892 o the relayed transport address 894 o The 5-tuple: (client's IP address, client's port, server IP 895 address, server port, transport protocol) 897 o the authentication information 898 o the time-to-expiry 900 o A list of permissions 902 o A list of channel to peer bindings 904 The relayed transport address is the transport address allocated by 905 the server for communicating with peers, while the 5-tuple describes 906 the communication path between the client and the server. On the 907 client, the 5-tuple uses the client's host transport address, while 908 on the server the 5-tuple uses the client's server-reflexive 909 transport address. 911 Both the relayed-transport-address and the 5-tuple MUST be unique 912 across all allocations, so either one can be used to uniquely 913 identify the allocation. 915 The authentication information (e.g., username, password, realm, and 916 nonce) are used to both verify subsequent requests and to compute the 917 message integrity of responses. The username, realm, and nonce 918 values are initially those used in the authenticated Allocate request 919 that creates the allocation, though the server can change the nonce 920 value during the lifetime of the allocation using a 438 (Stale Nonce) 921 reply . Note that rather than storing the password explicitly, it 922 may be desirable for security reasons for the server to store the key 923 value which is an MD5 hash over the username, realm and password (see 924 [RFC5389]). 926 The time-to-expiry is the time in seconds left until the allocation 927 expires. Each Allocate or Refresh transaction sets this timer, which 928 then ticks down towards 0. By default, each Allocate or Refresh 929 transaction resets this timer to 600 seconds (10 minutes), but the 930 client can request a different value in the Allocate and Refresh 931 request. Allocations can only be refreshed using the Refresh 932 request; sending data to a peer does not refresh an allocation. When 933 an allocation expires, the state data associated with the allocation 934 can be freed. 936 The list of permissions is described in Section 8 and the list of 937 channels is described in Section 11. 939 6. Creating an Allocation 941 An allocation on the server is created using an Allocate transaction. 943 6.1. Sending an Allocate Request 945 The client forms an Allocate request as follows. 947 The client first picks a host transport address. It is RECOMMENDED 948 that the client pick a currently-unused transport address, typically 949 by allowing the underlying OS to pick a currently-unused port for a 950 new socket. 952 The client then picks a transport protocol to use between the client 953 and the server. The transport protocol MUST be one of UDP, TCP, or 954 TLS over TCP. Since this specification only allows UDP between the 955 server and the peers, it is RECOMMENDED that the client pick UDP 956 unless it has a reason to use a different transport. One reason to 957 pick a different transport would be that the client believes, either 958 through configuration or by experiment, that it is unable to contact 959 any TURN server using UDP. See Section 2.1 for more discussion. 961 The client also picks a server transport address, which SHOULD be 962 done as follows. The client receives (perhaps through configuration) 963 a domain name for a TURN server. The client then uses the DNS 964 procedures described in [RFC5389], but using an SRV service name of 965 "turn" (or "turns" for TURN over TLS) instead of "stun" (or "stuns"). 966 For example, to find servers in the example.com domain, the client 967 performs a lookup for '_turn._udp.example.com', 968 '_turn._tcp.example.com', and '_turns._tcp.example.com' if the client 969 wants to communicate with the server using UDP, TCP, or TLS over TCP, 970 respectively. 972 The client MUST include a REQUESTED-TRANSPORT attribute in the 973 request. This attribute specifies the transport protocol between the 974 server and the peers (note that this is NOT the transport protocol 975 that appears in the 5-tuple). In this specification, the REQUESTED- 976 TRANSPORT type is always UDP. This attribute is included to allow 977 future extensions specify other protocols. 979 If the client wishes the server to initialize the time-to-expiry 980 field of the allocation to some value other the default lifetime, 981 then it MAY include a LIFETIME attribute specifying its desired 982 value. This is just a request, and the server may elect to use a 983 different value. Note that the server will ignore requests to 984 initialize the field to less than the default value. 986 If the client wishes to later use the DONT-FRAGMENT attribute in one 987 or more Send indications on this allocation, then the client SHOULD 988 include the DONT-FRAGMENT attribute in the Allocate request. This 989 allows the client to test whether this attribute is supported by the 990 server. 992 If the client requires the port number of the relayed-transport 993 address be even, the client includes the EVEN-PORT attribute. If 994 this attribute is not included, then the port can be even or odd. By 995 setting the R bit in the EVEN-PORT attribute to 1, the client can 996 request that the server reserve the next highest port number (on the 997 same IP address) for a subsequent allocation. If the R bit is 0, no 998 such request is made. 1000 The client MAY also include a RESERVATION-TOKEN attribute in the 1001 request to ask the server to use a previously reserved port for the 1002 allocation. If the RESERVATION-TOKEN attribute is included, then the 1003 client MUST omit the EVEN-PORT attribute. 1005 Once constructed, the client sends the Allocate request on the 1006 5-tuple. 1008 6.2. Receiving an Allocate Request 1010 When the server receives an Allocate request, it performs the 1011 following checks: 1013 1. The server SHOULD require that the request be authenticated using 1014 the Long-Term Credential mechanism of [RFC5389]. 1016 2. The server checks if the 5-tuple is currently in use by an 1017 existing allocation. If yes, the server rejects the request with 1018 a 437 (Allocation Mismatch) error. 1020 3. The server checks if the request contain a REQUESTED-TRANSPORT 1021 attribute. If the REQUESTED-TRANSPORT attribute is not included 1022 or is malformed, the server rejects the request with a 400 (Bad 1023 Request) error. Otherwise, if the attribute is included but 1024 specifies a protocol other that UDP, the server rejects the 1025 request with a 442 (Unsupported Transport Protocol) error. 1027 4. The request may contain a DONT-FRAGMENT attribute. If it does, 1028 but the server does not support sending UDP datagrams with the DF 1029 bit set to 1 (see Section 12), then the server treats the DONT- 1030 FRAGMENT attribute in the Allocate request as an unknown 1031 comprehension-required attribute. 1033 5. The server checks if the request contains a EVEN-PORT attribute. 1034 If yes, then the server checks that it satisfy the request. If 1035 the server cannot satisfy the request, then the server rejects 1036 the request with a 508 (Insufficient Port Capacity) error. 1038 6. The server checks if the request contains a RESERVATION-TOKEN 1039 attribute. If yes, and the request also contains a EVEN-PORT 1040 attribute, then the server rejects the request with a 400 (Bad 1041 Request) error. Otherwise it checks to see if the token is valid 1042 (i.e., the token is in range and has not expired, and the 1043 corresponding relayed transport address is still available). If 1044 the token is not valid for some reason, the server rejects the 1045 request with a 508 (Insufficient Port Capacity) error. 1047 7. At any point, the server MAY choose to reject the request with a 1048 486 (Allocation Quota Reached) error if it feels the client is 1049 trying to exceed some locally-defined allocation quota. The 1050 server is free to define this allocation quota any way it wishes, 1051 but SHOULD define it based on the username used to authenticate 1052 the request, and not on the client's transport address. 1054 8. Also at any point, the server MAY choose to reject the request 1055 with a 300 (Try Alternate) error if it wishes to redirect the 1056 client to a different server. The use of this error code and 1057 attribute follow the specification in [RFC5389], with the 1058 modification that a TURN server MAY return this error code and 1059 attribute in unauthenticated error responses as well as in 1060 authenticated error responses. 1062 If all the checks pass, the server creates the allocation. The 1063 5-tuple is set to the 5-tuple from the Allocate request, while the 1064 list of permissions and the list of channels are initially empty. 1066 The server chooses a relayed-transport-address for the allocation as 1067 follows: 1069 o If the request contains an EVEN-PORT attribute with the R bit set 1070 to 0, then the server allocates a relayed-transport-address with 1071 an even port number. 1073 o If the request contains an EVEN-PORT attribute with the R bit set 1074 to 1, then the server looks for a pair of port numbers N and N+1 1075 on the same IP address, where N is even. Port N is used in the 1076 current allocation, while the relayed transport address with port 1077 N+1 is assigned a token and reserved for a future allocation. The 1078 server MUST hold this reservation for at least 30 seconds, and MAY 1079 choose to hold longer (e.g. until the allocation with port N 1080 expires). The server then includes the token in a RESERVATION- 1081 TOKEN attribute in the success response. 1083 o If the request contains a RESERVATION-TOKEN, the server uses the 1084 previously-reserved transport address corresponding to the 1085 included token (if it is still available). Note that the 1086 reservation is a server-wide reservation and is not specific to a 1087 particular allocation, since the Allocate request containing the 1088 RESERVATION-TOKEN uses a different 5-tuple than the Allocate 1089 request that made the reservation. The 5-tuple for the Allocate 1090 request containing the RESERVATION-TOKEN attribute can be any 1091 allowed 5-tuple; it can use a different client IP address and 1092 port, a different transport protocol, and even different server IP 1093 address and port (provided, of course, that the server IP address 1094 and port is one that the server is listening for TURN requests 1095 on). 1097 o Otherwise, the server allocates any available relayed-transport- 1098 address. 1100 In all cases, the server SHOULD only allocate ports from the range 1101 49152 - 65535 (the Dynamic and/or Private Port range [Port-Numbers]), 1102 unless the TURN server application knows, through some means not 1103 specified here, that other applications running on the same host as 1104 the TURN server application will not be impacted by allocating ports 1105 outside this range. This condition can often be satisfied by running 1106 the TURN server application on a dedicated machine and/or by 1107 arranging that any other applications on the machine allocate ports 1108 before the TURN server application starts. In any case, the TURN 1109 server SHOULD NOT allocate ports in the range 0 - 1023 (the Well- 1110 Known Port range) to discourage clients from using TURN to run 1111 standard services. 1113 NOTE: The IETF is currently investigating the topic of randomized 1114 port assignments to avoid certain types of attacks (see 1115 [I-D.ietf-tsvwg-port-randomization]). It is strongly recommended 1116 that a TURN implementor keep abreast of this topic and, if 1117 appropriate, implement a randomized port assignment algorithm. 1118 This is especially applicable to servers that choose to pre- 1119 allocate a number of ports from the underlying OS and then later 1120 assign them to allocations; for example, a server may choose this 1121 technique to implement the EVEN-PORT attribute. 1123 The server determines the initial value of the time-to-expiry field 1124 as follows. If the request contains a LIFETIME attribute, and the 1125 proposed lifetime value is greater than the default lifetime, and the 1126 proposed lifetime value is otherwise acceptable to the server, then 1127 the server uses that value. Otherwise, the server uses the default 1128 lifetime. It is RECOMMENDED that the server impose a maximum 1129 lifetime of no more than 3600 seconds (1 hour). Servers that 1130 implement allocation quotas or charge users for allocations in some 1131 way may wish to use a smaller maximum lifetime (perhaps as small as 1132 the default lifetime) to more quickly remove orphaned allocations 1133 (that is, allocations where the corresponding client has crashed or 1134 terminated or the client connection has been lost for some reason). 1135 Also note that the time-to-expiry is recomputed with each successful 1136 Refresh request, and thus the value computed here applies only until 1137 the first refresh. 1139 Once the allocation is created, the server replies with a success 1140 response. The success response contains: 1142 o A XOR-RELAYED-ADDRESS attribute containing the relayed transport 1143 address; 1145 o A LIFETIME attribute containing the current value of the time-to- 1146 expiry timer; 1148 o A RESERVATION-TOKEN attribute (if a second relayed transport 1149 address was reserved). 1151 o An XOR-MAPPED-ADDRESS attribute containing the client's IP address 1152 and port (from the 5-tuple). 1154 NOTE: The XOR-MAPPED-ADDRESS attribute is included in the response 1155 as a convenience to the client. TURN itself does not make use of 1156 this value, but clients running ICE can often need this value and 1157 can thus avoid having to do an extra Binding transaction with some 1158 STUN server to learn it. 1160 The response (either success or error) is sent back to the client on 1161 the 5-tuple. 1163 NOTE: Implementations may implement the idempotency of the 1164 Allocate request over UDP using the so-called "stateless stack 1165 approach" as follows. To detect retransmissions when the original 1166 request was successful in creating an allocation, the server can 1167 store the transaction id that created the request with the 1168 allocation data and compare it with incoming Allocate requests on 1169 the same 5-tuple. Once such a request is detected, the server can 1170 stop parsing the request and immediately generate a success 1171 response. When building this response, the value of the LIFETIME 1172 attribute can be taken from the time-to-expiry field in the 1173 allocate state data, even though this value may differ slightly 1174 from the LIFETIME value originally returned. In addition, the 1175 server may need to store an indication of any reservation token 1176 returned in the original response, so that this may be returned in 1177 any retransmitted responses. 1179 For the case where the original request was unsuccessful in 1180 creating an allocation, the server may choose to do nothing 1181 special. Note, however, that there is a rare case where the 1182 server rejects the original request but accepts the retransmitted 1183 request (because conditions have changed in the brief intervening 1184 time period). If the client receives the first failure response, 1185 it will ignore the second (success) response and believe that an 1186 allocation was not created. An allocation created in this matter 1187 will eventually timeout, since the client will not refresh it. 1188 Furthermore, if the client later retries with the same 5-tuple but 1189 different transaction id, it will receive a 437 (Allocation 1190 Mismatch), which will cause it to retry with a different 5-tuple. 1191 The server may use a smaller maximum lifetime value to minimize 1192 the lifetime of allocations "orphaned" in this manner. 1194 6.3. Receiving an Allocate Success Response 1196 If the client receives an Allocate success response, then it MUST 1197 check that the mapped address and the relayed transport address are 1198 in an address family that the client understands and is prepared to 1199 deal with. This specification only covers the case where these two 1200 addresses are IPv4 addresses. If these two addresses are not in an 1201 address family that the client is prepared to deal with, then the 1202 client MUST delete the allocation (Section 7) and MUST NOT attempt to 1203 create another allocation on that server until it believes the 1204 mismatch has been fixed. 1206 The IETF is currently considering mechanisms for transitioning 1207 between IPv4 and IPv6 that could result in a client originating an 1208 Allocate request over IPv6, but the request would arrive at the 1209 server over IPv4, or vica-versa. Hence the importance of this 1210 check. 1212 Otherwise, the client creates its own copy of the allocation data 1213 structure to track what is happening on the server. In particular, 1214 the client needs to remember the actual lifetime received back from 1215 the server, rather than the value sent to the server in the request. 1216 The client must also remember the 5-tuple used for the request and 1217 the username and password it used to authenticate the request to 1218 ensure that it reuses them for subsequent messages. The client also 1219 needs to track the channels and permissions it establishes on the 1220 server. 1222 The client will probably wish to send the relayed transport address 1223 to peers (using some method not specified here) so the peers can 1224 communicate with it. The client may also wish to use the server- 1225 reflexive address it receives in the XOR-MAPPED-ADDRESS attribute in 1226 its ICE processing. 1228 6.4. Receiving an Allocate Error Response 1230 If the client receives an Allocate error response, then the 1231 processing depends on the actual error code returned: 1233 o (Request timed out): There is either a problem with the server, or 1234 a problem reaching the server with the chosen transport. The 1235 client considers the current transaction as having failed but MAY 1236 choose to retry the Allocate request using a different transport 1237 (e.g., TCP instead of UDP). 1239 o 300 (Try Alternate): The server would like the client to use the 1240 server specified in the ALTERNATE-SERVER attribute instead. The 1241 client considers the current transaction as having failed, but 1242 SHOULD try the Allocate request with the alternate server before 1243 trying any other servers (e.g., other servers discovered using the 1244 SRV procedures). When trying the Allocate request with the 1245 alternate server, the client follows the ALTERNATE-SERVER 1246 procedures specified in [RFC5389] with the following changes: the 1247 client SHOULD accept unauthenticated error responses containing 1248 the 300 (Try Alternate) error code, the client MUST ensure that 1249 the realm value received from the alternate server is as expected, 1250 the client MUST use the same transport protocol to the alternate 1251 server as it used to the original server, and the client MUST use 1252 the same username and password as it would have with the original 1253 server. The latter checks protect against an attacker sending the 1254 client an unauthenticated Allocate error response that redirects 1255 the client to some totally different and unexpected server. 1257 o 400 (Bad Request): The server believes the client's request is 1258 malformed for some reason. The client considers the current 1259 transaction as having failed. The client MAY notify the user or 1260 operator and SHOULD NOT retry the request with this server until 1261 it believes the problem has been fixed. 1263 o 401 (Unauthorized): If the client has followed the procedures of 1264 the Long-Term Credential mechanism and still gets this error, then 1265 the server is not accepting the client's credentials. In this 1266 case, the client considers the current transaction as having 1267 failed and SHOULD notify the user or operator. The client SHOULD 1268 NOT send any further requests to this server until it believes the 1269 problem has been fixed. 1271 o 420 (Unknown Attribute): If the client included a DONT-FRAGMENT 1272 attribute in the request and the server rejected the request with 1273 a 420 error code and listed the DONT-FRAGMENT attribute in the 1274 UNKNOWN-ATTRIBUTES attribute in the error response, then the 1275 client now knows that the server does not support the DONT- 1276 FRAGMENT attribute. The client considers the current transaction 1277 as having failed but MAY choose to retry the Allocate request 1278 without the DONT-FRAGMENT attribute. 1280 o 437 (Allocation Mismatch): This indicates that the client has 1281 picked a 5-tuple which the server sees as already in use. One way 1282 this could happen is if an intervening NAT assigned a mapped 1283 transport address that was used by another client which recently 1284 crashed. The client considers the current transaction as having 1285 failed. The client SHOULD pick another client transport address 1286 and retry the Allocate request (using a different transaction id). 1287 The client SHOULD try three different client transport addresses 1288 before giving up on this server. Once the client gives up on the 1289 server, it SHOULD NOT try to create another allocation on the 1290 server for 2 minutes. 1292 o 438 (Stale Nonce): See the procedures for the Long-Term Credential 1293 mechanism [RFC5389]. 1295 o 441 (Wrong Credentials): The client should not receive this error 1296 in response to a Allocate request. The client MAY notify the user 1297 or operator and SHOULD NOT retry the same request with this server 1298 until it believes the problem has been fixed. 1300 o 442 (Unsupported Transport Address): The client should not receive 1301 this error in response to a request for a UDP allocation. The 1302 client MAY notify the user or operator and SHOULD NOT reattempt 1303 the request with this server until it believes the problem has 1304 been fixed. 1306 o 486 (Allocation Quota Reached): The server is currently unable to 1307 create any more allocations with this username. The client 1308 considers the current transaction as having failed. The client 1309 SHOULD wait at least 1 minute before trying to create any more 1310 allocations on the server. 1312 o 508 (Insufficient Port Capacity): The server has no more relayed 1313 transport addresses available, or has none with the requested 1314 properties, or the one that was reserved is no longer available. 1315 The client considers the current operation as having failed. If 1316 the client is using either the EVEN-PORT or the RESERVATION-TOKEN 1317 attribute, then the client MAY choose to remove or modify this 1318 attribute and try again immediately. Otherwise, the client SHOULD 1319 wait at least 1 minute before trying to create any more 1320 allocations on this server. 1322 7. Refreshing an Allocation 1324 A Refresh transaction can be used to either (a) refresh an existing 1325 allocation and update its time-to-expiry, or (b) delete an existing 1326 allocation. 1328 If a client wishes to continue using an allocation, then the client 1329 MUST refresh it before it expires. It is suggested that the client 1330 refresh the allocation roughly 1 minute before it expires. If a 1331 client no longer wishes to use an allocation, then it SHOULD 1332 explicitly delete the allocation. A client MAY also refresh an 1333 allocation at any time for other reasons. 1335 7.1. Sending a Refresh Request 1337 If the client wishes to immediately delete an existing allocation, it 1338 includes a LIFETIME attribute with a value of 0. All other forms of 1339 the request refresh the allocation. 1341 The Refresh transaction updates the time-to-expiry timer of an 1342 allocation. If the client wishes the server to set the time-to- 1343 expiry timer to something other than the default lifetime, it 1344 includes a LIFETIME attribute with the requested value. The server 1345 then computes a new time-to-expiry value in the same way as it does 1346 for an Allocate transaction, with the exception that a requested 1347 lifetime of 0 causes the server to immediately delete the allocation. 1349 7.2. Receiving a Refresh Request 1351 When the server receives a Refresh request, it processes it as 1352 follows: 1354 1. The server checks the credentials of the request as per the Long- 1355 Term Credential mechanism, checks that the allocation exists, and 1356 does the additional username check of Section 4. 1358 2. The server computes a value called the "desired lifetime" as 1359 follows: If the request contains a LIFETIME attribute and the 1360 attribute value is 0, then the desired lifetime is 0. Otherwise, 1361 if the request contains a LIFETIME attribute and the attribute 1362 value is greater than the default lifetime, and if the attribute 1363 value is otherwise acceptable to the server, then the desired 1364 lifetime is the attribute value. Otherwise the desired lifetime 1365 is the default value. 1367 3. Subsequent processing depends on the desired lifetime value: 1369 * If desired lifetime is 0, then the request succeeds and the 1370 allocation is deleted. 1372 * If the desired lifetime is non-zero, then the request succeeds 1373 and the allocation's time-to-expiry is set to the desired 1374 lifetime 1376 If the request succeeds, then server sends a success response 1377 containing: 1379 * A LIFETIME attribute containing the current value of the time- 1380 to-expiry timer. 1382 NOTE: A server need not do anything special to implement 1383 idempotency of Refresh requests over UDP using the "stateless 1384 stack approach". Retransmitted Refresh requests with a non-zero 1385 desired lifetime will simply refresh the allocation. A 1386 retransmitted Refresh request with a zero desired lifetime will 1387 cause a 437 (Allocation Mismatch) response if the allocation has 1388 already been deleted, but the client will treat this as equivalent 1389 to a success response (see below). 1391 7.3. Receiving a Refresh Response 1393 If the client receives a success response to its Refresh request with 1394 a non-zero lifetime, it updates its copy of the allocation data 1395 structure with the time-to-expiry value contained in the response. 1397 If the client receives a 437 (Allocation Mismatch) error response to 1398 a request to delete the allocation, then the allocation no longer 1399 exists and it should consider its request as having effectively 1400 succeeded. 1402 8. Permissions 1404 For each allocation, the server keeps a list of zero or more 1405 permissions. Each permission consists of an IP address which 1406 uniquely identifies the permission, and an associated time-to-expiry. 1407 The IP address describes a set of peers that are allowed to send data 1408 to the client, and the time-to-expiry is the number of seconds until 1409 the permission expires. 1411 By sending either CreatePermission requests or ChannelBind requests, 1412 the client can cause the server to install or refresh a permission 1413 for a given IP address. This causes one of two things to happen: 1415 o If no permission for that IP address exists, then a permission is 1416 created with the given IP address and a time-to-expiry equal to 1417 the default permission lifetime. 1419 o If a permission for that IP address already exists, then the 1420 lifetime for that permission is reset to the default permission 1421 lifetime. 1423 The default permission lifetime MUST be 300 seconds (= 5 minutes). 1425 Each permission's time-to-expiry decreases down once per second until 1426 it reaches 0, at which point the permission expires and is deleted. 1428 CreatePermission and ChannelBind requests may be freely intermixed on 1429 a permission. A given permission may be installed or refreshed at 1430 one point in time with a CreatePermission request, and then refreshed 1431 with a ChannelBind request at a different point in time, or vice- 1432 versa. 1434 When a UDP datagram arrives at the relayed transport address for the 1435 allocation, the server checks the list of permissions for that 1436 allocation. If there is a permission with an IP address that is 1437 equal to the source IP address of the UDP datagram, then the UDP 1438 datagram can be relayed to the client. Otherwise, the UDP datagram 1439 is silently discarded. Note that only IP addresses are compared; 1440 port numbers are irrelevant. 1442 The permissions for one allocation are totally unrelated to the 1443 permissions for a different allocation. If an allocation expires, 1444 all its permissions expire with it. 1446 NOTE: Though TURN permissions expire after 5 minutes, many NATs 1447 deployed at the time of publication expire their UDP bindings 1448 considerably faster. Thus an application using TURN will probably 1449 wish to send some sort of keep-alive traffic at a much faster 1450 rate. Applications using ICE should follow the keep-alive 1451 guidelines of ICE [I-D.ietf-mmusic-ice], and applications not 1452 using ICE are advised to do something similar. 1454 9. CreatePermission 1456 TURN supports two ways for the client to install or refresh 1457 permissions on the server. This section describes one way: the 1458 CreatePermission request. 1460 A CreatePermission request may be used in conjunction with either the 1461 Send mechanism inSection 10 or the Channel mechanism in Section 11. 1463 9.1. Forming a CreatePermission request 1465 The client who wishes to install or refresh one or more permissions 1466 can send a CreatePermission request to the server. 1468 When forming a CreatePermission request, the client MUST include at 1469 least one XOR-PEER-ADDRESS attribute, and MAY include more than one 1470 such attribute. The IP address portion of each XOR-PEER-ADDRESS 1471 attribute contains the IP address for which a permission should be 1472 installed or refreshed. The port portion of each XOR-PEER-ADDRESS 1473 attribute will be ignored and can be any arbitrary value. The 1474 various XOR-PEER-ADDRESS attributes can appear in any order. 1476 9.2. Receiving a CreatePermission request 1478 When the server receives the CreatePermission request, it processes 1479 it as follows. 1481 The message is first checked for validity. The CreatePermission 1482 request MUST contain at least XOR-PEER-ADDRESS attribute and MAY 1483 contain multiple such attributes. If no such attribute exists, or if 1484 any of these attributes are invalid, then a 400 (Bad Request) error 1485 is returned. If the request is valid, but the server is unable to 1486 satisfy the request due to some capacity limit or similar, then a 508 1487 (Insufficient Capacity) error is returned. 1489 The server MAY impose restrictions on the range of values allowed for 1490 the IP address contained in one of the XOR-PEER-ADDRESS attributes. 1492 If the message is valid and the server is capable of carrying out the 1493 request, then the server installs or refreshes a permission for the 1494 IP address contained in each XOR-PEER-ADDRESS attribute as described 1495 in Section 8. The port portion of each attribute is ignored and may 1496 be any arbitrary value. 1498 The server then responds with a CreatePermission success response. 1499 There are no mandatory attributes in the success response. 1501 NOTE: A server need not do anything special to implement 1502 idempotency of CreatePermission requests over UDP using the 1503 "stateless stack approach". Retransmitted CreatePermission 1504 requests will simply refresh the permissions. 1506 9.3. Receiving a CreatePermission response 1508 If the client receives a valid CreatePermission success response, 1509 then the client updates its data structures to indicate that the 1510 permissions have been installed or refreshed. 1512 10. Send and Data Methods 1514 TURN supports two mechanisms for sending and receive data from peers. 1515 This section describes the use of the Send and Data mechanism, while 1516 Section 11 describes the use of the Channel mechanism. 1518 10.1. Forming a Send Indication 1520 The client can use a Send indication to pass data to the server for 1521 relaying to a peer. A client may use a Send indication even if a 1522 channel is bound to that peer. However the client MUST ensure that 1523 there is a permission installed for the IP address of the peer to 1524 which the Send indication is being sent; this prevents a third party 1525 from using a TURN server to send data to arbitrary destinations. 1527 When forming a Send indication, the client MUST include a XOR-PEER- 1528 ADDRESS attribute and a DATA attribute. The XOR-PEER-ADDRESS 1529 attribute contains the transport address of the peer to which the 1530 data is to be sent, and the DATA attribute contains the actual 1531 application data to be sent to the peer. 1533 The client MAY include a DONT-FRAGMENT attribute in the Send 1534 indication if it wishes the server to set the DF bit on the UDP 1535 datagram sent to the peer. 1537 10.2. Receiving a Send Indication 1539 When the server receives a Send indication, it processes it as 1540 follows. 1542 The message is first checked for validity. The Send indication MUST 1543 contain both a XOR-PEER-ADDRESS attribute and a DATA attribute. If 1544 one of these attributes is missing or invalid, then the message is 1545 discarded. 1547 The Send indication may also contain the DONT-FRAGMENT attribute. If 1548 the server is unable to set the DF bit on outgoing UDP datagrams when 1549 this attribute is present, then the server acts as if the DONT- 1550 FRAGMENT attribute is an unknown comprehension-required attribute 1551 (and thus the Send indication is discarded). 1553 The server also checks that there is a permission installed for the 1554 IP address contained in the XOR-PEER-ADDRESS attribute. If no such 1555 permission exists, the message is discarded. Furthermore, the server 1556 MUST NOT refresh the permission due to the receipt of the Send 1557 indication. 1559 The server MAY impose additional restrictions on the range of values 1560 allowed for the IP address and port contained in the XOR-PEER-ADDRESS 1561 attribute. 1563 If everything is OK, then the server forms a UDP datagram as follows: 1565 o the source transport address is the relayed transport address of 1566 the allocation, where the allocation is determined by the 5-tuple 1567 on which the Send indication arrived; 1569 o the destination transport address is taken from the XOR-PEER- 1570 ADDRESS attribute; 1572 o the data following the UDP header is the contents of the value 1573 field of the DATA attribute. 1575 The handling of the DONT-FRAGMENT attribute (if present), is 1576 described in Section 12. 1578 The resulting UDP datagram is then sent to the peer. 1580 10.3. Receiving a UDP Datagram 1582 When the server receives a UDP datagram at a currently allocated 1583 relayed transport address, the server looks up the allocation 1584 associated with the relayed transport address. It then checks to see 1585 if relaying is permitted, as described in Section 8. 1587 If relaying is permitted, then the server checks if there is a 1588 channel bound to the peer that sent the UDP datagram (see 1589 Section 11). If a channel is bound, then processing proceeds as 1590 described in Section 11.7. 1592 If relaying is permitted but no channel is bound to the peer, then 1593 the server forms and sends a Data indication. The Data indication 1594 MUST contain both a XOR-PEER-ADDRESS and a DATA attribute. The DATA 1595 attribute is set to the value of the 'data octets' field from the 1596 datagram, and the XOR-PEER-ADDRESS attribute is set to the source 1597 transport address of the received UDP datagram. The Data indication 1598 is then sent on the 5-tuple associated with the allocation. 1600 10.4. Receiving a Data Indication 1602 When the client receives a Data indication, it checks that the Data 1603 indication contains both a XOR-PEER-ADDRESS and a DATA attribute, and 1604 discards the indication if it does not. The client SHOULD also check 1605 that the XOR-PEER-ADDRESS attribute value contains an IP address with 1606 which the client believes there is an active permission, and discard 1607 the Data indication otherwise. 1609 NOTE: The latter check protects the client against an attacker who 1610 somehow manages to trick the server into installing permissions 1611 not desired by the client. 1613 If the Data indication passes the above checks, the client delivers 1614 the data octets inside the DATA attribute to the application, along 1615 with an indication that they were received from the peer whose 1616 transport address is given by the XOR-PEER-ADDRESS attribute. 1618 11. Channels 1620 Channels provide a way for the client and server to send application 1621 data using ChannelData messages, which have less overhead than Send 1622 and Data indications. 1624 The ChannelData message (see Section 11.4) starts with a two-byte 1625 field that carries the channel number. The values of this field are 1626 allocated as follows: 1628 0x0000 through 0x3FFF: These values can never be used for channel 1629 numbers. 1631 0x4000 through 0x7FFF: These values are the allowed channel 1632 numbers (16,383 possible values) 1634 0x8000 through 0xFFFF: These values are reserved for future use. 1636 Because of this division, ChannelData messages can be distinguished 1637 from STUN-formatted messages (e.g., Allocate request, Send 1638 indication, etc) by examining the first two bits of the message: 1640 0b00: STUN-formatted message (since the first two bits of a STUN- 1641 formatted message are always zero) 1643 0b01: ChannelData message (since the channel number is the first 1644 field in the ChannelData message and channel numbers fall in the 1645 range 0x4000 - 0x7FFF) 1647 0b10: Reserved 1649 0b11: Reserved 1651 The reserved values may be used in the future to extend the range of 1652 channel numbers. Thus an implementation MUST NOT assume that a TURN 1653 message always starts with a 0 bit. 1655 Channel bindings are always initiated by the client. The client can 1656 bind a channel to a peer at any time during the lifetime of the 1657 allocation. The client may bind a channel to a peer before 1658 exchanging data with it, or after exchanging data with it (using Send 1659 and Data indications) for some time, or may choose never to bind a 1660 channel it. The client can also bind channels to some peers while 1661 not binding channels to other peers. 1663 Channel bindings are specific to an allocation, so that the use of a 1664 channel number or peer transport address in a channel binding in one 1665 allocation has no impact on their use in a different allocation. If 1666 an allocation expires, all its channel bindings expire with it. 1668 A channel binding consists of: 1670 o A channel number; 1672 o A transport address (of the peer); 1674 o A time-to-expiry timer. 1676 Within the context of an allocation, a channel binding is uniquely 1677 identified either by the channel number or by the peer's transport 1678 address. Thus the same channel cannot be bound to two different 1679 transport addresses, nor can the same transport address be bound to 1680 two different channels. 1682 A channel binding lasts for 10 minutes unless refreshed. Refreshing 1683 the binding (by the server receiving a ChannelBind request rebinding 1684 the channel to the same peer) resets the time-to-expiry timer back to 1685 10 minutes. 1687 When the channel binding expires, the channel becomes unbound. Once 1688 unbound, the channel number can be bound to a different transport 1689 address, and the transport address can be bound to a different 1690 channel number. To prevent race conditions, the client MUST wait 5 1691 minutes after the channel binding expires before attempting to bind 1692 the channel number to a different transport address or the transport 1693 address to a different channel number. 1695 When binding a channel to a peer, the client SHOULD be prepared to 1696 receive ChannelData messages on the channel from the server as soon 1697 as it has sent the ChannelBind request. Over UDP, it is possible for 1698 the client to receive ChannelData messages from the server before it 1699 receives a ChannelBind success response. 1701 In the other direction, the client MAY elect to send ChannelData 1702 messages before receiving the ChannelBind success response. Doing 1703 so, however, runs the risk of having the ChannelData messages dropped 1704 by the server if the ChannelBind request does not succeed for some 1705 reason (e.g., packet lost if the request is sent over UDP, or the 1706 server being unable to fulfill the request). A client that wishes to 1707 be safe should either queue the data, or use Send indications until 1708 the channel binding is confirmed. 1710 11.1. Sending a ChannelBind Request 1712 A channel binding is created or refreshed using a ChannelBind 1713 transaction. A ChannelBind transaction also creates or refreshes a 1714 permission towards the peer. 1716 To initiate the ChannelBind transaction, the client forms a 1717 ChannelBind request. The channel to be bound is specified in a 1718 CHANNEL-NUMBER attribute, and the peer's transport address is 1719 specified in a XOR-PEER-ADDRESS attribute. Section 11.2 describes 1720 the restrictions on these attributes. 1722 Rebinding a channel to the same transport address that it is already 1723 bound to provides a way to refresh a channel binding and the 1724 corresponding permission without sending data to the peer. Note 1725 however, that permissions need to be refreshed more frequently than 1726 channels. 1728 11.2. Receiving a ChannelBind Request 1730 When the server receives a ChannelBind request, it checks the 1731 following: 1733 o The request contains both a CHANNEL-NUMBER and a XOR-PEER-ADDRESS 1734 attribute; 1736 o The channel number is in the range 0x4000 through 0x7FFE 1737 (inclusive); 1739 o The channel number is not currently bound to a different transport 1740 address (same transport address is OK); 1742 o The transport address is not currently bound to a different 1743 channel number. 1745 The server MAY also impose restrictions on the range of IP addresses 1746 and ports allowed in the XOR-PEER-ADDRESS attribute. 1748 If any of these tests fail, the server replies with a 400 (Bad 1749 Request) error. If the request is valid, but the server is unable to 1750 fulfill the request due to some capacity limit or similar, the server 1751 replies with a 508 (Insufficient Capacity) error. Otherwise, the 1752 server replies with a ChannelBind success response. There are no 1753 required attributes in a successful ChannelBind response. 1755 If the server can satisfy the request, then the server creates or 1756 refreshes the channel binding using the channel number in the 1757 CHANNEL-NUMBER attribute and the transport address in the XOR-PEER- 1758 ADDRESS attribute. The server also installs or refreshes a 1759 permission for the IP address in the XOR-PEER-ADDRESS attribute as 1760 described in Section 8. 1762 NOTE: A server need not do anything special to implement 1763 idempotency of ChannelBind requests over UDP using the "stateless 1764 stack approach". Retransmitted ChannelBind requests will simply 1765 refresh the channel binding and the corresponding permission. 1766 Furthermore, the client must wait 5 minutes before binding a 1767 previously bound channel number or peer address to a different 1768 channel, eliminating the possibility that the transaction would 1769 initially fail but succeed on a retransmission. 1771 11.3. Receiving a ChannelBind Response 1773 When the client receives a ChannelBind success response, it updates 1774 its data structures to record that the channel binding is now active. 1775 It also updates its data structures to record that the corresponding 1776 permission has been installed or refreshed. 1778 If the client receives a ChannelBind failure response that indicates 1779 that the channel information is out-of-sync between the client and 1780 the server (e.g., an unexpected 400 "Bad Request" response), then it 1781 is RECOMMENDED that the client immediately delete the allocation and 1782 start afresh with a new allocation. 1784 11.4. The ChannelData Message 1786 The ChannelData message is used to carry application data between the 1787 client and the server. It has the following format: 1789 0 1 2 3 1790 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 1791 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1792 | Channel Number | Length | 1793 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1794 | | 1795 / Application Data / 1796 / / 1797 | | 1798 | +-------------------------------+ 1799 | | 1800 +-------------------------------+ 1802 The Channel Number field specifies the number of the channel on which 1803 the data is traveling, and thus the address of the peer that is 1804 sending or is to receive the data. 1806 The Length field specifies the length in bytes of the application 1807 data field (i.e., it does not include the size of the ChannelData 1808 header). Note that 0 is a valid length. 1810 The Application Data field carries the data the client is trying to 1811 send to the peer, or that the peer is sending to the client. 1813 11.5. Sending a ChannelData Message 1815 Once a client has bound a channel to a peer, then when the client has 1816 data to send to that peer it may use either a ChannelData message or 1817 a Send indication; that is, the client is not obligated to use the 1818 channel when it exists and may freely intermix the two message types 1819 when sending data to the peer. The server, on the other hand, MUST 1820 use the ChannelData message if a channel has been bound to the peer. 1822 The fields of the ChannelData message are filled in as described in 1823 Section 11.4. 1825 Over stream transports, the ChannelData message MUST be padded to a 1826 multiple of four bytes in order to ensure the alignment of subsequent 1827 messages. The padding is not reflected in the length field of the 1828 ChannelData message, so the actual size of a ChannelData message 1829 (including padding) is (4 + Length) rounded up to the nearest 1830 multiple of 4. Over UDP, the padding is not required but MAY be 1831 included. 1833 The ChannelData message is then sent on the 5-tuple associated with 1834 the allocation. 1836 11.6. Receiving a ChannelData Message 1838 The receiver of the ChannelData message uses the first two bits to 1839 distinguish it from STUN-formatted messages, as described above. If 1840 the message uses a value in the reserved range (0x8000 through 1841 0xFFFF), then the message is silently discarded. 1843 If the ChannelData message is received in a UDP datagram, and if the 1844 UDP datagram is too short to contain the claimed length of the 1845 ChannelData message (i.e., the UDP header length field value is less 1846 than the ChannelData header length field value + 4 + 8), then the 1847 message is silently discarded. 1849 If the ChannelData message is received over TCP or over TLS over TCP, 1850 then the actual length of the ChannelData message is as described in 1851 Section 11.5. 1853 If the ChannelData message is received on a channel which is not 1854 bound to any peer, then the message is silently discarded. 1856 On the client, it is RECOMMENDED that the client discard the 1857 ChannelData message if the client believes there is no active 1858 permission towards the peer. On the server, the receipt of a 1859 ChannelData message MUST NOT refresh either the channel binding or 1860 the permission towards the peer. 1862 On the server, if no errors are detected, the server relays the 1863 application data to the peer by forming a UDP datagram as follows: 1865 o the source transport address is the relayed transport address of 1866 the allocation, where the allocation is determined by the 5-tuple 1867 on which the ChannelData message arrived; 1869 o the destination transport address is the transport address to 1870 which the channel is bound; 1872 o the data following the UDP header is the contents of the data 1873 field of the ChannelData message. 1875 The resulting UDP datagram is then sent to the peer. Note that if 1876 the Length field in the ChannelData message is 0, then there will be 1877 no data in the UDP datagram, but the UDP datagram is still formed and 1878 sent. 1880 11.7. Relaying Data from the Peer 1882 When the server receives a UDP datagram on the relayed transport 1883 address associated with an allocation, the server processes it as 1884 described in Section 10.3. If that section indicates that a 1885 ChannelData message should be sent (because there is a channel bound 1886 to the peer that sent to UDP datagram), then the server forms and 1887 sends a ChannelData message as described in Section 11.5. 1889 12. IP Header Fields 1891 This section describes how the server sets various fields in the IP 1892 header when relaying between the client and the peer or vica-versa. 1893 The descriptions in this section apply: (a) when the server sends a 1894 UDP datagram to the peer, or (b) when the server sends a Data 1895 indication or ChannelData message to the client over UDP transport. 1896 The descriptions in this section do not apply to TURN messages sent 1897 over TCP or TLS transport from the server to the client. 1899 The descriptions below have two parts: a preferred behavior and an 1900 alternate behavior. The server SHOULD implement the preferred 1901 behavior, but if that is not possible for a particular field, then it 1902 SHOULD implement the alternative behavior. 1904 Time to Live (TTL) field 1906 Preferred Behavior: If the incoming value is 0, then the drop the 1907 incoming packet. Otherwise set the outgoing Time to Live/Hop 1908 Count to one less than the incoming value. 1910 Alternate Behavior: Set the outgoing value to the default for 1911 outgoing packets. 1913 Diff-Serv Code Point (DSCP) field [RFC2474] 1915 Preferred Behavior: Set the outgoing value to the incoming value, 1916 unless the server includes a differentiated services classifier 1917 and marker [RFC2474]. 1919 Alternate Behavior: Set the outgoing value to a fixed value, which 1920 by default is Best Effort unless configured otherwise. 1922 In both cases, if the server is immediately adjacent to a 1923 differentiated services classifier and marker, then DSCP MAY be 1924 set to any arbitrary value in the direction towards the 1925 classifier. 1927 Explicit Congestion Notification (ECN) field [RFC3168] 1929 Preferred Behavior: Set the outgoing value to the incoming value, 1930 UNLESS the server is doing Active Queue Management, the incoming 1931 ECN field is ECT(1) (=0b01) or ECT(0) (=0b10), and the server 1932 wishes to indicate that congestion has been experienced, in which 1933 case set the outgoing value to CE (=0b11). 1935 Alternate Behavior: Set the outgoing value to Not-ECT (=0b00). 1937 IPv4 Fragmentation fields 1939 Preferred Behavior: 1941 When the server sends a packet to a peer in response to a Send 1942 indication containing the DONT-FRAGMENT attribute, then set the 1943 DF bit in the outgoing IP header to 1. In all other cases when 1944 sending an outgoing packet containing application data (e.g., 1945 Data indication, ChannelData message, or DONT-FRAGMENT 1946 attribute not included in the Send indication), copy the DF bit 1947 from the DF bit of the incoming packet that contained the 1948 application data. 1950 Set the other fragmentation fields (Identification, MF, 1951 Fragment Offset) as appropriate for a packet originating from 1952 the server. 1954 Alternate Behavior: As described in the Preferred Behavior, except 1955 always assume the incoming DF bit is 0. 1957 In both the Preferred and Alternate Behaviors, the resulting 1958 packet may be too large for the outgoing link. If this is the 1959 case, then the normal fragmentation rules apply [RFC1122]. 1961 IPv4 Options 1963 Preferred Behavior: The outgoing packet is sent without any IPv4 1964 options. 1966 Alternate Behavior: Same as preferred. 1968 13. New STUN Methods 1970 This section lists the codepoints for the new STUN methods defined in 1971 this specification. See elsewhere in this document for the semantics 1972 of these new methods. 1974 0x003 : Allocate (only request/response semantics defined) 1975 0x004 : Refresh (only request/response semantics defined) 1976 0x006 : Send (only indication semantics defined) 1977 0x007 : Data (only indication semantics defined) 1978 0x008 : CreatePermission (only request/response semantics defined 1979 0x009 : ChannelBind (only request/response semantics defined) 1981 14. New STUN Attributes 1983 This STUN extension defines the following new attributes: 1985 0x000C: CHANNEL-NUMBER 1986 0x000D: LIFETIME 1987 0x0010: Reserved (was BANDWIDTH) 1988 0x0012: XOR-PEER-ADDRESS 1989 0x0013: DATA 1990 0x0016: XOR-RELAYED-ADDRESS 1991 0x0018: EVEN-PORT 1992 0x0019: REQUESTED-TRANSPORT 1993 0x001A: DONT-FRAGMENT 1994 0x0021: Reserved (was TIMER-VAL) 1995 0x0022: RESERVATION-TOKEN 1997 14.1. CHANNEL-NUMBER 1999 The CHANNEL-NUMBER attribute contains the number of the channel. It 2000 is a 16-bit unsigned integer, followed by a two-octet RFFU (Reserved 2001 For Future Use) field which MUST be set to 0 on transmission and MUST 2002 be ignored on reception. 2004 0 1 2 3 2005 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 2006 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2007 | Channel Number | RFFU = 0 | 2008 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2010 14.2. LIFETIME 2012 The LIFETIME attribute represents the duration for which the server 2013 will maintain an allocation in the absence of a refresh. It is a 32- 2014 bit unsigned integral value representing the number of seconds 2015 remaining until expiration. 2017 14.3. XOR-PEER-ADDRESS 2019 The XOR-PEER-ADDRESS specifies the address and port of the peer as 2020 seen from the TURN server. (In other words, the peer's server- 2021 reflexive transport address if the peer is behind a NAT). It is 2022 encoded in the same way as XOR-MAPPED-ADDRESS [RFC5389]. 2024 14.4. DATA 2026 The DATA attribute is present in all Send and Data indications. The 2027 contents of DATA attribute is the application data (that is, the data 2028 that would immediately follow the UDP header if the data was been 2029 sent directly between the client and the peer). 2031 14.5. XOR-RELAYED-ADDRESS 2033 The XOR-RELAYED-ADDRESS is present in Allocate responses. It 2034 specifies the address and port that the server allocated to the 2035 client. It is encoded in the same way as XOR-MAPPED-ADDRESS 2036 [RFC5389]. 2038 14.6. EVEN-PORT 2040 This attribute allows the client to request that the port in the 2041 relayed-transport-address be even, and (optionally) that the server 2042 reserve the next-higher port number. The attribute is 8 bits long. 2043 Its format is: 2045 0 2046 0 1 2 3 4 5 6 7 2047 +-+-+-+-+-+-+-+-+ 2048 |R| RFFU | 2049 +-+-+-+-+-+-+-+-+ 2051 The attribute contains a single 1-bit flag: 2053 R: If 1, the server is requested to reserve the next higher port 2054 number (on the same IP address) for a subsequent allocation. If 2055 0, no such reservation is requested. 2057 The other 7 bits of the attribute must be set to zero on transmission 2058 and ignored on reception. 2060 14.7. REQUESTED-TRANSPORT 2062 This attribute is used by the client to request a specific transport 2063 protocol for the allocated transport address. It has the following 2064 format: 2065 0 1 2 3 2066 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 2067 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2068 | Protocol | RFFU | 2069 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2071 The Protocol field specifies the desired protocol. The codepoints 2072 used in this field are taken from those allowed in the Protocol field 2073 in the IPv4 header and the NextHeader field in the IPv6 header 2074 [Protocol-Numbers]. This specification only allows the use of 2075 codepoint 17 (User Datagram Protocol). 2077 The RFFU field MUST be set to zero on transmission and MUST be 2078 ignored on reception. It is reserved for future uses. 2080 14.8. DONT-FRAGMENT 2082 This attribute is used by the client to request that the server set 2083 the DF (Don't Fragment) bit in the IP header when relaying the 2084 application data onward to the peer. This attribute has no value 2085 part and thus the attribute length field is 0. 2087 14.9. RESERVATION-TOKEN 2089 The RESERVATION-TOKEN attribute contains a token that uniquely 2090 identifies a relayed transport address being held in reserve by the 2091 server. The server includes this attribute in a success response to 2092 tell the client about the token, and the client includes this 2093 attribute in a subsequent Allocate request to request the server use 2094 that relayed transport address for the allocation. 2096 The attribute value is a 64-bit-long field containing the token 2097 value. 2099 15. New STUN Error Response Codes 2101 This document defines the following new error response codes: 2103 437 (Allocation Mismatch): A request was received by the server that 2104 requires an allocation to be in place, but there is none, or a 2105 request was received which requires no allocation, but there is 2106 one. 2108 441 (Wrong Credentials): The credentials in the (non-Allocate) 2109 request, though otherwise acceptable to the server, do not match 2110 those used to create the allocation. 2112 442 (Unsupported Transport Protocol): The Allocate request asked the 2113 server to use a transport protocol between the server and the peer 2114 that the server does not support. NOTE: This does NOT refer to 2115 the transport protocol used in the 5-tuple. 2117 486 (Allocation Quota Reached): No more allocations using this 2118 username can be created at the present time. 2120 508 (Insufficient Capacity): The server is unable to carry out the 2121 request due to some capacity limit being reached. In an Allocate 2122 response, this could be due to the server having no more relayed 2123 transport addresses available right now, or having none with the 2124 requested properties, or the one that corresponds to the specified 2125 reservation token is not available. 2127 16. Detailed Example 2129 This section gives a example of the use of TURN, showing in detail 2130 the contents of the messages exchanged. The example uses the network 2131 diagram shown in the Overview (Figure 1). 2133 For each message, the attributes included in the message and their 2134 values are shown. For convenience, values are shown in a human- 2135 readable format rather than showing the actual octets; for example 2136 "XOR-RELAYED-ADDRESS=192.0.2.15:9000" shows that the XOR-RELAYED- 2137 ADDRESS attribute is included with an address of 192.0.2.15 and a 2138 port of 9000, here the address and port are shown before the xor-ing 2139 is done. For attributes with string-like values (e.g. 2140 SOFTWARE="Example client, version 1.03" and 2141 NONCE="adl7W7PeDU4hKE72jdaQvbAMcr6h39sm"), the value of the attribute 2142 is shown in quotes for readability, but these quotes do not appear in 2143 the actual value. 2145 TURN TURN Peer Peer 2146 client server A B 2147 | | | | 2148 |--- Allocate request -------------->| | | 2149 | Transaction-Id=0xA56250D3F17ABE679422DE85 | | 2150 | SOFTWARE="Example client, version 1.03" | | 2151 | LIFETIME=3600 (1 hour) | | | 2152 | REQUESTED-TRANSPORT=17 (UDP) | | | 2153 | DONT-FRAGMENT | | | 2154 | | | | 2155 |<-- Allocate error response --------| | | 2156 | Transaction-Id=0xA56250D3F17ABE679422DE85 | | 2157 | SOFTWARE="Example server, version 1.17" | | 2158 | ERROR-CODE=401 (Unauthorized) | | | 2159 | REALM="example.com" | | | 2160 | NONCE="adl7W7PeDU4hKE72jdaQvbAMcr6h39sm" | | 2161 | | | | 2162 |--- Allocate request -------------->| | | 2163 | Transaction-Id=0xC271E932AD7446A32C234492 | | 2164 | SOFTWARE="Example client 1.03" | | | 2165 | LIFETIME=3600 (1 hour) | | | 2166 | REQUESTED-TRANSPORT=17 (UDP) | | | 2167 | DONT-FRAGMENT | | | 2168 | USERNAME="George" | | | 2169 | REALM="example.com" | | | 2170 | NONCE="adl7W7PeDU4hKE72jdaQvbAMcr6h39sm" | | 2171 | MESSAGE-INTEGRITY=... | | | 2172 | | | | 2173 |<-- Allocate success response ------| | | 2174 | Transaction-Id=0xC271E932AD7446A32C234492 | | 2175 | SOFTWARE="Example server, version 1.17" | | 2176 | LIFETIME=1200 (20 minutes) | | | 2177 | XOR-RELAYED-ADDRESS=192.0.2.15:50000 | | 2178 | XOR-MAPPED-ADDRESS=192.0.2.1:7000 | | 2179 | MESSAGE-INTEGRITY=... | | | 2181 The client begins by selecting a host transport address to use for 2182 the TURN session; in this example the client has selected 10.1.1.2: 2183 49721 as shown in Figure 1. The client then sends an Allocate 2184 request to the server at the server transport address. The client 2185 randomly selects a 96-bit transaction id of 2186 0xA56250D3F17ABE679422DE85 for this transaction; this is encoded in 2187 the transaction id field in the fixed header. The client includes a 2188 SOFTWARE attribute that gives information about the client's 2189 software; here the value is "Example client, version 1.03" to 2190 indicate that this is version 1.03 of something called the Example 2191 client. The client includes the LIFETIME attribute because it wishes 2192 the allocation to have a longer lifetime than the default of 10 2193 minutes; the value of this attribute is 3600 seconds, which 2194 corresponds to 1 hour. The client must always include a REQUESTED- 2195 TRANSPORT attribute in an Allocate request and the only value allowed 2196 by this specification is 17, which indicates UDP transport between 2197 the server and the peers. The client also includes the DONT-FRAGMENT 2198 attribute because it wishes to use the DONT-FRAGMENT attribute later 2199 in Send indications; this attribute consists of only an attribute 2200 header, there is no value part. We assume the client has not 2201 recently interacted with the server, thus the client does not include 2202 USERNAME, REALM, NONCE, or MESSAGE-INTEGRITY attribute. Finally, 2203 note that the order of attributes in a message is arbitrary (except 2204 for the MESSAGE-INTEGRITY and FINGERPRINT attributes) and the client 2205 could have used a different order. 2207 The server follows the recommended practice in this specification of 2208 requiring all requests to be authenticated. Thus when the server 2209 receives the initial Allocate request, it rejects the request because 2210 the request does not contain the authentication attributes. 2211 Following the procedures of the Long-Term Credential Mechanism of 2212 STUN [RFC5389], the server includes an ERROR-CODE attribute with a 2213 value of 401 (Unauthorized), a REALM attribute that specifies the 2214 authentication realm used by the server (in this case, the server's 2215 domain "example.com"), and a nonce value in a NONCE attribute. The 2216 server also includes a SOFTWARE attribute that gives information 2217 about the server's software. 2219 The client, upon receipt of the 401 error, re-attempts the Allocate 2220 request, this time including the authentication attributes. The 2221 client selects a new transaction id, and then populates the new 2222 Allocate request with the same attributes as before. The client 2223 includes a USERNAME attribute and uses the realm value received from 2224 the server to help it determine which value to use; here the client 2225 is configured to use the username "George" for the realm 2226 "example.com". The client also includes the REALM and NONCE 2227 attributes, which are just copied from the 401 error response. 2228 Finally, the client includes a MESSAGE-INTEGRITY attribute as the 2229 last attribute in the message, whose value is an HMAC-SHA1 hash over 2230 the contents of the message (shown as just "..." above); this HMAC- 2231 SHA1 computation also covers a password value, thus an attacker 2232 cannot compute the message integrity value without somehow knowing 2233 the secret password. 2235 The server, upon receipt of the authenticated Allocate request, 2236 checks that everything is OK, then creates an allocation. The server 2237 replies with an Allocate success response. The server includes a 2238 LIFETIME attribute giving the lifetime of the allocation; here, the 2239 server as reduced the client's requested 1 hour lifetime to just 20 2240 minutes, because this particular server doesn't allow lifetimes 2241 longer than 20 minutes. The server includes an XOR-RELAYED-ADDRESS 2242 attribute whose value is the relayed transport address of the 2243 allocation. The server includes an XOR-MAPPED-ADDRESS attribute 2244 whose value is the server-reflexive address of the client; this value 2245 is not used otherwise in TURN but is returned as a convenience to the 2246 client. The server includes a MESSAGE-INTEGRITY attribute to 2247 authenticate the response and to insure its integrity; note that the 2248 response does not contain the USERNAME, REALM, and NONCE attributes. 2249 The server also includes a SOFTWARE attribute. 2251 TURN TURN Peer Peer 2252 client server A B 2253 |--- CreatePermission request ------>| | | 2254 | Transaction-Id=0xE5913A8F460956CA277D3319 | | 2255 | XOR-PEER-ADDRESS=192.0.2.150:0 | | | 2256 | USERNAME="George" | | | 2257 | REALM="example.com" | | | 2258 | NONCE="adl7W7PeDU4hKE72jdaQvbAMcr6h39sm" | | 2259 | MESSAGE-INTEGRITY=... | | | 2260 | | | | 2261 |<-- CreatePermission success resp.--| | | 2262 | Transaction-Id=0xE5913A8F460956CA277D3319 | | 2263 | MESSAGE-INTEGRITY=... | | | 2265 The client then creates a permission towards peer A in preparation 2266 for sending it some application data. This is done through a 2267 CreatePermission request. The XOR-PEER-ADDRESS attribute contains 2268 the IP address for which a permission is established (the IP address 2269 of peer A); note that the port number in the attribute is ignored 2270 when used in a CreatePermission request, and here it has been set to 2271 0; also note how the client uses Peer A's server-reflexive IP address 2272 and not its (private) host address. The client uses the same 2273 username, realm, and nonce values as in the previous request on the 2274 allocation. Though it is allowed to do so, the client has chosen not 2275 to include a SOFTWARE attribute in this request. 2277 The server receives the CreatePermission request, creates the 2278 corresponding permission, and then replies with a CreatePermission 2279 success response. Like the client, the server chooses not to include 2280 the SOFTWARE attribute in its reply. Again, note how success 2281 responses contain a MESSAGE-INTEGRITY attribute (assuming the server 2282 uses the Long-Term Credential Mechanism), but no USERNAME, REALM, and 2283 NONCE attributes. 2285 TURN TURN Peer Peer 2286 client server A B 2287 |--- Send indication --------------->| | | 2288 | Transaction-Id=0x1278E9ACA2711637EF7D3328 | | 2289 | XOR-PEER-ADDRSSS=192.0.2.150:32102 | | 2290 | DONT-FRAGMENT | | | 2291 | DATA=... | | | 2292 | |-- UDP dgm ->| | 2293 | | data=... | | 2294 | | | | 2295 | |<- UDP dgm --| | 2296 | | data=... | | 2297 |<-- Data indication ----------------| | | 2298 | Transaction-Id=0x8231AE8F9242DA9FF287FEFF | | 2299 | XOR-PEER-ADDRSSS=192.0.2.150:32102 | | 2300 | DATA=... | | | 2302 The client now sends application data to Peer A using a Send 2303 indication. Peer A's server-reflexive transport address is specified 2304 in the XOR-PEER-ADDRESS attribute, and the application data (shown 2305 here as just "...") is specified in the DATA attribute. The client 2306 is doing a form of path MTU discovery at the application layer and 2307 thus specifies (by including the DONT-FRAGMENT attribute) that the 2308 server should set the DF bit in the UDP datagram send to the peer. 2309 Indications cannot be authenticated using the Long-Term Credential 2310 Mechanism of STUN, so no MESSAGE-INTEGRITY attribute is included in 2311 the message. An application wishing to ensure that its data is not 2312 alerted or forged must integrity-protect its data at the application 2313 level. 2315 Upon receipt of the Send indication, the server extracts the 2316 application data and sends it in a UDP datagram to Peer A, with the 2317 relayed-transport-address as the source transport address of the 2318 datagram, and with the DF bit set as requested. Note that, had the 2319 client not previously established a permission for Peer A's server- 2320 reflexive IP address, then the server would have silently discarded 2321 the Send indication instead. 2323 Peer A then replies with its own UDP datagram containing application 2324 data. The datagram is sent to the relayed-transport-address on the 2325 server. When this arrives, the server creates a Data indication 2326 containing the source of the UDP datagram in the XOR-PEER-ADDRESS 2327 attribute, and the data from the UDP datagram in the DATA attribute. 2328 The resulting Data indication is then sent to the client. 2330 TURN TURN Peer Peer 2331 client server A B 2332 |--- ChannelBind request ----------->| | | 2333 | Transaction-Id=0x6490D3BC175AFF3D84513212 | | 2334 | CHANNEL-NUMBER=0x4000 | | | 2335 | XOR-PEER-ADDRESS=192.0.2.210:49191 | | 2336 | USERNAME="George" | | | 2337 | REALM="example.com" | | | 2338 | NONCE="adl7W7PeDU4hKE72jdaQvbAMcr6h39sm" | | 2339 | MESSAGE-INTEGRITY=... | | | 2340 | | | | 2341 |<-- ChannelBind success response ---| | | 2342 | Transaction-Id=0x6490D3BC175AFF3D84513212 | | 2343 | MESSAGE-INTEGRITY=... | | | 2345 The client now binds a channel to Peer B, specifying a free channel 2346 number (0x4000) in the CHANNEL-NUMBER attribute, and Peer B's 2347 transport address in the XOR-PEER-ADDRESS attribute. As before, the 2348 client re-uses the username, realm, and nonce from its last request 2349 in the message. 2351 Upon receipt of the request, the server binds the channel number to 2352 the peer, installs a permission for Peer B's IP address, and then 2353 replies with ChannelBind success response. 2355 TURN TURN Peer Peer 2356 client server A B 2357 |--- ChannelData ------------------->| | | 2358 | Channel-number=0x4000 |--- UDP datagram --------->| 2359 | Data=... | Data=... | 2360 | | | | 2361 | |<-- UDP datagram ----------| 2362 | | Data=... | | 2363 |<-- ChannelData --------------------| | | 2364 | Channel-number=0x4000 | | | 2365 | Data=... | | | 2367 The client now sends a ChannelData message to the server with data 2368 destined for Peer B. The ChannelData message is not a STUN message, 2369 and thus has no transaction id. Instead, its fixed header has only 2370 two fields: channel number and data; here the channel number field is 2371 0x4000 (the channel the client just bound to Peer B). When the 2372 server receives the ChannelData message, it checks that the channel 2373 is currently bound (which it is) and then sends the data onward to 2374 Peer B in a UDP datagram, using the relayed-transport-address as the 2375 source transport address and 192.0.2.210:49191 (the value of the XOR- 2376 PEER-ADDRESS attribute in the ChannelBind request) as the destination 2377 transport address. 2379 Later, Peer B sends a UDP datagram back to the relayed-transport- 2380 address. This causes the server to send a ChannelData message to the 2381 client containing the data from the UDP datagram. The server knows 2382 which client to send the ChannelData message to because of the 2383 relayed-transport-address the UDP datagram arrived at, and knows to 2384 use channel 0x4000 because this is the channel bound to 192.0.2.210: 2385 49191. Note that if there had not been any channel number bound to 2386 that address, the server would have used a Data indication instead. 2388 TURN TURN Peer Peer 2389 client server A B 2390 |--- Refresh request --------------->| | | 2391 | Transaction-Id=0x0864B3C27ADE9354B4312414 | | 2392 | SOFTWARE="Example client 1.03" | | | 2393 | USERNAME="George" | | | 2394 | REALM="example.com" | | | 2395 | NONCE="adl7W7PeDU4hKE72jdaQvbAMcr6h39sm" | | 2396 | MESSAGE-INTEGRITY=... | | | 2397 | | | | 2398 |<-- Refresh error response ---------| | | 2399 | Transaction-Id=0x0864B3C27ADE9354B4312414 | | 2400 | SOFTWARE="Example server, version 1.17" | | 2401 | ERROR-CODE=438 (Stale Nonce) | | | 2402 | REALM="example.com" | | | 2403 | NONCE="npSw1Xw239bBwGYhjNWgz2yH47sxB2j" | | 2404 | | | | 2405 |--- Refresh request --------------->| | | 2406 | Transaction-Id=0x427BD3E625A85FC731DC4191 | | 2407 | SOFTWARE="Example client 1.03" | | | 2408 | USERNAME="George" | | | 2409 | REALM="example.com" | | | 2410 | NONCE="npSw1Xw239bBwGYhjNWgz2yH47sxB2j" | | 2411 | MESSAGE-INTEGRITY=... | | | 2412 | | | | 2413 |<-- Refresh success response -------| | | 2414 | Transaction-Id=0x427BD3E625A85FC731DC4191 | | 2415 | SOFTWARE="Example server, version 1.17" | | 2416 | LIFETIME=600 (10 minutes) | | | 2418 Sometime before the 20 minute lifetime is up, the client refreshes 2419 the allocation. This is done using a Refresh request. As before, 2420 the client includes the latest username, realm, and nonce values in 2421 the request. The client also includes the SOFTWARE attribute, 2422 following the recommended practice of always including this attribute 2423 in Allocate and Refresh messages. When the server receives the 2424 Refresh request, it notices that the nonce value has expired, and so 2425 replies with 438 (Stale Nonce) error given a new nonce value. The 2426 client then reattempts the request, this time with the new nonce 2427 value. This second attempt is accepted, and the server replies with 2428 a success response. Note that the client did not include a LIFETIME 2429 attribute in the request, so the server refreshes the allocation for 2430 the default lifetime of 10 minutes (as can be seen by the LIFETIME 2431 attribute in the success response). 2433 17. Security Considerations 2435 This section considers attacks that are possible in a TURN 2436 deployment, and discusses how they are mitigated by mechanisms in the 2437 protocol or recommended practices in the implementation. 2439 17.1. Outsider Attacks 2441 Outsider attacks are ones where the attacker has no credentials in 2442 the system, and is attempting to disrupt the service seen by the 2443 client or the server. 2445 17.1.1. Obtaining Unauthorized Allocations 2447 An attacker might wish to obtain allocations on a TURN server for any 2448 number of nefarious purposes. A TURN server provides a mechanism for 2449 sending and receiving packets while cloaking the actual IP address of 2450 the client. This makes TURN servers an attractive target for 2451 attackers who wish to use it to mask their true identity. 2453 An attacker might also wish to simply utilize the services of a TURN 2454 server without paying for them. Since TURN services require 2455 resources from the provider, it is anticipated that their usage will 2456 come with a cost. 2458 These attacks are prevented using the digest authentication mechanism 2459 which allows the TURN server to determine the identity of the 2460 requestor and whether the requestor is allowed to obtain the 2461 allocation. 2463 17.1.2. Offline Dictionary Attacks 2465 The digest authentication mechanism used by TURN is subject to 2466 offline dictionary attacks. An attacker that is capable of 2467 eavesdropping on a message exchange between a client and server can 2468 determine the password by trying a number of candidate passwords and 2469 seeing if one of them is correct. This attack works when the 2470 passwords are low entropy, such as a word from the dictionary. This 2471 attack can be mitigated by using strong passwords with large entropy. 2472 In situations where even stronger mitigation is required, TLS 2473 transport between the client and the server can be used. 2475 17.1.3. Faked Refreshes and Permissions 2477 An attacker might wish to attack an active allocation by sending it a 2478 Refresh request with an immediate expiration, in order to delete it 2479 and disrupt service to the client. This is prevented by 2480 authentication of refreshes. Similarly, an attacker wishing to send 2481 CreatePermission requests to create permissions to undesirable 2482 destinations is prevented from doing so through authentication. The 2483 motivations for such an attack are described in Section 17.2. 2485 17.1.4. Fake Data 2487 An attacker might wish to send data to the client or the peer, as if 2488 they came from the peer or client respectively. To do that, the 2489 attacker can send the client a faked Data Indication or ChannelData 2490 message, or send the TURN server a faked Send Indication or 2491 ChannelData message. 2493 Indeed, since indications and ChannelData messages are not 2494 authenticated, this attack is not prevented by TURN. However, this 2495 attack is generally present in IP-based communications and is not 2496 substantially worsened by TURN. Consider an normal, non-TURN IP 2497 session between hosts A and B. An attacker can send packets to B as 2498 if they came from A by sending packets towards A with a spoofed IP 2499 address of B. This attack requires the attacker to know the IP 2500 addresses of A and B. With TURN, an attacker wishing to send packets 2501 towards a client using a Data indication needs to know its IP address 2502 (and port), the IP address and port of the TURN server, and the IP 2503 address and port of the peer (for inclusion in the XOR-PEER-ADDRESS 2504 attribute). To send a fake ChannelData message to a client, an 2505 attacker needs to know the IP address and port of the client, the IP 2506 address and port of the TURN server, and the channel number. This 2507 particular combination is mildly more guessable than in the non-TURN 2508 case. 2510 These attacks are more properly mitigated by application layer 2511 authentication techniques. In the case of real time traffic, usage 2512 of SRTP [RFC3711] prevents these attacks. 2514 In some situations, the TURN server may be situated in the network 2515 such that it is able to send to hosts that the client cannot directly 2516 send to. This can happen, for example, if the server is located 2517 behind a firewall that allows packets from outside the firewall to be 2518 delivered to the server, but not to other hosts behind the firewall. 2519 In these situations, an attacker could send the server a Send 2520 indication with an XOR-PEER-ADDRESS attribute containing the 2521 transport address of one of the other hosts behind the firewall. If 2522 the server was to allow relaying of traffic to arbitrary peers, then 2523 this would provide a way for the attacker to attack arbitrary hosts 2524 behind the firewall. 2526 To mitigate this attack, TURN requires that the client establish a 2527 permission to a host before sending it data. Thus an attacker can 2528 only attack hosts that the client is already communicating with, 2529 unless the attacker is able to create authenticated requests. 2530 Furthermore, the server administrator may configure the server to 2531 restrict the range of IP addresses and ports that it will relay data 2532 to. To provide even greater security, the server administrator can 2533 require that the client use TLS for all communication between the 2534 client and the server. 2536 17.1.5. Impersonating a Server 2538 When a client learns a relayed address from a TURN server, it uses 2539 that relayed address in application protocols to receive traffic. 2540 Therefore, an attacker wishing to intercept or redirect that traffic 2541 might try to impersonate a TURN server and provide the client with a 2542 faked relayed address. 2544 This attack is prevented through the digest authentication mechanism, 2545 which provides message integrity for responses in addition to 2546 verifying that they came from the server. Furthermore, an attacker 2547 cannot replay old server responses; the transaction ID in the STUN 2548 header prevents this. 2550 17.1.6. Eavesdropping Traffic 2552 TURN concerns itself primarily with authentication and message 2553 integrity. Confidentiality is only a secondary concern, as TURN 2554 control messages do not include information that is particularly 2555 sensitive. The primary protocol content of the messages is the IP 2556 address of the peer. If it is important to prevent an eavesdropper 2557 on a TURN connection from learning this, TURN can be run over TLS. 2559 Confidentiality for the application data relayed by TURN is best 2560 provided by the application protocol itself, since running TURN over 2561 TLS does not protect application data between the server and the 2562 peer. If confidentiality of application data is important, then the 2563 application should encrypt or otherwise protect its data. For 2564 example, for real time media, confidentiality can be provided by 2565 using SRTP. 2567 17.1.7. TURN loop attack 2569 An attacker might attempt to cause data packets to loop indefinitely 2570 between two TURN servers. The attack goes as follows. First, the 2571 attacker sends an Allocate request to server A, using the source 2572 address of server B. Server A will send its response to server B, and 2573 for the attack to succeed, the attacker must have the ability to 2574 either view or guess the contents of this response, so that the 2575 attacker can learn the allocated relayed-transport-address. The 2576 attacker then sends an Allocate request to server B, using the source 2577 address of server A. Again, the attacker must be able to view or 2578 guess the contents of the response, so it can send learn the 2579 allocated relayed-transport-address. Using the same spoofed source 2580 address technique, the attacker then binds a channel number on server 2581 A to the relayed-transport-address on server B, and similarly binds 2582 the same channel number on server B to the relayed-transport-address 2583 on server A. Finally, the attacker sends a ChannelData message to 2584 server A. 2586 The result is a data packet that loops from the relayed-transport- 2587 address on server A to the relayed-transport-address on server B, 2588 then from server B's transport address to server A's transport 2589 address, and then around the loop again. 2591 This attack is mitigated as follows. By requiring all requests to be 2592 authenticated and/or by randomizing the port number allocated for the 2593 relayed-transport-address, the server forces the attacker to either 2594 intercept or view responses sent to a third party (in this case, the 2595 other server) so that the attacker can authenticate the requests and 2596 learn the relayed-transport-address. Without one of these two 2597 measures, an attacker can guess the contents of the responses without 2598 needing to see them, which makes the attack much easier to perform. 2599 Furthermore, by requiring authenticated requests, the server forces 2600 the attacker to have credentials acceptable to the server, which 2601 turns this from an outsider attack into an insider attack and allows 2602 the attack to be traced back to the client initiating it. 2604 The attack can be further mitigated by imposing a per-username limit 2605 on the bandwidth used to relay data by allocations owned by that 2606 username, to limit the impact of this attack on other allocations. 2607 More mitigation can be achieved by decrementing the TTL when relaying 2608 data packets (if the underlying OS allows this). 2610 17.2. Firewall Considerations 2612 A key aspect of TURN's security considerations is that it should not 2613 weaken the protections afforded by firewalls deployed between a 2614 client and a TURN server. It is anticipated that TURN servers will 2615 often be present on the public Internet, and clients may often be 2616 inside enterprise networks with corporate firewalls. If TURN servers 2617 provide a 'backdoor' for reaching into the enterprise, TURN will be 2618 blocked by these firewalls. 2620 TURN servers therefore emulate the behavior of NAT devices which 2621 implement address-dependent filtering [RFC4787], a property common in 2622 many firewalls as well. When a NAT or firewall implements this 2623 behavior, packets from an outside IP address are only allowed to be 2624 sent to an internal IP address and port if the internal IP address 2625 and port had recently sent a packet to that outside IP address. TURN 2626 servers introduce the concept of permissions, which provide exactly 2627 this same behavior on the TURN server. An attacker cannot send a 2628 packet to a TURN server and expect it to be relayed towards the 2629 client, unless the client has tried to contact the attacker first. 2631 It is important to note that some firewalls have policies which are 2632 even more restrictive than address-dependent filtering. Firewalls 2633 can also be configured with address and port dependent filtering, or 2634 can be configured to disallow inbound traffic entirely. In these 2635 cases, if a client is allowed to connect the TURN server, 2636 communications to the client will be less restrictive than what the 2637 firewall would normally allow. 2639 17.2.1. Faked Permissions 2641 In firewalls and NAT devices, permissions are granted implicitly 2642 through the traversal of a packet from the inside of the network 2643 towards the outside peer. Thus, a permission cannot, by definition, 2644 be created by any entity except one inside the firewall or NAT. With 2645 TURN, this restriction no longer holds. Since the TURN server sits 2646 outside the firewall, at attacker outside the firewall can now send a 2647 message to the TURN server and try to create a permission for itself. 2649 This attack is prevented because all messages which create 2650 permissions (i.e., ChannelBind and CreatePermission) are 2651 authenticated. 2653 17.2.2. Blacklisted IP Addresses 2655 Many firewalls can be configured with blacklists which prevent a 2656 client behind the firewall from sending packets to, or receiving 2657 packets from, ranges of blacklisted IP addresses. This is 2658 accomplished by inspecting the source and destination addresses of 2659 packets entering and exiting the firewall, respectively. 2661 If a client connects to a TURN server, it will be able to bypass such 2662 blacklisting policies and communicate with IP addresses which the 2663 firewall would otherwise restrict. This is a problem for other 2664 protocols that provide tunneling functions, such as VPNs. It is 2665 possible to build TURN-aware firewalls which inspect TURN messages, 2666 and check the IP address of the correspondent. TURN messages to 2667 offending destinations can then be rejected. TURN is designed so 2668 that this inspection can be done statelessly. 2670 17.2.3. Running Servers on Well-Known Ports 2672 A malicious client behind a firewall might try to connect to a TURN 2673 server and obtain an allocation which it then uses to run a server. 2674 For example, a client might try to run a DNS server or FTP server. 2676 This is not possible in TURN. A TURN server will never accept 2677 traffic from a peer which the client itself has not contacted. Thus, 2678 peers cannot just connect to the allocated port in order to obtain 2679 the service. 2681 17.3. Insider Attacks 2683 In insider attacks, a client has legitimate credentials but defies 2684 the trust relationship that goes with those credentials. These 2685 attacks cannot be prevented by cryptographic means but need to be 2686 considered in the design of the protocol. 2688 17.3.1. DoS Against TURN Server 2690 A client wishing to disrupt service to other clients might obtain an 2691 allocation and then flood it with traffic, in an attempt to swamp the 2692 server and prevent it from servicing other legitimate clients. This 2693 is mitigated by the recommendation that the server limit the amount 2694 of bandwidth it will relay for a given username. This won't prevent 2695 a client from sending a large amount of traffic, but it allows the 2696 server to immediately discard traffic in excess. 2698 Since each allocation uses a port number on the IP address of the 2699 TURN server, the number of allocations on a server is finite. An 2700 attacker might attempt to consume all of them by requesting a large 2701 number of allocations. This is prevented by the recommendation that 2702 the server impose a limit of the number of allocations active at a 2703 time for a given username. 2705 17.3.2. Anonymous Relaying of Malicious Traffic 2707 TURN servers provide a degree of anonymization. A client can send 2708 data to correspondent peers without revealing their own IP addresses. 2709 TURN servers may therefore become attractive vehicles for attackers 2710 to launch attacks against targets without fear of detection. Indeed, 2711 it is possible for a client to chain together multiple TURN servers, 2712 such that any number of relays can be used before a target receives a 2713 packet. 2715 Administrators who are worried about this attack can maintain logs 2716 which capture the actual source IP and port of the client, and 2717 perhaps even every permission that client installs. This will allow 2718 for forensic tracing to determine the original source, should it be 2719 discovered that an attack is being relayed through a TURN server. 2721 17.3.3. Manipulating other Allocations 2723 An attacker might attempt to disrupt service to other users of the 2724 TURN server by sending Refresh requests or CreatePermission requests 2725 which (through source address spoofing) appear to be coming from 2726 another user of the TURN server. TURN prevents this by requiring 2727 that the credentials used in CreatePermission, Refresh, and 2728 ChannelBind messages match those used to create the initial 2729 allocation. Thus, the fake requests from the attacker will be 2730 rejected. 2732 17.4. Other Considerations 2734 Any relay addresses learned through an Allocate request will not 2735 operate properly with IPSec Authentication Header (AH) [RFC4302] in 2736 transport or tunnel mode. However, tunnel-mode IPSec ESP [RFC4303] 2737 should still operate. 2739 18. IANA Considerations 2741 Since TURN is an extension to STUN [RFC5389], the methods, attributes 2742 and error codes defined in this specification are new methods, 2743 attributes, and error codes for STUN. This section requests IANA to 2744 add these new protocol elements to the IANA registry of STUN protocol 2745 elements. 2747 The codepoints for the new STUN methods defined in this specification 2748 are listed in Section 13. 2750 The codepoints for the new STUN attributes defined in this 2751 specification are listed in Section 14. 2753 The codepoints for the new STUN error codes defined in this 2754 specification are listed in Section 15. 2756 IANA is requested to allocate the SRV service name of "turn" for TURN 2757 over UDP or TCP, and the service name of "turns" for TURN over TLS. 2759 19. IAB Considerations 2761 The IAB has studied the problem of "Unilateral Self Address Fixing", 2762 which is the general process by which a client attempts to determine 2763 its address in another realm on the other side of a NAT through a 2764 collaborative protocol reflection mechanism [RFC3424]. The TURN 2765 extension is an example of a protocol that performs this type of 2766 function. The IAB has mandated that any protocols developed for this 2767 purpose document a specific set of considerations. These 2768 considerations and the responses for TURN are documented in this 2769 section. 2771 Consideration 1: Precise definition of a specific, limited-scope 2772 problem that is to be solved with the UNSAF proposal. A short term 2773 fix should not be generalized to solve other problems. Such 2774 generalizations lead to the prolonged dependence on and usage of the 2775 supposed short term fix -- meaning that it is no longer accurate to 2776 call it "short term". 2778 Response: TURN is a protocol for communication between a relay (= 2779 TURN server) and its client. The protocol allows a client that is 2780 behind a NAT to obtain and use a public IP address on the relay. As 2781 a convenience to the client, TURN also allows the client to determine 2782 its server-reflexive transport address. 2784 Consideration 2: Description of an exit strategy/transition plan. 2785 The better short term fixes are the ones that will naturally see less 2786 and less use as the appropriate technology is deployed. 2788 Response: TURN will no longer be needed once there are no longer any 2789 NATs. The need for TURN will also decrease as the number of NATs 2790 with the mapping property of Endpoint-Independent Mapping [RFC4787] 2791 increases. 2793 Consideration 3: Discussion of specific issues that may render 2794 systems more "brittle". For example, approaches that involve using 2795 data at multiple network layers create more dependencies, increase 2796 debugging challenges, and make it harder to transition. 2798 Response: TURN is "brittle" in that it requires the NAT bindings 2799 between the client and the server to be maintained unchanged for the 2800 lifetime of the allocation. This is typically done using keep- 2801 alives. If this is not done, then the client will lose its 2802 allocation and can no longer exchange data with its peers. 2804 Consideration 4: Identify requirements for longer term, sound 2805 technical solutions; contribute to the process of finding the right 2806 longer term solution. 2808 Response: The need for TURN will be reduced once NATs implement the 2809 recommendations for NAT UDP behavior documented in [RFC4787]. 2811 Applications are also strongly urged to use ICE [I-D.ietf-mmusic-ice] 2812 to communicate with peers; though ICE uses TURN, it does so only as a 2813 last resort, and uses it in a controlled manner. 2815 Consideration 5: Discussion of the impact of the noted practical 2816 issues with existing deployed NATs and experience reports. 2818 Response: Some NATs deployed today exhibit a mapping behavior other 2819 than Endpoint-Independent mapping. These NATs are difficult to work 2820 with, as they make it difficult or impossible for protocols like ICE 2821 to use server-reflexive transport addresses on those NATs. A client 2822 behind such a NAT is often forced to use a relay protocol like TURN 2823 because "UDP hole punching" techniques [RFC5128] do not work. 2825 20. Open Issues 2827 Note to RFC Editor: Please remove this section prior to publication 2828 of this document as an RFC. 2830 This section lists the known issues in this version of the 2831 specification. 2833 (No known issues at this time). 2835 21. Changes from Previous Versions 2837 Note to RFC Editor: Please remove this section prior to publication 2838 of this document as an RFC. 2840 This section lists the changes between the various versions of this 2841 specification. 2843 21.1. Changes from -11 to -12 2845 o Changed the port numbers used in the examples for the client, the 2846 peers, and the relayed-transport-address to put them in the 2847 Dynamic port range. They were previously in the Registered port 2848 range, which was arguably unrealistic. 2850 o Noted that the XOR-MAPPED-ADDRESS attribute is defined in RFC 2851 5389. 2853 o Used the codepoint names (Not-ECT, ECT(0), ECT(1), and CE) when 2854 talking about the ECN field. 2856 o Updated the Introduction to note that the client must not only 2857 communicate its relayed-transport-address to the peers, but also 2858 learn the peers' server-reflexive transport addresses. As a 2859 result, removed the suggestion that the client could use a webpage 2860 to communicate with its peers. 2862 21.2. Changes from -10 to -11 2864 o Clarified that, when the client is redirected to an alternate 2865 server, the client uses the same transport protocol to the 2866 alternate server as it did to the original server. 2868 o Clarified the information that the server needs to store to 2869 authenticate requests and to compute the message-integrity on 2870 responses. Noted that the server need not store the password 2871 explicitly, but can instead store the key value, which may be 2872 desirable for security reasons. 2874 o Clarified that TURN runs on the same ports as TURN by default, but 2875 noted that a server can use a different port because TURN has its 2876 own SRV service names. Strengthened the language for using the 2877 SRV procedures from "typically" to "SHOULD". Also added a 2878 sentence in the IANA considerations section requesting that IANA 2879 reserve the service names for TURN; previously they were described 2880 in the text but not mentioned in the IANA considerations section. 2882 o Added a detailed example, complete with attributes and their 2883 values, of the use of TURN. 2885 o Reduced the range of channel numbers. Channel numbers now range 2886 from 0x4000 through 0x7FFF. Values in the range 0x8000 through 2887 0xFFFF are now reserved. 2889 o Rewrote the IAB Considerations section to directly address the 2890 considerations listed in [RFC3424]. 2892 o Generalized the 508 error code so it can be used for any sort of 2893 capacity-related problem. This error code was previously allowed 2894 only in Allocate responses, but is now also allowed in 2895 CreatePermission and ChannelBind responses to indicate that the 2896 server is unable to carry out the request due to some capacity 2897 problem. 2899 o Changed the syntax of the CreatePermission request to allow 2900 multiple XOR-PEER-ADDRESS attributes to appear in the message, so 2901 that multiple permissions can be created or refreshed at the same 2902 time. 2904 o Added the restriction that the server must already have a 2905 permission installed for the IP address in the XOR-PEER-ADDRESS 2906 attribute of a Send indication, otherwise the Send indication is 2907 ignored by the server. 2909 o Put back the preferred behaviors into Section 12, reversing the 2910 change made in version -10. 2912 o Explicitly allow the server to restrict the range of IP addresses 2913 and ports it is willing to relay data too. 2915 21.3. Changes from -09 to -10 2917 o Changed the recommendation for using the SOFTWARE attribute. 2918 Previously its use was recommended in all requests and responses; 2919 now it is only recommended in Allocate and Refresh requests and 2920 responses, though it may appear elsewhere. Also, version -09 2921 incorrectly referred to this attribute as "SOFTWARE-TYPE". 2923 o Changed the name of the PEER-ADDRESS and RELAYED-ADDRESS 2924 attributes to XOR-PEER-ADDRESS and XOR-RELAYED-ADDRESS 2925 respectively for consistency with other specifications. 2927 o Removed the concept of a "preserving" allocation. All allocations 2928 are now non-preserving. This simplifies the base specification 2929 and allows it to advance more rapidly; see the discussion in the 2930 BEHAVE meeting of 29 July 2008. The concept of a preserving 2931 allocation will be advanced as an extension to TURN. As part of 2932 this change, the P bit in the REQUESTED-PROPS attribute, the ICMP 2933 attribute, and ICMP message relaying was removed. Further, in 2934 Section 12, the preferred behaviors were removed, leaving the 2935 alternate behaviors as the specified behaviors. 2937 o Replaced the REQUESTED-PROPS attribute with the EVEN-PORT 2938 attribute. The new attribute lacks the feature of the old 2939 attribute of being an alternate way to specify new allocation 2940 properties. As a consequence, the only way to specify a new 2941 allocation property is to define a new attribute. 2943 o Added text recommending that the client check that the IP address 2944 in XOR-PEER-ADDRESS attribute in a received Data indication is one 2945 with which the client believes there is an active permission. 2946 Similarly, it is recommended that the client check that a 2947 permission exist when receiving a ChannelData message. 2949 o Added text recommending that the client delete the allocation if 2950 it receives a ChannelBind failure response on an unbound channel. 2952 o Added the CreatePermission request/response transaction which adds 2953 or updates permissions, and removed the ability for Send 2954 indications and ChannelBind messages to install or update 2955 permissions. The net effect is that only authenticate-able 2956 messages (i.e., CreatePermission requests and ChannelBind 2957 requests) can install or refresh permissions; unauthenticate-able 2958 Send indications and ChannelData messages do not. 2960 o Removed all support for IPv6. All IPv6 support, including ways of 2961 relaying between IPv4 and IPv6, will now be covered in 2962 [I-D.ietf-behave-turn-ipv6]. 2964 o Reserved attribute code point 0x0021. This was previously used 2965 for the TIMER-VAL attribute, which was removed when the 2966 SetActiveDestination feature was removed. 2968 o Added the DONT-FRAGMENT attribute which allows the client to 2969 request that the server set the DF bit when sending the UDP 2970 datagram to the peer. This attribute may appear in both Allocate 2971 requests and Send indications. 2973 o Changed how the ALTERNATE-SERVER attribute is used. The attribute 2974 can no longer be used with any error code, but must be used with 2975 300 (Try Alternative). It can now appear in unauthenticated 2976 responses, however there are restrictions around how the 2977 subsequent Allocate request is authenticated. 2979 o Reworked the details of how idempotency of requests is handled, 2980 making it clear that the stack can either remember all 2981 transactions for 40 seconds, or can handle this using the so- 2982 called "stateless stack approach". Made some changes to the 2983 semantics of the Allocate, Refresh, and ChannelBind requests as a 2984 consequence. 2986 o Added the requirement that a client cannot re-use previously bound 2987 channel number or transport address until 5 minutes after the 2988 channel binding expires. This avoids various race conditions. 2990 o Removed the requirement that an allocation cannot be re-used 2991 within 2 minutes of having been deleted. This requirement was put 2992 in place to prevent mis-delivered packets but is no longer seen as 2993 having any real value. 2995 o Added a recommendation that the server impose quotas on both the 2996 number of allocations and the amount of bandwidth a given username 2997 can use at one time. These quotas help protect against denial-of- 2998 service attacks. 3000 o Completely rewrote the security considerations section. 3002 o Made quite a few changes to the descriptive text in both the 3003 Overview and the normative text to try to further clarify 3004 concepts. 3006 21.4. Changes from -08 to -09 3008 o Added text to properly define the ICMP attribute. This attribute 3009 was introduced in TURN-08, but not fully defined due to an 3010 oversight. Clarified that the attribute can appear in a Data 3011 indication, but not a Send indication. Added text to the section 3012 on receiving a Data indication that points out that this attribute 3013 may be present. 3015 o Changed the wording around the handling of the DSCP field to allow 3016 the server to set the DSCP to an arbitrary value if the next hop 3017 is a Diff-Serv classifier and marker. 3019 o When the server generates a 508 response due to an unsupported 3020 flag in the REQUESTED-PROPS attribute, the server now includes the 3021 REQUESTED-PROPS attribute in the response with all the flags it 3022 supports set to 1. This allows the client to see if the server 3023 does not understand one of its flags. Similarly, the client is 3024 now allowed to immediately retry the request if it modifies the 3025 included REQUESTED-PROPS attribute. 3027 o Clarified that the REQUESTED-PROPS attribute can be used in 3028 conjunction with the RESERVATION-TOKEN attribute as long as both 3029 the E and R bits are 0. The spec previously contradicted itself 3030 on this point. 3032 o Clarified that when the server receives a ChannelData message with 3033 a length field of 0, it sends a UDP Datagram to the peer that 3034 contains no application data. 3036 o Rewrote some text around relaying incoming UDP Datagrams to avoid 3037 duplication of text in the Data indication and Channel sections. 3039 o Added a note that points out that the on-going work on randomizing 3040 port allocations [I-D.ietf-tsvwg-port-randomization] may be 3041 applicable to TURN. 3043 o Clarified that the Allocate request containing a RESERVATION-TOKEN 3044 attribute can use any 5-tuple, and that 5-tuple need not have any 3045 specific relationship to the 5-tuple of the Allocate request that 3046 created the reservation. 3048 o Added a note that discusses retransmitted Allocate requests over 3049 UDP where the first request receives a failure response, but the 3050 second receives a success response. The server may elect to 3051 remember transmitted failure responses to avoid this situation. 3053 o Added text about the usage of the SOFTWARE-TYPE attribute 3054 (formerly known as the SERVER attribute) in TURN messages. 3056 o Rewrote the text in the Overview that motivates why TURN supports 3057 TCP and TLS between the client and the server. The previous text 3058 had been identified by various readers as inadequate and 3059 misleading. 3061 o Rewrote the section how a server handles a Refresh request to 3062 clarify processing in various error conditions. The new text 3063 makes it clear that it is OK to delete a non-existent allocation. 3064 It also clarifies how to handle retransmissions of Refresh 3065 requests over UDP. 3067 o Renamed the "RELAY-ADDRESS" attribute to "RELAYED-ADDRESS", since 3068 the text consistently uses the term "relayed transport address" 3069 for the concept and ICE uses the term "relayed candidate". 3071 o Changed the codepoint assigned to the error code "Wrong 3072 Credentials" from 438 to 441 to avoid a conflict with the "Stale 3073 Nonce" error code of STUN. 3075 o Changed the text to consistently use non-capitalized "request", 3076 "response" and "indication", except in headings, error code names, 3077 etc. 3079 o Added a note mentioning that TURN packets can be demuxed from 3080 other packets arriving on the same socket by looking at the 3081 5-tuple of the arriving packet. 3083 o Clarified that there are no required attributes is a ChannelBind 3084 success response. 3086 21.5. Changes from -07 to -08 3088 o Removed the BANDWIDTH attribute and all associated text (including 3089 error code 507 "Insufficient Bandwidth Capacity"), as the 3090 requirements for this feature were not clear and it was felt the 3091 feature could be easily added later. 3093 o Changed the format of the REQUESTED-PROPS attribute from a one- 3094 byte field to a set of bit flags. Changed the semantics of the 3095 unused portion of the value from RFFU to "MUST be 0" to give a 3096 more desirable behavior when new flags are defined. 3098 o Introduced the concept of Preserving vs. Non-Preserving 3099 allocations. As a result, completely revamped the rules for how 3100 to set the fields in the IP header, and added rules for relaying 3101 ICMP messages when the allocation is Preserving. 3103 21.6. Changes from -06 to -07 3105 o Rewrote the General Behavior section, making various changes in 3106 the process. 3108 o Changed the usage of authentication from MUST to SHOULD. 3110 o Changed the requirement that subsequent requests use the same 3111 username and password from MUST to SHOULD to allow for the 3112 possibility of changing the credentials using some unspecified 3113 mechanism. 3115 o Introduced a 438 (Wrong Credentials) error which is used when a 3116 non-Allocate request authenticates but does not use the same 3117 username and password as the Allocate request. Having a separate 3118 error code for this case avoids the client being confused over 3119 what the error actually is. 3121 o The server must now prevent the relayed transport address and the 3122 5-tuple from being reused in different allocations for 2 minutes 3123 after the allocation expires. 3125 o Changed the usage of FINGERPRINT from MUST NOT to MAY, to allow 3126 for the possible multiplexing of TURN with some other protocol. 3128 o Rewrote much of the section on Allocations, splitting it into 3129 three new sections (one on allocations in general, one on creating 3130 an allocation, and one on refreshing an allocation). 3132 o Replaced the mechanism for requesting relayed transport addresses 3133 with specific properties. The new mechanism is less powerful: a 3134 client can request an even port, or a pair of ports, but cannot 3135 request a single odd port or a specific port as was possible under 3136 the old mechanism. Nor can the client request a specific IP 3137 address. 3139 o Changed the rules for handling ALTERNATE-SERVER, removing the 3140 requirement that the referring server have "positive knowledge" 3141 about the state of the alternate server. The new rules instead 3142 rely on text in STUN to prevent referral loops. 3144 o Changed the rules for allocation lifetimes. Allocations lifetimes 3145 are now a minimum of 10 minutes; the client can ask for longer 3146 values, but requests for shorter values are ignored. The text now 3147 recommends that the client refresh an allocation one minute before 3148 it expires. 3150 o Put in temporary procedures for handling the BANDWIDTH attribute, 3151 modelled on the LIFETIME attribute. These procedures are mostly 3152 placeholders and likely to change in the next revision. 3154 o Added a detailed description of how a client reacts to the various 3155 errors it can receive in reply to an Allocate request. This 3156 replaces the various descriptions that were previously scattered 3157 throughout the document, which were inconsistent and sometimes 3158 contradictory. 3160 o Added a new section that gives the normative rules for 3161 permissions. 3163 o Changed the rules around permission lifetimes. The text used to 3164 recommend a value of one minute; it MUST now be 5 minutes. 3166 o Removed the errors "Channel Missing or Invalid", "Peer Address 3167 Missing or Invalid" and "Lifetime Malformed or Invalid" and used 3168 400 "Bad Request" instead. 3170 o Rewrote portions of the section on Send and Data indications and 3171 the section on Channels to try to make the client vs. server 3172 behavior clearer. 3174 o Channel bindings now expire after 10 minutes, and must be 3175 refreshed to keep them alive. 3177 o Binding a channel now installs or refreshes a permission for the 3178 IP address of corresponding peer. 3180 o Changed the wording describing the situation when the client sends 3181 a ChannelData message before receiving the ChannelBind success 3182 response. -06 said that client SHOULD NOT do this; -07 now says 3183 that a client MAY, but describes the consequences of doing it. 3185 o Added a section discussing the setting of fields in the IP header. 3187 o Replaced the REQUESTED-PORT-PROPS attribute with the REQUESTED- 3188 PROPS attribute that has a different format and semantics, but 3189 reuses the same code point. 3191 o Replaced the REQUESTED-IP attribute with the RESERVATION-TOKEN 3192 attribute, which has a different format and semantics, but reuses 3193 the same code point. 3195 o Removed error codes 443 and 444, and replaced them with 508 3196 (Insufficient Port Capacity). Also changed the error text for 3197 code 507 from "Insufficient Capacity" to "Insufficient Bandwidth 3198 Capacity". 3200 21.7. Changes from -05 to -06 3202 o Changed the mechanism for allocating channels to the one proposed 3203 by Eric Rescorla at the Dec 2007 IETF meeting. 3205 o Removed the framing mechanism (which was used to frame all 3206 messages) and replaced it with the ChannelData message. As part 3207 of this change, noted that the demux of ChannelData messages from 3208 TURN messages can be done using the first two bits of the message. 3210 o Rewrote the sections on transmitted and receiving data as a result 3211 of the above to changes, splitting it into a section on Send and 3212 Data indications and a separate section on channels. 3214 o Clarified the handling of Allocate request messages. In 3215 particular, subsequent Allocate request messages over UDP with the 3216 same transaction id are not an error but a retransmission. 3218 o Restricted the range of ports available for allocation to the 3219 Dynamic and/or Private Port range, and noted when ports outside 3220 this range can be used. 3222 o Changed the format of the REQUESTED-TRANSPORT attribute. The 3223 previous version used 00 for UDP and 01 for TCP; the new version 3224 uses protocol numbers from the IANA protocol number registry. The 3225 format of the attribute also changed. 3227 o Made a large number of changes to the non-normative portion of the 3228 document to reflect technical changes and improve the 3229 presentation. 3231 o Added the Issues section. 3233 21.8. Changes from -04 to -05 3235 o Removed the ability to allocate addresses for TCP relaying. This 3236 is now covered in a separate document. However, communication 3237 between the client and the server can still run over TCP or TLS/ 3238 TCP. This resulted in the removal of the Connect method and the 3239 TIMER-VAL and CONNECT-STAT attributes. 3241 o Added the concept of channels. All communication between the 3242 client and the server flows on a channel. Channels are numbered 3243 0..65535. Channel 0 is used for TURN messages, while the 3244 remaining channels are used for sending unencapsulated data to/ 3245 from a remote peer. This concept adds a new Channel Confirmation 3246 method and a new CHANNEL-NUMBER attribute. The new attribute is 3247 also used in the Send and Data methods. 3249 o The framing mechanism formally used just for stream-oriented 3250 transports is now also used for UDP, and the former Type and 3251 Reserved fields in the header have been replaced by a Channel 3252 Number field. The length field is zero when running over UDP. 3254 o TURN now runs on its own port, rather than using the STUN port. 3255 The use of channels requires this. 3257 o Removed the SetActiveDestination concept. This has been replaced 3258 by the concept of channels. 3260 o Changed the allocation refresh mechanism. The new mechanism uses 3261 a new Refresh method, rather than repeating the Allocation 3262 transaction. 3264 o Changed the syntax of SRV requests for secure transport. The new 3265 syntax is "_turns._tcp" rather than the old "_turn._tls". This 3266 change mirrors the corresponding change in STUN SRV syntax. 3268 o Renamed the old REMOTE-ADDRESS attribute to PEER-ADDRESS, and 3269 changed it to use the XOR-MAPPED-ADDRESS format. 3271 o Changed the RELAY-ADDRESS attribute to use the XOR-MAPPED-ADDRESS 3272 format (instead of the MAPPED-ADDRESS format)). 3274 o Renamed the 437 error code from "No Binding" to "Allocation 3275 Mismatch". 3277 o Added a discussion of what happens if a client's public binding on 3278 its outermost NAT changes. 3280 o The document now consistently uses the term "peer" as the name of 3281 a remote endpoint with which the client wishes to communicate. 3283 o Rewrote much of the document to describe the new concepts. At the 3284 same time, tried to make the presentation clearer and less 3285 repetitive. 3287 22. Acknowledgements 3289 The authors would like to thank the various participants in the 3290 BEHAVE working group for their many comments on this draft. Marc 3291 Petit-Huguenin, Remi Denis-Courmont, Jason Fischl, Derek MacDonald, 3292 Scott Godin, Cullen Jennings, Lars Eggert, Magnus Westerlund, Benny 3293 Prijono, and Eric Rescorla have been particularly helpful, with Eric 3294 also suggesting the channel allocation mechanism, and Cullen 3295 suggesting the REQUESTED-PORT-PROPS mechanism. Christian Huitema was 3296 an early contributor to this document and was a co-author on the 3297 first few drafts. Finally, the authors would like to thank Dan Wing 3298 for both his contributions to the text and his huge help in 3299 restarting progress on this draft after work had stalled. 3301 23. References 3303 23.1. Normative References 3305 [RFC5389] Rosenberg, J., Mahy, R., Matthews, P., and D. Wing, 3306 "Session Traversal Utilities for NAT (STUN)", RFC 5389, 3307 October 2008. 3309 [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate 3310 Requirement Levels", BCP 14, RFC 2119, March 1997. 3312 [RFC2474] Nichols, K., Blake, S., Baker, F., and D. Black, 3313 "Definition of the Differentiated Services Field (DS 3314 Field) in the IPv4 and IPv6 Headers", RFC 2474, 3315 December 1998. 3317 [RFC3168] Ramakrishnan, K., Floyd, S., and D. Black, "The Addition 3318 of Explicit Congestion Notification (ECN) to IP", 3319 RFC 3168, September 2001. 3321 [RFC1122] Braden, R., "Requirements for Internet Hosts - 3322 Communication Layers", STD 3, RFC 1122, October 1989. 3324 23.2. Informative References 3326 [RFC1918] Rekhter, Y., Moskowitz, R., Karrenberg, D., Groot, G., and 3327 E. Lear, "Address Allocation for Private Internets", 3328 BCP 5, RFC 1918, February 1996. 3330 [RFC3424] Daigle, L. and IAB, "IAB Considerations for UNilateral 3331 Self-Address Fixing (UNSAF) Across Network Address 3332 Translation", RFC 3424, November 2002. 3334 [RFC4787] Audet, F. and C. Jennings, "Network Address Translation 3335 (NAT) Behavioral Requirements for Unicast UDP", BCP 127, 3336 RFC 4787, January 2007. 3338 [I-D.ietf-mmusic-ice] 3339 Rosenberg, J., "Interactive Connectivity Establishment 3340 (ICE): A Protocol for Network Address Translator (NAT) 3341 Traversal for Offer/Answer Protocols", 3342 draft-ietf-mmusic-ice-19 (work in progress), October 2007. 3344 [I-D.ietf-behave-turn-tcp] 3345 Rosenberg, J. and R. Mahy, "Traversal Using Relays around 3346 NAT (TURN) Extensions for TCP Allocations", 3347 draft-ietf-behave-turn-tcp-01 (work in progress), 3348 November 2008. 3350 [I-D.ietf-behave-turn-ipv6] 3351 Camarillo, G. and O. Novo, "Traversal Using Relays around 3352 NAT (TURN) Extension for IPv4/IPv6 Transition", 3353 draft-ietf-behave-turn-ipv6-05 (work in progress), 3354 October 2008. 3356 [I-D.ietf-tsvwg-port-randomization] 3357 Larsen, M. and F. Gont, "Port Randomization", 3358 draft-ietf-tsvwg-port-randomization-02 (work in progress), 3359 August 2008. 3361 [RFC5128] Srisuresh, P., Ford, B., and D. Kegel, "State of Peer-to- 3362 Peer (P2P) Communication across Network Address 3363 Translators (NATs)", RFC 5128, March 2008. 3365 [RFC1928] Leech, M., Ganis, M., Lee, Y., Kuris, R., Koblas, D., and 3366 L. Jones, "SOCKS Protocol Version 5", RFC 1928, 3367 March 1996. 3369 [RFC3550] Schulzrinne, H., Casner, S., Frederick, R., and V. 3370 Jacobson, "RTP: A Transport Protocol for Real-Time 3371 Applications", STD 64, RFC 3550, July 2003. 3373 [RFC3711] Baugher, M., McGrew, D., Naslund, M., Carrara, E., and K. 3374 Norrman, "The Secure Real-time Transport Protocol (SRTP)", 3375 RFC 3711, March 2004. 3377 [RFC4302] Kent, S., "IP Authentication Header", RFC 4302, 3378 December 2005. 3380 [RFC4303] Kent, S., "IP Encapsulating Security Payload (ESP)", 3381 RFC 4303, December 2005. 3383 [RFC4821] Mathis, M. and J. Heffner, "Packetization Layer Path MTU 3384 Discovery", RFC 4821, March 2007. 3386 [RFC3261] Rosenberg, J., Schulzrinne, H., Camarillo, G., Johnston, 3387 A., Peterson, J., Sparks, R., Handley, M., and E. 3388 Schooler, "SIP: Session Initiation Protocol", RFC 3261, 3389 June 2002. 3391 [I-D.rosenberg-mmusic-ice-nonsip] 3392 Rosenberg, J., "Guidelines for Usage of Interactive 3393 Connectivity Establishment (ICE) by non Session 3394 Initiation Protocol (SIP) Protocols", 3395 draft-rosenberg-mmusic-ice-nonsip-01 (work in progress), 3396 July 2008. 3398 [Port-Numbers] 3399 "IANA Port Numbers Registry", 3400 . 3402 [Protocol-Numbers] 3403 "IANA Protocol Numbers Registry", 2005, 3404 . 3406 Authors' Addresses 3408 Jonathan Rosenberg 3409 Cisco Systems, Inc. 3410 Edison, NJ 3411 USA 3413 Email: jdrosen@cisco.com 3414 URI: http://www.jdrosen.net 3416 Rohan Mahy 3417 (Unaffiliated) 3419 Email: rohan@ekabal.com 3420 Philip Matthews 3421 Alcatel-Lucent 3422 600 March Road 3423 Ottawa, Ontario 3424 Canada 3426 Phone: 3427 Fax: 3428 Email: philip_matthews@magma.ca 3429 URI: 3431 Full Copyright Statement 3433 Copyright (C) The IETF Trust (2008). 3435 This document is subject to the rights, licenses and restrictions 3436 contained in BCP 78, and except as set forth therein, the authors 3437 retain all their rights. 3439 This document and the information contained herein are provided on an 3440 "AS IS" basis and THE CONTRIBUTOR, THE ORGANIZATION HE/SHE REPRESENTS 3441 OR IS SPONSORED BY (IF ANY), THE INTERNET SOCIETY, THE IETF TRUST AND 3442 THE INTERNET ENGINEERING TASK FORCE DISCLAIM ALL WARRANTIES, EXPRESS 3443 OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTY THAT THE USE OF 3444 THE INFORMATION HEREIN WILL NOT INFRINGE ANY RIGHTS OR ANY IMPLIED 3445 WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. 3447 Intellectual Property 3449 The IETF takes no position regarding the validity or scope of any 3450 Intellectual Property Rights or other rights that might be claimed to 3451 pertain to the implementation or use of the technology described in 3452 this document or the extent to which any license under such rights 3453 might or might not be available; nor does it represent that it has 3454 made any independent effort to identify any such rights. Information 3455 on the procedures with respect to rights in RFC documents can be 3456 found in BCP 78 and BCP 79. 3458 Copies of IPR disclosures made to the IETF Secretariat and any 3459 assurances of licenses to be made available, or the result of an 3460 attempt made to obtain a general license or permission for the use of 3461 such proprietary rights by implementers or users of this 3462 specification can be obtained from the IETF on-line IPR repository at 3463 http://www.ietf.org/ipr. 3465 The IETF invites any interested party to bring to its attention any 3466 copyrights, patents or patent applications, or other proprietary 3467 rights that may cover technology that may be required to implement 3468 this standard. Please address the information to the IETF at 3469 ietf-ipr@ietf.org.