rfc9329xml2.original.xml   rfc9329.xml 
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE rfc [
<!ENTITY nbsp "&#160;">
<!ENTITY zwsp "&#8203;">
<!ENTITY nbhy "&#8209;">
<!ENTITY wj "&#8288;">
]>
<!DOCTYPE rfc SYSTEM "rfc2629.dtd"> <rfc xmlns:xi="http://www.w3.org/2001/XInclude" submissionType="IETF" category="
std" consensus="true" docName="draft-ietf-ipsecme-rfc8229bis-09" number="9329" i
<rfc category="std" ipr="trust200902" docName="draft-ietf-ipsecme-rfc8229bis-09" pr="trust200902" obsoletes="8229" updates="" xml:lang="en" tocInclude="true" sym
obsoletes="8229"> Refs="true" sortRefs="false" version="3">
<?xml-stylesheet type='text/xsl' href='rfc2629.xslt' ?>
<?rfc toc="yes" ?>
<?rfc symrefs="yes" ?>
<?rfc sortrefs="no"?>
<?rfc iprnotified="no" ?>
<?rfc strict="yes" ?>
<front> <!-- xml2rfc v2v3 conversion 3.14.2 -->
<title abbrev="TCP Encapsulation of IKE and IPsec Packets">TCP Encapsula
tion of IKE and IPsec Packets</title>
<author fullname="Tommy Pauly" initials="T." surname="Pauly">
<organization>Apple Inc.</organization>
<address>
<postal>
<street>1 Infinite Loop</street>
<city>Cupertino, California 95014</city>
<country>United States of America</country>
</postal>
<email>tpauly@apple.com</email>
</address>
</author>
<author initials='V.' surname="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/>
<!-- <front>
<keyword></keyword> <title abbrev="TCP Encapsulation of IKE &amp; IPsec Packets">TCP Encapsulati
--> on of Internet 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</city>
<region>California</region>
<code>95014</code>
<country>United States of America</country>
</postal>
<email>tpauly@apple.com</email>
</address>
</author>
<author initials="V." surname="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 year="2022" month="November" />
<area>sec</area>
<workgroup>ipsecme</workgroup>
<abstract> <abstract>
<t> This document describes a method to transport Internet Key Exchange <t> This document describes a method to transport Internet Key Exchange
Protocol (IKE) and IPsec packets over a TCP connection for traversing Protocol (IKE) and IPsec packets over a TCP connection for traversing
network middleboxes that may block IKE negotiation over UDP. This network middleboxes that may block IKE negotiation over UDP. This
method, referred to as "TCP encapsulation", involves sending both IKE method, referred to as "TCP encapsulation", involves sending both IKE
packets for Security Association establishment and Encapsulating packets for Security Association (SA) establishment and Encapsulating
Security Payload (ESP) packets over a TCP connection. This method is Security Payload (ESP) packets over a TCP connection. This method is
intended to be used as a fallback option when IKE cannot be intended to be used as a fallback option when IKE cannot be
negotiated over UDP. negotiated over UDP.
</t> </t>
<t>TCP encapsulation for IKE and IPsec was defined in RFC 8229. <t>TCP encapsulation for IKE and IPsec was defined in RFC 8229.
This document updates the specification for TCP encapsulation by includi This document clarifies the specification for TCP encapsulation by inclu
ng ding
additional clarifications obtained during implementation and deployment additional clarifications obtained during implementation and deployment
of this method. This documents obsoletes RFC 8229. of this method. This documents obsoletes RFC 8229.
</t> </t>
</abstract> </abstract>
</front> </front>
<middle>
<middle> <section anchor="intro" numbered="true" toc="default">
<section title="Introduction" anchor="intro"> <name>Introduction</name>
<t> The Internet Key Exchange Protocol version 2 (IKEv2) <xref target="R <t> The Internet Key Exchange Protocol version 2 (IKEv2) <xref target="RFC
FC7296"/> is a 7296" format="default"/> is a
protocol for establishing IPsec Security Associations (SAs), using protocol for establishing IPsec Security Associations (SAs) using
IKE messages over UDP for control traffic, and using Encapsulating IKE messages over UDP for control traffic and using Encapsulating
Security Payload (ESP) <xref target="RFC4303"/> messages for encrypted d Security Payload (ESP) messages <xref target="RFC4303" format="default"/
ata traffic. > for encrypted data traffic.
Many network middleboxes that filter traffic on public hotspots block Many network middleboxes that filter traffic on public hotspots block
all UDP traffic, including IKE and IPsec, but allow TCP connections all UDP traffic, including IKE and IPsec, but allow TCP connections
through because they appear to be web traffic. Devices on these through because they appear to be web traffic. Devices on these
networks that need to use IPsec (to access private enterprise networks that need to use IPsec (to access private enterprise
networks, to route Voice over IP calls to carrier networks, networks, to route Voice over IP calls to carrier networks
because of security policies, etc.) are unable to establish IPsec SAs. because of security policies, etc.) are unable to establish IPsec SAs.
This document defines a method for encapsulating IKE control messages This document defines a method for encapsulating IKE control messages
as well as ESP data messages within a TCP connection. Note that AH is no as well as ESP data messages within a TCP connection. Note that Authenti
t supported by this specification. cation Header (AH) is not supported by this specification.
</t> </t>
<t> Using TCP as a transport for IPsec packets adds a third option to th e <t> Using TCP as a transport for IPsec packets adds the third option (belo w) to the
list of traditional IPsec transports: list of traditional IPsec transports:
</t> </t>
<ol spacing="normal" type="1"><li>Direct. Usually, IKE negotiations begin
<t><list style="numbers"> over UDP port 500. If
<t>Direct. Currently, IKE negotiations begin over UDP port 500. If
no Network Address Translation (NAT) device is detected between no Network Address Translation (NAT) device is detected between
the Initiator and the Responder, then subsequent IKE packets are the Initiator and the Responder, then subsequent IKE packets are
sent over UDP port 500, and IPsec data packets are sent sent over UDP port 500 and IPsec data packets are sent
using ESP.</t> using ESP.</li>
<li>UDP Encapsulation. Described in <xref target="RFC3948" format="defa
<t>UDP Encapsulation <xref target="RFC3948"/>. If a NAT is detected b ult"/>. If a NAT is detected between the
etween the
Initiator and the Responder, then subsequent IKE packets are sent Initiator and the Responder, then subsequent IKE packets are sent
over UDP port 4500 with four bytes of zero at the start of the over UDP port 4500 with 4 bytes of zero at the start of the
UDP payload, and ESP packets are sent out over UDP port 4500. UDP payload, and ESP packets are sent out over UDP port 4500.
Some implementations default to using UDP encapsulation even when no N AT is Some implementations default to using UDP encapsulation even when no N AT is
detected on the path, as some middleboxes do not support IP detected on the path, as some middleboxes do not support IP
protocols other than TCP and UDP.</t> protocols other than TCP and UDP.</li>
<li>TCP Encapsulation. Described in this document. If the other two me
<t>TCP Encapsulation. If the other two methods are not available or thods are not available or
appropriate, IKE negotiation packets as well as ESP packets can appropriate, IKE negotiation packets as well as ESP packets can
be sent over a single TCP connection to the peer.</t> be sent over a single TCP connection to the peer.</li>
</list> </ol>
</t>
<t> Direct use of ESP or UDP encapsulation should be preferred by <t> Direct use of ESP or UDP encapsulation should be preferred by
IKE implementations due to performance concerns when using IKE implementations due to performance concerns when using
TCP encapsulation (<xref target="perf"/>). Most implementations should use TCP encapsulation (<xref target="perf" format="default"/>). Most implem entations should use
TCP encapsulation only on networks where negotiation over UDP has TCP encapsulation only on networks where negotiation over UDP has
been attempted without receiving responses from the peer or if a been attempted without receiving responses from the peer or if a
network is known to not support UDP.</t> network is known to not support UDP.</t>
<section anchor="prior" numbered="true" toc="default">
<section title="Prior Work and Motivation" anchor="prior"> <name>Prior Work and Motivation</name>
<t> Encapsulating IKE connections within TCP streams is a common appro <t> Encapsulating IKE connections within TCP streams is a common approac
ach h
to solve the problem of UDP packets being blocked by network to solve the problem of UDP packets being blocked by network
middleboxes. The specific goals of this document are as follows:</t> middleboxes. The specific goals of this document are as follows:</t>
<ul spacing="normal">
<t><list style="symbols"> <li>To promote interoperability by defining a standard method of
<t>To promote interoperability by defining a standard method of framing IKE and ESP messages within TCP streams.</li>
framing IKE and ESP messages within TCP streams.</t> <li>To be compatible with the current IKEv2 standard without requiring
modifications or extensions.</li>
<t>To be compatible with the current IKEv2 standard without requirin <li>To use IKE over UDP by default to avoid the overhead of other
g
modifications or extensions.</t>
<t>To use IKE over UDP by default to avoid the overhead of other
alternatives that always rely on TCP or Transport Layer Security alternatives that always rely on TCP or Transport Layer Security
(TLS) <xref target="RFC5246"/><xref target="RFC8446"/>.</t> (TLS) <xref target="RFC5246" format="default"/> <xref target="RFC844
6" format="default"/>.</li>
</list> </ul>
</t> <t>Some previous alternatives include:</t>
<dl newline="true" spacing="normal" indent="3">
<t>Some previous alternatives include:</t> <dt>Cellular Network Access:</dt>
<dd>
<t><list style="hanging" hangIndent="3">
<t hangText="Cellular Network Access">
<vspace blankLines="0"/>
Interworking Wireless LAN (IWLAN) uses IKEv2 to create secure Interworking Wireless LAN (IWLAN) uses IKEv2 to create secure
connections to cellular carrier networks for making voice calls connections to cellular carrier networks for making voice calls
and accessing other network services over Wi-Fi networks. 3GPP has and accessing other network services over Wi-Fi networks. 3GPP has
recommended that IKEv2 and ESP packets be sent within a TLS recommended that IKEv2 and ESP packets be sent within a TLS
connection to be able to establish connections on restrictive connection to be able to establish connections on restrictive
networks. networks.
</t> </dd>
<dt>ISAKMP over TCP:</dt>
<t hangText="ISAKMP over TCP"> <dd>
<vspace blankLines="0"/>
Various non-standard extensions to the Internet Security Various non-standard extensions to the Internet Security
Association and Key Management Protocol (ISAKMP) have been Association and Key Management Protocol (ISAKMP) have been
deployed that send IPsec traffic over TCP or TCP-like packets. deployed that send IPsec traffic over TCP or TCP-like packets.
</t> </dd>
<dt>Secure Sockets Layer (SSL) VPNs:</dt>
<t hangText="Secure Sockets Layer (SSL) VPNs"> <dd>
<vspace blankLines="0"/>
Many proprietary VPN solutions use a combination of TLS and IPsec Many proprietary VPN solutions use a combination of TLS and IPsec
in order to provide reliability. These often run on TCP port 443. in order to provide reliability. These often run on TCP port 443.
</t> </dd>
<dt>IKEv2 over TCP:</dt>
<t hangText="IKEv2 over TCP"> <dd>
<vspace blankLines="0"/> IKEv2 over TCP as described in <xref target="I-D.ietf-ipsecme-ike-tc
IKEv2 over TCP as described in <xref target="I-D.ietf-ipsecme-ike-tc p" format="default"/> is used to avoid UDP
p"/> is used to avoid UDP
fragmentation. fragmentation.
</t> </dd>
</dl>
</list> <t>
TCP encapsulation for IKE and IPsec was defined in <xref target="RFC82 29" />. TCP encapsulation for IKE and IPsec was defined in <xref target="RFC82 29" format="default"/>.
This document updates the specification for TCP encapsulation by inclu ding This document updates the specification for TCP encapsulation by inclu ding
additional clarifications obtained during implementation and deploymen t additional clarifications obtained during implementation and deploymen t
of this method. of this method.
</t> </t>
<t>In particular:
<t>In particular: </t>
<list style="symbols"> <ul spacing="normal">
<t>The interpretation of the Length field preceding every message is <li>The interpretation of the Length field preceding every message is
clarified (<xref target="format" />)</t> clarified (<xref target="format" format="default"/>).</li>
<t>The use of the NAT_DETECTION_*_IP notifications is clarified <li>The use of the NAT_DETECTION_*_IP notifications is clarified
(Sections <xref format = "counter" target="fallback" />, <xref forma (Sections <xref format="counter" target="fallback"/>, <xref format="
t = "counter" target="nat-det" />, counter" target="nat-det"/>,
and <xref format = "counter" target="mobike" />)</t> and <xref format="counter" target="mobike"/>).</li>
<t>Retransmission behavior is clarified (<xref target="retr" />)</t> <li>Retransmission behavior is clarified (<xref target="retr" format="
<t>The use of cookies and puzzles is described in more detail (<xref default"/>).</li>
target="cookie-puzzle" />)</t> <li>The use of cookies and puzzles is described in more detail (<xref
<t>Error handling is clarified (<xref target="errors" />)</t> target="cookie-puzzle" format="default"/>).</li>
<t>Implications of TCP encapsulation on IPsec SA processing are expa <li>Error handling is clarified (<xref target="errors" format="default
nded (<xref target="ipsec" />)</t> "/>).</li>
<t><xref target="extensions" /> describing interactions with other I <li>Implications of TCP encapsulation on IPsec SA processing are expan
KEv2 extensions is added</t> ded (<xref target="ipsec" format="default"/>).</li>
<t>The interaction of TCP encapsulation with MOBIKE is clarified (<x <li>
ref target="mobike" />)</t> <xref target="extensions" format="default"/> describing interactions
<t>The recommendation for TLS encapsulation (<xref target="tls" />) with other IKEv2 extensions is added.</li>
now includes TLS 1.3</t> <li>The interaction of TCP encapsulation with IKEv2 Mobility and Multi
<t>Examples of TLS encapsulation are provided using TLS 1.3 (<xref t homing (MOBIKE) is clarified (<xref target="mobike" format="default"/>).</li>
arget="tls-example" />)</t> <li>The recommendation for TLS encapsulation (<xref target="tls" forma
<t>More security considerations are added.</t> t="default"/>) now includes TLS 1.3.</li>
</list> <li>Examples of TLS encapsulation are provided using TLS 1.3 (<xref ta
</t> rget="tls-example" format="default"/>).</li>
<li>More security considerations are added.</li>
</section> </ul>
</section>
<section anchor="mustshouldmay" title="Terminology and Notation"> <section anchor="mustshouldmay" numbered="true" toc="default">
<t> This document distinguishes between the IKE peer that initiates TC <name>Terminology and Notation</name>
P <t> This document distinguishes between the IKE peer that initiates TCP
connections to be used for TCP encapsulation and the roles of connections to be used for TCP encapsulation and the roles of
Initiator and Responder for particular IKE messages. During the Initiator and Responder for particular IKE messages. During the
course of IKE exchanges, the role of IKE Initiator and Responder may 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 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 the TCP connection is still responsible for tearing down the TCP
connection and re-establishing it if necessary. For this reason, connection and re-establishing it if necessary. For this reason,
this document will use the term "TCP Originator" to indicate the IKE this document will use the term "TCP Originator" to indicate the IKE
peer that initiates TCP connections. The peer that receives TCP peer that initiates TCP connections. The peer that receives TCP
connections will be referred to as the "TCP Responder". If an IKE SA connections will be referred to as the "TCP Responder". If an IKE SA
is rekeyed one or more times, the TCP Originator MUST remain the peer is rekeyed one or more times, the TCP Originator <bcp14>MUST</bcp14> r emain the peer
that originally initiated the first IKE SA. that originally initiated the first IKE SA.
</t> </t>
<t>
<t> The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT" The key words "<bcp14>MUST</bcp14>", "<bcp14>MUST NOT</bcp14>", "<bcp14>REQU
, "SHOULD", "SHOULD NOT", IRED</bcp14>", "<bcp14>SHALL</bcp14>", "<bcp14>SHALL
"RECOMMENDED", "NOT RECOMMENDED", "MAY", and "OPTIONAL" in this docume NOT</bcp14>", "<bcp14>SHOULD</bcp14>", "<bcp14>SHOULD NOT</bcp14>", "<bcp14>
nt are to be interpreted RECOMMENDED</bcp14>", "<bcp14>NOT RECOMMENDED</bcp14>",
as described in BCP 14 <xref target="RFC2119" /> <xref target="RFC8174 "<bcp14>MAY</bcp14>", and "<bcp14>OPTIONAL</bcp14>" in this document are to
" /> when, and only when, be interpreted as
they appear in all capitals, as shown here. described in BCP&nbsp;14 <xref target="RFC2119"/> <xref target="RFC8174"/>
</t> when, and only when, they appear in all capitals, as shown here.
</section> </t>
</section> </section>
</section>
<section title="Configuration" anchor="config"> <section anchor="config" numbered="true" toc="default">
<t>One of the main reasons to use TCP encapsulation is that UDP traffic <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 may be entirely blocked on a network. Because of this, support for
TCP encapsulation is not specifically negotiated in the IKE exchange. TCP encapsulation is not specifically negotiated in the IKE exchange.
Instead, support for TCP encapsulation must be pre-configured on both Instead, support for TCP encapsulation must be preconfigured on both
the TCP Originator and the TCP Responder.</t> the TCP Originator and the TCP Responder.</t>
<t>Compliant implementations <bcp14>MUST</bcp14> support TCP encapsulation
<t>Compliant implementations MUST support TCP encapsulation on TCP port on TCP port 4500,
4500,
which is reserved for IPsec NAT traversal.</t> which is reserved for IPsec NAT traversal.</t>
<t>Beyond a flag indicating support for TCP encapsulation, the
<t>Beyond a flag indicating support for TCP encapsulation, the
configuration for each peer can include the following optional configuration for each peer can include the following optional
parameters:</t> parameters:</t>
<ul spacing="normal">
<t><list style="symbols"> <li>Alternate TCP ports on which the specific TCP Responder listens
<t>Alternate TCP ports on which the specific TCP Responder listens
for incoming connections. Note that the TCP Originator may for incoming connections. Note that the TCP Originator may
initiate TCP connections to the TCP Responder from any local port.</t> initiate TCP connections to the TCP Responder from any local port.</li
>
<t>An extra framing protocol to use on top of TCP to further <li>An extra framing protocol to use on top of TCP to further
encapsulate the stream of IKE and IPsec packets. See <xref target="tl encapsulate the stream of IKE and IPsec packets. See <xref target="tl
s" /> s" format="default"/>
for a detailed discussion.</t> for a detailed discussion.</li>
</list> </ul>
</t> <t>Since TCP encapsulation of IKE and IPsec packets adds overhead and
<t>Since TCP encapsulation of IKE and IPsec packets adds overhead and
has potential performance trade-offs compared to direct or has potential performance trade-offs compared to direct or
UDP-encapsulated SAs (as described in <xref target="perf"/>), implementa UDP-encapsulated SAs (as described in <xref target="perf" format="defaul
tions t"/>), implementations
SHOULD prefer ESP direct or UDP-encapsulated SAs over <bcp14>SHOULD</bcp14> prefer ESP direct or UDP-encapsulated SAs over
TCP-encapsulated SAs when possible. TCP-encapsulated SAs when possible.
</t> </t>
</section>
</section> <section anchor="format" numbered="true" toc="default">
<name>TCP-Encapsulated Data Formats</name>
<section title="TCP-Encapsulated Data Formats" anchor="format"> <t>Like UDP encapsulation, TCP encapsulation uses the first 4 bytes
<t>Like UDP encapsulation, TCP encapsulation uses the first four bytes
of a message to differentiate IKE and ESP messages. TCP of a message to differentiate IKE and ESP messages. TCP
encapsulation also adds a 16-bit Length field that precedes every messag e encapsulation also adds a 16-bit Length field that precedes every messag e
to define the boundaries of messages within a stream. to define the boundaries of messages within a stream.
The value in this field is equal to the length of the original me ssage The value in this field is equal to the length of the original me ssage
plus the length of the field itself, in octets. If the first 32 bits 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 co mprise an of the message are zeros (a non-ESP marker), then the contents co mprise an
IKE message. Otherwise, the contents comprise an ESP message. IKE message. Otherwise, the contents comprise an ESP message.
Authentication Header (AH) messages are not supported for TCP AH messages are not supported for TCP
encapsulation. encapsulation.
</t> </t>
<t>Although a TCP stream may be able to send very long messages,
<t>Although a TCP stream may be able to send very long messages, implementations <bcp14>SHOULD</bcp14> limit message lengths to match the
implementations SHOULD limit message lengths to match the lengths lengths
used for UDP encapsulation of ESP messages. used for UDP encapsulation of ESP messages.
The maximum message length is used as the effective MTU The maximum message length is used as the effective MTU
for connections that are being encrypted using ESP, for connections that are being encrypted using ESP,
so the maximum message length will influence characteristics of these so the maximum message length will influence characteristics of these
connections, such as the TCP Maximum Segment Size (MSS). connections, such as the TCP Maximum Segment Size (MSS).
</t> </t>
<t>Due to the fact that the Length field is 16 bits and includes both the
<t>Due to the fact that the Length field is 16-bit and includes both the message length and the
message length and the
length of the field itself, it is impossible to encapsulate messages gre ater than 65533 length of the field itself, it is impossible to encapsulate messages gre ater than 65533
octets in length. In most cases, this is not a problem. Note also that a octets in length. In most cases, this is not a problem. Note that a simi
similar lar
limitation exists for encapsulation ESP in UDP <xref target="RFC3948" /> limitation exists for encapsulation ESP in UDP <xref target="RFC3948" fo
. rmat="default"/>.
</t> </t>
<t>The minimum size of an encapsulated message is 1 octet
<t>The minimum size of an encapsulated message is 1 octet (for NAT-keepalive packets, see <xref target="nat-ka" format="default"/>
(for NAT-keepalive packets, see <xref target="nat-ka" />). Empty message ). Empty messages
s (where the Length field equals 2) <bcp14>MUST</bcp14> be silently ignore
(where the Length field equals to 2) MUST be silently ignored by receive d by receiver.
r. </t>
</t> <t>Note that this method of encapsulation will also work for placing IKE
<t>Note that this method of encapsulation will also work for placing IKE
and ESP messages within any protocol that presents a stream and ESP messages within any protocol that presents a stream
abstraction, beyond TCP. abstraction, beyond TCP.
</t> </t>
<section anchor="format-ike" numbered="true" toc="default">
<section title="TCP-Encapsulated IKE Message Format" anchor="format-ike" <name>TCP-Encapsulated IKE Message Format</name>
> <figure anchor="f-format-ike">
<figure title="IKE message format for TCP encapsulation" anchor="f-for <name>IKE Message Format for TCP Encapsulation</name>
mat-ike"><artwork><![CDATA[ <artwork name="" type="" align="left" alt=""><![CDATA[
1 2 3 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 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 | | Length |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Non-ESP Marker | | Non-ESP Marker |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| | | |
~ IKE message [RFC7296] ~ ~ IKE Message (RFC 7296) ~
| | | |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+]]></artwork>
]]></artwork> </figure>
</figure> <t> The IKE message is preceded by a 16-bit Length field in network byte
<t> The IKE message is preceded by a 16-bit Length field in network by
te
order that specifies the length of the IKE message (including the order that specifies the length of the IKE message (including the
non-ESP marker) within the TCP stream. As with IKE over UDP 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 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 start of the IKE header in order to differentiate the traffic from
ESP traffic between the same addresses and ports. ESP traffic between the same addresses and ports.
</t> </t>
<dl newline="false" spacing="normal">
<t><list style="symbols"> <dt>Length (2 octets, unsigned integer):</dt> <dd> Length of the IKE m
<t>Length (2 octets, unsigned integer) - Length of the IKE message, essage,
including the Length field and non-ESP marker. The value in the Leng th including the Length field and non-ESP marker. The value in the Leng th
field MUST NOT be 0 or 1. The receiver MUST treat these v field <bcp14>MUST NOT</bcp14> be 0 or 1. The receiver <bc
alues as p14>MUST</bcp14> treat these values as
fatal errors and MUST close the TCP connection. fatal errors and <bcp14>MUST</bcp14> close the TCP connec
</t> tion.
<t>Non-ESP Marker (4 octets) - Four zero-valued bytes. </dd>
</t> <dt>Non-ESP Marker (4 octets):</dt> <dd>Four zero-valued bytes.</dd>
</list> </dl>
</t> </section>
<section anchor="format-esp" numbered="true" toc="default">
</section> <name>TCP-Encapsulated ESP Packet Format</name>
<figure anchor="f-format-esp">
<section title="TCP-Encapsulated ESP Packet Format" anchor="format-esp"> <name>ESP Packet Format for TCP Encapsulation</name>
<figure title="ESP packet format for TCP encapsulation" anchor="f-form <artwork name="" type="" align="left" alt=""><![CDATA[
at-esp"><artwork><![CDATA[
1 2 3 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 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 | | Length |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| | | |
~ ESP packet [RFC4303] ~ ~ ESP Packet (RFC 4303) ~
| | | |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+]]></artwork>
]]></artwork> </figure>
</figure> <t>The ESP packet is preceded by a 16-bit Length field in network byte
<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 order that specifies the length of the ESP packet within the TCP
stream.</t> stream.</t>
<t>The Security Parameter Index (SPI) field <xref target="RFC7296" forma
<t>The Security Parameter Index (SPI) field <xref target="RFC7296"/> i t="default"/> in the ESP header
n the ESP header <bcp14>MUST NOT</bcp14> be a zero value.</t>
MUST NOT be a zero value.</t> <dl newline="false" spacing="normal">
<dt>Length (2 octets, unsigned integer):</dt> <dd>Length of the ESP
<t><list style="symbols"> packet, including the Length field. The value in the Length field
<t>Length (2 octets, unsigned integer) - Length of the ESP packet, <bcp14>MUST NOT</bcp14> be 0 or 1. The receiver <bcp14>MUST</bcp14>
including the Length field. The value in the Length treat these values as fatal errors and <bcp14>MUST</bcp14> close TCP
field MUST NOT be 0 or 1. The receiver MUST treat these v connection.</dd>
alues as </dl>
fatal errors and MUST close TCP connection.</t> </section>
</section>
</list> <section anchor="prefix" numbered="true" toc="default">
</t> <name>TCP-Encapsulated Stream Prefix</name>
<t>Each stream of bytes used for IKE and IPsec encapsulation <bcp14>MUST</
</section> bcp14> begin
</section> with a fixed sequence of 6 bytes as a magic value, containing the
<section title="TCP-Encapsulated Stream Prefix" anchor="prefix">
<t>Each stream of bytes used for IKE and IPsec encapsulation MUST begin
with a fixed sequence of six bytes as a magic value, containing the
characters "IKETCP" as ASCII values. characters "IKETCP" as ASCII values.
</t> </t>
<figure anchor="f-prefix">
<figure title="TCP-Encapsulated Stream Prefix" anchor="f-prefix"><artwor <name>TCP-Encapsulated Stream Prefix</name>
k><![CDATA[ <artwork name="" type="" align="left" alt=""><![CDATA[
0 1 2 3 4 5 0 1 2 3 4 5
+------+------+------+------+------+------+ +------+------+------+------+------+------+
| 0x49 | 0x4b | 0x45 | 0x54 | 0x43 | 0x50 | | 0x49 | 0x4b | 0x45 | 0x54 | 0x43 | 0x50 |
+------+------+------+------+------+------+ +------+------+------+------+------+------+]]></artwork>
]]></artwork> </figure>
</figure> <t>This value is intended to
<t>This value is intended to
identify and validate that the TCP connection is being used for TCP identify and validate that the TCP connection is being used for TCP
encapsulation as defined in this document, to avoid conflicts with encapsulation as defined in this document, to avoid conflicts with
the prevalence of previous non-standard protocols that used TCP the prevalence of previous non-standard protocols that used TCP
port 4500. This value is only sent once, by the TCP Originator only, 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. at the beginning of the TCP stream of IKE and ESP messages.
</t> </t>
<figure><artwork><![CDATA[ <artwork name="" type="" align="left" alt=""><![CDATA[
Initiator Responder Initiator Responder
--------------------------------------------------------------------- ---------------------------------------------------------------------
<new TCP connection is established by Initiator> <new TCP connection is established by Initiator>
Stream Prefix|Length|non-ESP marker|IKE message --> 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|non-ESP marker|IKE message -->
<-- Length|non-ESP marker|IKE message <-- Length|non-ESP marker|IKE message
[...] [...]
Length|ESP packet -> Length|ESP packet ->
<- Length|ESP packet <- Length|ESP packet]]></artwor
]]></artwork> k>
</figure>
<t>If other framing protocols are used within TCP to further encapsulate <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 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 be at the start of the TCP Originator's IKE and ESP message stream
within the added protocol layer (<xref target="tls" />). Although some framing within the added protocol layer (<xref target="tls" format="default"/>). Although some framing
protocols do support negotiating inner protocols, the stream prefix protocols do support negotiating inner protocols, the stream prefix
should always be used in order for implementations to be as generic 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. as possible and not rely on other framing protocols on top of TCP.
</t> </t>
</section>
</section> <section anchor="applicability" numbered="true" toc="default">
<name>Applicability</name>
<section title="Applicability" anchor="applicability"> <t>TCP encapsulation is applicable only when it has been configured to
<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 be used with specific IKE peers. If a Responder is configured to accept and is allowed to use
TCP encapsulation, it MUST listen on the configured port(s) in case TCP encapsulation, it <bcp14>MUST</bcp14> listen on the configured port(
any peers will initiate new IKE sessions. Initiators MAY use TCP s) in case
any peers will initiate new IKE sessions. Initiators <bcp14>MAY</bcp14>
use TCP
encapsulation for any IKE session to a peer that is configured to encapsulation for any IKE session to a peer that is configured to
support TCP encapsulation, although it is recommended that Initiators support TCP encapsulation, although it is recommended that Initiators
only use TCP encapsulation when traffic over UDP is blocked. only use TCP encapsulation when traffic over UDP is blocked.
</t> </t>
<t>Since the support of TCP encapsulation is a configured property, not
<t>Since the support of TCP encapsulation is a configured property, not
a negotiated one, it is recommended that if there are multiple IKE a negotiated one, it is recommended that if there are multiple IKE
endpoints representing a single peer (such as multiple machines with endpoints representing a single peer (such as multiple machines with
different IP addresses when connecting by Fully Qualified Domain different IP addresses when connecting by Fully Qualified Domain
Name, or endpoints used with IKE redirection), all of the endpoints Name (FQDN), or endpoints used with IKE redirection), all of the endpoin ts
equally support TCP encapsulation. equally support TCP encapsulation.
</t> </t>
<t>If TCP encapsulation is being used for a specific IKE SA, all
<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 SAs <bcp14>MU
IKE messages for that IKE SA and ESP packets for its Child SAs MUST be s ST</bcp14> be sent over a TCP
ent over a TCP
connection until the SA is deleted or IKEv2 Mobility and Multihoming connection until the SA is deleted or IKEv2 Mobility and Multihoming
(MOBIKE) is used to change the SA endpoints and/or the encapsulation (MOBIKE) is used to change the SA endpoints and/or the encapsulation
protocol. See <xref target="mobike"/> for more details on using MOBIKE to protocol. See <xref target="mobike" format="default"/> for more details on using MOBIKE to
transition between encapsulation modes. transition between encapsulation modes.
</t> </t>
<section anchor="fallback" numbered="true" toc="default">
<section title="Recommended Fallback from UDP" anchor="fallback"> <name>Recommended Fallback from UDP</name>
<t>Since UDP is the preferred method of transport for IKE messages, <t>Since UDP is the preferred method of transport for IKE messages,
implementations that use TCP encapsulation should have an algorithm implementations that use TCP encapsulation should have an algorithm
for deciding when to use TCP after determining that UDP is unusable. for deciding when to use TCP after determining that UDP is unusable.
If an Initiator implementation has no prior knowledge about the If an Initiator implementation has no prior knowledge about the
network it is on and the status of UDP on that network, it SHOULD network it is on and the status of UDP on that network, it <bcp14>SHOU LD</bcp14>
always attempt to negotiate IKE over UDP first. IKEv2 defines how to always attempt to negotiate IKE over UDP first. IKEv2 defines how to
use retransmission timers with IKE messages and, specifically, use retransmission timers with IKE messages and, specifically,
IKE_SA_INIT messages <xref target="RFC7296"/>. Generally, this means that the IKE_SA_INIT messages <xref target="RFC7296" format="default"/>. Gener ally, this means that the
implementation will define a frequency of retransmission and the implementation will define a frequency of retransmission and the
maximum number of retransmissions allowed before marking the IKE SA maximum number of retransmissions allowed before marking the IKE SA
as failed. An implementation can attempt negotiation over TCP once as failed. An implementation can attempt negotiation over TCP once
it has hit the maximum retransmissions over UDP, or slightly before it has hit the maximum retransmissions over UDP, or slightly before
to reduce connection setup delays. It is recommended that the to reduce connection setup delays. It is recommended that the
initial message over UDP be retransmitted at least once before initial message over UDP be retransmitted at least once before
falling back to TCP, unless the Initiator knows beforehand that the falling back to TCP, unless the Initiator knows beforehand that the
network is likely to block UDP. network is likely to block UDP.
</t> </t>
<t>When switching from UDP to TCP, a new IKE_SA_INIT exchange <bcp14>MUS
<t>When switching from UDP to TCP, a new IKE_SA_INIT exchange MUST be T</bcp14> be
initiated with the Initiator's new SPI and with recalculated content o f initiated with the Initiator's new SPI and with recalculated content o f
NAT_DETECTION_*_IP notifications. NAT_DETECTION_*_IP notifications.
</t> </t>
</section>
</section> </section>
</section>
<section title="Using TCP Encapsulation" anchor="tcp-encap"> <section anchor="tcp-encap" numbered="true" toc="default">
<section title="Connection Establishment and Teardown" anchor="establish <name>Using TCP Encapsulation</name>
"> <section anchor="establish" numbered="true" toc="default">
<t>When the IKE Initiator uses TCP encapsulation, it will initiate a T <name>Connection Establishment and Teardown</name>
CP <t>When the IKE Initiator uses TCP encapsulation, it will initiate a TCP
connection to the Responder using the Responder's preconfigured TCP po rt. The first connection to the Responder using the Responder's preconfigured TCP po rt. The first
bytes sent on the TCP stream MUST be the stream prefix value (<xref ta rget="prefix"/>). bytes sent on the TCP stream <bcp14>MUST</bcp14> be the stream prefix value (<xref target="prefix" format="default"/>).
After this prefix, encapsulated IKE messages will negotiate the IKE After this prefix, encapsulated IKE messages will negotiate the IKE
SA and initial Child SA <xref target="RFC7296"/>. After this point, b SA and initial Child SA <xref target="RFC7296" format="default"/>. Af
oth ter this point, both
encapsulated IKE (<xref target="f-format-ike" />) and ESP (<xref targe encapsulated IKE (<xref target="f-format-ike" format="default"/>) and
t="f-format-esp" />) ESP (<xref target="f-format-esp" format="default"/>)
messages will be sent over the TCP connection. The TCP Responder MUST messages will be sent over the TCP connection. The TCP Responder <bcp
wait for the entire 14>MUST</bcp14> wait for the entire
stream prefix to be received on the stream before trying to parse out 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 any IKE or ESP messages. The stream prefix is sent only once, and
only by the TCP Originator. only by the TCP Originator.
</t> </t>
<t>In order to close an IKE session, either the Initiator or Responder
<t>In order to close an IKE session, either the Initiator or Responder <bcp14>SHOULD</bcp14> gracefully tear down IKE SAs with DELETE payload
SHOULD gracefully tear down IKE SAs with DELETE payloads. Once the s. Once the
SA has been deleted, the TCP Originator SHOULD close the TCP SA has been deleted, the TCP Originator <bcp14>SHOULD</bcp14> close th
e TCP
connection if it does not intend to use the connection for another 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 IKE session to the TCP Responder. If the TCP connection is no longer
associated with any active IKE SA, the TCP Responder MAY close the con associated with any active IKE SA, the TCP Responder <bcp14>MAY</bcp14
nection > close the connection
to clean up IKE resources if TCP Originator didn't close it within som to clean up IKE resources if the TCP Originator didn't close it within
e reasonable period of time (e.g., a few seconds). some reasonable period of time (e.g., a few seconds).
</t> </t>
<t>An unexpected FIN or a TCP Reset on the TCP connection may indicate a
<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 loss of connectivity, an attack, or some other error. If a DELETE
payload has not been sent, both sides SHOULD maintain the state for payload has not been sent, both sides <bcp14>SHOULD</bcp14> maintain t he state for
their SAs for the standard lifetime or timeout period. The TCP their SAs for the standard lifetime or timeout period. The TCP
Originator is responsible for re-establishing the TCP connection if Originator is responsible for re-establishing the TCP connection if
it is torn down for any unexpected reason. Since new TCP connections 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 loc al address or port allocations may use different IP addresses and/or ports due to NAT mappings or loc al address or port allocations
changing, the TCP Responder MUST allow packets for existing SAs to be changing, the TCP Responder <bcp14>MUST</bcp14> allow packets for exis ting SAs to be
received from new source IP addresses and ports. Note that the received from new source IP addresses and ports. Note that the
IPv6 Flow-ID header MUST remain constant when new TCP connection is cre IPv6 Flow-ID header <bcp14>MUST</bcp14> remain constant when a new TCP
ated to avoid ECMP load balancing. connection is created to avoid ECMP load balancing.
</t>
<t>A peer MUST discard a partially received message due to a broken </t>
<t>A peer <bcp14>MUST</bcp14> discard a partially received message due t
o a broken
connection. connection.
</t> </t>
<t>Whenever the TCP Originator opens a new TCP connection to be used for
<t>Whenever the TCP Originator opens a new TCP connection to be used f an existing IKE SA, it <bcp14>MUST</bcp14> send the stream prefix firs
or t, before any
an existing IKE SA, it MUST send the stream prefix first, before any
IKE or ESP messages. This follows the same behavior as the initial IKE or ESP messages. This follows the same behavior as the initial
TCP connection. TCP connection.
</t> </t>
<t>Multiple IKE SAs <bcp14>MUST NOT</bcp14> share a single TCP connectio
<t>Multiple IKE SAs MUST NOT share a single TCP connection, unless one n, unless one
is a rekey of an existing IKE SA, in which case there will is a rekey of an existing IKE SA, in which case there will
temporarily be two IKE SAs on the same TCP connection. temporarily be two IKE SAs on the same TCP connection.
</t> </t>
<t>If a TCP connection is being used to continue an existing IKE/ESP
<t>If a TCP connection is being used to continue an existing IKE/ESP s session, the TCP Responder can recognize the session using either the
ession, IKE SPI from an encapsulated IKE message or the ESP SPI from an
the TCP Responder can recognize the session using either the IKE SPI encapsulated ESP packet. If the session had been fully established
from an encapsulated IKE message or the ESP SPI from an encapsulated previously, it is suggested that the TCP Originator send an
ESP packet. If the session had been fully established previously, UPDATE_SA_ADDRESSES message if MOBIKE is supported and an
it is suggested that the TCP Originator send an UPDATE_SA_ADDRESSES empty informational message if it is not.
message if MOBIKE is supported, or an empty informational message othe </t>
rwise. <t>The TCP Responder <bcp14>MUST NOT</bcp14> accept any messages for the
</t> existing IKE
<t>The TCP Responder MUST NOT accept any messages for the existing IKE
session on a new incoming connection, unless that connection begins session on a new incoming connection, unless that connection begins
with the stream prefix. If either the TCP Originator or TCP with the stream prefix. If either the TCP Originator or TCP
Responder detects corruption on a connection that was started with a Responder detects corruption on a connection that was started with a
valid stream prefix, it SHOULD close the TCP connection. The valid stream prefix, it <bcp14>SHOULD</bcp14> close the TCP connection
connection can be determined to be corrupted if there are too many . The
connection can be corrupted if there are too many
subsequent messages that cannot be parsed as valid IKE messages or subsequent messages that cannot be parsed as valid IKE messages or
ESP messages with known SPIs, or if the authentication check for an ESP messages with known SPIs, or if the authentication check for an
IKE message or ESP message with a known SPI fails. Implementations SH OULD NOT IKE message or ESP message with a known SPI fails. Implementations <b cp14>SHOULD NOT</bcp14>
tear down a connection if only a few consecutive ESP packets have unkn own tear down a connection if only a few consecutive ESP packets have unkn own
SPIs, since the SPI databases may be momentarily out of sync. If SPIs since the SPI databases may be momentarily out of sync. If
there is instead a syntax issue within an IKE message, an there is instead a syntax issue within an IKE message, an
implementation MUST send the INVALID_SYNTAX notify payload and implementation <bcp14>MUST</bcp14> send the INVALID_SYNTAX notify payl oad and
tear down the IKE SA as usual, rather than tearing down the TCP tear down the IKE SA as usual, rather than tearing down the TCP
connection directly. connection directly.
</t> </t>
<t>A TCP Originator <bcp14>SHOULD</bcp14> only open one TCP connection p
<t>A TCP Originator SHOULD only open one TCP connection per IKE SA, ov er IKE SA, over
er
which it sends all of the corresponding IKE and ESP messages. This which it sends all of the corresponding IKE and ESP messages. This
helps ensure that any firewall or NAT mappings allocated for the TCP helps ensure that any firewall or NAT mappings allocated for the TCP
connection apply to all of the traffic associated with the IKE SA connection apply to all of the traffic associated with the IKE SA
equally. equally.
</t> </t>
<t> As with TCP Originators, a TCP Responder <bcp14>SHOULD</bcp14> send
<t>Similarly, a TCP Responder SHOULD at any given time send packets fo packets for an
r IKE SA and its Child SAs over only one TCP connection at any given
an IKE SA and its Child SAs over only one TCP connection. It SHOULD time. It <bcp14>SHOULD</bcp14> choose the TCP connection on which it last rec
choose the TCP connection on which it last received a valid and eived
decryptable IKE or ESP message. In order to be considered valid for a valid and decryptable IKE or ESP message. In order to be
choosing a TCP connection, an IKE message must be successfully considered valid for choosing a TCP connection, an IKE message must
decrypted and authenticated, not be a retransmission of a previously be successfully decrypted and authenticated, not be a retransmission
received message, and be within the expected window for IKE of a previously received message, and be within the expected window
message IDs. Similarly, an ESP message must pass authentication for IKE message IDs. Similarly, an ESP message must be successfully
checks and be decrypted, and must not be a replay of a previous decrypted and authenticated, and must not be a replay of a previous
message. message.
</t> </t>
<t>Since a connection may be broken and a new connection re-established
<t>Since a connection may be broken and a new connection re-establishe
d
by the TCP Originator without the TCP Responder being aware, a TCP by the TCP Originator without the TCP Responder being aware, a TCP
Responder SHOULD accept receiving IKE and ESP messages on both old Responder <bcp14>SHOULD</bcp14> accept receiving IKE and ESP messages on both old
and new connections until the old connection is closed by the TCP and new connections until the old connection is closed by the TCP
Originator. A TCP Responder MAY close a TCP connection that it Originator. A TCP Responder <bcp14>MAY</bcp14> close a TCP connection that it
perceives as idle and extraneous (one previously used for IKE and ESP perceives as idle and extraneous (one previously used for IKE and ESP
messages that has been replaced by a new connection). messages that has been replaced by a new connection).
</t> </t>
</section>
</section> <section anchor="retr" numbered="true" toc="default">
<name>Retransmissions</name>
<t><xref target="RFC7296" sectionFormat="of" section="2.1"/> describes h
ow IKEv2 deals with the unreliability
of the UDP protocol.
<section title="Retransmissions" anchor="retr" > In brief, the exchange Initiator is responsible for retransmissions
<t>Section 2.1 of <xref target="RFC7296" /> describes how IKEv2 deals and must retransmit request messages until a response message is
with the unreliability received. If no reply is received after several
of the UDP protocol. In brief, the exchange Initiator is responsible
for
retransmissions and must retransmit requests message until response
message is received. If no reply is received after several
retransmissions, the SA is deleted. The Responder never initiates ret ransmission, retransmissions, the SA is deleted. The Responder never initiates ret ransmission,
but must send a response message again in case it receives a retransmi but it must send a response message again in case it receives a retran
tted request. smitted request.
</t> </t>
<t>When IKEv2 uses a reliable transport protocol, like TCP, the retransm
ission rules are as follows:
</t>
<t>When IKEv2 uses a reliable transport protocol, like TCP, the retran <ul spacing="normal">
smission rules are as follows: <li>The exchange Initiator <bcp14>SHOULD NOT</bcp14> retransmit reques
<list style="symbols" > t message (*); if
<t>The exchange Initiator SHOULD NOT retransmit request message (*);
if
no response is received within some reasonable period of time, the no response is received within some reasonable period of time, the
IKE SA is deleted. IKE SA is deleted.
</t> </li>
<t>If a new TCP connection for the IKE SA is established while the e <li>If a new TCP connection for the IKE SA is established while the ex
xchange change
Initiator is waiting for a response, the Initiator MUST Initiator is waiting for a response, the Initiator <bcp14>MUST</bcp1
4>
retransmit its request over this connection and continue to wait for a response. retransmit its request over this connection and continue to wait for a response.
</t> </li>
<t>The exchange Responder does not change its behavior, but acts as <li>The exchange Responder does not change its behavior, but acts as
described in Section 2.1 of <xref target="RFC7296" />. described in <xref target="RFC7296" sectionFormat="of" se
</t> ction="2.1"/>.
</list> </li>
(*) This is an optimization, implementations may continue to use the r </ul>
etransmission logic from <t>
Section 2.1 of <xref target="RFC7296" /> for simplicity. (*) This is an optimization; implementations may continue to use the r
</t> etransmission logic from
</section> <xref target="RFC7296" sectionFormat="of" section="2.1"/> for simplici
ty.
<section title="Cookies and Puzzles" anchor="cookie-puzzle" > </t>
<t>IKEv2 provides a DoS attack protection mechanism through Cookies, w </section>
hich <section anchor="cookie-puzzle" numbered="true" toc="default">
is described in Section 2.6 of <xref target="RFC7296" />. <xref targe <name>Cookies and Puzzles</name>
t="RFC8019" /> extends this <t>IKEv2 provides a DoS attack protection mechanism through Cookies, whi
ch
is described in <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 mechanism for protection against DDoS attacks by means of Client
Puzzles. Both mechanisms allow the Responder to avoid keeping state u ntil Puzzles. Both mechanisms allow the Responder to avoid keeping state u ntil
the Initiator proves its IP address is legitimate (and after solving a puzzle if required). the Initiator proves its IP address is legitimate (and after solving a puzzle if required).
</t> </t>
<t>The connection-oriented nature of TCP transport brings additional
<t>The connection-oriented nature of TCP transport brings additional
considerations for using these mechanisms. considerations for using these mechanisms.
In general, Cookies provide less value in case of TCP encapsulation, In general, Cookies provide less value in the case of TCP encapsulatio
since by the time a Responder receives the IKE_SA_INIT request, the TC n; by the time a Responder receives the IKE_SA_INIT request, the TCP
P
session has already been established and the Initiator's IP address session has already been established and the Initiator's IP address
has been verified. Moreover, a TCP/IP stack creates state once has been verified. Moreover, a TCP/IP stack creates state once
a TCP SYN packet is received (unless SYN Cookies described in <xref ta rget="RFC4987" /> a TCP SYN packet is received (unless SYN Cookies described in <xref ta rget="RFC4987" format="default"/>
are employed), which contradicts the statelessness of IKEv2 Cookies. are employed), which contradicts the statelessness of IKEv2 Cookies.
In particular, with TCP, an attacker is able to mount a SYN flooding D oS attack In particular, with TCP, an attacker is able to mount a SYN flooding D oS attack
which an IKEv2 Responder cannot prevent using stateless IKEv2 Cookies. that an IKEv2 Responder cannot prevent using stateless IKEv2 Cookies.
Thus, when using TCP encapsulation, it makes little sense to send Cook ie requests without Thus, when using TCP encapsulation, it makes little sense to send Cook ie requests without
Puzzles unless the Responder is concerned with a possibility of TCP Puzzles unless the Responder is concerned with a possibility of TCP
Sequence Number attacks (see <xref target="RFC6528" /> for details). P uzzles, on sequence number attacks (see <xref target="RFC6528"/> and <xref target ="RFC9293" format="default"/> for details). Puzzles, on
the other hand, still remain useful (and their use requires usi ng Cookies). the other hand, still remain useful (and their use requires usi ng Cookies).
</t> </t>
<t>The following considerations are applicable for using Cookie and
<t>The following considerations are applicable for using Cookie and Puzzle mechanisms in the case of TCP encapsulation:
Puzzle mechanisms in case of TCP encapsulation: </t>
<list style="symbols" > <ul spacing="normal">
<t>the exchange Responder SHOULD NOT send an IKEv2 Cookie request wi <li>The exchange Responder <bcp14>SHOULD NOT</bcp14> send an IKEv2 Coo
thout an accompanied Puzzle; kie request without an accompanied Puzzle;
implementations might choose to have exceptions to this for c implementations might choose to have exceptions to this for c
ases like mitigating TCP Sequence Number attacks. ases like mitigating TCP sequence number attacks.
</t> </li>
<t>if the Responder chooses to send a Cookie request (possibly along <li>If the Responder chooses to send a Cookie request (possibly along
with Puzzle request), then the TCP connection that the IKE_SA_INIT with Puzzle request), then the TCP connection that the IKE_SA_INIT
request message was received over SHOULD be closed after the Respond er sends its reply request message was received over <bcp14>SHOULD</bcp14> be closed af ter the Responder sends its reply
and no repeated requests are received within some short period of ti me and no repeated requests are received within some short period of ti me
to keep the Responder stateless (see <xref target="tradeoff" />). No te that the Responder MUST NOT to keep the Responder stateless (see <xref target="tradeoff" format= "default"/>). Note that the Responder <bcp14>MUST NOT</bcp14>
include the Initiator's TCP port into the Cookie include the Initiator's TCP port into the Cookie
calculation (*), since the Cookie can be returned over a new calculation (*) since the Cookie can be returned over a n ew
TCP connection with a different port. TCP connection with a different port.
</t> </li>
<t>the exchange Initiator acts as described in Section 2.6 of <li>The exchange Initiator acts as described in <xref target="RFC7296"
<xref target="RFC7296" /> and Section 7 of <xref target="RFC8019" /> sectionFormat="of" section="2.6"/> and <xref target="RFC8019" sectionFormat="of
, " section="7"/>, i.e., using TCP encapsulation doesn't change the Initiator's be
i.e. using TCP encapsulation doesn't change the Initiator's behavior havior.
. </li>
</t> </ul>
</list> <t>
(*) Examples of Cookie calculation methods are given in Section 2.6 (*) Examples of Cookie calculation methods are given in <xref
of <xref target="RFC7296" /> and in Section 7.1.1.3 of <xref target="R target="RFC7296" sectionFormat="of" section="2.6"/> and in <xref
FC8019" /> target="RFC8019" sectionFormat="of" section="7.1.1.3"/>, and they don'
and they don't include transport protocol ports. However these exampl t
es are given include transport protocol ports. However, these examples are given
for illustrative purposes, since Cookie generation algorithm is a for illustrative purposes since the Cookie generation algorithm is a
local matter and some implementations might include port numbers, local matter and some implementations might include port numbers
that won't work with TCP encapsulation. Note also that these that won't work with TCP encapsulation. Note also that these
examples include the Initiator's IP address in Cookie calculation. examples include the Initiator's IP address in Cookie calculation.
In general this address may change between two initial requests (with In general, this address may change between two initial requests
and without Cookies). (with and without Cookies). This may happen due to NATs, which
This may happen due to NATs, since NATs have more freedom to change so have more freedom to change source IP addresses for new TCP
urce IP addresses for new connections than for UDP. In such cases, cookie verification might
TCP connections than for UDP. In such cases cookie verification might fail.
fail. </t>
</t> <section anchor="tradeoff" numbered="true" toc="default">
<name>Statelessness versus Delay of SA Establishment</name>
<section title="Statelessness versus Delay of SA Establishment" anchor <t>
="tradeoff" >
<t>
There is a trade-off in choosing the period of time after which 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 In itiator the TCP connection is closed. If it is too short, then the proper In itiator
which repeats its request would need to re-establish the TCP connect ion that repeats its request would need to re-establish the TCP connecti on,
introducing additional delay. On the other hand, if it is too long, then introducing additional delay. On the other hand, if it is too long, then
the Responder's resources would be wasted in case the Initiator neve r comes back. the Responder's resources would be wasted in case the Initiator neve r comes back.
This document doesn't specify the duration of time, because it doesn This document doesn't mandate the duration of time because it doesn'
't affect interoperability, t affect interoperability,
but it is believed that 5-10 seconds is a good compromise. Note also but it is believed that 5-10 seconds is a good compromise. Also, not
, that if the Responder requests e that if the Responder requests that
the Initiator to solve a puzzle, then the Responder can estimate how the Initiator solve a puzzle, then the Responder can estimate how lo
long it would take the Initiator ng it would take the Initiator
to find a solution and adjust the time interval accordingly. to find a solution and adjust the time interval accordingly.
</t>
</section>
</section>
<section title="Error Handling in IKE_SA_INIT" anchor="errors" >
<t>Section 2.21.1 of <xref target="RFC7296" /> describes how error not
ifications
are handled in the IKE_SA_INIT exchange. In particular, it is
advised
that the Initiator should not act immediately after receiving an error
notification and should instead wait some time for valid response,
since the IKE_SA_INIT messages are completely unauthenticated. This
advice does not apply equally in case of TCP encapsulation. If the
Initiator receives a response message over TCP, then either this
message is genuine and was sent by the peer, or the TCP session was
hijacked and the message is forged. In this latter case, no genuine
messages from the Responder will be received.
</t> </t>
</section>
<t>Thus, in case of TCP encapsulation, an Initiator SHOULD NOT wait fo </section>
r <section anchor="errors" numbered="true" toc="default">
<name>Error Handling in IKE_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 error notification; instead, it shoul
d
wait some time for a valid 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 the peer or the TCP session was hijacked and the message is
forged. In the latter case, no genuine messages from the Responder
will be received.
</t>
<t>Thus, in the case of TCP encapsulation, an Initiator <bcp14>SHOULD NO
T</bcp14> wait for
additional messages in case it receives an error notification from the additional messages in case it receives an error notification from the
Responder in the IKE_SA_INIT exchange. Responder in the IKE_SA_INIT exchange.
</t> </t>
<t>In the IKE_SA_INIT exchange, if the Responder returns an error notifi
<t>If in the IKE_SA_INIT exchange the Responder returns an error notif cation that implies
ication that implies
a recovery action from the Initiator (such as INVALID_KE_PAYLOAD a recovery action from the Initiator (such as INVALID_KE_PAYLOAD
or INVALID_MAJOR_VERSION, see Section 2.21.1 of <xref target="RFC7296" or INVALID_MAJOR_VERSION, see <xref target="RFC7296" sectionFormat="of
/>) " section="2.21.1"/>),
then the Responder SHOULD NOT close the TCP connection immediately, in then the Responder <bcp14>SHOULD NOT</bcp14> close the TCP connection
anticipation immediately in anticipation of the fact
that the Initiator will repeat the request with corrected parameters. that the Initiator will repeat the request with corrected parameters.
See also <xref target="cookie-puzzle" />. See also <xref target="cookie-puzzle" format="default"/>.
</t> </t>
</section> </section>
<section anchor="nat-det" numbered="true" toc="default">
<section title="NAT Detection Payloads" anchor="nat-det"> <name>NAT-Detection Payloads</name>
<t>When negotiating over UDP, IKE_SA_INIT packets include <t>When negotiating over UDP, IKE_SA_INIT packets include
NAT_DETECTION_SOURCE_IP and NAT_DETECTION_DESTINATION_IP payloads to NAT_DETECTION_SOURCE_IP and NAT_DETECTION_DESTINATION_IP payloads to
determine if UDP encapsulation of IPsec packets should be used. determine if UDP encapsulation of IPsec packets should be used.
These payloads contain SHA-1 digests of the SPIs, IP addresses, and These payloads contain SHA-1 digests of the SPIs, IP addresses, and
ports as defined in <xref target="RFC7296"/>. IKE_SA_INIT packets sen ports as defined in <xref target="RFC7296" format="default"/>. IKE_SA
t on a TCP _INIT packets sent on a TCP
connection SHOULD include these payloads with the same content as connection <bcp14>SHOULD</bcp14> include these payloads with the same
when sending over UDP and SHOULD use the applicable TCP ports when content as
when sending over UDP and <bcp14>SHOULD</bcp14> use the applicable TCP
ports when
creating and checking the SHA-1 digests. creating and checking the SHA-1 digests.
</t> </t>
<t>If a NAT is detected due to the SHA-1 digests not matching the
<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 expected values, no change should be made for encapsulation of
subsequent IKE or ESP packets, since TCP encapsulation inherently subsequent IKE or ESP packets since TCP encapsulation inherently
supports NAT traversal. However, for the transport mode IPsec SAs, imp lementations supports NAT traversal. However, for the transport mode IPsec SAs, imp lementations
need to handle TCP and UDP packet checksum fixup during decapsulation, need to handle TCP and UDP packet checksum fixup during decapsulation,
as defined for UDP encapsulation in <xref target="RFC3948"/>. as defined for UDP encapsulation in <xref target="RFC3948" format="def
</t> ault"/>.
</t>
<t>Implementations MAY use the information that <t>Implementations <bcp14>MAY</bcp14> use the information that
a NAT is present to influence keepalive timer values. a NAT is present to influence keepalive timer values.
</t> </t>
</section>
</section> <section anchor="nat-ka" numbered="true" toc="default">
<name>NAT-Keepalive Packets</name>
<section title="NAT-keepalive Packets" anchor="nat-ka"> <t>Encapsulating IKE and IPsec inside of a TCP connection can impact the
<t>Encapsulating IKE and IPsec inside of a TCP connection can impact th
e
strategy that implementations use to strategy that implementations use to
maintain middlebox port mappings. maintain middlebox port mappings.
</t> </t>
<t>In general, TCP port mappings are maintained by NATs longer than UDP
<t>In general, TCP port mappings are maintained by NATs longer than UDP port mappings, so IPsec ESP NAT-keepalive packets <xref target="RFC394
port mappings, so IPsec ESP NAT-keepalive packets <xref target="RFC394 8" format="default"/> <bcp14>SHOULD NOT</bcp14> be
8"/> SHOULD NOT be
sent when using TCP encapsulation. Any implementation using TCP sent when using TCP encapsulation. Any implementation using TCP
encapsulation MUST silently drop incoming NAT-keepalive packets encapsulation <bcp14>MUST</bcp14> silently drop incoming NAT-keepalive packets
and not treat them as errors. NAT-keepalive packets over a and not treat them as errors. NAT-keepalive packets over a
TCP-encapsulated IPsec connection will be sent as a one-octet-long pay TCP-encapsulated IPsec connection will be sent as a 1-octet-long paylo
load ad
with the value 0xFF, preceded by the two byte Length specifying a leng with the value 0xFF, preceded by the 2-octet Length specifying a lengt
th h
of 3 (since it includes the length of the Length field). of 3 (since it includes the length of the Length field).
</t> </t>
</section>
</section> <section anchor="dpd" numbered="true" toc="default">
<name>Dead Peer Detection and Transport Keepalives</name>
<section title="Dead Peer Detection and Transport Keepalives" anchor="dpd <t>Peer liveness should be checked
"> using IKE informational packets <xref target="RFC7296" format="default
<t>Peer liveness should be checked "/>.
using IKE informational packets <xref target="RFC7296"/>. </t>
</t> <t>Note that, depending on the configuration of TCP and TLS on the
connection, TCP keep-alives <xref target="RFC1122" format="default"/>
<t>Note that, depending on the configuration of TCP and TLS on the and TLS keep-alives <xref target="RFC6520" format="default"/>
connection, TCP keep-alives <xref target="RFC1122"/> and TLS keep-aliv <bcp14>MAY</bcp14> be used. These <bcp14>MUST NOT</bcp14> be used as
es <xref target="RFC6520"/> indications of IKE peer
MAY be used. These MUST NOT be used as indications of IKE peer
liveness, for which purpose the standard IKEv2 mechanism of exchanging (usually empty) INFORMATIONAL messages is used liveness, for which purpose the standard IKEv2 mechanism of exchanging (usually empty) INFORMATIONAL messages is used
(see Section 1.4 of <xref target="RFC7296" />). (see <xref target="RFC7296" sectionFormat="of" section="1.4"/>).
</t> </t>
</section> </section>
<section anchor="ipsec" numbered="true" toc="default">
<section title="Implications of TCP Encapsulation on IPsec SA Processing <name>Implications of TCP Encapsulation on IPsec SA Processing</name>
" anchor="ipsec" > <t>Using TCP encapsulation affects some aspects of IPsec SA processing.
<t>Using TCP encapsulation affects some aspects of IPsec SA processing </t>
. <ol spacing="normal" type="1"><li><xref target="RFC4301" sectionFormat="
<list style="numbers" > of" section="8.1"/> requires all tunnel mode IPsec SAs to
<t>Section 8.1 of <xref target="RFC4301"/> requires all tunnel mode
IPsec SAs to
be able to copy the Don't Fragment (DF) bit from inner IPv4 header t o be able to copy the Don't Fragment (DF) bit from inner IPv4 header t o
the outer (tunnel) one. With TCP encapsulation this is generally the outer (tunnel) one. With TCP encapsulation, this is generally
not possible, because the TCP/IP stack manages the DF bit in the out not possible because the TCP/IP stack manages the DF bit in the oute
er IPv4 r IPv4
header, and usually the stack ensures that the DF bit is set for TCP header, and usually the stack ensures that the DF bit is set for TCP
packets to avoid IP fragmentation. Note, that this behavior is packets to avoid IP fragmentation. Note, that this behavior is
compliant with generic tunneling considerations, since the outer TCP header acts compliant with generic tunneling considerations since the outer TCP header acts
as a link-layer protocol and its fragmentation and reassembly have n o correlation with as a link-layer protocol and its fragmentation and reassembly have n o correlation with
the inner payload. the inner payload.
</t> </li>
<li>The other feature that is less applicable with TCP encapsulation i
<t>The other feature that is less applicable with TCP encapsulation s an
is an
ability to split traffic of different QoS classes into different ability to split traffic of different QoS classes into different
IPsec SAs, created by a single IKE SA. In this case the IPsec SAs, created by a single IKE SA. In this case, the
Differentiated Services Code Point (DSCP) field is usually copied Differentiated Services Code Point (DSCP) field is usually copied
from the inner IP header to the outer (tunnel) one, ensuring that from the inner IP header to the outer (tunnel) one, ensuring that
IPsec traffic of each SA receives the corresponding level of service . IPsec traffic of each SA receives the corresponding level of service .
With TCP encapsulation all IPsec SAs created by a single IKE SA will With TCP encapsulation, all IPsec SAs created by a single IKE SA wil
share a single TCP connection and thus will receive the same level o l
f share a single TCP connection; thus, they will receive the same leve
service (see <xref target="perf.3" />). If this functionality is ne l of
eded, service (see <xref target="perf.3" format="default"/>). If this fun
implementations should create several IKE SAs each over separate TCP ctionality is needed,
connection implementations should create several IKE SAs each over separate TCP
connections
and assign a corresponding DSCP value to each of them. and assign a corresponding DSCP value to each of them.
</t> </li>
</list> </ol>
</t> <t>TCP encapsulation of IPsec packets may have implications
<t>TCP encapsulation of IPsec packets may have implications
on performance of the encapsulated traffic. Performance considerations on performance of the encapsulated traffic. Performance considerations
are discussed in <xref target="perf" />. are discussed in <xref target="perf" format="default"/>.
</t> </t>
</section>
</section> </section>
</section>
<section title="Interaction with IKEv2 Extensions" anchor="extensions" > <section anchor="extensions" numbered="true" toc="default">
<section title="MOBIKE Protocol" anchor="mobike"> <name>Interaction with IKEv2 Extensions</name>
<t>The MOBIKE protocol, which allows SAs to migrate between IP <section anchor="mobike" numbered="true" toc="default">
addresses, is defined in <xref target="RFC4555"/>, and <xref target="R <name>MOBIKE Protocol</name>
FC4621"/> further clarifies <t>The MOBIKE protocol, which allows SAs to migrate between IP
addresses, is defined in <xref target="RFC4555" format="default"/>; <x
ref target="RFC4621" format="default"/> further clarifies
the details of the protocol. When an IKE session that has negotiated M OBIKE is the details of the protocol. When an IKE session that has negotiated M OBIKE is
transitioning between networks, the Initiator of the transition may transitioning between networks, the Initiator of the transition may
switch between using TCP encapsulation, UDP encapsulation, or no switch between using TCP encapsulation, UDP encapsulation, or no
encapsulation. Implementations that implement both MOBIKE and TCP encapsulation. Implementations that implement both MOBIKE and TCP
encapsulation within the same connection configuration encapsulation within the same connection configuration
MUST support dynamically enabling and disabling TCP <bcp14>MUST</bcp14> support dynamically enabling and disabling TCP
encapsulation as interfaces change. encapsulation as interfaces change.
</t> </t>
<t>When a MOBIKE-enabled Initiator changes networks, the
<t>When a MOBIKE-enabled Initiator changes networks, the INFORMATIONAL exchange with the UPDATE_SA_ADDRESSES notification <bcp1
INFORMATIONAL exchange with the UPDATE_SA_ADDRESSES notification SHOUL 4>SHOULD</bcp14> be initiated
D be initiated
first over UDP before attempting over TCP. If there is a response to the 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 ov er IP or over UDP port 4500 request sent over UDP, then the ESP packets should be sent directly ov er IP or over UDP port 4500
(depending on if a NAT was detected), regardless of if a connection on a previous (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 withi n a certain period of time after network was using TCP encapsulation. If no response is received withi n a certain period of time after
several retransmissions, the Initiator ought to change its transport f or this exchange from several retransmissions, the Initiator ought to change its transport f or this exchange from
UDP to TCP and resend the request message. A new INFORMATIONAL exchang UDP to TCP and resend the request message. A new INFORMATIONAL exchang
e MUST e <bcp14>MUST
NOT be started in this situation. If the Responder only responds to th NOT</bcp14> be started in this situation. If the Responder only respon
e request sent over TCP, then ds to the request sent over TCP, then
the ESP packets should be sent over the TCP connection, regardless of the ESP packets should be sent over the TCP connection, regardless of
if a connection on a previous network did not use TCP encapsulation. if a connection on a previous network did not use TCP encapsulation.
</t> </t>
<t>The value of the timeout and the specific number of retransmissions b
<t>The value of the timeout and the specific number of retransmissions efore switching to
before switching to
TCP can vary depending on the Initiator's configuration. Implementatio ns ought to provide TCP can vary depending on the Initiator's configuration. Implementatio ns ought to provide
reasonable defaults to ensure that UDP attempts have a chance to succe ed, but can shorten reasonable defaults to ensure that UDP attempts have a chance to succe ed, but can shorten
the timeout based on historical data or metrics. the timeout based on historical data or metrics.
</t> </t>
<t>If the TCP transport was used for the previous network connection, th
<t>If the TCP transport was used for the previous network connection, e old TCP
the old TCP connection <bcp14>SHOULD</bcp14> be closed by the Initiator once MOBIK
connection SHOULD be closed by the Initiator once MOBIKE finishes migr E finishes migration
ation
to a new connection (either TCP or UDP). to a new connection (either TCP or UDP).
</t> </t>
<t>Since switching from UDP to TCP can happen during a single
<t>Since switching from UDP to TCP can happen during a single
INFORMATIONAL message exchange, the content of the NAT_DETECTIO N_*_IP INFORMATIONAL message exchange, the content of the NAT_DETECTIO N_*_IP
notifications will in most cases be incorrect (since UDP and TC P ports notifications will in most cases be incorrect (since UDP and TC P ports
will most likely be different), and the peer may incorrectly de tect will most likely be different), and the peer may incorrectly de tect
the presence of a NAT. Section 3.5 of <xref target="RFC4555" /> states that the presence of a NAT. <xref target="RFC4555" sectionFormat="of " section="3.5"/> states that
a new INFORMATIONAL exchange with the UPDATE_SA_ADDRESSES notify is in itiated a new INFORMATIONAL exchange with the UPDATE_SA_ADDRESSES notify is in itiated
in case the address (or transport) is changed while waiting for a resp onse. in case the address (or transport) is changed while waiting for a resp onse.
</t> </t>
<t><xref target="RFC4555" sectionFormat="of" section="3.5"/> also states
<t>Section 3.5 of <xref target="RFC4555" /> also states that that
once an IKE SA is switched to a new IP address, all outstanding reques ts in this SA once an IKE SA is switched to a new IP address, all outstanding reques ts in this SA
are immediately retransmitted using this address. See also <xref targe are immediately retransmitted using this address. See also <xref targe
t="retr" />. t="retr" format="default"/>.
</t> </t>
<t>The MOBIKE protocol defines the NO_NATS_ALLOWED notification that can
<t>The MOBIKE protocol defines the NO_NATS_ALLOWED notification that c be
an be
used to detect the presence of NAT between peer and to refuse to used to detect the presence of NAT between peer and to refuse to
communicate in this situation. In case of TCP the NO_NATS_ALLOWED communicate in this situation. In the case of TCP, the NO_NATS_ALLOWE
notification SHOULD be ignored because TCP generally has no problems D
notification <bcp14>SHOULD</bcp14> be ignored because TCP generally ha
s no problems
with NAT boxes. with NAT boxes.
</t> </t>
<t><xref target="RFC4555" sectionFormat="of" section="3.7"/> describes a
<t>Section 3.7 of <xref target="RFC4555"/> describes an additional opt n additional optional step in the
ional step in the process of changing IP addresses called "Return Routability Check". I
process of changing IP addresses called Return Routability Check. It t
is performed by Responders in order to be sure that the new is performed by Responders in order to be sure that the new
initiator's address is in fact routable. In case of TCP Initiator's address is, in fact, routable.
encapsulation this check has little value, since TCP handshake proves In the case of TCP encapsulation, this check has little value since a
routability of the TCP Originator's address. So, in case of TCP TCP handshake proves the routability of the TCP Originator's address;
encapsulation the Return Routability Check SHOULD NOT be performed. thus, the Return Routability Check <bcp14>SHOULD NOT</bcp14> be performed.
</t>
</section>
<section title="IKE Redirect" anchor="redirect" > </t>
<t>A redirect mechanism for IKEv2 is defined in <xref target="RFC5685" </section>
/>. This mechanism <section anchor="redirect" numbered="true" toc="default">
<name>IKE Redirect</name>
<t>A redirect mechanism for IKEv2 is defined in <xref target="RFC5685" f
ormat="default"/>. This mechanism
allows security gateways to redirect clients to another gateway allows security gateways to redirect clients to another gateway
either during IKE SA establishment or after session setup. If a either during IKE SA establishment or after session setup. If a
client is connecting to a security gateway using TCP and client is connecting to a security gateway using TCP and
then is redirected to another security gateway, the client then is redirected to another security gateway, the client
needs to reset its transport selection. In other words, the client needs to reset its transport selection.
MUST again try first 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>
<section title="IKEv2 Session Resumption" anchor="resumption" > In other words, with the next security gateway, the client <bcp14>MUST</bcp14> f
<t>Session resumption for IKEv2 is defined in <xref target="RFC5723"/> irst try UDP and then fall
. Once an IKE SA is 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>
<section anchor="resumption" numbered="true" toc="default">
<name>IKEv2 Session Resumption</name>
<t>Session resumption for IKEv2 is defined in <xref target="RFC5723" for
mat="default"/>. Once an IKE SA is
established, the server creates a resumption ticket where information established, the server creates a resumption ticket where information
about this SA is stored, and transfers this ticket to the client. about this SA is stored and transfers this ticket to the client.
The ticket may be later used to resume the IKE SA after it is deleted. The ticket may be later used to resume the IKE SA after it is deleted.
In the event of resumption the client presents the ticket in a new In the event of resumption, the client presents the ticket in a new
exchange, called IKE_SESSION_RESUME. Some parameters in the new SA exchange, called IKE_SESSION_RESUME. Some parameters in the new SA
are retrieved from the ticket and others are re-negotiated (more detai are retrieved from the ticket and others are renegotiated (more detail
ls s
are given in Section 5 of <xref target="RFC5723"/>). are given in <xref target="RFC5723" sectionFormat="of" section="5"/>).
</t> </t>
<t>Since network conditions may change while the client is inactive,
<t>Since network conditions may change while the client is inactive, the fact that TCP encapsulation was used in an old SA <bcp14>SHOULD NO
the fact that TCP encapsulation was used in an old SA SHOULD NOT affec T</bcp14> affect which transport
t which transport
is used during session resumption. In other words, the transport shoul d be is used during session resumption. In other words, the transport shoul d be
selected as if the IKE SA is being created from scratch. selected as if the IKE SA is being created from scratch.
</t> </t>
</section> </section>
<section anchor="ha" numbered="true" toc="default">
<section title="IKEv2 Protocol Support for High Availability" anchor="ha <name>IKEv2 Protocol Support for High Availability</name>
" > <t><xref target="RFC6311" format="default"/> defines a support for High
<t><xref target="RFC6311"/> defines a support for High Availability in Availability in IKEv2.
IKEv2.
In case of cluster failover, a new active node In case of cluster failover, a new active node
must immediately initiate a special INFORMATION exchange containing th e must immediately initiate a special INFORMATION exchange containing th e
IKEV2_MESSAGE_ID_SYNC notification, which instructs the client to IKEV2_MESSAGE_ID_SYNC notification, which instructs the client to
skip some number of Message IDs that might not be synchronized yet skip some number of Message IDs that might not be synchronized yet
between nodes at the time of failover. between nodes at the time of failover.
</t> </t>
<t>Synchronizing states when using TCP encapsulation is much harder than
<t>Synchronizing states when using TCP encapsulation is much harder th
an
when using UDP; doing so requires access to TCP/IP stack internals, wh ich is when using UDP; doing so requires access to TCP/IP stack internals, wh ich is
not always available from an IKE/IPsec implementation. If a cluster not always available from an IKE/IPsec implementation. If a cluster
implementation doesn't synchronize TCP states between nodes, then implementation doesn't synchronize TCP states between nodes, then
after failover event the new active node will not have any TCP after failover event the new active node will not have any TCP
connection with the client, so the node cannot initiate the connection with the client, so the node cannot initiate the
INFORMATIONAL exchange as required by <xref target="RFC6311"/>. Since INFORMATIONAL exchange as required by <xref target="RFC6311" format="d
the cluster efault"/>. Since the cluster
usually acts as TCP Responder, the new active node cannot re- usually acts as TCP Responder, the new active node cannot re- establis
establish TCP connection, since only the TCP Originator can do it. h TCP connection because only the TCP Originator can do it.
For the client, the cluster failover event may remain For the client, the cluster failover event may remain
undetected for long time if it has no IKE or ESP traffic to send. Onc e undetected for long time if it has no IKE or ESP traffic to send. Onc e
the client sends an ESP or IKEv2 packet, the cluster node will reply 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 T CP with TCP RST and the client (as TCP Originator) will reestablish the T CP
connection so that the node will be able to initiate the connection so that the node will be able to initiate the
INFORMATIONAL exchange informing the client about the cluster INFORMATIONAL exchange informing the client about the cluster
failover. failover.
</t> </t>
<t>This document makes the following recommendation: if support for High
<t>This document makes the following recommendation: if support for Hi
gh
Availability in IKEv2 is negotiated and TCP transport is used, Availability in IKEv2 is negotiated and TCP transport is used,
a client that is a TCP Originator SHOULD periodically send a client that is a TCP Originator <bcp14>SHOULD</bcp14> periodi
IKEv2 messages (e.g. by initiating liveness check exchange) whenever cally send
IKEv2 messages (e.g., by initiating liveness check exchange) whenever
there is no IKEv2 or ESP traffic. This differs from the there is no IKEv2 or ESP traffic. This differs from the
recommendations given in Section 2.4 of <xref target="RFC7296"/> in th e following: recommendations given in <xref target="RFC7296" sectionFormat="of" sec tion="2.4"/> in the following:
the liveness check should be periodically performed even if the the liveness check should be periodically performed even if the
client has nothing to send over ESP. The frequency of sending such client has nothing to send over ESP. The frequency of sending such
messages should be high enough to allow quick detection and restoring messages should be high enough to allow quick detection and restoratio n
of broken TCP connections. of broken TCP connections.
</t> </t>
</section> </section>
<section anchor="frag" numbered="true" toc="default">
<section title="IKEv2 Fragmentation" anchor="frag"> <name>IKEv2 Fragmentation</name>
<t>IKE message fragmentation <xref target="RFC7383"/> is not required <t>IKE message fragmentation <xref target="RFC7383" format="default"/> i
when using TCP s not required when using TCP
encapsulation, since a TCP stream already handles the fragmentation encapsulation since a TCP stream already handles the fragmentation
of its contents across packets. Since fragmentation is redundant in of its contents across packets. Since fragmentation is redundant in
this case, implementations might choose to not negotiate IKE this case, implementations might choose to not negotiate IKE
fragmentation. Even if fragmentation is negotiated, an fragmentation. Even if fragmentation is negotiated, an
implementation SHOULD NOT send fragments when going over a TCP implementation <bcp14>SHOULD NOT</bcp14> send fragments when going ove
connection, although it MUST support receiving fragments. r a TCP
</t> connection, although it <bcp14>MUST</bcp14> support receiving fragment
s.
<t>If an implementation supports both MOBIKE and IKE fragmentation, it </t>
SHOULD negotiate IKE fragmentation over a TCP-encapsulated session in <t>If an implementation supports both MOBIKE and IKE fragmentation, it
<bcp14>SHOULD</bcp14> negotiate IKE fragmentation over a TCP-encapsula
ted session in
case the session switches to UDP encapsulation on another network. case the session switches to UDP encapsulation on another network.
</t> </t>
</section>
</section> </section>
</section>
<section title="Middlebox Considerations" anchor="middle"> <section anchor="middle" numbered="true" toc="default">
<t>Many security networking devices, such as firewalls or intrusion <name>Middlebox Considerations</name>
<t>Many security networking devices, such as firewalls or intrusion
prevention systems, network optimization/acceleration devices, and prevention systems, network optimization/acceleration devices, and
NAT devices, keep the state of sessions that traverse through them. NAT devices, keep the state of sessions that traverse through them.
</t> </t>
<t>These devices commonly track the transport-layer and/or application-
<t>These devices commonly track the transport-layer and/or application-
layer data to drop traffic that is anomalous or malicious in nature. layer data to drop traffic that is anomalous or malicious in nature.
While many of these devices will be more likely to pass While many of these devices will be more likely to pass
TCP-encapsulated traffic as opposed to UDP-encapsulated traffic, some TCP-encapsulated traffic as opposed to UDP-encapsulated traffic, some
may still block or interfere with TCP-encapsulated IKE and IPsec may still block or interfere with TCP-encapsulated IKE and IPsec
traffic. traffic.
</t> </t>
<t>A network device that monitors the transport layer will track the
<t>A network device that monitors the transport layer will track the
state of TCP sessions, such as TCP sequence numbers. If the IKE impleme ntation state of TCP sessions, such as TCP sequence numbers. If the IKE impleme ntation
has its own minimal implementation of TCP, has its own minimal implementation of TCP,
it SHOULD still use common TCP behaviors to avoid being dropped by it <bcp14>SHOULD</bcp14> still use common TCP behaviors to avoid being d ropped by
middleboxes. middleboxes.
</t> </t>
<t>Operators that intentionally block IPsec because of security implicatio
<t>Operators that intentionally block IPsec because of security implicat ns
ions
might want to also block TCP port 4500 or use other methods to reject TC P encapsulated IPsec traffic might want to also block TCP port 4500 or use other methods to reject TC P encapsulated IPsec traffic
(e.g. filter out TCP connections that begin with the "IKETCP" stream pref (e.g., filter out TCP connections that begin with the "IKETCP" stream pre
ix). fix).
</t> </t>
</section> </section>
<section anchor="perf" numbered="true" toc="default">
<section title="Performance Considerations" anchor="perf"> <name>Performance Considerations</name>
<t>Several aspects of TCP encapsulation for IKE and IPsec packets may <t>Several aspects of TCP encapsulation for IKE and IPsec packets may
negatively impact the performance of connections within a tunnel-mode negatively impact the performance of connections within a tunnel-mode
IPsec SA. Implementations should be aware of these performance IPsec SA. Implementations should be aware of these performance
impacts and take these into consideration when determining when to impacts and take these into consideration when determining when to
use TCP encapsulation. Implementations MUST favor using direct ESP use TCP encapsulation. Implementations <bcp14>MUST</bcp14> favor using direct ESP
or UDP encapsulation over TCP encapsulation whenever possible. or UDP encapsulation over TCP encapsulation whenever possible.
</t> </t>
<section anchor="perf.1" numbered="true" toc="default">
<section title="TCP-in-TCP" anchor="perf.1"> <name>TCP-in-TCP</name>
<t>If the outer connection between IKE peers is over TCP, inner TCP <t>If the outer connection between IKE peers is over TCP, inner TCP
connections may suffer negative effects from using TCP within TCP. connections may suffer negative effects from using TCP within TCP.
Running TCP within TCP is discouraged, since the TCP algorithms Running TCP within TCP is discouraged since the TCP algorithms
generally assume that they are running over an unreliable datagram generally assume that they are running over an unreliable datagram
layer. layer.
</t> </t>
<t>If the outer (tunnel) TCP connection experiences packet loss, this
<t>If the outer (tunnel) TCP connection experiences packet loss, this loss will be hidden from any inner TCP connections since the outer
loss will be hidden from any inner TCP connections, since the outer
connection will retransmit to account for the losses. Since the connection will retransmit to account for the losses. Since the
outer TCP connection will deliver the inner messages in order, any outer TCP connection will deliver the inner messages in order, any
messages after a lost packet may have to wait until the loss is messages after a lost packet may have to wait until the loss is
recovered. This means that loss on the outer connection will be recovered. This means that loss on the outer connection will be
interpreted only as delay by inner connections. The burstiness of interpreted only as delay by inner connections. The burstiness of
inner traffic can increase, since a large number of inner packets may inner traffic can increase since a large number of inner packets may
be delivered across the tunnel at once. The inner TCP connection may be delivered across the tunnel at once. The inner TCP connection may
interpret a long period of delay as a transmission problem, interpret a long period of delay as a transmission problem,
triggering a retransmission timeout, which will cause spurious triggering a retransmission timeout, which will cause spurious
retransmissions. The sending rate of the inner connection may be retransmissions. The sending rate of the inner connection may be
unnecessarily reduced if the retransmissions are not detected as unnecessarily reduced if the retransmissions are not detected as
spurious in time. spurious in time.
</t> </t>
<t>The inner TCP connection's round-trip-time estimation will be
<t>The inner TCP connection's round-trip-time estimation will be
affected by the burstiness of the outer TCP connection if there are affected by the burstiness of the outer TCP connection if there are
long delays when packets are retransmitted by the outer TCP long delays when packets are retransmitted by the outer TCP
connection. This will make the congestion control loop of the inner connection. This will make the congestion control loop of the inner
TCP traffic less reactive, potentially permanently leading to a lower TCP traffic less reactive, potentially permanently leading to a lower
sending rate than the outer TCP would allow for. sending rate than the outer TCP would allow for.
</t> </t>
<t> TCP-in-TCP can also lead to "TCP meltdown", where stacked instances
<t> TCP-in-TCP can also lead to "TCP meltdown", where stacked instance
s
of TCP can result in significant impacts to performance of TCP can result in significant impacts to performance
<xref target="TCP-MELTDOWN" />. This can occur when losses in the lowe r TCP (closer to the link) <xref target="TCP-MELTDOWN" format="default"/>. This can occur when lo sses in the lower TCP (closer to the link)
increase delays seen by the higher TCP (closer to the application) tha t create increase delays seen by the higher TCP (closer to the application) tha t create
timeouts, which in turn cause retransmissions that can then cause loss es in timeouts, which, in turn, cause retransmissions that can then cause lo sses in
the lower TCP by overrunning its buffer. The very mechanism intended t o avoid loss the lower TCP by overrunning its buffer. The very mechanism intended t o avoid loss
(retransmission) interacts between the two layers to increase loss. To limit this effect, (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 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. the higher layer has a much longer timeout than the lower layer.
</t> </t>
<t>Note that any negative effects will be shared among all flows going
<t>Note that any negative effects will be shared among all flows going
through the outer TCP connection. This is of particular concern for through the outer TCP connection. This is of particular concern for
any latency-sensitive or real-time applications using the tunnel. If any latency-sensitive or real-time applications using the tunnel. If
such traffic is using a TCP-encapsulated IPsec connection, it is such traffic is using a TCP-encapsulated IPsec connection, it is
recommended that the number of inner connections sharing the tunnel recommended that the number of inner connections sharing the tunnel
be limited as much as possible. be limited as much as possible.
</t> </t>
</section> </section>
<section anchor="perf.2" numbered="true" toc="default">
<section title="Added Reliability for Unreliable Protocols" anchor="perf <name>Added Reliability for Unreliable Protocols</name>
.2"> <t>Since ESP is an unreliable protocol, transmitting ESP packets over a
<t>Since ESP is an unreliable protocol, transmitting ESP packets over
a
TCP connection will change the fundamental behavior of the packets. TCP connection will change the fundamental behavior of the packets.
Some application-level protocols that prefer packet loss to delay Some application-level protocols that prefer packet loss to delay
(such as Voice over IP or other real-time protocols) may be (such as Voice over IP or other real-time protocols) may be
negatively impacted if their packets are retransmitted by the TCP negatively impacted if their packets are retransmitted by the TCP
connection due to packet loss. connection due to packet loss.
</t> </t>
</section> </section>
<section anchor="perf.3" numbered="true" toc="default">
<section title="Quality-of-Service Markings" anchor="perf.3"> <name>Quality-of-Service Markings</name>
<t>Quality-of-Service (QoS) markings, such as the Differentiated <t>Quality-of-Service (QoS) markings, such as the Differentiated
Services Code Point (DSCP) and Traffic Class, should be used with Services Code Point (DSCP) and Traffic Class, should be used with
care on TCP connections used for encapsulation. Individual packets care on TCP connections used for encapsulation. Individual packets
SHOULD NOT use different markings than the rest of the connection, <bcp14>SHOULD NOT</bcp14> use different markings than the rest of the connection
since packets with different priorities may be routed differently and since packets with different priorities may be routed differently and
cause unnecessary delays in the connection. cause unnecessary delays in the connection.
</t> </t>
</section> </section>
<section anchor="perf.4" numbered="true" toc="default">
<section title="Maximum Segment Size" anchor="perf.4"> <name>Maximum Segment Size</name>
<t>A TCP connection used for IKE encapsulation SHOULD negotiate its MS <t>A TCP connection used for IKE encapsulation <bcp14>SHOULD</bcp14> neg
S otiate its MSS
in order to avoid unnecessary fragmentation of packets. in order to avoid unnecessary fragmentation of packets.
</t> </t>
</section> </section>
<section anchor="perf.5" numbered="true" toc="default">
<name>Tunneling ECN in TCP</name>
<section title="Tunneling ECN in TCP" anchor="perf.5"> <t>Since there is not a one-to-one relationship between outer IP packets
<t>Since there is not a one-to-one relationship between outer IP packe
ts
and inner ESP/IP messages when using TCP encapsulation, the markings and inner ESP/IP messages when using TCP encapsulation, the markings
for Explicit Congestion Notification (ECN) <xref target="RFC3168"/> ca nnot be simply for Explicit Congestion Notification (ECN) <xref target="RFC3168" form at="default"/> cannot easily be
mapped. However, any ECN Congestion Experienced (CE) marking on mapped. However, any ECN Congestion Experienced (CE) marking on
inner headers should be preserved through the tunnel. inner headers should be preserved through the tunnel.
</t> </t>
<t>Implementations <bcp14>SHOULD</bcp14> follow the ECN compatibility mo
<t>Implementations SHOULD follow the ECN compatibility mode for tunnel de for tunnel
ingress as described in <xref target="RFC6040"/>. In compatibility mo ingress as described in <xref target="RFC6040" format="default"/>. In
de, the outer compatibility mode, the outer
tunnel TCP connection marks its packet headers as not ECN-capable. tunnel TCP connection marks its packet headers as not ECN-capable.
</t> </t>
<t>Upon egress, if the arriving outer header is marked with CE, the
<t>If upon egress, the arriving outer header is marked with CE, the implementation will drop the inner packet since there is not a
implementation will drop the inner packet, since there is not a
distinct inner packet header onto which to translate the ECN distinct inner packet header onto which to translate the ECN
markings. markings.
</t> </t>
</section>
</section> </section>
</section>
<section title="Security Considerations" anchor="security"> <section anchor="security" numbered="true" toc="default">
<t>IKE Responders that support TCP encapsulation may become vulnerable <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 to new Denial-of-Service (DoS) attacks that are specific to TCP, such
as SYN-flooding attacks. TCP Responders should be aware of this addition al attack surface. as SYN-flooding attacks. TCP Responders should be aware of this addition al attack surface.
</t> </t>
<t>TCP connections are also susceptible to RST and other spoofing attacks
<t>TCP connections are also susceptible to RST and other spoofing attack <xref target="RFC4953" format="default"/>.
s <xref target="RFC4953" />.
This specification makes IPsec tolerant of sudden TCP connection drops, but if an attacker 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, is able to tear down TCP connections, IPsec connection's performance can suffer,
effectively making this a DoS attack. effectively making this a DoS attack.
</t> </t>
<t>TCP data injection attacks have no effect on application data since IPs
<t>TCP data injection attacks have no effect on application data since I ec provides data integrity.
Psec provides data integrity.
However, they can have some effect, mostly by creating DoS attacks: However, they can have some effect, mostly by creating DoS attacks:
<list style="symbols"> </t>
<t>if an attacker alters the content of the Length field that separate <ul spacing="normal">
s packets, <li>If an attacker alters the content of the Length field that separates
then the receiver will incorrectly identify the boundaries of the foll packets,
owing packets and then the Receiver will incorrectly identify the boundaries of the foll
owing packets and
will drop all of them or even tear down the TCP connection if the cont ent of the will drop all of them or even tear down the TCP connection if the cont ent of the
Length field happens to be 0 or 1 (see <xref target="format"/>) Length field happens to be 0 or 1 (see <xref target="format" format="d
</t> efault"/>).
<t>if the content of an IKE message is altered, then it will be droppe </li>
d by the receiver; <li>If the content of an IKE message is altered, then it will be dropped
if the dropped message is the IKE request message, then the initiator by the receiver;
will tear if the dropped message is the IKE request message, then the Initiator
down the IKE SA after some timeout, since in most cases the request me will tear
ssage will not be retransmitted down the IKE SA after some timeout since, in most cases, the request m
(as advised in <xref target="retr"/>) and thus the response will never essage will not be retransmitted
be received (as advised in <xref target="retr" format="default"/>); thus, the resp
</t> onse will never be received.
<t>if an attacker alters the non-ESP marker then IKE packets will be d </li>
ispatched to ESP
and sometimes visa versa, those packets will be dropped
</t>
<t>if an attacker modifies TCP-Encapsulated stream prefix or unencrypt
ed IKE messages before IKE SA is established,
then in most cases this will result in failure to establish IKE SA, of
ten with false "authentication failed" diagnostics
</t>
</list>
<xref target="RFC5961" /> discusses how TCP injection attacks can be mit
igated.
</t>
<t>Note that data injection attacks are also possible on IP level (e.g. <li>If an attacker alters the non-ESP marker, then IKE packets will be d
when IP fragmentation is used), ispatched to ESP
(and sometimes visa versa) and those packets will be dropped.
</li>
<li>If an attacker modifies TCP-Encapsulated stream prefix or unencrypte
d IKE messages before IKE SA is established,
then in most cases this will result in failure to establish IKE SA, of
ten with false "authentication failed" diagnostics.
</li>
</ul>
<t>
<xref target="RFC5961" format="default"/> discusses how TCP injection at
tacks can be mitigated.
</t>
<t>Note that data injection attacks are also possible on IP level (e.g., w
hen IP fragmentation is used),
resulting in DoS attacks even if TCP encapsulation is not used. On the o ther hand, TCP injection attacks are easier to mount resulting in DoS attacks even if TCP encapsulation is not used. On the o ther hand, TCP injection attacks are easier to mount
than the IP fragmentation injection attacks, because TCP keeps a long re than the IP fragmentation injection attacks because TCP keeps a long rec
ceive window open that’s a sitting target for such attacks. eive window open that's a sitting target for such attacks.
</t> </t>
<t>If an attacker successfully mounts an injection attack on a TCP connect
<t>If an attacker successfully mounts an injection attack on a TCP conne ion used for encapsulating IPsec traffic
ction 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 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. 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. Com munication will eventually recover, but this might After such a parsing failure, all following packets will be dropped. Com munication will eventually recover, but this might
take several minutes and can result in IKE SA deletion and re-creation. take several minutes and can result in IKE SA deletion and re-creation.
</t> </t>
<t>To speed up the recovery from such attacks, implementations are advised
<t>To speed up the recovery from such attacks, implementations are advis to follow recommendations in <xref target="establish" format="default"/> and cl
ed to follow recommendations in <xref target="establish" /> and close ose
the TCP connection if incoming packets contain SPIs that don't match any known SAs. the TCP connection if incoming packets contain SPIs that don't match any known SAs.
Once the TCP connection is closed it will be re-created by the TCP Origi Once the TCP connection is closed, it will be re-created by the TCP Orig
nator as described in <xref target="establish" />. inator as described in <xref target="establish" format="default"/>.
</t> </t>
<t>To avoid performance degradation caused by closing and re-creating TCP
<t>To avoid performance degradation caused by closing and re-creating TC connections,
P connection, implementations <bcp14>MAY</bcp14> alternatively try to resync after they
implementations MAY alternatively try to re-sync after they receive unkno receive unknown SPIs by searching the TCP stream
wn SPIs by searching the TCP stream
for a 64-bit binary vector consisting of a known SPI in the first 32 bit s and a valid Sequence Number for this SPI in the for a 64-bit binary vector consisting of a known SPI in the first 32 bit s and a valid Sequence Number for this SPI in the
second 32 bits, and then validate the ICV of this packet candidate by ta second 32 bits. Then, they can validate the Integrity Check Value (ICV)
king the preceding 16 bits as the Length field. 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 12
8 bits of IKE SPIs of IKE SA associated with this TCP connection
and then validate ICV of this IKE message candidate by taking the 16 bit
s preceding the non-ESP marker as the Length field.
Implementations SHOULD limit the attempts to resync, since if the inject
ion attack is ongoing
then there is a high probability that the resync process will not succee
d, or quickly
come under attack again.
</t>
<t>An attacker capable of blocking UDP traffic can force peers to use TC They can also search for 4 bytes of zero (non-ESP marker) followed by
P encapsulation, 128 bits of IKE SPIs of the IKE SA(s) associated with this TCP connection and
thus degrading the performance and making the connection more vulnerable then validate the ICV of this IKE message candidate by taking the 16 bits
to DoS attacks. preceding the non-ESP marker as the Length field.
Note that an attacker able to modify packets on the wire or to block the
m can
prevent peers to communicate regardless of the transport being used.
</t>
<t>TCP Responders should be careful to ensure that the stream prefix Implementations <bcp14>SHOULD</bcp14> limit the attempts to resync, becau
se if the
injection attack is ongoing, then there is a high probability that
the resync process will not succeed or will quickly come under attack
again.
</t>
<t>An attacker capable of blocking UDP traffic can force peers to use TCP
encapsulation,
thus, degrading the performance and making the connection more vulnerabl
e to DoS attacks.
Note that an attacker that is able to modify packets on the wire or to b
lock them can
prevent peers from 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 "IKETCP" uniquely identifies incoming streams as streams that use the
TCP encapsulation protocol. TCP encapsulation protocol.
</t> </t>
<t>Attackers may be able to disrupt the TCP connection by sending
<t>Attackers may be able to disrupt the TCP connection by sending spurious TCP Reset packets. Therefore, implementations <bcp14>SHOULD</b
spurious TCP Reset packets. Therefore, implementations SHOULD make cp14> make
sure that IKE session state persists even if the underlying TCP sure that IKE session state persists even if the underlying TCP
connection is torn down. connection is torn down.
</t> </t>
<t>If MOBIKE is being used, all of the security considerations outlined
<t>If MOBIKE is being used, all of the security considerations outlined for MOBIKE apply <xref target="RFC4555" format="default"/>.
for MOBIKE apply <xref target="RFC4555"/>. </t>
</t> <t>Similar to MOBIKE, TCP encapsulation requires a TCP Responder to
<t>Similarly to MOBIKE, TCP encapsulation requires a TCP Responder to
handle changes to source address and port due to network or handle changes to source address and port due to network or
connection disruption. The successful delivery of valid new IKE or ESP connection disruption. The successful delivery of valid new IKE or ESP
messages over a new TCP connection is used by the TCP Responder to messages over a new TCP connection is used by the TCP Responder to
determine where to send subsequent responses. If an attacker is able determine where to send subsequent responses. If an attacker is able
to send packets on a new TCP connection that pass the validation to send packets on a new TCP connection that pass the validation
checks of the TCP Responder, it can influence which path future checks of the TCP Responder, it can influence which path future
packets will take. For this reason, the validation of messages on packets will take. For this reason, the validation of messages on
the TCP Responder must include decryption, authentication, and replay the TCP Responder must include decryption, authentication, and replay
checks. checks.
</t> </t>
</section>
<section anchor="iana" numbered="true" toc="default">
<name>IANA Considerations</name>
<t>TCP port 4500 is already allocated to IPsec for NAT traversal in the "S
ervice Name and Transport Protocol Port Number Registry". This
port <bcp14>SHOULD</bcp14> be used for TCP-encapsulated IKE and ESP as d
escribed in
this document.
</t>
<t>This document updates the reference for TCP port 4500 from RFC 8229 to
itself:
</t>
</section> <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>
<section title="IANA Considerations" anchor="iana"> <displayreference target="I-D.ietf-ipsecme-ike-tcp" to="IPSECME-IKE-TCP"/>
<t>TCP port 4500 is already allocated to IPsec for NAT traversal. This
port SHOULD 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 t <references>
o itself: <name>References</name>
</t> <references>
<name>Normative References</name>
<xi:include href="https://bib.ietf.org/public/rfc/bibxml/reference.RFC.2
119.xml"/>
<xi:include href="https://bib.ietf.org/public/rfc/bibxml/reference.RFC.3
948.xml"/>
<xi:include href="https://bib.ietf.org/public/rfc/bibxml/reference.RFC.4
301.xml"/>
<xi:include href="https://bib.ietf.org/public/rfc/bibxml/reference.RFC.4
303.xml"/>
<xi:include href="https://bib.ietf.org/public/rfc/bibxml/reference.RFC.6
040.xml"/>
<xi:include href="https://bib.ietf.org/public/rfc/bibxml/reference.RFC.7
296.xml"/>
<xi:include href="https://bib.ietf.org/public/rfc/bibxml/reference.RFC.8
019.xml"/>
<xi:include href="https://bib.ietf.org/public/rfc/bibxml/reference.RFC.8
174.xml"/>
</references>
<references>
<name>Informative References</name>
<figure><artwork><![CDATA[ <!-- [I-D.ietf-ipsecme-ike-tcp]; IESG state Expired as of 10/3/22 -->
Keyword Decimal Description Reference
----------- -------- ------------------- ---------
ipsec-nat-t 4500/tcp IPsec NAT-Traversal [RFCXXXX]
]]></artwork>
</figure>
</section>
</middle>
<back> <xi:include href="https://datatracker.ietf.org/doc/bibxml3/reference.I-D
<references title='Normative References'> .ietf-ipsecme-ike-tcp.xml"/>
<?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" ?>
</references>
<references title='Informative References'> <!-- [I-D.ietf-uta-rfc7525bis]; In AUTH48-DONE as of 11/28/22 -->
<?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" ?>
<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="Osamu Honda" />
<author fullname="Hiroyuki Ohsaki" />
<author fullname="Makoto Imase" />
<author fullname="Mika Ishizuka" />
<author fullname="Junichi Murayama" />
<date year="2005"/>
</front>
</reference>
</references>
<section title="Using TCP Encapsulation with TLS" anchor="tls"> <reference anchor="RFC9325" target="https://www.rfc-editor.org/info/rfc9325">
<t>This section provides recommendations on how to use TLS in addition <front>
to TCP encapsulation. <title>Recommendations for Secure Use of Transport Layer Security (TLS) an
</t> d 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>
<t>When using TCP encapsulation, implementations may choose to use TLS <xi:include href="https://bib.ietf.org/public/rfc/bibxml/reference.RFC.1
1.2 122.xml"/>
<xref target="RFC5246"/> or TLS 1.3 <xref target="RFC8446"/> on the TC <xi:include href="https://bib.ietf.org/public/rfc/bibxml/reference.RFC.2
P connection 817.xml"/>
to be able to traverse middleboxes, which may otherwise block the traf <xi:include href="https://bib.ietf.org/public/rfc/bibxml/reference.RFC.3
fic. 168.xml"/>
</t> <xi:include href="https://bib.ietf.org/public/rfc/bibxml/reference.RFC.4
555.xml"/>
<xi:include href="https://bib.ietf.org/public/rfc/bibxml/reference.RFC.4
621.xml"/>
<xi:include href="https://bib.ietf.org/public/rfc/bibxml/reference.RFC.4
953.xml"/>
<xi:include href="https://bib.ietf.org/public/rfc/bibxml/reference.RFC.4
987.xml"/>
<xi:include href="https://bib.ietf.org/public/rfc/bibxml/reference.RFC.5
246.xml"/>
<xi:include href="https://bib.ietf.org/public/rfc/bibxml/reference.RFC.5
685.xml"/>
<xi:include href="https://bib.ietf.org/public/rfc/bibxml/reference.RFC.5
723.xml"/>
<xi:include href="https://bib.ietf.org/public/rfc/bibxml/reference.RFC.5
961.xml"/>
<xi:include href="https://bib.ietf.org/public/rfc/bibxml/reference.RFC.6
311.xml"/>
<xi:include href="https://bib.ietf.org/public/rfc/bibxml/reference.RFC.6
520.xml"/>
<xi:include href="https://bib.ietf.org/public/rfc/bibxml/reference.RFC.6
528.xml"/>
<xi:include href="https://bib.ietf.org/public/rfc/bibxml/reference.RFC.9
293.xml"/>
<xi:include href="https://bib.ietf.org/public/rfc/bibxml/reference.RFC.7
383.xml"/>
<xi:include href="https://bib.ietf.org/public/rfc/bibxml/reference.RFC.8
229.xml"/>
<xi:include href="https://bib.ietf.org/public/rfc/bibxml/reference.RFC.8
446.xml"/>
<t>If a web proxy is applied to the ports used for the TCP connection <reference anchor="TCP-MELTDOWN" target="https://doi.org/10.1117/12.6304
96">
<front>
<title>Understanding TCP over TCP: effects of TCP tunneling on end-t
o-end throughput and latency</title>
<author fullname="Osamu Honda"/>
<author fullname="Hiroyuki Ohsaki"/>
<author fullname="Makoto Imase"/>
<author fullname="Mika Ishizuka"/>
<author fullname="Junichi Murayama"/>
<date month="October" year="2005"/>
</front>
</reference>
</references>
</references>
<section anchor="tls" numbered="true" toc="default">
<name>Using TCP Encapsulation with 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
<xref target="RFC5246" format="default"/> or TLS 1.3 <xref target="RFC
8446" format="default"/> on the TCP connection
to be able to traverse middleboxes, which may otherwise block the traf
fic.
</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 and TLS is being used, the TCP Originator can send an HTTP CONNECT
message to establish an SA through the proxy <xref target="RFC2817"/>. message to establish an SA through the proxy <xref target="RFC2817" fo
</t> rmat="default"/>.
</t>
<t>The use of TLS should be configurable on the peers, and may be used <t>The use of TLS should be configurable on the peers and may be used
as the default when using TCP encapsulation or may be used as a as the default when using TCP encapsulation or may be used as a
fallback when basic TCP encapsulation fails. The TCP Responder may fallback when basic TCP encapsulation fails. The TCP Responder may
expect to read encapsulated IKE and ESP packets directly from the TCP 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 connection, or it may expect to read them from a stream of TLS data
packets. The TCP Originator should be pre-configured to use TLS packets. The TCP Originator should be preconfigured regarding whether
or not when communicating with a given port on the TCP Responder. or not to use TLS
</t> when communicating with a given port on the TCP Responder.
</t>
<t>When new TCP connections are re-established due to a broken <t>When new TCP connections are re-established due to a broken
connection, TLS must be renegotiated. TLS session resumption is connection, TLS must be renegotiated. TLS session resumption is
recommended to improve efficiency in this case. recommended to improve efficiency in this case.
</t> </t>
<t>The security of the IKE session is entirely derived from the IKE
<t>The security of the IKE session is entirely derived from the IKE negotiation and key establishment and not from the TLS session (which,
negotiation and key establishment and not from the TLS session (which in this context, is only used for encapsulation purposes); therefore,
in this context is only used for encapsulation purposes); therefore,
when TLS is used on the TCP connection, both the TCP Originator and when TLS is used on the TCP connection, both the TCP Originator and
the TCP Responder SHOULD allow the NULL cipher to be selected for the TCP Responder <bcp14>SHOULD</bcp14> allow the NULL cipher to be se
performance reasons. Note, that TLS 1.3 only supports AEAD algorithms lected for
performance reasons. Note that TLS 1.3 only supports AEAD algorithms
and at the time of writing this document there was no recommended ciph er suite and at the time of writing this document there was no recommended ciph er suite
for TLS 1.3 with the NULL cipher. It is RECOMMENDED to follow for TLS 1.3 with the NULL cipher. It is <bcp14>RECOMMENDED</bcp14> to
<xref target="I-D.ietf-uta-rfc7525bis" /> when selecting parameters fo follow
r TLS. <xref target="RFC9325" format="default"/> when selecting parameters fo
</t> r TLS.
</t>
<t>Implementations should be aware that the use of TLS introduces <t>Implementations should be aware that the use of TLS introduces
another layer of overhead requiring more bytes to transmit a given another layer of overhead requiring more bytes to transmit a given
IKE and IPsec packet. For this reason, direct ESP, UDP IKE and IPsec packet. For this reason, direct ESP, UDP
encapsulation, or TCP encapsulation without TLS should be preferred encapsulation, or TCP encapsulation without TLS should be preferred
in situations in which TLS is not required in order to traverse in situations in which TLS is not required in order to traverse
middleboxes. middleboxes.
</t> </t>
</section> </section>
<section anchor="tls-example" numbered="true" toc="default">
<section title="Example Exchanges of TCP Encapsulation with TLS 1.3" anc <name>Example Exchanges of TCP Encapsulation with TLS 1.3</name>
hor="tls-example"> <t>This appendix contains examples of data flows in cases where TCP encaps
<section title="Establishing an IKE Session" anchor="tls-example-1"> ulation of IKE and IPsec packets
<figure><artwork><![CDATA[ is used with TLS 1.3. The examples below are provided for illustrative pu
rpose only;
readers should refer to the main body of the document for details.</t>
<section anchor="tls-example-1" numbered="true" toc="default">
<name>Establishing an IKE Session</name>
<artwork name="" type="" align="left" alt=""><![CDATA[
Client Server Client Server
---------- ---------- ---------- ----------
1) -------------------- TCP Connection ------------------- 1) -------------------- TCP Connection -------------------
(IP_I:Port_I -> IP_R:Port_R) (IP_I:Port_I -> IP_R:Port_R)
TcpSyn -------> TcpSyn ------->
<------- TcpSyn,Ack <------- TcpSyn,Ack
TcpAck -------> TcpAck ------->
2) --------------------- TLS Session --------------------- 2) --------------------- TLS Session ---------------------
ClientHello -------> ClientHello ------->
ServerHello ServerHello
skipping to change at line 1342 skipping to change at line 1297
IKE_AUTH (repeat 1..N times) IKE_AUTH (repeat 1..N times)
HDR SK {EAP} HDR SK {EAP}
Length + Non-ESP Marker -------> Length + Non-ESP Marker ------->
final IKE_AUTH final IKE_AUTH
HDR, SK {AUTH} HDR, SK {AUTH}
<------- Length + Non-ESP Marker <------- Length + Non-ESP Marker
final IKE_AUTH final IKE_AUTH
HDR, SK {AUTH, CP(CFG_REPLY), HDR, SK {AUTH, CP(CFG_REPLY),
SA, TSi, TSr, ...} SA, TSi, TSr, ...}
-------------- IKE and IPsec SAs Established ------------ -------------- IKE and IPsec SAs Established ------------
Length + ESP Frame -------> Length + ESP Frame ------->]]></artwork>
]]></artwork>
</figure>
<t><list style="numbers"> <ol spacing="normal" type="1"><li>The client establishes a TCP connection
<t>The client establishes a TCP connection with the server on with the server on
port 4500 or on an alternate pre-configured port that the server port 4500 or on an alternate preconfigured port that the server
is listening on. is listening on.
</t> </li>
<li>If configured to use TLS, the client initiates a TLS handshake.
<t>If configured to use TLS, the client initiates a TLS handshake. During the TLS handshake, the server <bcp14>SHOULD NOT</bcp14> req
During the TLS handshake, the server SHOULD NOT request the uest the
client's certificate, since authentication is handled as part of client's certificate since authentication is handled as part of
IKE negotiation.</t> IKE negotiation.</li>
<li>The client sends the stream prefix for TCP-encapsulated IKE
<t>The client sends the stream prefix for TCP-encapsulated IKE (<xref target="prefix" format="default"/>) traffic to signal the b
(<xref target="prefix"/>) traffic to signal the beginning of IKE n eginning of IKE negotiation.</li>
egotiation.</t> <li>The client and server establish an IKE connection. This example
<t>The client and server establish an IKE connection. This exampl
e
shows EAP-based authentication, although any authentication type shows EAP-based authentication, although any authentication type
may be used.</t> may be used.</li>
</list> </ol>
</t> </section>
</section> <section anchor="tls-example-2" numbered="true" toc="default">
<name>Deleting an IKE Session</name>
<section title="Deleting an IKE Session" anchor="tls-example-2"> <artwork name="" type="" align="left" alt=""><![CDATA[
<figure><artwork><![CDATA[
Client Server Client Server
---------- ---------- ---------- ----------
1) ----------------------- IKE Session --------------------- 1) ----------------------- IKE Session ---------------------
Length + Non-ESP Marker -------> Length + Non-ESP Marker ------->
INFORMATIONAL INFORMATIONAL
HDR, SK {[N,] [D,] HDR, SK {[N,] [D,]
[CP,] ...} [CP,] ...}
<------- Length + Non-ESP Marker <------- Length + Non-ESP Marker
INFORMATIONAL INFORMATIONAL
HDR, SK {[N,] [D,] HDR, SK {[N,] [D,]
[CP], ...} [CP], ...}
2) --------------------- TLS Session --------------------- 2) --------------------- TLS Session ---------------------
close_notify -------> close_notify ------->
<------- close_notify <------- close_notify
3) -------------------- TCP Connection ------------------- 3) -------------------- TCP Connection -------------------
TcpFin -------> TcpFin ------->
<------- Ack <------- Ack
<------- TcpFin <------- TcpFin
Ack -------> Ack ------->
-------------------- IKE SA Deleted ------------------- -------------------- IKE SA Deleted -------------------]]></artwork>
]]></artwork>
</figure>
<t><list style="numbers">
<t>The client and server exchange informational messages to notify
IKE SA deletion.</t>
<t>The client and server negotiate TLS session deletion using TLS
CLOSE_NOTIFY.</t>
<t>The TCP connection is torn down.</t>
</list>
</t>
<t>The deletion of the IKE SA should lead to the disposal of the <ol spacing="normal" type="1"><li>The client and server exchange informa
tional messages to notify
IKE SA deletion.</li>
<li>The client and server negotiate TLS session deletion using TLS
CLOSE_NOTIFY.</li>
<li>The TCP connection is torn down.</li>
</ol>
<t>The deletion of the IKE SA should lead to the disposal of the
underlying TLS and TCP state.</t> underlying TLS and TCP state.</t>
</section> </section>
<section anchor="tls-example-3" numbered="true" toc="default">
<name>Re-establishing an IKE Session</name>
<section title="Re-establishing an IKE Session" anchor="tls-example-3" <artwork name="" type="" align="left" alt=""><![CDATA[
>
<figure><artwork><![CDATA[
Client Server Client Server
---------- ---------- ---------- ----------
1) -------------------- TCP Connection ------------------- 1) -------------------- TCP Connection -------------------
(IP_I:Port_I -> IP_R:Port_R) (IP_I:Port_I -> IP_R:Port_R)
TcpSyn -------> TcpSyn ------->
<------- TcpSyn,Ack <------- TcpSyn,Ack
TcpAck -------> TcpAck ------->
2) --------------------- TLS Session --------------------- 2) --------------------- TLS Session ---------------------
ClientHello -------> ClientHello ------->
ServerHello ServerHello
{EncryptedExtensions} {EncryptedExtensions}
<------- {Finished} <------- {Finished}
{Finished} -------> {Finished} ------->
3) ---------------------- Stream Prefix -------------------- 3) ---------------------- Stream Prefix --------------------
"IKETCP" -------> "IKETCP" ------->
4) <---------------------> IKE/ESP Flow <------------------> 4) <---------------------> IKE/ESP Flow <------------------>]]></artwork>
]]></artwork>
</figure> <ol spacing="normal" type="1"><li>If a previous TCP connection was broke
<t><list style="numbers"> n (for example, due to a
<t>If a previous TCP connection was broken (for example, due to a
TCP Reset), the client is responsible for re-initiating the TCP TCP Reset), the client is responsible for re-initiating the TCP
connection. The TCP Originator's address and port (IP_I and connection. The TCP Originator's address and port (IP_I and
Port_I) may be different from the previous connection's address Port_I) may be different from the previous connection's address
and port. and port.
</t> </li>
<li>The client <bcp14>SHOULD</bcp14> attempt TLS session resumption if
<t>The client SHOULD attempt TLS session resumption if it it
has previously established a session with the server. has previously established a session with the server.
</t> </li>
<li>After TCP and TLS are complete, the client sends the stream
<t>After TCP and TLS are complete, the client sends the stream prefix for TCP-encapsulated IKE traffic (<xref target="prefix" for
prefix for TCP-encapsulated IKE traffic (<xref target="prefix"/>). mat="default"/>).
</t> </li>
<li>The IKE and ESP packet flow can resume. If MOBIKE is being used,
<t>The IKE and ESP packet flow can resume. If MOBIKE is being use the Initiator <bcp14>SHOULD</bcp14> send an UPDATE_SA_ADDRESSES me
d, ssage.
the Initiator SHOULD send an UPDATE_SA_ADDRESSES message. </li>
</t> </ol>
</section>
</list> <section anchor="tls-example-4" numbered="true" toc="default">
</t> <name>Using MOBIKE between UDP and TCP Encapsulation</name>
</section>
<section title="Using MOBIKE between UDP and TCP Encapsulation" anchor <artwork name="" type="" align="left" alt=""><![CDATA[
="tls-example-4">
<figure><artwork><![CDATA[
Client Server Client Server
---------- ---------- ---------- ----------
1) --------------------- IKE_session ---------------------- 1) --------------------- IKE_session ----------------------
(IP_I1:UDP500 -> IP_R:UDP500) (IP_I1:UDP500 -> IP_R:UDP500)
IKE_SA_INIT -------> IKE_SA_INIT ------->
HDR, SAi1, KEi, Ni, HDR, SAi1, KEi, Ni,
[N(NAT_DETECTION_SOURCE_IP)], [N(NAT_DETECTION_SOURCE_IP)],
[N(NAT_DETECTION_DESTINATION_IP)] [N(NAT_DETECTION_DESTINATION_IP)]
<------- IKE_SA_INIT <------- IKE_SA_INIT
HDR, SAr1, KEr, Nr, HDR, SAr1, KEr, Nr,
skipping to change at line 1498 skipping to change at line 1435
TcpAck -------> TcpAck ------->
4) --------------------- TLS Session --------------------- 4) --------------------- TLS Session ---------------------
ClientHello -------> ClientHello ------->
ServerHello ServerHello
{EncryptedExtensions} {EncryptedExtensions}
{Certificate*} {Certificate*}
{CertificateVerify*} {CertificateVerify*}
<------- {Finished} <------- {Finished}
{Finished} -------> {Finished} ------->
5) ---------------------- Stream Prefix -------------------- 5) ---------------------- Stream Prefix --------------------
"IKETCP" -------> "IKETCP" ------->]]></artwork>
<artwork name="" type="" align="left" alt=""><![CDATA[
6) ------------ Retransmit Message from step 2 ------------- 6) ------------ Retransmit Message from step 2 -------------
Length + Non-ESP Marker -------> Length + Non-ESP Marker ------->
INFORMATIONAL INFORMATIONAL
HDR, SK { N(UPDATE_SA_ADDRESSES), HDR, SK { N(UPDATE_SA_ADDRESSES),
N(NAT_DETECTION_SOURCE_IP), N(NAT_DETECTION_SOURCE_IP),
N(NAT_DETECTION_DESTINATION_IP) } N(NAT_DETECTION_DESTINATION_IP) }
<------- Length + Non-ESP Marker <------- Length + Non-ESP Marker
INFORMATIONAL INFORMATIONAL
HDR, SK { N(NAT_DETECTION_SOURCE_IP), HDR, SK { N(NAT_DETECTION_SOURCE_IP),
N(NAT_DETECTION_DESTINATION_IP) } N(NAT_DETECTION_DESTINATION_IP) }
7) -- New Exchange with recalculated NAT_DETECTION_*_IP --- 7) -- New Exchange with recalculated NAT_DETECTION_*_IP ---
Length + Non-ESP Marker -------> Length + Non-ESP Marker ------->
INFORMATIONAL INFORMATIONAL
HDR, SK { N(UPDATE_SA_ADDRESSES), HDR, SK { N(UPDATE_SA_ADDRESSES),
N(NAT_DETECTION_SOURCE_IP), N(NAT_DETECTION_SOURCE_IP),
N(NAT_DETECTION_DESTINATION_IP) } N(NAT_DETECTION_DESTINATION_IP) }
<------- Length + Non-ESP Marker <------- Length + Non-ESP Marker
INFORMATIONAL INFORMATIONAL
HDR, SK { N(NAT_DETECTION_SOURCE_IP), HDR, SK { N(NAT_DETECTION_SOURCE_IP),
N(NAT_DETECTION_DESTINATION_IP) } N(NAT_DETECTION_DESTINATION_IP) }
8) <---------------------> IKE/ESP Flow <------------------> 8) <---------------------> IKE/ESP Flow <------------------>]]></artwork>
]]></artwork>
</figure>
<t><list style="numbers">
<t>During the IKE_AUTH exchange, the client and server exchange
MOBIKE_SUPPORTED notify payloads to indicate support for MOBIKE.
</t>
<t>The client changes its point of attachment to the network and <ol spacing="normal" type="1"><li>During the IKE_AUTH exchange, the clie
nt and server exchange
MOBIKE_SUPPORTED notify payloads to indicate support for MOBIKE.
</li>
<li>The client changes its point of attachment to the network and
receives a new IP address. The client attempts to re-establish receives a new IP address. The client attempts to re-establish
the IKE session using the UPDATE_SA_ADDRESSES notify payload, but the IKE session using the UPDATE_SA_ADDRESSES notify payload, but
the server does not respond because the network blocks UDP the server does not respond because the network blocks UDP
traffic. traffic.
</t> </li>
<li>The client brings up a TCP connection to the server in order to
<t>The client brings up a TCP connection to the server in order to
use TCP encapsulation. use TCP encapsulation.
</t> </li>
<li>The client initiates a TLS handshake with the server.</li>
<t>The client initiates a TLS handshake with the server.</t> <li>The client sends the stream prefix for TCP-encapsulated IKE
traffic (<xref target="prefix" format="default"/>).
<t>The client sends the stream prefix for TCP-encapsulated IKE </li>
traffic (<xref target="prefix"/>). <li>The client sends the UPDATE_SA_ADDRESSES notify payload in the
</t>
<t>The client sends the UPDATE_SA_ADDRESSES notify payload in the
INFORMATIONAL exchange on the INFORMATIONAL exchange on the
TCP-encapsulated connection. Note that this IKE message is 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 same as the one sent over UDP in step 2; it should have the same
message ID and contents. message ID and contents.
</t> </li>
<li>Once the client receives a response on the
<t>Once the client receives a response on the
TCP-encapsulated connection, it immediately starts a new INFORMATI ONAL TCP-encapsulated connection, it immediately starts a new INFORMATI ONAL
exchange with an UPDATE_SA_ADDRESSES notify payload and recalculat ed exchange with an UPDATE_SA_ADDRESSES notify payload and recalculat ed
NAT_DETECTION_*_IP notify payloads in order to get correct informa tion about the presence NAT_DETECTION_*_IP notify payloads in order to get correct informa tion about the presence
of NATs. of NATs.
</t> </li>
<li>The IKE and ESP packet flow can resume.</li>
<t>The IKE and ESP packet flow can resume.</t> </ol>
</list> </section>
</t> </section>
<section numbered="false" anchor="acknowledgments" toc="default">
</section> <name>Acknowledgments</name>
<t>Thanks to the authors of RFC 8229 (<contact fullname="Tommy
</section> Pauly"/>, <contact fullname="Samy Touati"/>, and <contact fullname="Ravi
Mantha"/>). Since this document clarifies and obsoletes RFC 8229, most of
<section title="Acknowledgments" numbered="no" anchor="acknowledgments"> its text was borrowed from the original document.
<t>Thanks to the original authors of RFC 8229, Tommy Pauly, Samy Touat </t>
i, and Ravi Mantha. <t>The following people provided valuable feedback and advice while
Since this document updates and obsoletes RFC 8229, most of its text w preparing RFC 8229: <contact fullname="Stuart Cheshire"/>, <contact
as borrowed fullname="Delziel Fernandes"/>, <contact fullname="Yoav Nir"/>, <contact
from the original document. fullname="Christoph Paasch"/>, <contact fullname="Yaron Sheffer"/>,
</t> <contact fullname="David Schinazi"/>, <contact fullname="Graham
Bartlett"/>, <contact fullname="Byju Pularikkal"/>, <contact
<t>The following people provided valuable feedback and advices while p fullname="March Wu"/>, <contact fullname="Kingwel Xie"/>, <contact
reparing RFC8229: fullname="Valery Smyslov"/>, <contact fullname="Jun Hu"/>, and <contact
Stuart Cheshire, Delziel Fernandes, Yoav Nir, Christoph Paasch, Yaron fullname="Tero Kivinen"/>. Special thanks to <contact fullname="Eric
Sheffer, David Schinazi, Graham Bartlett, Byju Pularikkal, March Wu, Kinnear"/> for his implementation work.
Kingwel Xie, Valery Smyslov, Jun Hu, and Tero Kivinen. Special </t>
thanks to Eric Kinnear for his implementation work. <t>The authors would like to thank <contact fullname="Tero Kivinen"/>,
</t> <contact fullname="Paul Wouters"/>, <contact fullname="Joseph Touch"/>,
and <contact fullname="Christian Huitema"/> for their valuable comments
<t>The authors would like to thank Tero Kivinen, Paul Wouters, Joseph while preparing this document.
Touch, and Christian Huitema for their </t>
valuable comments while preparing this document. </section>
</t> </back>
</section>
</back>
</rfc> </rfc>
 End of changes. 235 change blocks. 
1159 lines changed or deleted 1110 lines changed or added

This html diff was produced by rfcdiff 1.48.