<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE rfcSYSTEM "rfc2629.dtd">[ <!ENTITY nbsp " "> <!ENTITY zwsp "​"> <!ENTITY nbhy "‑"> <!ENTITY wj "⁠"> ]> <rfc xmlns:xi="http://www.w3.org/2001/XInclude" submissionType="IETF" category="std"ipr="trust200902"consensus="true" docName="draft-ietf-ipsecme-rfc8229bis-09"obsoletes="8229"> <?xml-stylesheet type='text/xsl' href='rfc2629.xslt' ?> <?rfc toc="yes" ?> <?rfc symrefs="yes" ?> <?rfc sortrefs="no"?> <?rfc iprnotified="no" ?> <?rfc strict="yes" ?>number="9329" ipr="trust200902" obsoletes="8229" updates="" xml:lang="en" tocInclude="true" symRefs="true" sortRefs="false" version="3"> <!-- xml2rfc v2v3 conversion 3.14.2 --> <front> <title abbrev="TCP Encapsulation of IKEand& IPsec Packets">TCP Encapsulation ofIKEInternet Key Exchange Protocol (IKE) and IPsec Packets</title> <seriesInfo name="RFC" value="9329"/> <author fullname="Tommy Pauly" initials="T." surname="Pauly"> <organization>Apple Inc.</organization> <address> <postal> <street>1 Infinite Loop</street><city>Cupertino, California 95014</city><city>Cupertino</city> <region>California</region> <code>95014</code> <country>United States of America</country> </postal> <email>tpauly@apple.com</email> </address> </author> <authorinitials='V.'initials="V." surname="Smyslov"fullname='Valery Smyslov'>fullname="Valery Smyslov"> <organization>ELVIS-PLUS</organization> <address> <postal> <street>PO Box 81</street> <city>Moscow (Zelenograd)</city> <code>124460</code> <country>Russian Federation</country> </postal> <phone>+7 495 276 0211</phone> <email>svan@elvis.ru</email> </address> </author><date/> <!-- <keyword></keyword> --><date year="2022" month="November" /> <area>sec</area> <workgroup>ipsecme</workgroup> <abstract> <t> This document describes a method to transport Internet Key Exchange Protocol (IKE) and IPsec packets over a TCP connection for traversing network middleboxes that may block IKE negotiation over UDP. This method, referred to as "TCP encapsulation", involves sending both IKE packets for Security Association (SA) establishment and Encapsulating Security Payload (ESP) packets over a TCP connection. This method is intended to be used as a fallback option when IKE cannot be negotiated over UDP. </t> <t>TCP encapsulation for IKE and IPsec was defined in RFC 8229. This documentupdatesclarifies the specification for TCP encapsulation by including additional clarifications obtained during implementation and deployment of this method. This documents obsoletes RFC 8229. </t> </abstract> </front> <middle> <sectiontitle="Introduction" anchor="intro">anchor="intro" numbered="true" toc="default"> <name>Introduction</name> <t> The Internet Key Exchange Protocol version 2 (IKEv2) <xreftarget="RFC7296"/>target="RFC7296" format="default"/> is a protocol for establishing IPsec Security Associations(SAs),(SAs) using IKE messages over UDP for controltraffic,traffic and using Encapsulating Security Payload (ESP)<xref target="RFC4303"/>messages <xref target="RFC4303" format="default"/> for encrypted data traffic. Many network middleboxes that filter traffic on public hotspots block all UDP traffic, including IKE and IPsec, but allow TCP connections through because they appear to be web traffic. Devices on these networks that need to use IPsec (to access private enterprise networks, to route Voice over IP calls to carriernetworks,networks because of security policies, etc.) are unable to establish IPsec SAs. This document defines a method for encapsulating IKE control messages as well as ESP data messages within a TCP connection. Note thatAHAuthentication Header (AH) is not supported by this specification. </t> <t> Using TCP as a transport for IPsec packets addsathe third option (below) to the list of traditional IPsec transports: </t><t><list style="numbers"> <t>Direct. Currently,<ol spacing="normal" type="1"><li>Direct. Usually, IKE negotiations begin over UDP port 500. If no Network Address Translation (NAT) device is detected between the Initiator and the Responder, then subsequent IKE packets are sent over UDP port500,500 and IPsec data packets are sent usingESP.</t> <t>UDP EncapsulationESP.</li> <li>UDP Encapsulation. Described in <xreftarget="RFC3948"/>.target="RFC3948" format="default"/>. If a NAT is detected between the Initiator and the Responder, then subsequent IKE packets are sent over UDP port 4500 withfour4 bytes of zero at the start of the UDP payload, and ESP packets are sent out over UDP port 4500. Some implementations default to using UDP encapsulation even when no NAT is detected on the path, as some middleboxes do not support IP protocols other than TCP andUDP.</t> <t>TCPUDP.</li> <li>TCP Encapsulation. Described in this document. If the other two methods are not available or appropriate, IKE negotiation packets as well as ESP packets can be sent over a single TCP connection to thepeer.</t> </list> </t>peer.</li> </ol> <t> Direct use of ESP or UDP encapsulation should be preferred by IKE implementations due to performance concerns when using TCP encapsulation (<xreftarget="perf"/>).target="perf" format="default"/>). Most implementations should use TCP encapsulation only on networks where negotiation over UDP has been attempted without receiving responses from the peer or if a network is known to not support UDP.</t> <sectiontitle="Prioranchor="prior" numbered="true" toc="default"> <name>Prior Work andMotivation" anchor="prior">Motivation</name> <t> Encapsulating IKE connections within TCP streams is a common approach to solve the problem of UDP packets being blocked by network middleboxes. The specific goals of this document are as follows:</t><t><list style="symbols"> <t>To<ul spacing="normal"> <li>To promote interoperability by defining a standard method of framing IKE and ESP messages within TCPstreams.</t> <t>Tostreams.</li> <li>To be compatible with the current IKEv2 standard without requiring modifications orextensions.</t> <t>Toextensions.</li> <li>To use IKE over UDP by default to avoid the overhead of other alternatives that always rely on TCP or Transport Layer Security (TLS) <xreftarget="RFC5246"/><xref target="RFC8446"/>.</t> </list> </t>target="RFC5246" format="default"/> <xref target="RFC8446" format="default"/>.</li> </ul> <t>Some previous alternatives include:</t><t><list style="hanging" hangIndent="3"> <t hangText="Cellular<dl newline="true" spacing="normal" indent="3"> <dt>Cellular NetworkAccess"> <vspace blankLines="0"/>Access:</dt> <dd> Interworking Wireless LAN (IWLAN) uses IKEv2 to create secure connections to cellular carrier networks for making voice calls and accessing other network services over Wi-Fi networks. 3GPP has recommended that IKEv2 and ESP packets be sent within a TLS connection to be able to establish connections on restrictive networks.</t> <t hangText="ISAKMP</dd> <dt>ISAKMP overTCP"> <vspace blankLines="0"/>TCP:</dt> <dd> Various non-standard extensions to the Internet Security Association and Key Management Protocol (ISAKMP) have been deployed that send IPsec traffic over TCP or TCP-like packets.</t> <t hangText="Secure</dd> <dt>Secure Sockets Layer (SSL)VPNs"> <vspace blankLines="0"/>VPNs:</dt> <dd> Many proprietary VPN solutions use a combination of TLS and IPsec in order to provide reliability. These often run on TCP port 443.</t> <t hangText="IKEv2</dd> <dt>IKEv2 overTCP"> <vspace blankLines="0"/>TCP:</dt> <dd> IKEv2 over TCP as described in <xreftarget="I-D.ietf-ipsecme-ike-tcp"/>target="I-D.ietf-ipsecme-ike-tcp" format="default"/> is used to avoid UDP fragmentation.</t> </list></dd> </dl> <t> TCP encapsulation for IKE and IPsec was defined in <xref target="RFC8229"/>.format="default"/>. This document updates the specification for TCP encapsulation by including additional clarifications obtained during implementation and deployment of this method. </t> <t>In particular:<list style="symbols"> <t>The</t> <ul spacing="normal"> <li>The interpretation of the Length field preceding every message is clarified (<xref target="format"/>)</t> <t>Theformat="default"/>).</li> <li>The use of the NAT_DETECTION_*_IP notifications is clarified (Sections <xrefformat = "counter" target="fallback" />, <xref format = "counter" target="nat-det" />, and <xref format = "counter" target="mobike" />)</t> <t>Retransmissionformat="counter" target="fallback"/>, <xref format="counter" target="nat-det"/>, and <xref format="counter" target="mobike"/>).</li> <li>Retransmission behavior is clarified (<xref target="retr"/>)</t> <t>Theformat="default"/>).</li> <li>The use of cookies and puzzles is described in more detail (<xref target="cookie-puzzle"/>)</t> <t>Errorformat="default"/>).</li> <li>Error handling is clarified (<xref target="errors"/>)</t> <t>Implicationsformat="default"/>).</li> <li>Implications of TCP encapsulation on IPsec SA processing are expanded (<xref target="ipsec"/>)</t> <t><xrefformat="default"/>).</li> <li> <xref target="extensions"/>format="default"/> describing interactions with other IKEv2 extensions isadded</t> <t>Theadded.</li> <li>The interaction of TCP encapsulation withMOBIKEIKEv2 Mobility and Multihoming (MOBIKE) is clarified (<xref target="mobike"/>)</t> <t>Theformat="default"/>).</li> <li>The recommendation for TLS encapsulation (<xref target="tls"/>)format="default"/>) now includes TLS1.3</t> <t>Examples1.3.</li> <li>Examples of TLS encapsulation are provided using TLS 1.3 (<xref target="tls-example"/>)</t> <t>Moreformat="default"/>).</li> <li>More security considerations areadded.</t> </list> </t>added.</li> </ul> </section> <section anchor="mustshouldmay"title="Terminologynumbered="true" toc="default"> <name>Terminology andNotation">Notation</name> <t> This document distinguishes between the IKE peer that initiates TCP connections to be used for TCP encapsulation and the roles of Initiator and Responder for particular IKE messages. During the course of IKE exchanges, the role of IKE Initiator and Responder may swap for a given SA (as with IKE SA rekeys), while the Initiator of the TCP connection is still responsible for tearing down the TCP connection and re-establishing it if necessary. For this reason, this document will use the term "TCP Originator" to indicate the IKE peer that initiates TCP connections. The peer that receives TCP connections will be referred to as the "TCP Responder". If an IKE SA is rekeyed one or more times, the TCP OriginatorMUST<bcp14>MUST</bcp14> remain the peer that originally initiated the first IKE SA. </t> <t> The key words"MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED", "MAY","<bcp14>MUST</bcp14>", "<bcp14>MUST NOT</bcp14>", "<bcp14>REQUIRED</bcp14>", "<bcp14>SHALL</bcp14>", "<bcp14>SHALL NOT</bcp14>", "<bcp14>SHOULD</bcp14>", "<bcp14>SHOULD NOT</bcp14>", "<bcp14>RECOMMENDED</bcp14>", "<bcp14>NOT RECOMMENDED</bcp14>", "<bcp14>MAY</bcp14>", and"OPTIONAL""<bcp14>OPTIONAL</bcp14>" in this document are to be interpreted as described inBCP 14BCP 14 <xreftarget="RFC2119" />target="RFC2119"/> <xreftarget="RFC8174" />target="RFC8174"/> when, and only when, they appear in all capitals, as shown here. </t> </section> </section> <sectiontitle="Configuration" anchor="config">anchor="config" numbered="true" toc="default"> <name>Configuration</name> <t>One of the main reasons to use TCP encapsulation is that UDP traffic may be entirely blocked on a network. Because of this, support for TCP encapsulation is not specifically negotiated in the IKE exchange. Instead, support for TCP encapsulation must bepre-configuredpreconfigured on both the TCP Originator and the TCP Responder.</t> <t>Compliant implementationsMUST<bcp14>MUST</bcp14> support TCP encapsulation on TCP port 4500, which is reserved for IPsec NAT traversal.</t> <t>Beyond a flag indicating support for TCP encapsulation, the configuration for each peer can include the following optional parameters:</t><t><list style="symbols"> <t>Alternate<ul spacing="normal"> <li>Alternate TCP ports on which the specific TCP Responder listens for incoming connections. Note that the TCP Originator may initiate TCP connections to the TCP Responder from any localport.</t> <t>Anport.</li> <li>An extra framing protocol to use on top of TCP to further encapsulate the stream of IKE and IPsec packets. See <xref target="tls"/>format="default"/> for a detaileddiscussion.</t> </list> </t>discussion.</li> </ul> <t>Since TCP encapsulation of IKE and IPsec packets adds overhead and has potential performance trade-offs compared to direct or UDP-encapsulated SAs (as described in <xreftarget="perf"/>),target="perf" format="default"/>), implementationsSHOULD<bcp14>SHOULD</bcp14> prefer ESP direct or UDP-encapsulated SAs over TCP-encapsulated SAs when possible. </t> </section> <sectiontitle="TCP-Encapsulatedanchor="format" numbered="true" toc="default"> <name>TCP-Encapsulated DataFormats" anchor="format">Formats</name> <t>Like UDP encapsulation, TCP encapsulation uses the firstfour4 bytes of a message to differentiate IKE and ESP messages. TCP encapsulation also adds a 16-bit Length field that precedes every message to define the boundaries of messages within a stream. The value in this field is equal to the length of the original message plus the length of the field itself, in octets. If the first 32 bits of the message are zeros (a non-ESP marker), then the contents comprise an IKE message. Otherwise, the contents comprise an ESP message.Authentication Header (AH)AH messages are not supported for TCP encapsulation. </t> <t>Although a TCP stream may be able to send very long messages, implementationsSHOULD<bcp14>SHOULD</bcp14> limit message lengths to match the lengths used for UDP encapsulation of ESP messages. The maximum message length is used as the effective MTU for connections that are being encrypted using ESP, so the maximum message length will influence characteristics of these connections, such as the TCP Maximum Segment Size (MSS). </t> <t>Due to the fact that the Length field is16-bit16 bits and includes both the message length and the length of the field itself, it is impossible to encapsulate messages greater than 65533 octets in length. In most cases, this is not a problem. Notealsothat a similar limitation exists for encapsulation ESP in UDP <xref target="RFC3948"/>.format="default"/>. </t> <t>The minimum size of an encapsulated message is 1 octet (for NAT-keepalive packets, see <xref target="nat-ka"/>).format="default"/>). Empty messages (where the Length field equalsto2)MUST<bcp14>MUST</bcp14> be silently ignored by receiver. </t> <t>Note that this method of encapsulation will also work for placing IKE and ESP messages within any protocol that presents a stream abstraction, beyond TCP. </t> <sectiontitle="TCP-Encapsulatedanchor="format-ike" numbered="true" toc="default"> <name>TCP-Encapsulated IKE MessageFormat" anchor="format-ike">Format</name> <figuretitle="IKE message formatanchor="f-format-ike"> <name>IKE Message Format for TCPencapsulation" anchor="f-format-ike"><artwork><![CDATA[Encapsulation</name> <artwork name="" type="" align="left" alt=""><![CDATA[ 1 2 3 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 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Length | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Non-ESP Marker | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | | ~ IKEmessage [RFC7296]Message (RFC 7296) ~ | |+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ ]]></artwork>+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+]]></artwork> </figure> <t> The IKE message is preceded by a 16-bit Length field in network byte order that specifies the length of the IKE message (including the non-ESP marker) within the TCP stream. As with IKE over UDP port 4500, a zeroed 32-bit non-ESP marker is inserted before the start of the IKE header in order to differentiate the traffic from ESP traffic between the same addresses and ports. </t><t><list style="symbols"> <t>Length<dl newline="false" spacing="normal"> <dt>Length (2 octets, unsignedinteger) -integer):</dt> <dd> Length of the IKE message, including the Length field and non-ESP marker. The value in the Length fieldMUST NOT<bcp14>MUST NOT</bcp14> be 0 or 1. The receiverMUST<bcp14>MUST</bcp14> treat these values as fatal errors andMUST<bcp14>MUST</bcp14> close the TCP connection.</t> <t>Non-ESP</dd> <dt>Non-ESP Marker (4octets) - Fouroctets):</dt> <dd>Four zero-valuedbytes. </t> </list> </t>bytes.</dd> </dl> </section> <sectiontitle="TCP-Encapsulatedanchor="format-esp" numbered="true" toc="default"> <name>TCP-Encapsulated ESP PacketFormat" anchor="format-esp">Format</name> <figuretitle="ESP packet formatanchor="f-format-esp"> <name>ESP Packet Format for TCPencapsulation" anchor="f-format-esp"><artwork><![CDATA[Encapsulation</name> <artwork name="" type="" align="left" alt=""><![CDATA[ 1 2 3 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 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Length | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | | ~ ESPpacket [RFC4303]Packet (RFC 4303) ~ | |+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ ]]></artwork>+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+]]></artwork> </figure> <t>The ESP packet is preceded by a 16-bit Length field in network byte order that specifies the length of the ESP packet within the TCP stream.</t> <t>The Security Parameter Index (SPI) field <xreftarget="RFC7296"/>target="RFC7296" format="default"/> in the ESP headerMUST NOT<bcp14>MUST NOT</bcp14> be a zero value.</t><t><list style="symbols"> <t>Length<dl newline="false" spacing="normal"> <dt>Length (2 octets, unsignedinteger) - Lengthinteger):</dt> <dd>Length of the ESP packet, including the Length field. The value in the Length fieldMUST NOT<bcp14>MUST NOT</bcp14> be 0 or 1. The receiverMUST<bcp14>MUST</bcp14> treat these values as fatal errors andMUST<bcp14>MUST</bcp14> close TCPconnection.</t> </list> </t>connection.</dd> </dl> </section> </section> <sectiontitle="TCP-Encapsulatedanchor="prefix" numbered="true" toc="default"> <name>TCP-Encapsulated StreamPrefix" anchor="prefix">Prefix</name> <t>Each stream of bytes used for IKE and IPsec encapsulationMUST<bcp14>MUST</bcp14> begin with a fixed sequence ofsix6 bytes as a magic value, containing the characters "IKETCP" as ASCII values. </t> <figuretitle="TCP-Encapsulatedanchor="f-prefix"> <name>TCP-Encapsulated StreamPrefix" anchor="f-prefix"><artwork><![CDATA[Prefix</name> <artwork name="" type="" align="left" alt=""><![CDATA[ 0 1 2 3 4 5 +------+------+------+------+------+------+ | 0x49 | 0x4b | 0x45 | 0x54 | 0x43 | 0x50 |+------+------+------+------+------+------+ ]]></artwork>+------+------+------+------+------+------+]]></artwork> </figure> <t>This value is intended to identify and validate that the TCP connection is being used for TCP encapsulation as defined in this document, to avoid conflicts with the prevalence of previous non-standard protocols that used TCP port 4500. This value is only sent once, by the TCP Originator only, at the beginning of the TCP stream of IKE and ESP messages. </t><figure><artwork><![CDATA[<artwork name="" type="" align="left" alt=""><![CDATA[ Initiator Responder --------------------------------------------------------------------- <new TCP connection is established by Initiator> Stream Prefix|Length|non-ESP marker|IKE message --> <-- Length|non-ESP marker|IKE message Length|non-ESP marker|IKE message --> <-- Length|non-ESP marker|IKE message [...] Length|ESP packet -> <- Length|ESPpacket ]]></artwork> </figure>packet]]></artwork> <t>If other framing protocols are used within TCP to further encapsulate or encrypt the stream of IKE and ESP messages, the stream prefix must be at the start of the TCP Originator's IKE and ESP message stream within the added protocol layer (<xref target="tls"/>).format="default"/>). Although some framing protocols do support negotiating inner protocols, the stream prefix should always be used in order for implementations to be as generic as possible and not rely on other framing protocols on top of TCP. </t> </section> <sectiontitle="Applicability" anchor="applicability">anchor="applicability" numbered="true" toc="default"> <name>Applicability</name> <t>TCP encapsulation is applicable only when it has been configured to be used with specific IKE peers. If a Responder is configured to accept and is allowed to use TCP encapsulation, itMUST<bcp14>MUST</bcp14> listen on the configured port(s) in case any peers will initiate new IKE sessions. InitiatorsMAY<bcp14>MAY</bcp14> use TCP encapsulation for any IKE session to a peer that is configured to support TCP encapsulation, although it is recommended that Initiators only use TCP encapsulation when traffic over UDP is blocked. </t> <t>Since the support of TCP encapsulation is a configured property, not a negotiated one, it is recommended that if there are multiple IKE endpoints representing a single peer (such as multiple machines with different IP addresses when connecting by Fully Qualified DomainName,Name (FQDN), or endpoints used with IKE redirection), all of the endpoints equally support TCP encapsulation. </t> <t>If TCP encapsulation is being used for a specific IKE SA, all IKE messages for that IKE SA and ESP packets for its Child SAsMUST<bcp14>MUST</bcp14> be sent over a TCP connection until the SA is deleted or IKEv2 Mobility and Multihoming (MOBIKE) is used to change the SA endpoints and/or the encapsulation protocol. See <xreftarget="mobike"/>target="mobike" format="default"/> for more details on using MOBIKE to transition between encapsulation modes. </t> <sectiontitle="Recommendedanchor="fallback" numbered="true" toc="default"> <name>Recommended Fallback fromUDP" anchor="fallback">UDP</name> <t>Since UDP is the preferred method of transport for IKE messages, implementations that use TCP encapsulation should have an algorithm for deciding when to use TCP after determining that UDP is unusable. If an Initiator implementation has no prior knowledge about the network it is on and the status of UDP on that network, itSHOULD<bcp14>SHOULD</bcp14> always attempt to negotiate IKE over UDP first. IKEv2 defines how to use retransmission timers with IKE messages and, specifically, IKE_SA_INIT messages <xreftarget="RFC7296"/>.target="RFC7296" format="default"/>. Generally, this means that the implementation will define a frequency of retransmission and the maximum number of retransmissions allowed before marking the IKE SA as failed. An implementation can attempt negotiation over TCP once it has hit the maximum retransmissions over UDP, or slightly before to reduce connection setup delays. It is recommended that the initial message over UDP be retransmitted at least once before falling back to TCP, unless the Initiator knows beforehand that the network is likely to block UDP. </t> <t>When switching from UDP to TCP, a new IKE_SA_INIT exchangeMUST<bcp14>MUST</bcp14> be initiated with the Initiator's new SPI and with recalculated content of NAT_DETECTION_*_IP notifications. </t> </section> </section> <sectiontitle="Using TCP Encapsulation" anchor="tcp-encap"> <section title="Connectionanchor="tcp-encap" numbered="true" toc="default"> <name>Using TCP Encapsulation</name> <section anchor="establish" numbered="true" toc="default"> <name>Connection Establishment andTeardown" anchor="establish">Teardown</name> <t>When the IKE Initiator uses TCP encapsulation, it will initiate a TCP connection to the Responder using the Responder's preconfigured TCP port. The first bytes sent on the TCP streamMUST<bcp14>MUST</bcp14> be the stream prefix value (<xreftarget="prefix"/>).target="prefix" format="default"/>). After this prefix, encapsulated IKE messages will negotiate the IKE SA and initial Child SA <xreftarget="RFC7296"/>.target="RFC7296" format="default"/>. After this point, both encapsulated IKE (<xref target="f-format-ike"/>)format="default"/>) and ESP (<xref target="f-format-esp"/>)format="default"/>) messages will be sent over the TCP connection. The TCP ResponderMUST<bcp14>MUST</bcp14> wait for the entire stream prefix to be received on the stream before trying to parse out any IKE or ESP messages. The stream prefix is sent only once, and only by the TCP Originator. </t> <t>In order to close an IKE session, either the Initiator or ResponderSHOULD<bcp14>SHOULD</bcp14> gracefully tear down IKE SAs with DELETE payloads. Once the SA has been deleted, the TCP OriginatorSHOULD<bcp14>SHOULD</bcp14> close the TCP connection if it does not intend to use the connection for another IKE session to the TCP Responder. If the TCP connection is no longer associated with any active IKE SA, the TCP ResponderMAY<bcp14>MAY</bcp14> close the connection to clean up IKE resources if the TCP Originator didn't close it within some reasonable period of time (e.g., a few seconds). </t> <t>An unexpected FIN or a TCP Reset on the TCP connection may indicate a loss of connectivity, an attack, or some other error. If a DELETE payload has not been sent, both sidesSHOULD<bcp14>SHOULD</bcp14> maintain the state for their SAs for the standard lifetime or timeout period. The TCP Originator is responsible for re-establishing the TCP connection if it is torn down for any unexpected reason. Since new TCP connections may use different IP addresses and/or ports due to NAT mappings or local address or port allocations changing, the TCP ResponderMUST<bcp14>MUST</bcp14> allow packets for existing SAs to be received from new source IP addresses and ports. Note that the IPv6 Flow-ID headerMUST<bcp14>MUST</bcp14> remain constant when a new TCP connection is created to avoid ECMP load balancing. </t> <t>A peerMUST<bcp14>MUST</bcp14> discard a partially received message due to a broken connection. </t> <t>Whenever the TCP Originator opens a new TCP connection to be used for an existing IKE SA, itMUST<bcp14>MUST</bcp14> send the stream prefix first, before any IKE or ESP messages. This follows the same behavior as the initial TCP connection. </t> <t>Multiple IKE SAsMUST NOT<bcp14>MUST NOT</bcp14> share a single TCP connection, unless one is a rekey of an existing IKE SA, in which case there will temporarily be two IKE SAs on the same TCP connection. </t> <t>If a TCP connection is being used to continue an existing IKE/ESP session, the TCP Responder can recognize the session using either the IKE SPI from an encapsulated IKE message or the ESP SPI from an encapsulated ESP packet. If the session had been fully established previously, it is suggested that the TCP Originator send an UPDATE_SA_ADDRESSES message if MOBIKE issupported, orsupported and an empty informational messageotherwise.if it is not. </t> <t>The TCP ResponderMUST NOT<bcp14>MUST NOT</bcp14> accept any messages for the existing IKE session on a new incoming connection, unless that connection begins with the stream prefix. If either the TCP Originator or TCP Responder detects corruption on a connection that was started with a valid stream prefix, itSHOULD<bcp14>SHOULD</bcp14> close the TCP connection. The connection can bedetermined to becorrupted if there are too many subsequent messages that cannot be parsed as valid IKE messages or ESP messages with known SPIs, or if the authentication check for an IKE message or ESP message with a known SPI fails. ImplementationsSHOULD NOT<bcp14>SHOULD NOT</bcp14> tear down a connection if only a few consecutive ESP packets have unknownSPIs,SPIs since the SPI databases may be momentarily out of sync. If there is instead a syntax issue within an IKE message, an implementationMUST<bcp14>MUST</bcp14> send the INVALID_SYNTAX notify payload and tear down the IKE SA as usual, rather than tearing down the TCP connection directly. </t> <t>A TCP OriginatorSHOULD<bcp14>SHOULD</bcp14> only open one TCP connection per IKE SA, over which it sends all of the corresponding IKE and ESP messages. This helps ensure that any firewall or NAT mappings allocated for the TCP connection apply to all of the traffic associated with the IKE SA equally. </t><t>Similarly,<t> As with TCP Originators, a TCP ResponderSHOULD at any given time<bcp14>SHOULD</bcp14> send packets for an IKE SA and its Child SAs over only one TCPconnection.connection at any given time. ItSHOULD<bcp14>SHOULD</bcp14> choose the TCP connection on which it last received a valid and decryptable IKE or ESP message. In order to be considered valid for choosing a TCP connection, an IKE message must be successfully decrypted and authenticated, not be a retransmission of a previously received message, and be within the expected window for IKE message IDs. Similarly, an ESP message mustpass authentication checks andbedecrypted,successfully decrypted and authenticated, and must not be a replay of a previous message. </t> <t>Since a connection may be broken and a new connection re-established by the TCP Originator without the TCP Responder being aware, a TCP ResponderSHOULD<bcp14>SHOULD</bcp14> accept receiving IKE and ESP messages on both old and new connections until the old connection is closed by the TCP Originator. A TCP ResponderMAY<bcp14>MAY</bcp14> close a TCP connection that it perceives as idle and extraneous (one previously used for IKE and ESP messages that has been replaced by a new connection). </t> </section> <sectiontitle="Retransmissions"anchor="retr"> <t>Section 2.1 of <xrefnumbered="true" toc="default"> <name>Retransmissions</name> <t><xref target="RFC7296"/>sectionFormat="of" section="2.1"/> describes how IKEv2 deals with the unreliability of the UDP protocol. In brief, the exchange Initiator is responsible for retransmissions and must retransmitrequests messagerequest messages until a response message is received. If no reply is received after several retransmissions, the SA is deleted. The Responder never initiates retransmission, but it must send a response message again in case it receives a retransmitted request. </t> <t>When IKEv2 uses a reliable transport protocol, like TCP, the retransmission rules are as follows:<list style="symbols" > <t>The</t> <ul spacing="normal"> <li>The exchange InitiatorSHOULD NOT<bcp14>SHOULD NOT</bcp14> retransmit request message (*); if no response is received within some reasonable period of time, the IKE SA is deleted.</t> <t>If</li> <li>If a new TCP connection for the IKE SA is established while the exchange Initiator is waiting for a response, the InitiatorMUST<bcp14>MUST</bcp14> retransmit its request over this connection and continue to wait for a response.</t> <t>The</li> <li>The exchange Responder does not change its behavior, but acts as described inSection 2.1 of<xref target="RFC7296"/>. </t> </list>sectionFormat="of" section="2.1"/>. </li> </ul> <t> (*) This is anoptimization,optimization; implementations may continue to use the retransmission logic fromSection 2.1 of<xref target="RFC7296"/>sectionFormat="of" section="2.1"/> for simplicity. </t> </section> <sectiontitle="Cookies and Puzzles"anchor="cookie-puzzle">numbered="true" toc="default"> <name>Cookies and Puzzles</name> <t>IKEv2 provides a DoS attack protection mechanism through Cookies, which is described inSection 2.6 of<xref target="RFC7296"/>.sectionFormat="of" section="2.6"/>. <xref target="RFC8019"/>format="default"/> extends this mechanism for protection against DDoS attacks by means of Client Puzzles. Both mechanisms allow the Responder to avoid keeping state until the Initiator proves its IP address is legitimate (and after solving a puzzle if required). </t> <t>The connection-oriented nature of TCP transport brings additional considerations for using these mechanisms. In general, Cookies provide less value in the case of TCPencapsulation, sinceencapsulation; by the time a Responder receives the IKE_SA_INIT request, the TCP session has already been established and the Initiator's IP address has been verified. Moreover, a TCP/IP stack creates state once a TCP SYN packet is received (unless SYN Cookies described in <xref target="RFC4987"/>format="default"/> are employed), which contradicts the statelessness of IKEv2 Cookies. In particular, with TCP, an attacker is able to mount a SYN flooding DoS attackwhichthat an IKEv2 Responder cannot prevent using stateless IKEv2 Cookies. Thus, when using TCP encapsulation, it makes little sense to send Cookie requests without Puzzles unless the Responder is concerned with a possibility of TCPSequence Numbersequence number attacks (see <xreftarget="RFC6528" />target="RFC6528"/> and <xref target="RFC9293" format="default"/> for details). Puzzles, on the other hand, still remain useful (and their use requires using Cookies). </t> <t>The following considerations are applicable for using Cookie and Puzzle mechanisms in the case of TCP encapsulation:<list style="symbols" > <t>the</t> <ul spacing="normal"> <li>The exchange ResponderSHOULD NOT<bcp14>SHOULD NOT</bcp14> send an IKEv2 Cookie request without an accompanied Puzzle; implementations might choose to have exceptions to this for cases like mitigating TCPSequence Numbersequence number attacks.</t> <t>if</li> <li>If the Responder chooses to send a Cookie request (possibly along with Puzzle request), then the TCP connection that the IKE_SA_INIT request message was received overSHOULD<bcp14>SHOULD</bcp14> be closed after the Responder sends its reply and no repeated requests are received within some short period of time to keep the Responder stateless (see <xref target="tradeoff"/>).format="default"/>). Note that the ResponderMUST NOT<bcp14>MUST NOT</bcp14> include the Initiator's TCP port into the Cookie calculation(*),(*) since the Cookie can be returned over a new TCP connection with a different port.</t> <t>the</li> <li>The exchange Initiator acts as described inSection 2.6 of<xref target="RFC7296"/>sectionFormat="of" section="2.6"/> andSection 7 of<xref target="RFC8019"/>, i.e.sectionFormat="of" section="7"/>, i.e., using TCP encapsulation doesn't change the Initiator's behavior.</t> </list></li> </ul> <t> (*) Examples of Cookie calculation methods are given inSection 2.6 of<xref target="RFC7296"/>sectionFormat="of" section="2.6"/> and inSection 7.1.1.3 of<xref target="RFC8019"/>sectionFormat="of" section="7.1.1.3"/>, and they don't include transport protocol ports.HoweverHowever, these examples are given for illustrativepurposes,purposes since the Cookie generation algorithm is a local matter and some implementations might include portnumbers,numbers that won't work with TCP encapsulation. Note also that these examples include the Initiator's IP address in Cookie calculation. Ingeneralgeneral, this address may change between two initial requests (with and without Cookies). This may happen due to NATs,since NATswhich have more freedom to change source IP addresses for new TCP connections than for UDP. In suchcasescases, cookie verification might fail. </t> <sectiontitle="Statelessnessanchor="tradeoff" numbered="true" toc="default"> <name>Statelessness versus Delay of SAEstablishment" anchor="tradeoff" >Establishment</name> <t> There is a trade-off in choosing the period of time after which the TCP connection is closed. If it is too short, then the proper Initiatorwhichthat repeats its request would need to re-establish the TCPconnectionconnection, introducing additional delay. On the other hand, if it is too long, then the Responder's resources would be wasted in case the Initiator never comes back. This document doesn'tspecifymandate the duration oftime,time because it doesn't affect interoperability, but it is believed that 5-10 seconds is a good compromise.Note also,Also, note that if the Responder requests that the Initiatortosolve a puzzle, then the Responder can estimate how long it would take the Initiator to find a solution and adjust the time interval accordingly. </t> </section> </section> <sectiontitle="Erroranchor="errors" numbered="true" toc="default"> <name>Error Handling inIKE_SA_INIT" anchor="errors" > <t>Section 2.21.1 of <xrefIKE_SA_INIT</name> <t><xref target="RFC7296"/>sectionFormat="of" section="2.21.1"/> describes how error notifications are handled in the IKE_SA_INIT exchange. In particular, it is advised that the Initiator should not act immediately after receiving an errornotification andnotification; instead, it shouldinsteadwait some time for a validresponse,response since the IKE_SA_INIT messages are completely unauthenticated. This advice does not apply equally in the case of TCP encapsulation. If the Initiator receives a response message over TCP, then either this message is genuine and was sent by thepeer,peer or the TCP session was hijacked and the message is forged. Inthisthe latter case, no genuine messages from the Responder will be received. </t> <t>Thus, in the case of TCP encapsulation, an InitiatorSHOULD NOT<bcp14>SHOULD NOT</bcp14> wait for additional messages in case it receives an error notification from the Responder in the IKE_SA_INIT exchange. </t><t>If in<t>In the IKE_SA_INITexchangeexchange, if the Responder returns an error notification that implies a recovery action from the Initiator (such as INVALID_KE_PAYLOAD or INVALID_MAJOR_VERSION, seeSection 2.21.1 of<xref target="RFC7296"/>)sectionFormat="of" section="2.21.1"/>), then the ResponderSHOULD NOT<bcp14>SHOULD NOT</bcp14> close the TCP connectionimmediately,immediately in anticipation of the fact that the Initiator will repeat the request with corrected parameters. See also <xref target="cookie-puzzle"/>.format="default"/>. </t> </section> <sectiontitle="NAT Detection Payloads" anchor="nat-det">anchor="nat-det" numbered="true" toc="default"> <name>NAT-Detection Payloads</name> <t>When negotiating over UDP, IKE_SA_INIT packets include NAT_DETECTION_SOURCE_IP and NAT_DETECTION_DESTINATION_IP payloads to determine if UDP encapsulation of IPsec packets should be used. These payloads contain SHA-1 digests of the SPIs, IP addresses, and ports as defined in <xreftarget="RFC7296"/>.target="RFC7296" format="default"/>. IKE_SA_INIT packets sent on a TCP connectionSHOULD<bcp14>SHOULD</bcp14> include these payloads with the same content as when sending over UDP andSHOULD<bcp14>SHOULD</bcp14> use the applicable TCP ports when creating and checking the SHA-1 digests. </t> <t>If a NAT is detected due to the SHA-1 digests not matching the expected values, no change should be made for encapsulation of subsequent IKE or ESPpackets,packets since TCP encapsulation inherently supports NAT traversal. However, for the transport mode IPsec SAs, implementations need to handle TCP and UDP packet checksum fixup during decapsulation, as defined for UDP encapsulation in <xreftarget="RFC3948"/>.target="RFC3948" format="default"/>. </t> <t>ImplementationsMAY<bcp14>MAY</bcp14> use the information that a NAT is present to influence keepalive timer values. </t> </section> <sectiontitle="NAT-keepalive Packets" anchor="nat-ka">anchor="nat-ka" numbered="true" toc="default"> <name>NAT-Keepalive Packets</name> <t>Encapsulating IKE and IPsec inside of a TCP connection can impact the strategy that implementations use to maintain middlebox port mappings. </t> <t>In general, TCP port mappings are maintained by NATs longer than UDP port mappings, so IPsec ESP NAT-keepalive packets <xreftarget="RFC3948"/> SHOULD NOTtarget="RFC3948" format="default"/> <bcp14>SHOULD NOT</bcp14> be sent when using TCP encapsulation. Any implementation using TCP encapsulationMUST<bcp14>MUST</bcp14> silently drop incoming NAT-keepalive packets and not treat them as errors. NAT-keepalive packets over a TCP-encapsulated IPsec connection will be sent as aone-octet-long1-octet-long payload with the value 0xFF, preceded by thetwo byte2-octet Length specifying a length of 3 (since it includes the length of the Length field). </t> </section> <sectiontitle="Deadanchor="dpd" numbered="true" toc="default"> <name>Dead Peer Detection and TransportKeepalives" anchor="dpd">Keepalives</name> <t>Peer liveness should be checked using IKE informational packets <xreftarget="RFC7296"/>.target="RFC7296" format="default"/>. </t> <t>Note that, depending on the configuration of TCP and TLS on the connection, TCP keep-alives <xreftarget="RFC1122"/>target="RFC1122" format="default"/> and TLS keep-alives <xreftarget="RFC6520"/> MAYtarget="RFC6520" format="default"/> <bcp14>MAY</bcp14> be used. TheseMUST NOT<bcp14>MUST NOT</bcp14> be used as indications of IKE peer liveness, for which purpose the standard IKEv2 mechanism of exchanging (usually empty) INFORMATIONAL messages is used (seeSection 1.4 of<xref target="RFC7296"/>).sectionFormat="of" section="1.4"/>). </t> </section> <sectiontitle="Implicationsanchor="ipsec" numbered="true" toc="default"> <name>Implications of TCP Encapsulation on IPsec SAProcessing" anchor="ipsec" >Processing</name> <t>Using TCP encapsulation affects some aspects of IPsec SA processing.<list style="numbers" > <t>Section 8.1 of <xref target="RFC4301"/></t> <ol spacing="normal" type="1"><li><xref target="RFC4301" sectionFormat="of" section="8.1"/> requires all tunnel mode IPsec SAs to be able to copy the Don't Fragment (DF) bit from inner IPv4 header to the outer (tunnel) one. With TCPencapsulationencapsulation, this is generally notpossible,possible because the TCP/IP stack manages the DF bit in the outer IPv4 header, and usually the stack ensures that the DF bit is set for TCP packets to avoid IP fragmentation. Note, that this behavior is compliant with generic tunnelingconsiderations,considerations since the outer TCP header acts as a link-layer protocol and its fragmentation and reassembly have no correlation with the inner payload.</t> <t>The</li> <li>The other feature that is less applicable with TCP encapsulation is an ability to split traffic of different QoS classes into different IPsec SAs, created by a single IKE SA. In thiscasecase, the Differentiated Services Code Point (DSCP) field is usually copied from the inner IP header to the outer (tunnel) one, ensuring that IPsec traffic of each SA receives the corresponding level of service. With TCPencapsulationencapsulation, all IPsec SAs created by a single IKE SA will share a single TCPconnection and thusconnection; thus, they will receive the same level of service (see <xref target="perf.3"/>).format="default"/>). If this functionality is needed, implementations should create several IKE SAs each over separate TCPconnectionconnections and assign a corresponding DSCP value to each of them.</t> </list> </t></li> </ol> <t>TCP encapsulation of IPsec packets may have implications on performance of the encapsulated traffic. Performance considerations are discussed in <xref target="perf"/>.format="default"/>. </t> </section> </section> <sectiontitle="Interactionanchor="extensions" numbered="true" toc="default"> <name>Interaction with IKEv2Extensions" anchor="extensions" >Extensions</name> <sectiontitle="MOBIKE Protocol" anchor="mobike">anchor="mobike" numbered="true" toc="default"> <name>MOBIKE Protocol</name> <t>The MOBIKE protocol, which allows SAs to migrate between IP addresses, is defined in <xreftarget="RFC4555"/>, andtarget="RFC4555" format="default"/>; <xreftarget="RFC4621"/>target="RFC4621" format="default"/> further clarifies the details of the protocol. When an IKE session that has negotiated MOBIKE is transitioning between networks, the Initiator of the transition may switch between using TCP encapsulation, UDP encapsulation, or no encapsulation. Implementations that implement both MOBIKE and TCP encapsulation within the same connection configurationMUST<bcp14>MUST</bcp14> support dynamically enabling and disabling TCP encapsulation as interfaces change. </t> <t>When a MOBIKE-enabled Initiator changes networks, the INFORMATIONAL exchange with the UPDATE_SA_ADDRESSES notificationSHOULD<bcp14>SHOULD</bcp14> be initiated first over UDP before attempting over TCP. If there is a response to the request sent over UDP, then the ESP packets should be sent directly over IP or over UDP port 4500 (depending on if a NAT was detected), regardless of if a connection on a previous network was using TCP encapsulation. If no response is received within a certain period of time after several retransmissions, the Initiator ought to change its transport for this exchange from UDP to TCP and resend the request message. A new INFORMATIONAL exchangeMUST NOT<bcp14>MUST NOT</bcp14> be started in this situation. If the Responder only responds to the request sent over TCP, then the ESP packets should be sent over the TCP connection, regardless of if a connection on a previous network did not use TCP encapsulation. </t> <t>The value of the timeout and the specific number of retransmissions before switching to TCP can vary depending on the Initiator's configuration. Implementations ought to provide reasonable defaults to ensure that UDP attempts have a chance to succeed, but can shorten the timeout based on historical data or metrics. </t> <t>If the TCP transport was used for the previous network connection, the old TCP connectionSHOULD<bcp14>SHOULD</bcp14> be closed by the Initiator once MOBIKE finishes migration to a new connection (either TCP or UDP). </t> <t>Since switching from UDP to TCP can happen during a single INFORMATIONAL message exchange, the content of the NAT_DETECTION_*_IP notifications will in most cases be incorrect (since UDP and TCP ports will most likely be different), and the peer may incorrectly detect the presence of a NAT.Section 3.5 of<xref target="RFC4555"/>sectionFormat="of" section="3.5"/> states that a new INFORMATIONAL exchange with the UPDATE_SA_ADDRESSES notify is initiated in case the address (or transport) is changed while waiting for a response. </t><t>Section 3.5 of <xref<t><xref target="RFC4555"/>sectionFormat="of" section="3.5"/> also states that once an IKE SA is switched to a new IP address, all outstanding requests in this SA are immediately retransmitted using this address. See also <xref target="retr"/>.format="default"/>. </t> <t>The MOBIKE protocol defines the NO_NATS_ALLOWED notification that can be used to detect the presence of NAT between peer and to refuse to communicate in this situation. In the case ofTCPTCP, the NO_NATS_ALLOWED notificationSHOULD<bcp14>SHOULD</bcp14> be ignored because TCP generally has no problems with NAT boxes. </t><t>Section 3.7 of <xref target="RFC4555"/><t><xref target="RFC4555" sectionFormat="of" section="3.7"/> describes an additional optional step in the process of changing IP addresses calledReturn"Return RoutabilityCheck.Check". It is performed by Responders in order to be sure that the newinitiator'sInitiator's addressisis, infactfact, routable. In the case of TCPencapsulationencapsulation, this check has littlevalue,value since a TCP handshake proves the routability of the TCP Originator'saddress. So, in case of TCP encapsulationaddress; thus, the Return Routability CheckSHOULD NOT<bcp14>SHOULD NOT</bcp14> be performed. </t> </section> <sectiontitle="IKE Redirect"anchor="redirect">numbered="true" toc="default"> <name>IKE Redirect</name> <t>A redirect mechanism for IKEv2 is defined in <xreftarget="RFC5685"/>.target="RFC5685" format="default"/>. This mechanism allows security gateways to redirect clients to another gateway either during IKE SA establishment or after session setup. If a client is connecting to a security gateway using TCP and then is redirected to another security gateway, the client needs to reset its transport selection. In other words, with the next security gateway, the clientMUST again try<bcp14>MUST</bcp14> first try UDP and then fall back to TCP while establishing a new IKE SA, regardless of the transport of the SA the redirect notification was received over (unless the client's configuration instructs it to instantly use TCP for the gateway it is redirected to). </t> </section> <sectiontitle="IKEv2 Session Resumption"anchor="resumption">numbered="true" toc="default"> <name>IKEv2 Session Resumption</name> <t>Session resumption for IKEv2 is defined in <xreftarget="RFC5723"/>.target="RFC5723" format="default"/>. Once an IKE SA is established, the server creates a resumption ticket where information about this SA isstored,stored and transfers this ticket to the client. The ticket may be later used to resume the IKE SA after it is deleted. In the event ofresumptionresumption, the client presents the ticket in a new exchange, called IKE_SESSION_RESUME. Some parameters in the new SA are retrieved from the ticket and others arere-negotiatedrenegotiated (more details are given inSection 5 of<xreftarget="RFC5723"/>).target="RFC5723" sectionFormat="of" section="5"/>). </t> <t>Since network conditions may change while the client is inactive, the fact that TCP encapsulation was used in an old SASHOULD NOT<bcp14>SHOULD NOT</bcp14> affect which transport is used during session resumption. In other words, the transport should be selected as if the IKE SA is being created from scratch. </t> </section> <sectiontitle="IKEv2anchor="ha" numbered="true" toc="default"> <name>IKEv2 Protocol Support for HighAvailability" anchor="ha" >Availability</name> <t><xreftarget="RFC6311"/>target="RFC6311" format="default"/> defines a support for High Availability in IKEv2. In case of cluster failover, a new active node must immediately initiate a special INFORMATION exchange containing the IKEV2_MESSAGE_ID_SYNC notification, which instructs the client to skip some number of Message IDs that might not be synchronized yet between nodes at the time of failover. </t> <t>Synchronizing states when using TCP encapsulation is much harder than when using UDP; doing so requires access to TCP/IP stack internals, which is not always available from an IKE/IPsec implementation. If a cluster implementation doesn't synchronize TCP states between nodes, then after failover event the new active node will not have any TCP connection with the client, so the node cannot initiate the INFORMATIONAL exchange as required by <xreftarget="RFC6311"/>.target="RFC6311" format="default"/>. Since the cluster usually acts as TCP Responder, the new active node cannot re- establish TCPconnection, sinceconnection because only the TCP Originator can do it. For the client, the cluster failover event may remain undetected for long time if it has no IKE or ESP traffic to send. Once the client sends an ESP or IKEv2 packet, the cluster node will reply with TCP RST and the client (as TCP Originator) will reestablish the TCP connection so that the node will be able to initiate the INFORMATIONAL exchange informing the client about the cluster failover. </t> <t>This document makes the following recommendation: if support for High Availability in IKEv2 is negotiated and TCP transport is used, a client that is a TCP OriginatorSHOULD<bcp14>SHOULD</bcp14> periodically send IKEv2 messages(e.g.(e.g., by initiating liveness check exchange) whenever there is no IKEv2 or ESP traffic. This differs from the recommendations given inSection 2.4 of<xreftarget="RFC7296"/>target="RFC7296" sectionFormat="of" section="2.4"/> in the following: the liveness check should be periodically performed even if the client has nothing to send over ESP. The frequency of sending such messages should be high enough to allow quick detection andrestoringrestoration of broken TCP connections. </t> </section> <sectiontitle="IKEv2 Fragmentation" anchor="frag">anchor="frag" numbered="true" toc="default"> <name>IKEv2 Fragmentation</name> <t>IKE message fragmentation <xreftarget="RFC7383"/>target="RFC7383" format="default"/> is not required when using TCPencapsulation,encapsulation since a TCP stream already handles the fragmentation of its contents across packets. Since fragmentation is redundant in this case, implementations might choose to not negotiate IKE fragmentation. Even if fragmentation is negotiated, an implementationSHOULD NOT<bcp14>SHOULD NOT</bcp14> send fragments when going over a TCP connection, although itMUST<bcp14>MUST</bcp14> support receiving fragments. </t> <t>If an implementation supports both MOBIKE and IKE fragmentation, itSHOULD<bcp14>SHOULD</bcp14> negotiate IKE fragmentation over a TCP-encapsulated session in case the session switches to UDP encapsulation on another network. </t> </section> </section> <sectiontitle="Middlebox Considerations" anchor="middle">anchor="middle" numbered="true" toc="default"> <name>Middlebox Considerations</name> <t>Many security networking devices, such as firewalls or intrusion prevention systems, network optimization/acceleration devices, and NAT devices, keep the state of sessions that traverse through them. </t> <t>These devices commonly track the transport-layer and/or application- layer data to drop traffic that is anomalous or malicious in nature. While many of these devices will be more likely to pass TCP-encapsulated traffic as opposed to UDP-encapsulated traffic, some may still block or interfere with TCP-encapsulated IKE and IPsec traffic. </t> <t>A network device that monitors the transport layer will track the state of TCP sessions, such as TCP sequence numbers. If the IKE implementation has its own minimal implementation of TCP, itSHOULD<bcp14>SHOULD</bcp14> still use common TCP behaviors to avoid being dropped by middleboxes. </t> <t>Operators that intentionally block IPsec because of security implications might want to also block TCP port 4500 or use other methods to reject TCP encapsulated IPsec traffic(e.g.(e.g., filter out TCP connections that begin with the "IKETCP" stream prefix). </t> </section> <sectiontitle="Performance Considerations" anchor="perf">anchor="perf" numbered="true" toc="default"> <name>Performance Considerations</name> <t>Several aspects of TCP encapsulation for IKE and IPsec packets may negatively impact the performance of connections within a tunnel-mode IPsec SA. Implementations should be aware of these performance impacts and take these into consideration when determining when to use TCP encapsulation. ImplementationsMUST<bcp14>MUST</bcp14> favor using direct ESP or UDP encapsulation over TCP encapsulation whenever possible. </t> <sectiontitle="TCP-in-TCP" anchor="perf.1">anchor="perf.1" numbered="true" toc="default"> <name>TCP-in-TCP</name> <t>If the outer connection between IKE peers is over TCP, inner TCP connections may suffer negative effects from using TCP within TCP. Running TCP within TCP isdiscouraged,discouraged since the TCP algorithms generally assume that they are running over an unreliable datagram layer. </t> <t>If the outer (tunnel) TCP connection experiences packet loss, this loss will be hidden from any inner TCPconnections,connections since the outer connection will retransmit to account for the losses. Since the outer TCP connection will deliver the inner messages in order, any messages after a lost packet may have to wait until the loss is recovered. This means that loss on the outer connection will be interpreted only as delay by inner connections. The burstiness of inner traffic canincrease,increase since a large number of inner packets may be delivered across the tunnel at once. The inner TCP connection may interpret a long period of delay as a transmission problem, triggering a retransmission timeout, which will cause spurious retransmissions. The sending rate of the inner connection may be unnecessarily reduced if the retransmissions are not detected as spurious in time. </t> <t>The inner TCP connection's round-trip-time estimation will be affected by the burstiness of the outer TCP connection if there are long delays when packets are retransmitted by the outer TCP connection. This will make the congestion control loop of the inner TCP traffic less reactive, potentially permanently leading to a lower sending rate than the outer TCP would allow for. </t> <t> TCP-in-TCP can also lead to "TCP meltdown", where stacked instances of TCP can result in significant impacts to performance <xref target="TCP-MELTDOWN"/>.format="default"/>. This can occur when losses in the lower TCP (closer to the link) increase delays seen by the higher TCP (closer to the application) that create timeouts,whichwhich, inturnturn, cause retransmissions that can then cause losses in the lower TCP by overrunning its buffer. The very mechanism intended to avoid loss (retransmission) interacts between the two layers to increase loss. To limit this effect, the timeouts of the two TCP layers need to be carefully managed, e.g., such that the higher layer has a much longer timeout than the lower layer. </t> <t>Note that any negative effects will be shared among all flows going through the outer TCP connection. This is of particular concern for any latency-sensitive or real-time applications using the tunnel. If such traffic is using a TCP-encapsulated IPsec connection, it is recommended that the number of inner connections sharing the tunnel be limited as much as possible. </t> </section> <sectiontitle="Addedanchor="perf.2" numbered="true" toc="default"> <name>Added Reliability for UnreliableProtocols" anchor="perf.2">Protocols</name> <t>Since ESP is an unreliable protocol, transmitting ESP packets over a TCP connection will change the fundamental behavior of the packets. Some application-level protocols that prefer packet loss to delay (such as Voice over IP or other real-time protocols) may be negatively impacted if their packets are retransmitted by the TCP connection due to packet loss. </t> </section> <sectiontitle="Quality-of-Service Markings" anchor="perf.3">anchor="perf.3" numbered="true" toc="default"> <name>Quality-of-Service Markings</name> <t>Quality-of-Service (QoS) markings, such as the Differentiated Services Code Point (DSCP) and Traffic Class, should be used with care on TCP connections used for encapsulation. Individual packetsSHOULD NOT<bcp14>SHOULD NOT</bcp14> use different markings than the rest of theconnection,connection since packets with different priorities may be routed differently and cause unnecessary delays in the connection. </t> </section> <sectiontitle="Maximumanchor="perf.4" numbered="true" toc="default"> <name>Maximum SegmentSize" anchor="perf.4">Size</name> <t>A TCP connection used for IKE encapsulationSHOULD<bcp14>SHOULD</bcp14> negotiate its MSS in order to avoid unnecessary fragmentation of packets. </t> </section> <sectiontitle="Tunnelinganchor="perf.5" numbered="true" toc="default"> <name>Tunneling ECN inTCP" anchor="perf.5">TCP</name> <t>Since there is not a one-to-one relationship between outer IP packets and inner ESP/IP messages when using TCP encapsulation, the markings for Explicit Congestion Notification (ECN) <xreftarget="RFC3168"/>target="RFC3168" format="default"/> cannot easily besimplymapped. However, any ECN Congestion Experienced (CE) marking on inner headers should be preserved through the tunnel. </t> <t>ImplementationsSHOULD<bcp14>SHOULD</bcp14> follow the ECN compatibility mode for tunnel ingress as described in <xreftarget="RFC6040"/>.target="RFC6040" format="default"/>. In compatibility mode, the outer tunnel TCP connection marks its packet headers as not ECN-capable. </t><t>If upon<t>Upon egress, if the arriving outer header is marked with CE, the implementation will drop the innerpacket,packet since there is not a distinct inner packet header onto which to translate the ECN markings. </t> </section> </section> <sectiontitle="Security Considerations" anchor="security">anchor="security" numbered="true" toc="default"> <name>Security Considerations</name> <t>IKE Responders that support TCP encapsulation may become vulnerable to new Denial-of-Service (DoS) attacks that are specific to TCP, such as SYN-flooding attacks. TCP Responders should be aware of this additional attack surface. </t> <t>TCP connections are also susceptible to RST and other spoofing attacks <xref target="RFC4953"/>.format="default"/>. This specification makes IPsec tolerant of sudden TCP connection drops, but if an attacker is able to tear down TCP connections, IPsec connection's performance can suffer, effectively making this a DoS attack. </t> <t>TCP data injection attacks have no effect on application data since IPsec provides data integrity. However, they can have some effect, mostly by creating DoS attacks:<list style="symbols"> <t>if</t> <ul spacing="normal"> <li>If an attacker alters the content of the Length field that separates packets, then thereceiverReceiver will incorrectly identify the boundaries of the following packets and will drop all of them or even tear down the TCP connection if the content of the Length field happens to be 0 or 1 (see <xreftarget="format"/>) </t> <t>iftarget="format" format="default"/>). </li> <li>If the content of an IKE message is altered, then it will be dropped by the receiver; if the dropped message is the IKE request message, then theinitiatorInitiator will tear down the IKE SA after sometimeout, sincetimeout since, in mostcasescases, the request message will not be retransmitted (as advised in <xreftarget="retr"/>) and thustarget="retr" format="default"/>); thus, the response will never bereceived </t> <t>ifreceived. </li> <li>If an attacker alters the non-ESPmarkermarker, then IKE packets will be dispatched to ESPand(and sometimes visaversa,versa) and those packets will bedropped </t> <t>ifdropped. </li> <li>If an attacker modifies TCP-Encapsulated stream prefix or unencrypted IKE messages before IKE SA is established, then in most cases this will result in failure to establish IKE SA, often with false "authentication failed"diagnostics </t> </list>diagnostics. </li> </ul> <t> <xref target="RFC5961"/>format="default"/> discusses how TCP injection attacks can be mitigated. </t> <t>Note that data injection attacks are also possible on IP level(e.g.(e.g., when IP fragmentation is used), resulting in DoS attacks even if TCP encapsulation is not used. On the other hand, TCP injection attacks are easier to mount than the IP fragmentation injectionattacks,attacks because TCP keeps a long receive window openthat’sthat's a sitting target for such attacks. </t> <t>If an attacker successfully mounts an injection attack on a TCP connection used for encapsulating IPsec traffic and modifies a Length field, the receiver might not be able to correctly identify the boundaries of the following packets in the stream since it will try to parse arbitrary data as an ESP or IKE header. After such a parsing failure, all following packets will be dropped. Communication will eventually recover, but this might take several minutes and can result in IKE SA deletion and re-creation. </t> <t>To speed up the recovery from such attacks, implementations are advised to follow recommendations in <xref target="establish"/>format="default"/> and close the TCP connection if incoming packets contain SPIs that don't match any known SAs. Once the TCP connection isclosedclosed, it will be re-created by the TCP Originator as described in <xref target="establish"/>.format="default"/>. </t> <t>To avoid performance degradation caused by closing and re-creating TCPconnection,connections, implementationsMAY<bcp14>MAY</bcp14> alternatively try tore-syncresync after they receive unknown SPIs by searching the TCP stream for a 64-bit binary vector consisting of a known SPI in the first 32 bits and a valid Sequence Number for this SPI in the second 32bits, and thenbits. Then, they can validate theICVIntegrity Check Value (ICV) of this packet candidate by taking the preceding 16 bits as the Length field. They can also search for 4 bytes of zero (non-ESP marker) followed by 128 bits of IKE SPIs of the IKESASA(s) associated with this TCP connection and then validate the ICV of this IKE message candidate by taking the 16 bits preceding the non-ESP marker as the Length field. ImplementationsSHOULD<bcp14>SHOULD</bcp14> limit the attempts to resync,sincebecause if the injection attack isongoingongoing, then there is a high probability that the resync process will notsucceed,succeed or will quickly come under attack again. </t> <t>An attacker capable of blocking UDP traffic can force peers to use TCP encapsulation,thusthus, degrading the performance and making the connection more vulnerable to DoS attacks. Note that an attacker that is able to modify packets on the wire or to block them can prevent peersto communicatefrom communicating regardless of the transport being used. </t> <t>TCP Responders should be careful to ensure that the stream prefix "IKETCP" uniquely identifies incoming streams as streams that use the TCP encapsulation protocol. </t> <t>Attackers may be able to disrupt the TCP connection by sending spurious TCP Reset packets. Therefore, implementationsSHOULD<bcp14>SHOULD</bcp14> make sure that IKE session state persists even if the underlying TCP connection is torn down. </t> <t>If MOBIKE is being used, all of the security considerations outlined for MOBIKE apply <xreftarget="RFC4555"/>.target="RFC4555" format="default"/>. </t><t>Similarly<t>Similar to MOBIKE, TCP encapsulation requires a TCP Responder to handle changes to source address and port due to network or connection disruption. The successful delivery of valid new IKE or ESP messages over a new TCP connection is used by the TCP Responder to determine where to send subsequent responses. If an attacker is able to send packets on a new TCP connection that pass the validation checks of the TCP Responder, it can influence which path future packets will take. For this reason, the validation of messages on the TCP Responder must include decryption, authentication, and replay checks. </t> </section> <sectiontitle="IANA Considerations" anchor="iana">anchor="iana" numbered="true" toc="default"> <name>IANA Considerations</name> <t>TCP port 4500 is already allocated to IPsec for NATtraversal.traversal in the "Service Name and Transport Protocol Port Number Registry". This portSHOULD<bcp14>SHOULD</bcp14> be used for TCP-encapsulated IKE and ESP as described in this document. </t> <t>This document updates the reference for TCP port 4500 from RFC 8229 to itself: </t><figure><artwork><![CDATA[ Keyword Decimal Description Reference ----------- -------- ------------------- --------- ipsec-nat-t 4500/tcp IPsec NAT-Traversal [RFCXXXX] ]]></artwork> </figure><dl newline="false" spacing="compact"> <dt>Service Name:</dt> <dd>ipsec-nat-t</dd> <dt>Port Number / Transport Protocol:</dt> <dd>4500/tcp</dd> <dt>Description:</dt> <dd>IPsec NAT-Traversal</dd> <dt>Reference:</dt> <dd>RFC 9329</dd> </dl> </section> </middle> <back><references title='Normative References'> <?rfc include="https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.2119.xml" ?> <?rfc include="https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.3948.xml" ?> <?rfc include="https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.4301.xml" ?> <?rfc include="https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.4303.xml" ?> <?rfc include="https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.6040.xml" ?> <?rfc include="https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.7296.xml" ?> <?rfc include="https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.8019.xml" ?> <?rfc include="https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.8174.xml" ?><displayreference target="I-D.ietf-ipsecme-ike-tcp" to="IPSECME-IKE-TCP"/> <references> <name>References</name> <references> <name>Normative References</name> <xi:include href="https://bib.ietf.org/public/rfc/bibxml/reference.RFC.2119.xml"/> <xi:include href="https://bib.ietf.org/public/rfc/bibxml/reference.RFC.3948.xml"/> <xi:include href="https://bib.ietf.org/public/rfc/bibxml/reference.RFC.4301.xml"/> <xi:include href="https://bib.ietf.org/public/rfc/bibxml/reference.RFC.4303.xml"/> <xi:include href="https://bib.ietf.org/public/rfc/bibxml/reference.RFC.6040.xml"/> <xi:include href="https://bib.ietf.org/public/rfc/bibxml/reference.RFC.7296.xml"/> <xi:include href="https://bib.ietf.org/public/rfc/bibxml/reference.RFC.8019.xml"/> <xi:include href="https://bib.ietf.org/public/rfc/bibxml/reference.RFC.8174.xml"/> </references><references title='Informative References'> <?rfc include="https://xml2rfc.ietf.org/public/rfc/bibxml3/reference.I-D.ietf-ipsecme-ike-tcp.xml" ?> <?rfc include="https://xml2rfc.ietf.org/public/rfc/bibxml3/reference.I-D.ietf-uta-rfc7525bis.xml" ?> <?rfc include="https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.1122.xml" ?> <?rfc include="https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.2817.xml" ?> <?rfc include="https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.3168.xml" ?> <?rfc include="https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.4555.xml" ?> <?rfc include="https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.4621.xml" ?> <?rfc include="https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.4953.xml" ?> <?rfc include="https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.4987.xml" ?> <?rfc include="https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.5246.xml" ?> <?rfc include="https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.5685.xml" ?> <?rfc include="https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.5723.xml" ?> <?rfc include="https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.5961.xml" ?> <?rfc include="https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.6311.xml" ?> <?rfc include="https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.6520.xml" ?> <?rfc include="https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.6528.xml" ?> <?rfc include="https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.7383.xml" ?> <?rfc include="https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.8229.xml" ?> <?rfc include="https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.8446.xml" ?><references> <name>Informative References</name> <!-- [I-D.ietf-ipsecme-ike-tcp]; IESG state Expired as of 10/3/22 --> <xi:include href="https://datatracker.ietf.org/doc/bibxml3/reference.I-D.ietf-ipsecme-ike-tcp.xml"/> <!-- [I-D.ietf-uta-rfc7525bis]; In AUTH48-DONE as of 11/28/22 --> <reference anchor="RFC9325" target="https://www.rfc-editor.org/info/rfc9325"> <front> <title>Recommendations for Secure Use of Transport Layer Security (TLS) and Datagram Transport Layer Security (DTLS)</title> <author initials="Y." surname="Sheffer" fullname="Yaron Sheffer"> <organization>Intuit</organization> </author> <author initials="P." surname="Saint-Andre" fullname="Peter Saint-Andre"> <organization>independent</organization> </author> <author initials="T." surname="Fossati" fullname="Thomas Fossati"> <organization>arm</organization> </author> <date month="November" year="2022" /> </front> <seriesInfo name="RFC" value="9325" /> <seriesInfo name="DOI" value="10.17487/RFC9325"/> </reference> <xi:include href="https://bib.ietf.org/public/rfc/bibxml/reference.RFC.1122.xml"/> <xi:include href="https://bib.ietf.org/public/rfc/bibxml/reference.RFC.2817.xml"/> <xi:include href="https://bib.ietf.org/public/rfc/bibxml/reference.RFC.3168.xml"/> <xi:include href="https://bib.ietf.org/public/rfc/bibxml/reference.RFC.4555.xml"/> <xi:include href="https://bib.ietf.org/public/rfc/bibxml/reference.RFC.4621.xml"/> <xi:include href="https://bib.ietf.org/public/rfc/bibxml/reference.RFC.4953.xml"/> <xi:include href="https://bib.ietf.org/public/rfc/bibxml/reference.RFC.4987.xml"/> <xi:include href="https://bib.ietf.org/public/rfc/bibxml/reference.RFC.5246.xml"/> <xi:include href="https://bib.ietf.org/public/rfc/bibxml/reference.RFC.5685.xml"/> <xi:include href="https://bib.ietf.org/public/rfc/bibxml/reference.RFC.5723.xml"/> <xi:include href="https://bib.ietf.org/public/rfc/bibxml/reference.RFC.5961.xml"/> <xi:include href="https://bib.ietf.org/public/rfc/bibxml/reference.RFC.6311.xml"/> <xi:include href="https://bib.ietf.org/public/rfc/bibxml/reference.RFC.6520.xml"/> <xi:include href="https://bib.ietf.org/public/rfc/bibxml/reference.RFC.6528.xml"/> <xi:include href="https://bib.ietf.org/public/rfc/bibxml/reference.RFC.9293.xml"/> <xi:include href="https://bib.ietf.org/public/rfc/bibxml/reference.RFC.7383.xml"/> <xi:include href="https://bib.ietf.org/public/rfc/bibxml/reference.RFC.8229.xml"/> <xi:include href="https://bib.ietf.org/public/rfc/bibxml/reference.RFC.8446.xml"/> <reference anchor="TCP-MELTDOWN" target="https://doi.org/10.1117/12.630496"> <front> <title>Understanding TCP over TCP: effects of TCP tunneling on end-to-end throughput and latency</title> <author fullname="OsamuHonda" />Honda"/> <author fullname="HiroyukiOhsaki" />Ohsaki"/> <author fullname="MakotoImase" />Imase"/> <author fullname="MikaIshizuka" />Ishizuka"/> <author fullname="JunichiMurayama" />Murayama"/> <date month="October" year="2005"/> </front> </reference> </references> </references> <sectiontitle="Usinganchor="tls" numbered="true" toc="default"> <name>Using TCP Encapsulation withTLS" anchor="tls">TLS</name> <t>This section provides recommendations on how to use TLS in addition to TCP encapsulation. </t> <t>When using TCP encapsulation, implementations may choose to use TLS 1.2 <xreftarget="RFC5246"/>target="RFC5246" format="default"/> or TLS 1.3 <xreftarget="RFC8446"/>target="RFC8446" format="default"/> on the TCP connection to be able to traverse middleboxes, which may otherwise block the traffic. </t> <t>If a web proxy is applied to the ports used for the TCP connection and TLS is being used, the TCP Originator can send an HTTP CONNECT message to establish an SA through the proxy <xreftarget="RFC2817"/>.target="RFC2817" format="default"/>. </t> <t>The use of TLS should be configurable on thepeers,peers and may be used as the default when using TCP encapsulation or may be used as a fallback when basic TCP encapsulation fails. The TCP Responder may expect to read encapsulated IKE and ESP packets directly from the TCP connection, or it may expect to read them from a stream of TLS data packets. The TCP Originator should bepre-configuredpreconfigured regarding whether or not to use TLSor notwhen communicating with a given port on the TCP Responder. </t> <t>When new TCP connections are re-established due to a broken connection, TLS must be renegotiated. TLS session resumption is recommended to improve efficiency in this case. </t> <t>The security of the IKE session is entirely derived from the IKE negotiation and key establishment and not from the TLS session(which(which, in thiscontextcontext, is only used for encapsulation purposes); therefore, when TLS is used on the TCP connection, both the TCP Originator and the TCP ResponderSHOULD<bcp14>SHOULD</bcp14> allow the NULL cipher to be selected for performance reasons.Note,Note that TLS 1.3 only supports AEAD algorithms and at the time of writing this document there was no recommended cipher suite for TLS 1.3 with the NULL cipher. It isRECOMMENDED<bcp14>RECOMMENDED</bcp14> to follow <xreftarget="I-D.ietf-uta-rfc7525bis" />target="RFC9325" format="default"/> when selecting parameters for TLS. </t> <t>Implementations should be aware that the use of TLS introduces another layer of overhead requiring more bytes to transmit a given IKE and IPsec packet. For this reason, direct ESP, UDP encapsulation, or TCP encapsulation without TLS should be preferred in situations in which TLS is not required in order to traverse middleboxes. </t> </section> <sectiontitle="Exampleanchor="tls-example" numbered="true" toc="default"> <name>Example Exchanges of TCP Encapsulation with TLS1.3" anchor="tls-example">1.3</name> <t>This appendix contains examples of data flows in cases where TCP encapsulation of IKE and IPsec packets is used with TLS 1.3. The examples below are provided for illustrative purpose only; readers should refer to the main body of the document for details.</t> <sectiontitle="Establishinganchor="tls-example-1" numbered="true" toc="default"> <name>Establishing an IKESession" anchor="tls-example-1"> <figure><artwork><![CDATA[Session</name> <artwork name="" type="" align="left" alt=""><![CDATA[ Client Server ---------- ---------- 1) -------------------- TCP Connection ------------------- (IP_I:Port_I -> IP_R:Port_R) TcpSyn -------> <------- TcpSyn,Ack TcpAck -------> 2) --------------------- TLS Session --------------------- ClientHello -------> ServerHello {EncryptedExtensions} {Certificate*} {CertificateVerify*} <------- {Finished} {Finished} -------> 3) ---------------------- Stream Prefix -------------------- "IKETCP" -------> 4) ----------------------- IKE Session --------------------- Length + Non-ESP Marker -------> IKE_SA_INIT HDR, SAi1, KEi, Ni, [N(NAT_DETECTION_SOURCE_IP)], [N(NAT_DETECTION_DESTINATION_IP)] <------- Length + Non-ESP Marker IKE_SA_INIT HDR, SAr1, KEr, Nr, [N(NAT_DETECTION_SOURCE_IP)], [N(NAT_DETECTION_DESTINATION_IP)] Length + Non-ESP Marker -------> first IKE_AUTH HDR, SK {IDi, [CERTREQ] CP(CFG_REQUEST), IDr, SAi2, TSi, TSr, ...} <------- Length + Non-ESP Marker first IKE_AUTH HDR, SK {IDr, [CERT], AUTH, EAP, SAr2, TSi, TSr} Length + Non-ESP Marker -------> IKE_AUTH (repeat 1..N times) HDR, SK {EAP} <------- Length + Non-ESP Marker IKE_AUTH (repeat 1..N times) HDR SK {EAP} Length + Non-ESP Marker -------> final IKE_AUTH HDR, SK {AUTH} <------- Length + Non-ESP Marker final IKE_AUTH HDR, SK {AUTH, CP(CFG_REPLY), SA, TSi, TSr, ...} -------------- IKE and IPsec SAs Established ------------ Length + ESP Frame-------> ]]></artwork> </figure> <t><list style="numbers"> <t>The------->]]></artwork> <ol spacing="normal" type="1"><li>The client establishes a TCP connection with the server on port 4500 or on an alternatepre-configuredpreconfigured port that the server is listening on.</t> <t>If</li> <li>If configured to use TLS, the client initiates a TLS handshake. During the TLS handshake, the serverSHOULD NOT<bcp14>SHOULD NOT</bcp14> request the client'scertificate,certificate since authentication is handled as part of IKEnegotiation.</t> <t>Thenegotiation.</li> <li>The client sends the stream prefix for TCP-encapsulated IKE (<xreftarget="prefix"/>)target="prefix" format="default"/>) traffic to signal the beginning of IKEnegotiation.</t> <t>Thenegotiation.</li> <li>The client and server establish an IKE connection. This example shows EAP-based authentication, although any authentication type may beused.</t> </list> </t>used.</li> </ol> </section> <sectiontitle="Deleting an IKE Session" anchor="tls-example-2"> <figure><artwork><![CDATA[anchor="tls-example-2" numbered="true" toc="default"> <name>Deleting an IKE Session</name> <artwork name="" type="" align="left" alt=""><![CDATA[ Client Server ---------- ---------- 1) ----------------------- IKE Session --------------------- Length + Non-ESP Marker -------> INFORMATIONAL HDR, SK {[N,] [D,] [CP,] ...} <------- Length + Non-ESP Marker INFORMATIONAL HDR, SK {[N,] [D,] [CP], ...} 2) --------------------- TLS Session --------------------- close_notify -------> <------- close_notify 3) -------------------- TCP Connection ------------------- TcpFin -------> <------- Ack <------- TcpFin Ack -------> -------------------- IKE SA Deleted------------------- ]]></artwork> </figure> <t><list style="numbers"> <t>The-------------------]]></artwork> <ol spacing="normal" type="1"><li>The client and server exchange informational messages to notify IKE SAdeletion.</t> <t>Thedeletion.</li> <li>The client and server negotiate TLS session deletion using TLSCLOSE_NOTIFY.</t> <t>TheCLOSE_NOTIFY.</li> <li>The TCP connection is torndown.</t> </list> </t>down.</li> </ol> <t>The deletion of the IKE SA should lead to the disposal of the underlying TLS and TCP state.</t> </section> <sectiontitle="Re-establishinganchor="tls-example-3" numbered="true" toc="default"> <name>Re-establishing an IKESession" anchor="tls-example-3"> <figure><artwork><![CDATA[Session</name> <artwork name="" type="" align="left" alt=""><![CDATA[ Client Server ---------- ---------- 1) -------------------- TCP Connection ------------------- (IP_I:Port_I -> IP_R:Port_R) TcpSyn -------> <------- TcpSyn,Ack TcpAck -------> 2) --------------------- TLS Session --------------------- ClientHello -------> ServerHello {EncryptedExtensions} <------- {Finished} {Finished} -------> 3) ---------------------- Stream Prefix -------------------- "IKETCP" -------> 4) <---------------------> IKE/ESP Flow<------------------> ]]></artwork> </figure> <t><list style="numbers"> <t>If<------------------>]]></artwork> <ol spacing="normal" type="1"><li>If a previous TCP connection was broken (for example, due to a TCP Reset), the client is responsible for re-initiating the TCP connection. The TCP Originator's address and port (IP_I and Port_I) may be different from the previous connection's address and port.</t> <t>The</li> <li>The clientSHOULD<bcp14>SHOULD</bcp14> attempt TLS session resumption if it has previously established a session with the server.</t> <t>After</li> <li>After TCP and TLS are complete, the client sends the stream prefix for TCP-encapsulated IKE traffic (<xreftarget="prefix"/>). </t> <t>Thetarget="prefix" format="default"/>). </li> <li>The IKE and ESP packet flow can resume. If MOBIKE is being used, the InitiatorSHOULD<bcp14>SHOULD</bcp14> send an UPDATE_SA_ADDRESSES message.</t> </list> </t></li> </ol> </section> <sectiontitle="Usinganchor="tls-example-4" numbered="true" toc="default"> <name>Using MOBIKE between UDP and TCPEncapsulation" anchor="tls-example-4"> <figure><artwork><![CDATA[Encapsulation</name> <artwork name="" type="" align="left" alt=""><![CDATA[ Client Server ---------- ---------- 1) --------------------- IKE_session ---------------------- (IP_I1:UDP500 -> IP_R:UDP500) IKE_SA_INIT -------> HDR, SAi1, KEi, Ni, [N(NAT_DETECTION_SOURCE_IP)], [N(NAT_DETECTION_DESTINATION_IP)] <------- IKE_SA_INIT HDR, SAr1, KEr, Nr, [N(NAT_DETECTION_SOURCE_IP)], [N(NAT_DETECTION_DESTINATION_IP)] (IP_I1:UDP4500 -> IP_R:UDP4500) Non-ESP Marker -------> IKE_AUTH HDR, SK { IDi, CERT, AUTH, SAi2, TSi, TSr, N(MOBIKE_SUPPORTED) } <------- Non-ESP Marker IKE_AUTH HDR, SK { IDr, CERT, AUTH, SAr2, TSi, TSr, N(MOBIKE_SUPPORTED) } <---------------------> IKE/ESP Flow <------------------> 2) ------------ MOBIKE Attempt on New Network -------------- (IP_I2:UDP4500 -> IP_R:UDP4500) Non-ESP Marker -------> INFORMATIONAL HDR, SK { N(UPDATE_SA_ADDRESSES), N(NAT_DETECTION_SOURCE_IP), N(NAT_DETECTION_DESTINATION_IP) } 3) -------------------- TCP Connection ------------------- (IP_I2:Port_I -> IP_R:Port_R) TcpSyn -------> <------- TcpSyn,Ack TcpAck -------> 4) --------------------- TLS Session --------------------- ClientHello -------> ServerHello {EncryptedExtensions} {Certificate*} {CertificateVerify*} <------- {Finished} {Finished} -------> 5) ---------------------- Stream Prefix -------------------- "IKETCP"------->------->]]></artwork> <artwork name="" type="" align="left" alt=""><![CDATA[ 6) ------------ Retransmit Message from step 2 ------------- Length + Non-ESP Marker -------> INFORMATIONAL HDR, SK { N(UPDATE_SA_ADDRESSES), N(NAT_DETECTION_SOURCE_IP), N(NAT_DETECTION_DESTINATION_IP) } <------- Length + Non-ESP Marker INFORMATIONAL HDR, SK { N(NAT_DETECTION_SOURCE_IP), N(NAT_DETECTION_DESTINATION_IP) } 7) -- New Exchange with recalculated NAT_DETECTION_*_IP --- Length + Non-ESP Marker -------> INFORMATIONAL HDR, SK { N(UPDATE_SA_ADDRESSES), N(NAT_DETECTION_SOURCE_IP), N(NAT_DETECTION_DESTINATION_IP) } <------- Length + Non-ESP Marker INFORMATIONAL HDR, SK { N(NAT_DETECTION_SOURCE_IP), N(NAT_DETECTION_DESTINATION_IP) } 8) <---------------------> IKE/ESP Flow<------------------> ]]></artwork> </figure> <t><list style="numbers"> <t>During<------------------>]]></artwork> <ol spacing="normal" type="1"><li>During the IKE_AUTH exchange, the client and server exchange MOBIKE_SUPPORTED notify payloads to indicate support for MOBIKE.</t> <t>The</li> <li>The client changes its point of attachment to the network and receives a new IP address. The client attempts to re-establish the IKE session using the UPDATE_SA_ADDRESSES notify payload, but the server does not respond because the network blocks UDP traffic.</t> <t>The</li> <li>The client brings up a TCP connection to the server in order to use TCP encapsulation.</t> <t>The</li> <li>The client initiates a TLS handshake with theserver.</t> <t>Theserver.</li> <li>The client sends the stream prefix for TCP-encapsulated IKE traffic (<xreftarget="prefix"/>). </t> <t>Thetarget="prefix" format="default"/>). </li> <li>The client sends the UPDATE_SA_ADDRESSES notify payload in the INFORMATIONAL exchange on the TCP-encapsulated connection. Note that this IKE message is the same as the one sent over UDP in step 2; it should have the same message ID and contents.</t> <t>Once</li> <li>Once the client receives a response on the TCP-encapsulated connection, it immediately starts a new INFORMATIONAL exchange with an UPDATE_SA_ADDRESSES notify payload and recalculated NAT_DETECTION_*_IP notify payloads in order to get correct information about the presence of NATs.</t> <t>The</li> <li>The IKE and ESP packet flow canresume.</t> </list> </t>resume.</li> </ol> </section> </section> <sectiontitle="Acknowledgments" numbered="no" anchor="acknowledgments">numbered="false" anchor="acknowledgments" toc="default"> <name>Acknowledgments</name> <t>Thanks to theoriginalauthors of RFC8229, Tommy Pauly, Samy Touati, and Ravi Mantha.8229 (<contact fullname="Tommy Pauly"/>, <contact fullname="Samy Touati"/>, and <contact fullname="Ravi Mantha"/>). Since this documentupdatesclarifies and obsoletes RFC 8229, most of its text was borrowed from the original document. </t> <t>The following people provided valuable feedback andadvicesadvice while preparingRFC8229: Stuart Cheshire, Delziel Fernandes, Yoav Nir, Christoph Paasch, Yaron Sheffer, David Schinazi, Graham Bartlett, Byju Pularikkal, March Wu, Kingwel Xie, Valery Smyslov, Jun Hu, and Tero Kivinen.RFC 8229: <contact fullname="Stuart Cheshire"/>, <contact fullname="Delziel Fernandes"/>, <contact fullname="Yoav Nir"/>, <contact fullname="Christoph Paasch"/>, <contact fullname="Yaron Sheffer"/>, <contact fullname="David Schinazi"/>, <contact fullname="Graham Bartlett"/>, <contact fullname="Byju Pularikkal"/>, <contact fullname="March Wu"/>, <contact fullname="Kingwel Xie"/>, <contact fullname="Valery Smyslov"/>, <contact fullname="Jun Hu"/>, and <contact fullname="Tero Kivinen"/>. Special thanks toEric Kinnear<contact fullname="Eric Kinnear"/> for his implementation work. </t> <t>The authors would like to thankTero Kivinen, Paul Wouters, Joseph Touch, and Christian Huitema<contact fullname="Tero Kivinen"/>, <contact fullname="Paul Wouters"/>, <contact fullname="Joseph Touch"/>, and <contact fullname="Christian Huitema"/> for their valuable comments while preparing this document. </t> </section> </back> </rfc>