idnits 2.17.00 (12 Aug 2021) /tmp/idnits41138/draft-ietf-ipsecme-tcp-encaps-02.txt: Checking boilerplate required by RFC 5378 and the IETF Trust (see https://trustee.ietf.org/license-info): ---------------------------------------------------------------------------- No issues found here. Checking nits according to https://www.ietf.org/id-info/1id-guidelines.txt: ---------------------------------------------------------------------------- No issues found here. Checking nits according to https://www.ietf.org/id-info/checklist : ---------------------------------------------------------------------------- No issues found here. Miscellaneous warnings: ---------------------------------------------------------------------------- == The copyright year in the IETF Trust and authors Copyright Line does not match the current year -- The document date (August 17, 2016) is 2103 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: 'Section 12' is mentioned on line 128, but not defined == Missing Reference: 'Appendix A' is mentioned on line 286, but not defined == Missing Reference: 'Section 4' is mentioned on line 849, but not defined == Missing Reference: 'Figure 2' is mentioned on line 435, but not defined == Missing Reference: 'ChangeCipherSpec' is mentioned on line 815, but not defined == Missing Reference: 'CERTREQ' is mentioned on line 667, but not defined == Missing Reference: 'CERT' is mentioned on line 671, but not defined == Missing Reference: 'CP' is mentioned on line 709, but not defined -- Obsolete informational reference (is this intentional?): RFC 5246 (Obsoleted by RFC 8446) Summary: 0 errors (**), 0 flaws (~~), 9 warnings (==), 2 comments (--). Run idnits with the --verbose option for more detailed information about the items above. -------------------------------------------------------------------------------- 2 Network T. Pauly 3 Internet-Draft Apple Inc. 4 Intended status: Standards Track S. Touati 5 Expires: February 18, 2017 Ericsson 6 R. Mantha 7 Cisco Systems 8 August 17, 2016 10 TCP Encapsulation of IKE and IPsec Packets 11 draft-ietf-ipsecme-tcp-encaps-02 13 Abstract 15 This document describes a method to transport IKE and IPsec packets 16 over a TCP connection for traversing network middleboxes that may 17 block IKE negotiation over UDP. This method, referred to as TCP 18 encapsulation, involves sending both IKE packets for tunnel 19 establishment as well as tunneled packets using ESP over a TCP 20 connection. This method is intended to be used as a fallback option 21 when IKE cannot be negotiated over UDP. 23 Status of This Memo 25 This Internet-Draft is submitted in full conformance with the 26 provisions of BCP 78 and BCP 79. 28 Internet-Drafts are working documents of the Internet Engineering 29 Task Force (IETF). Note that other groups may also distribute 30 working documents as Internet-Drafts. The list of current Internet- 31 Drafts is at http://datatracker.ietf.org/drafts/current/. 33 Internet-Drafts are draft documents valid for a maximum of six months 34 and may be updated, replaced, or obsoleted by other documents at any 35 time. It is inappropriate to use Internet-Drafts as reference 36 material or to cite them other than as "work in progress." 38 This Internet-Draft will expire on February 18, 2017. 40 Copyright Notice 42 Copyright (c) 2016 IETF Trust and the persons identified as the 43 document authors. All rights reserved. 45 This document is subject to BCP 78 and the IETF Trust's Legal 46 Provisions Relating to IETF Documents 47 (http://trustee.ietf.org/license-info) in effect on the date of 48 publication of this document. Please review these documents 49 carefully, as they describe your rights and restrictions with respect 50 to this document. Code Components extracted from this document must 51 include Simplified BSD License text as described in Section 4.e of 52 the Trust Legal Provisions and are provided without warranty as 53 described in the Simplified BSD License. 55 Table of Contents 57 1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . 2 58 1.1. Prior Work and Motivation . . . . . . . . . . . . . . . . 3 59 1.2. Requirements Language . . . . . . . . . . . . . . . . . . 4 60 2. Configuration . . . . . . . . . . . . . . . . . . . . . . . . 4 61 3. TCP-Encapsulated Header Formats . . . . . . . . . . . . . . . 5 62 3.1. TCP-Encapsulated IKE Header Format . . . . . . . . . . . 5 63 3.2. TCP-Encapsulated ESP Header Format . . . . . . . . . . . 6 64 4. TCP-Encapsulated Stream Prefix . . . . . . . . . . . . . . . 6 65 5. Applicability . . . . . . . . . . . . . . . . . . . . . . . . 7 66 6. Connection Establishment and Teardown . . . . . . . . . . . . 7 67 7. Interaction with NAT Detection Payloads . . . . . . . . . . . 8 68 8. Using MOBIKE with TCP encapsulation . . . . . . . . . . . . . 9 69 9. Using IKE Message Fragmentation with TCP encapsulation . . . 9 70 10. Considerations for Keep-alives and DPD . . . . . . . . . . . 9 71 11. Middlebox Considerations . . . . . . . . . . . . . . . . . . 10 72 12. Performance Considerations . . . . . . . . . . . . . . . . . 10 73 12.1. TCP-in-TCP . . . . . . . . . . . . . . . . . . . . . . . 10 74 12.2. Added Reliability for Unreliable Protocols . . . . . . . 11 75 12.3. Quality of Service Markings . . . . . . . . . . . . . . 11 76 12.4. Maximum Segment Size . . . . . . . . . . . . . . . . . . 11 77 13. Security Considerations . . . . . . . . . . . . . . . . . . . 11 78 14. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 11 79 15. Acknowledgments . . . . . . . . . . . . . . . . . . . . . . . 12 80 16. References . . . . . . . . . . . . . . . . . . . . . . . . . 12 81 16.1. Normative References . . . . . . . . . . . . . . . . . . 12 82 16.2. Informative References . . . . . . . . . . . . . . . . . 12 83 Appendix A. Using TCP encapsulation with TLS . . . . . . . . . . 13 84 Appendix B. Example exchanges of TCP Encapsulation with TLS . . 14 85 B.1. Establishing an IKE session . . . . . . . . . . . . . . . 14 86 B.2. Deleting an IKE session . . . . . . . . . . . . . . . . . 16 87 B.3. Re-establishing an IKE session . . . . . . . . . . . . . 17 88 B.4. Using MOBIKE between UDP and TCP Encapsulation . . . . . 18 89 Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . 19 91 1. Introduction 93 IKEv2 [RFC7296] is a protocol for establishing IPsec tunnels, using 94 IKE messages over UDP for control traffic, and using Encapsulating 95 Security Payload (ESP) messages for tunneled data traffic. Many 96 network middleboxes that filter traffic on public hotspots block all 97 UDP traffic, including IKE and IPsec, but allow TCP connections 98 through since they appear to be web traffic. Devices on these 99 networks that need to use IPsec (to access private enterprise 100 networks, to route voice-over-IP calls to carrier networks, or 101 because of security policies) are unable to establish IPsec tunnels. 102 This document defines a method for encapsulating both the IKE control 103 messages as well as the IPsec data messages within a TCP connection. 105 Using TCP as a transport for IPsec packets adds a third option to the 106 list of traditional IPsec transports: 108 1. Direct. Currently, IKE negotiations begin over UDP port 500. 109 If no NAT is detected between the initiator and the receiver, 110 then subsequent IKE packets are sent over UDP port 500 and 111 IPsec data packets are sent using ESP [RFC4303]. 113 2. UDP Encapsulation [RFC3948]. If a NAT is detected between the 114 initiator and the receiver, then subsequent IKE packets are 115 sent over UDP port 4500 with four bytes of zero at the start of 116 the UDP payload and ESP packets are sent out over UDP port 117 4500. Some peers default to using UDP encapsulation even when 118 no NAT are detected on the path as some middleboxes do not 119 support IP protocols other than TCP and UDP. 121 3. TCP Encapsulation. If both of the other two methods are not 122 available or appropriate, both IKE negotiation packets as well 123 as ESP packets can be sent over a single TCP connection to the 124 peer. 126 Direct use of ESP or UDP Encapsulation should be preferred by IKE 127 implementations due to performance concerns when using TCP 128 Encapsulation [Section 12]. Most implementations should use TCP 129 Encapsulation only on networks where negotiation over UDP has been 130 attempted without receiving responses from the peer, or if a network 131 is known to not support UDP. 133 1.1. Prior Work and Motivation 135 Encapsulating IKE connections within TCP streams is a common approach 136 to solve the problem of UDP packets being blocked by network 137 middleboxes. The goal of this document is to promote 138 interoperability by providing a standard method of framing IKE and 139 ESP message within streams, and to provide guidelines for how to 140 configure and use TCP encapsulation. 142 Some previous alternatives include: 144 Cellular Network Access Interworking Wireless LAN (IWLAN) uses IKEv2 145 to create secure connections to cellular carrier networks for 146 making voice calls and accessing other network services over 147 Wi-Fi networks. 3GPP has recommended that IKEv2 and ESP packets 148 be sent within a TLS connection to be able to establish 149 connections on restrictive networks. 151 ISAKMP over TCP Various non-standard extensions to ISAKMP have been 152 deployed that send IPsec traffic over TCP or TCP-like packets. 154 SSL VPNs Many proprietary VPN solutions use a combination of TLS and 155 IPsec in order to provide reliability. 157 IKEv2 over TCP IKEv2 over TCP as described in 158 [I-D.nir-ipsecme-ike-tcp] is used to avoid UDP fragmentation. 160 The goal of this specification is to provide a standardized method 161 for using TCP streams to transport IPsec that is compatible with the 162 current IKE standard, and avoids the overhead of other alternatives 163 that always rely on TCP or TLS. 165 1.2. Requirements Language 167 The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", 168 "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this 169 document are to be interpreted as described in RFC 2119 [RFC2119]. 171 2. Configuration 173 One of the main reasons to use TCP encapsulation is that UDP traffic 174 may be entirely blocked on a network. Because of this, support for 175 TCP encapsulation is not specifically negotiated in the IKE exchange. 176 Instead, support for TCP encapsulation must be pre-configured on both 177 the initiator and the responder. 179 The configuration defined on each peer should include the following 180 parameters: 182 o One or more TCP ports on which the responder will listen for 183 incoming connections. Note that the initiator may initiate TCP 184 connections to the responder from any local port. The ports on 185 which the responder listens will likey be based on the ports 186 commonly allowed on restricted networks. 188 o Optionally, an extra framing protocol to use on top of TCP to 189 further encapsulate the stream of IKE and IPsec packets. See 190 Appendix A for a detailed discussion. 192 This document leaves the selection of TCP ports up to 193 implementations. It is suggested to use TCP port 4500, which is 194 allocated for IPsec NAT Traversal. 196 Since TCP encapsulation of IKE and IPsec packets adds overhead and 197 has potential performance trade-offs compared to direct or UDP- 198 encapsulated tunnels (as described in Performance Considerations, 199 Section 12), implementations SHOULD prefer ESP direct or UDP 200 encapsulated tunnels over TCP encapsulated tunnels when possible. 202 3. TCP-Encapsulated Header Formats 204 Like UDP encapsulation, TCP encapsulation uses the first four bytes 205 of a message to differentiate IKE and ESP messages. TCP 206 encapsulation also adds a length field to define the boundaries of 207 messages within a stream. The message length is sent in a 16-bit 208 field that precedes every message. If the first 32-bits of the 209 message are zeros (a Non-ESP Marker), then the contents comprise an 210 IKE message. Otherwise, the contents comprise an ESP message. 211 Authentication Header (AH) messages are not supported for TCP 212 encapsulation. 214 Although a TCP stream may be able to send very long messages, 215 implementations SHOULD limit message lengths to typical UDP datagram 216 ESP payload lengths. The maximum message length is used as the 217 effective MTU for connections that are being encrypted using ESP, so 218 the maximum message length will influence characteristics of inner 219 connections, such as the TCP Maximum Segment Size (MSS). 221 3.1. TCP-Encapsulated IKE Header Format 223 1 2 3 224 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 225 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 226 | Length | 227 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 228 | Non-ESP Marker | 229 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 230 | | 231 ~ IKE header [RFC7296] ~ 232 | | 233 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 235 Figure 1 237 The IKE header is preceded by a 16-bit length field in network byte 238 order that specifies the length of the IKE message (including the 239 Non-ESP marker) within the TCP stream. As with IKE over UDP port 240 4500, a zeroed 32-bit Non-ESP Marker is inserted before the start of 241 the IKE header in order to differentiate the traffic from ESP traffic 242 between the same addresses and ports. 244 o Length (2 octets, unsigned integer) - Length of the IKE packet 245 including the Length Field and Non-ESP Marker. 247 3.2. TCP-Encapsulated ESP Header Format 249 1 2 3 250 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 251 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 252 | Length | 253 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 254 | | 255 ~ ESP header [RFC4303] ~ 256 | | 257 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 259 Figure 2 261 The ESP header is preceded by a 16-bit length field in network byte 262 order that specifies the length of the ESP packet within the TCP 263 stream. 265 The SPI field in the ESP header MUST NOT be a zero value. 267 o Length (2 octets, unsigned integer) - Length of the ESP packet 268 including the Length Field. 270 4. TCP-Encapsulated Stream Prefix 272 Each stream of bytes used for IKE and IPsec encapsulation MUST begin 273 with a fixed sequence of six bytes as a magic value, containing the 274 characters "IKETCP" as ASCII values. This allows peers to 275 differentiate this protocol from other protocols that may be run over 276 the same TCP port. Since TCP encapsulated IPsec is not assigned to a 277 specific port, responders may be able to receive multiple protocols 278 on the same port. The bytes of the stream prefix do not overlap with 279 the valid start of any other known stream protocol. This value is 280 only sent once, by the Initiator only, at the beginning of any stream 281 of IKE and ESP messages. 283 If other framing protocols are used within TCP to further encapsulate 284 or encrypt the stream of IKE and ESP messages, the Stream Prefix must 285 be at the start of the Initiator's IKE and ESP message stream within 286 the added protocol layer [Appendix A]. Although some framing 287 protocols do support negotiating inner protocols, the stream prefix 288 should always be used in order for implementations to be as generic 289 as possible and not rely on other framing protocols on top of TCP. 291 0 1 2 3 4 5 292 +------+------+------+------+------+------+ 293 | 0x49 | 0x4b | 0x45 | 0x54 | 0x43 | 0x50 | 294 +------+------+------+------+------+------+ 296 Figure 3 298 5. Applicability 300 TCP encapsulation is applicable only when it has been configured to 301 be used with specific IKE peers. If a responder is configured to use 302 TCP encapsulation, it MUST listen on the configured port(s) in case 303 any peers will initiate new IKE sessions. Initiators MAY use TCP 304 encapsulation for any IKE session to a peer that is configured to 305 support TCP encapsulation, although it is recommended that initiators 306 should only use TCP encapsulation when traffic over UDP is blocked. 308 Since the support of TCP encapsulation is a configured property, not 309 a negotiated one, it is recommended that if there are multiple IKE 310 endpoints representing a single peer (such as multiple machines with 311 different IP addresses when connecting by Fully-Qualified Domain 312 Name, or endpoints used with IKE redirection), all of the endpoints 313 equally support TCP encapsulation. 315 If TCP encapsulation is being used for a specific IKE SA, all 316 messages for that IKE SA and its Child SAs MUST be sent over a TCP 317 connection until the SA is deleted or MOBIKE is used to change the SA 318 endpoints and/or encapsulation protocol. See Section 8 for more 319 details on using MOBIKE to transition between encapsulation modes. 321 6. Connection Establishment and Teardown 323 When the IKE initiator uses TCP encapsulation for its negotiation, it 324 will initiate a TCP connection to the responder using the configured 325 TCP port. The first bytes sent on the stream MUST be the stream 326 prefix value [Section 4]. After this prefix, encapsulated IKE 327 messages will negotiate the IKE SA and initial Child SA [RFC7296]. 328 After this point, both encapsulated IKE Figure 1 and ESP Figure 2 329 messages will be sent over the TCP connection. 331 In order to close an IKE session, either the initiator or responder 332 SHOULD gracefully tear down IKE SAs with DELETE payloads. Once all 333 SAs have been deleted, the initiator of the original connection MUST 334 close the TCP connection. 336 An unexpected FIN or a RST on the TCP connection may indicate either 337 a loss of connectivity, an attack, or some other error. If a DELETE 338 payload has not been sent, both sides SHOULD maintain the state for 339 their SAs for the standard lifetime or time-out period. The original 340 initiator (that is, the endpoint that initiated the TCP connection 341 and sent the first IKE_SA_INIT message) is responsible for re- 342 establishing the TCP connection if it is torn down for any unexpected 343 reason. Since new TCP connections may use different ports due to NAT 344 mappings or local port allocations changing, the responder MUST allow 345 packets for existing SAs to be received from new source ports. 347 A peer MUST discard a partially received message due to a broken 348 connection. 350 The streams of data sent over any TCP connection used for this 351 protocol MUST begin with the stream prefix value followed by a 352 complete message, which is either an encapsulated IKE or ESP message. 353 If the connection is being used to resume a previous IKE session, the 354 responder can recognize the session using either the IKE SPI from an 355 encapsulated IKE message or the ESP SPI from an encapsulated ESP 356 message. If the session had been fully established previously, it is 357 suggested that the initiator send an UPDATE_SA_ADDRESSES message if 358 MOBIKE is supported, or an INFORMATIONAL message (a keepalive) 359 otherwise. If either initiator or responder receives a stream that 360 cannot be parsed correctly, it MUST close the TCP connection. 362 Multiple TCP connections between the initiator and the responder are 363 allowed, but their use must take into account the initiator 364 capabilities and the deployment model such as to connect to multiple 365 gateways handling different ESP SAs when deployed in a high 366 availability model. It is also possible to negotiate multiple IKE 367 SAs over the same TCP connection. 369 The processing of the TCP packets is the same whether its within a 370 single or multiple TCP connections. 372 7. Interaction with NAT Detection Payloads 374 When negotiating over UDP port 500, IKE_SA_INIT packets include 375 NAT_DETECTION_SOURCE_IP and NAT_DETECTION_DESTINATION_IP payloads to 376 determine if UDP encapsulation of IPsec packets should be used. 377 These payloads contain SHA-1 digests of the SPIs, IP addresses, and 378 ports. IKE_SA_INIT packets sent on a TCP connection SHOULD include 379 these payloads, and SHOULD use the applicable TCP ports when creating 380 and checking the SHA-1 digests. 382 If a NAT is detected due to the SHA-1 digests not matching the 383 expected values, no change should be made for encapsulation of 384 subsequent IKE or ESP packets, since TCP encapsulation inherently 385 supports NAT traversal. Implementations MAY use the information that 386 a NAT is present to influence keep-alive timer values. 388 8. Using MOBIKE with TCP encapsulation 390 When an IKE session is transitioned between networks using MOBIKE 391 [RFC4555], the initiator of the transition may switch between using 392 TCP encapsulation, UDP encapsulation, or no encapsulation. 393 Implementations that implement both MOBIKE and TCP encapsulation MUST 394 support dynamically enabling and disabling TCP encapsulation as 395 interfaces change. 397 When a MOBIKE-enabled initiator changes networks, the 398 UPDATE_SA_ADDRESSES notification SHOULD be sent out first over UDP 399 before attempting over TCP. If there is a response to the 400 UPDATE_SA_ADDRESSES notification sent over UDP, then the ESP packets 401 should be sent directly over IP or over UDP port 4500 (depending on 402 if a NAT was detected), regardless of if a connection on a previous 403 network was using TCP encapsulation. Similarly, if the responder 404 only responds to the UPDATE_SA_ADDRESSES notification over TCP, then 405 the ESP packets should be sent over the TCP connection, regardless of 406 if a connection on a previous network did not use TCP encapsulation. 408 9. Using IKE Message Fragmentation with TCP encapsulation 410 IKE Message Fragmentation [RFC7383] is not required when using TCP 411 encapsulation, since a TCP stream already handles the fragmentation 412 of its contents across packets. Since fragmentation is redundant in 413 this case, implementations might choose to not negotiate IKE 414 fragmentation. Even if fragmentation is negotiated, an 415 implementation MAY choose to not fragment when going over a TCP 416 connection. 418 If an implementation supports both MOBIKE and IKE fragmentation, it 419 SHOULD negotiate IKE fragmentation over a TCP encapsulated session in 420 case the session switches to UDP encapsulation on another network. 422 10. Considerations for Keep-alives and DPD 424 Encapsulating IKE and IPsec inside of a TCP connection can impact the 425 strategy that implementations use to detect peer liveness and to 426 maintain middlebox port mappings. Peer liveness should be checked 427 using IKE Informational packets [RFC7296]. 429 In general, TCP port mappings are maintained by NATs longers than UDP 430 port mappings, so IPsec ESP NAT keep-alives [RFC3948] SHOULD NOT be 431 sent when using TCP encapsulation. Any implementation using TCP 432 encapsulation MUST silently drop incoming NAT keep-alive packets, and 433 not treat them as errors. NAT keep-alive packets over a TCP 434 encapsulated IPsec connection will be sent with a length value of 1 435 byte, whose value is 0xFF [Figure 2]. 437 Note that depending on the configuration of TCP and TLS on the 438 connection, TCP keep-alives [RFC1122] and TLS keep-alives [RFC6520] 439 may be used. These MUST NOT be used as indications of IKE peer 440 liveness. 442 11. Middlebox Considerations 444 Many security networking devices such as Firewalls or Intrusion 445 Prevention Systems, network optimization/acceleration devices and 446 Network Address Translation (NAT) devices keep the state of sessions 447 that traverse through them. 449 These devices commonly track the transport layer and/or the 450 application layer data to drop traffic that is anomalous or malicious 451 in nature. 453 A network device that monitors up to the application layer will 454 commonly expect to see HTTP traffic within a TCP socket running over 455 port 80, if non-HTTP traffic is seen (such as TCP encapsulated IKE), 456 this could be dropped by the security device. 458 A network device that monitors the transport layer will track the 459 state of TCP sessions, such as TCP sequence numbers. TCP 460 encapsulation of IKE should therefore use standard TCP behaviors to 461 avoid being dropped by middleboxes. 463 12. Performance Considerations 465 Several aspects of TCP encapsulation for IKE and IPsec packets may 466 negatively impact the performance of connections within the tunnel. 467 Implementations should be aware of these and take these into 468 consideration when determining when to use TCP encapsulation. 470 12.1. TCP-in-TCP 472 If the outer connection between IKE peers is over TCP, inner TCP 473 connections may suffer effects from using TCP within TCP. In 474 particular, the inner TCP's round-trip-time estimation will be 475 affected by the burstiness of the outer TCP. This will make loss- 476 recovery of the inner TCP traffic less reactive and more prone to 477 spurious retransmission timeouts. 479 12.2. Added Reliability for Unreliable Protocols 481 Since ESP is an unreliable protocol, transmitting ESP packets over a 482 TCP connection will change the fundamental behavior of the packets. 483 Some application-level protocols that prefer packet loss to delay 484 (such as Voice over IP or other real-time protocols) may be 485 negatively impacted if their packets are retransmitted by the TCP 486 connection due to packet loss. 488 12.3. Quality of Service Markings 490 Quality of Service (QoS) markings, such as DSCP and Traffic Class, 491 should be used with care on TCP connections used for encapsulation. 492 Individual packets SHOULD NOT use different markings than the rest of 493 the connection, since packets with different priorities may be routed 494 differently and cause unnecessary delays in the connection. 496 12.4. Maximum Segment Size 498 A TCP connection used for IKE encapsulation SHOULD negotiate its 499 maximum segment size (MSS) in order to avoid unnecessary 500 fragmentation of packets. 502 13. Security Considerations 504 IKE responders that support TCP encapsulation may become vulnerable 505 to new Denial-of-Service (DoS) attacks that are specific to TCP, such 506 as SYN-flooding attacks. Responders should be aware of this 507 additional attack-surface. 509 Responders should be careful to ensure that the stream prefix 510 "IKETCP" uniquely identifies streams using the TCP encapsulation 511 protocol. The prefix was chosen to not overlap with the start of any 512 known valid protocol over TCP, but implementations should make sure 513 to validate this assumption in order to avoid unexpected processing 514 of TCP connections. 516 Attackers may be able to disrupt the TCP connection by sending 517 spurious RST packets. Due to this, implementations SHOULD make sure 518 that IKE session state persists even if the underlying TCP connection 519 is torn down. 521 14. IANA Considerations 523 This memo includes no request to IANA. 525 TCP port 4500 is already allocated to IPsec. This port MAY be used 526 for the protocol described in this document, but implementations MAY 527 prefer to use other ports based on local policy. 529 15. Acknowledgments 531 The authors would like to acknowledge the input and advice of Stuart 532 Cheshire, Delziel Fernandes, Yoav Nir, Christoph Paasch, Yaron 533 Sheffer, David Schinazi, Graham Bartlett, Byju Pularikkal, March Wu 534 and Kingwel Xie. Special thanks to Eric Kinnear for his 535 implementation work. 537 16. References 539 16.1. Normative References 541 [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate 542 Requirement Levels", BCP 14, RFC 2119, 543 DOI 10.17487/RFC2119, March 1997, 544 . 546 [RFC7296] Kaufman, C., Hoffman, P., Nir, Y., Eronen, P., and T. 547 Kivinen, "Internet Key Exchange Protocol Version 2 548 (IKEv2)", STD 79, RFC 7296, DOI 10.17487/RFC7296, October 549 2014, . 551 16.2. Informative References 553 [I-D.nir-ipsecme-ike-tcp] 554 Nir, Y., "A TCP transport for the Internet Key Exchange", 555 draft-nir-ipsecme-ike-tcp-01 (work in progress), July 556 2012. 558 [RFC1122] Braden, R., Ed., "Requirements for Internet Hosts - 559 Communication Layers", STD 3, RFC 1122, 560 DOI 10.17487/RFC1122, October 1989, 561 . 563 [RFC2817] Khare, R. and S. Lawrence, "Upgrading to TLS Within 564 HTTP/1.1", RFC 2817, DOI 10.17487/RFC2817, May 2000, 565 . 567 [RFC3948] Huttunen, A., Swander, B., Volpe, V., DiBurro, L., and M. 568 Stenberg, "UDP Encapsulation of IPsec ESP Packets", 569 RFC 3948, DOI 10.17487/RFC3948, January 2005, 570 . 572 [RFC4303] Kent, S., "IP Encapsulating Security Payload (ESP)", 573 RFC 4303, DOI 10.17487/RFC4303, December 2005, 574 . 576 [RFC4555] Eronen, P., "IKEv2 Mobility and Multihoming Protocol 577 (MOBIKE)", RFC 4555, DOI 10.17487/RFC4555, June 2006, 578 . 580 [RFC5246] Dierks, T. and E. Rescorla, "The Transport Layer Security 581 (TLS) Protocol Version 1.2", RFC 5246, 582 DOI 10.17487/RFC5246, August 2008, 583 . 585 [RFC6520] Seggelmann, R., Tuexen, M., and M. Williams, "Transport 586 Layer Security (TLS) and Datagram Transport Layer Security 587 (DTLS) Heartbeat Extension", RFC 6520, 588 DOI 10.17487/RFC6520, February 2012, 589 . 591 [RFC7383] Smyslov, V., "Internet Key Exchange Protocol Version 2 592 (IKEv2) Message Fragmentation", RFC 7383, 593 DOI 10.17487/RFC7383, November 2014, 594 . 596 Appendix A. Using TCP encapsulation with TLS 598 This section provides recommendations on the support of TLS with the 599 TCP encapsulation. 601 When using TCP encapsulation, implementations may choose to use TLS 602 [RFC5246], to be able to traverse middle-boxes, which may block non 603 HTTP traffic. 605 If a web proxy is applied to the ports for the TCP connection, and 606 TLS is being used, the initiator can send an HTTP CONNECT message to 607 establish a tunnel through the proxy [RFC2817]. 609 The use of TLS should be configurable on the peers. The responder 610 may expect to read encapsulated IKE and ESP packets directly from the 611 TCP connection, or it may expect to read them from a stream of TLS 612 data packets. The initiator should be pre-configured to use TLS or 613 not when communicating with a given port on the responder. 615 When new TCP connections are re-established due to a broken 616 connection, TLS must be re-negotiated. TLS Session Resumption is 617 recommended to improve efficiency in this case. 619 The security of the IKE session is entirely derived from the IKE 620 negotiation and key establishment and not from the TLS session (which 621 in this context is only used for encapsulation purposes), therefore 622 when TLS is used on the TCP connection, both the initiator and 623 responder SHOULD allow the NULL cipher to be selected for performance 624 reasons. 626 Implementations should be aware that the use of TLS introduces 627 another layer of overhead requiring more bytes to transmit a given 628 IKE and IPsec packet. For this reason, direct ESP, UDP 629 encapsulation, or TCP encapsulation without TLS should be preferred 630 in situations in which TLS is not required in order to traverse 631 middle-boxes. 633 Appendix B. Example exchanges of TCP Encapsulation with TLS 635 B.1. Establishing an IKE session 636 Client Server 637 ---------- ---------- 638 1) -------------------- TCP Connection ------------------- 639 (IP_I:Port_I -> IP_R:TCP443 or TCP4500) 640 TcpSyn ----------> 641 <---------- TcpSyn,Ack 642 TcpAck ----------> 644 2) --------------------- TLS Session --------------------- 645 ClientHello ----------> 646 ServerHello 647 Certificate* 648 ServerKeyExchange* 649 <---------- ServerHelloDone 650 ClientKeyExchange 651 CertificateVerify* 652 [ChangeCipherSpec] 653 Finished ----------> 654 [ChangeCipherSpec] 655 <---------- Finished 657 3) ---------------------- Stream Prefix -------------------- 658 "IKETCP" ----------> 659 4) ----------------------- IKE Session --------------------- 660 IKE_SA_INIT ----------> 661 HDR, SAi1, KEi, Ni, 662 [N(NAT_DETECTION_*_IP)] 663 <---------- IKE_SA_INIT 664 HDR, SAr1, KEr, Nr, 665 [N(NAT_DETECTION_*_IP)] 666 first IKE_AUTH ----------> 667 HDR, SK {IDi, [CERTREQ] 668 CP(CFG_REQUEST), IDr, 669 SAi2, TSi, TSr, ...} 670 <---------- first IKE_AUTH 671 HDR, SK {IDr, [CERT], AUTH, 672 EAP, SAr2, TSi, TSr} 673 EAP ----------> 674 repeat 1..N times 675 <---------- EAP 676 final IKE_AUTH ----------> 677 HDR, SK {AUTH} 678 <---------- final IKE_AUTH 679 HDR, SK {AUTH, CP(CFG_REPLY), 680 SA, TSi, TSr, ...} 681 ----------------- IKE Tunnel Established ---------------- 683 Figure 4 685 1. Client establishes a TCP connection with the server on port 443 686 or 4500. 688 2. Client initiates TLS handshake. During TLS handshake, the 689 server SHOULD NOT request the client's' certificate, since 690 authentication is handled as part of IKE negotiation. 692 3. Client send the Stream Prefix for TCP encapsulated IKE 693 [Section 4] traffic to signal the beginning of IKE negotation. 695 4. Client and server establish an IKE connection. This example 696 shows EAP-based authentication, although any authentication 697 type may be used. 699 B.2. Deleting an IKE session 701 Client Server 702 ---------- ---------- 703 1) ----------------------- IKE Session --------------------- 704 INFORMATIONAL ----------> 705 HDR, SK {[N,] [D,] 706 [CP,] ...} 707 <---------- INFORMATIONAL 708 HDR, SK {[N,] [D,] 709 [CP], ...} 711 2) --------------------- TLS Session --------------------- 712 close_notify ----------> 713 <---------- close_notify 714 3) -------------------- TCP Connection ------------------- 715 TcpFin ----------> 716 <---------- Ack 717 <---------- TcpFin 718 Ack ----------> 719 --------------------- Tunnel Deleted ------------------- 721 Figure 5 723 1. Client and server exchange INFORMATIONAL messages to notify IKE 724 SA deletion. 726 2. Client and server negotiate TLS session deletion using TLS 727 CLOSE_NOTIFY. 729 3. The TCP connection is torn down. 731 Unless the TCP connection and/or TLS session are being used for 732 multiple IKE SAs, the deletion of the IKE SA should lead to the 733 disposal of the underlying TLS and TCP state. 735 B.3. Re-establishing an IKE session 737 Client Server 738 ---------- ---------- 739 1) -------------------- TCP Connection ------------------- 740 (IP_I:Port_I -> IP_R:TCP443 or TCP4500) 741 TcpSyn ----------> 742 <---------- TcpSyn,Ack 743 TcpAck ----------> 744 2) --------------------- TLS Session --------------------- 745 ClientHello ----------> 746 <---------- ServerHello 747 [ChangeCipherSpec] 748 Finished 749 [ChangeCipherSpec] ----------> 750 Finished 751 3) ---------------------- Stream Prefix -------------------- 752 "IKETCP" ----------> 753 4) <---------------------> IKE/ESP flow <------------------> 755 Figure 6 757 1. If a previous TCP connection was broken (for example, due to a 758 RST), the client is responsible for re-initiating the TCP 759 connection. The initiator's address and port (IP_I and Port_I) 760 may be different from the previous connection's address and 761 port. 763 2. In ClientHello TLS message, the client SHOULD send the Session 764 ID it received in the previous TLS handshake if available. It 765 is up to the server to perform either an abbreviated handshake 766 or full handshake based on the session ID match. 768 3. After TCP and TLS are complete, the client sends the Stream 769 Prefix for TCP encapsulated IKE traffic [Section 4]. 771 4. The IKE and ESP packet flow can resume. If MOBIKE is being 772 used, the initiator SHOULD send UPDATE_SA_ADDRESSES. 774 B.4. Using MOBIKE between UDP and TCP Encapsulation 776 Client Server 777 ---------- ---------- 778 (IP_I1:UDP500 -> IP_R:UDP500) 779 1) ----------------- IKE_SA_INIT Exchange ----------------- 780 (IP_I1:UDP4500 -> IP_R:UDP4500) 781 Intial IKE_AUTH -----------> 782 HDR, SK { IDi, CERT, AUTH, 783 CP(CFG_REQUEST), 784 SAi2, TSi, TSr, 785 N(MOBIKE_SUPPORTED) } 786 <----------- Initial IKE_AUTH 787 HDR, SK { IDr, CERT, AUTH, 788 EAP, SAr2, TSi, TSr, 789 N(MOBIKE_SUPPORTED) } 790 <---------------- IKE tunnel establishment -------------> 792 2) ------------ MOBIKE Attempt on new network -------------- 793 (IP_I2:UDP4500 -> IP_R:UDP4500) 794 INFORMATIONAL -----------> 795 HDR, SK { N(UPDATE_SA_ADDRESSES), 796 N(NAT_DETECTION_SOURCE_IP), 797 N(NAT_DETECTION_DESTINATION_IP) } 799 3) -------------------- TCP Connection ------------------- 800 (IP_I2:PORT_I -> IP_R:TCP443 or TCP4500) 801 TcpSyn -----------> 802 <----------- TcpSyn,Ack 803 TcpAck -----------> 805 4) --------------------- TLS Session --------------------- 806 ClientHello -----------> 807 ServerHello 808 Certificate* 809 ServerKeyExchange* 810 <----------- ServerHelloDone 811 ClientKeyExchange 812 CertificateVerify* 813 [ChangeCipherSpec] 814 Finished -----------> 815 [ChangeCipherSpec] 816 <----------- Finished 817 5) ---------------------- Stream Prefix -------------------- 818 "IKETCP" ----------> 820 6) ----------------------- IKE Session --------------------- 821 INFORMATIONAL -----------> 822 HDR, SK { N(UPDATE_SA_ADDRESSES), 823 N(NAT_DETECTION_SOURCE_IP), 824 N(NAT_DETECTION_DESTINATION_IP) } 826 <----------- INFORMATIONAL 827 HDR, SK { N(NAT_DETECTION_SOURCE_IP), 828 N(NAT_DETECTION_DESTINATION_IP) } 829 7) <----------------- IKE/ESP data flow -------------------> 831 Figure 7 833 1. During the IKE_SA_INIT exchange, the client and server exchange 834 MOBIKE_SUPPORTED notify payloads to indicate support for 835 MOBIKE. 837 2. The client changes its point of attachment to the network, and 838 receives a new IP address. The client attempts to re-establish 839 the IKE session using the UPDATE_SA_ADDRESSES notify payload, 840 but the server does not respond because the network blocks UDP 841 traffic. 843 3. The client brings up a TCP connection to the server in order to 844 use TCP encapsulation. 846 4. The client initiates and TLS handshake with the server. 848 5. The client sends the Stream Prefix for TCP encapsulated IKE 849 traffic [Section 4]. 851 6. The client sends the UPDATE_SA_ADDRESSES notify payload on the 852 TCP encapsulated connection. 854 7. The IKE and ESP packet flow can resume. 856 Authors' Addresses 858 Tommy Pauly 859 Apple Inc. 860 1 Infinite Loop 861 Cupertino, California 95014 862 US 864 Email: tpauly@apple.com 865 Samy Touati 866 Ericsson 867 300 Holger Way 868 San Jose, California 95134 869 US 871 Email: samy.touati@ericsson.com 873 Ravi Mantha 874 Cisco Systems 875 SEZ, Embassy Tech Village 876 Panathur, Bangalore 560 037 877 India 879 Email: ramantha@cisco.com