draft-ietf-ipsecme-tcp-encaps-05.txt   draft-ietf-ipsecme-tcp-encaps-06.txt 
Network T. Pauly Network T. Pauly
Internet-Draft Apple Inc. Internet-Draft Apple Inc.
Intended status: Standards Track S. Touati Intended status: Standards Track S. Touati
Expires: July 27, 2017 Ericsson Expires: August 7, 2017 Ericsson
R. Mantha R. Mantha
Cisco Systems Cisco Systems
January 23, 2017 February 3, 2017
TCP Encapsulation of IKE and IPsec Packets TCP Encapsulation of IKE and IPsec Packets
draft-ietf-ipsecme-tcp-encaps-05 draft-ietf-ipsecme-tcp-encaps-06
Abstract Abstract
This document describes a method to transport IKE and IPsec packets This document describes a method to transport IKE and IPsec packets
over a TCP connection for traversing network middleboxes that may over a TCP connection for traversing network middleboxes that may
block IKE negotiation over UDP. This method, referred to as TCP block IKE negotiation over UDP. This method, referred to as TCP
encapsulation, involves sending both IKE packets for tunnel encapsulation, involves sending both IKE packets for Security
establishment as well as tunneled packets using ESP over a TCP Association establishment as well as ESP packets over a TCP
connection. This method is intended to be used as a fallback option connection. This method is intended to be used as a fallback option
when IKE cannot be negotiated over UDP. when IKE cannot be negotiated over UDP.
Status of This Memo Status of This Memo
This Internet-Draft is submitted in full conformance with the This Internet-Draft is submitted in full conformance with the
provisions of BCP 78 and BCP 79. provisions of BCP 78 and BCP 79.
Internet-Drafts are working documents of the Internet Engineering Internet-Drafts are working documents of the Internet Engineering
Task Force (IETF). Note that other groups may also distribute Task Force (IETF). Note that other groups may also distribute
working documents as Internet-Drafts. The list of current Internet- working documents as Internet-Drafts. The list of current Internet-
Drafts is at http://datatracker.ietf.org/drafts/current/. Drafts is at http://datatracker.ietf.org/drafts/current/.
Internet-Drafts are draft documents valid for a maximum of six months Internet-Drafts are draft documents valid for a maximum of six months
and may be updated, replaced, or obsoleted by other documents at any and may be updated, replaced, or obsoleted by other documents at any
time. It is inappropriate to use Internet-Drafts as reference time. It is inappropriate to use Internet-Drafts as reference
material or to cite them other than as "work in progress." material or to cite them other than as "work in progress."
This Internet-Draft will expire on July 27, 2017. This Internet-Draft will expire on August 7, 2017.
Copyright Notice Copyright Notice
Copyright (c) 2017 IETF Trust and the persons identified as the Copyright (c) 2017 IETF Trust and the persons identified as the
document authors. All rights reserved. document authors. All rights reserved.
This document is subject to BCP 78 and the IETF Trust's Legal This document is subject to BCP 78 and the IETF Trust's Legal
Provisions Relating to IETF Documents Provisions Relating to IETF Documents
(http://trustee.ietf.org/license-info) in effect on the date of (http://trustee.ietf.org/license-info) in effect on the date of
publication of this document. Please review these documents publication of this document. Please review these documents
carefully, as they describe your rights and restrictions with respect carefully, as they describe your rights and restrictions with respect
to this document. Code Components extracted from this document must to this document. Code Components extracted from this document must
include Simplified BSD License text as described in Section 4.e of include Simplified BSD License text as described in Section 4.e of
the Trust Legal Provisions and are provided without warranty as the Trust Legal Provisions and are provided without warranty as
described in the Simplified BSD License. described in the Simplified BSD License.
Table of Contents Table of Contents
1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . 2 1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . 2
1.1. Prior Work and Motivation . . . . . . . . . . . . . . . . 3 1.1. Prior Work and Motivation . . . . . . . . . . . . . . . . 3
1.2. Requirements Language . . . . . . . . . . . . . . . . . . 4 1.2. Terminology and Notation . . . . . . . . . . . . . . . . 4
2. Configuration . . . . . . . . . . . . . . . . . . . . . . . . 4 2. Configuration . . . . . . . . . . . . . . . . . . . . . . . . 4
3. TCP-Encapsulated Header Formats . . . . . . . . . . . . . . . 5 3. TCP-Encapsulated Header Formats . . . . . . . . . . . . . . . 5
3.1. TCP-Encapsulated IKE Header Format . . . . . . . . . . . 5 3.1. TCP-Encapsulated IKE Header Format . . . . . . . . . . . 6
3.2. TCP-Encapsulated ESP Header Format . . . . . . . . . . . 6 3.2. TCP-Encapsulated ESP Header Format . . . . . . . . . . . 6
4. TCP-Encapsulated Stream Prefix . . . . . . . . . . . . . . . 6 4. TCP-Encapsulated Stream Prefix . . . . . . . . . . . . . . . 7
5. Applicability . . . . . . . . . . . . . . . . . . . . . . . . 7 5. Applicability . . . . . . . . . . . . . . . . . . . . . . . . 7
5.1. Recommended Fallback from UDP . . . . . . . . . . . . . . 7 5.1. Recommended Fallback from UDP . . . . . . . . . . . . . . 8
6. Connection Establishment and Teardown . . . . . . . . . . . . 8 6. Connection Establishment and Teardown . . . . . . . . . . . . 8
7. Interaction with NAT Detection Payloads . . . . . . . . . . . 9 7. Interaction with NAT Detection Payloads . . . . . . . . . . . 10
8. Using MOBIKE with TCP encapsulation . . . . . . . . . . . . . 10 8. Using MOBIKE with TCP encapsulation . . . . . . . . . . . . . 10
9. Using IKE Message Fragmentation with TCP encapsulation . . . 10 9. Using IKE Message Fragmentation with TCP encapsulation . . . 11
10. Considerations for Keep-alives and DPD . . . . . . . . . . . 11 10. Considerations for Keep-alives and DPD . . . . . . . . . . . 11
11. Middlebox Considerations . . . . . . . . . . . . . . . . . . 11 11. Middlebox Considerations . . . . . . . . . . . . . . . . . . 11
12. Performance Considerations . . . . . . . . . . . . . . . . . 11 12. Performance Considerations . . . . . . . . . . . . . . . . . 12
12.1. TCP-in-TCP . . . . . . . . . . . . . . . . . . . . . . . 12 12.1. TCP-in-TCP . . . . . . . . . . . . . . . . . . . . . . . 12
12.2. Added Reliability for Unreliable Protocols . . . . . . . 12 12.2. Added Reliability for Unreliable Protocols . . . . . . . 12
12.3. Quality of Service Markings . . . . . . . . . . . . . . 12 12.3. Quality of Service Markings . . . . . . . . . . . . . . 12
12.4. Maximum Segment Size . . . . . . . . . . . . . . . . . . 12 12.4. Maximum Segment Size . . . . . . . . . . . . . . . . . . 12
13. Security Considerations . . . . . . . . . . . . . . . . . . . 12 13. Security Considerations . . . . . . . . . . . . . . . . . . . 13
14. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 13 14. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 13
15. Acknowledgments . . . . . . . . . . . . . . . . . . . . . . . 13 15. Acknowledgments . . . . . . . . . . . . . . . . . . . . . . . 14
16. References . . . . . . . . . . . . . . . . . . . . . . . . . 13 16. References . . . . . . . . . . . . . . . . . . . . . . . . . 14
16.1. Normative References . . . . . . . . . . . . . . . . . . 13 16.1. Normative References . . . . . . . . . . . . . . . . . . 14
16.2. Informative References . . . . . . . . . . . . . . . . . 14 16.2. Informative References . . . . . . . . . . . . . . . . . 14
Appendix A. Using TCP encapsulation with TLS . . . . . . . . . . 15 Appendix A. Using TCP encapsulation with TLS . . . . . . . . . . 15
Appendix B. Example exchanges of TCP Encapsulation with TLS . . 15 Appendix B. Example exchanges of TCP Encapsulation with TLS . . 16
B.1. Establishing an IKE session . . . . . . . . . . . . . . . 15 B.1. Establishing an IKE session . . . . . . . . . . . . . . . 16
B.2. Deleting an IKE session . . . . . . . . . . . . . . . . . 17 B.2. Deleting an IKE session . . . . . . . . . . . . . . . . . 17
B.3. Re-establishing an IKE session . . . . . . . . . . . . . 18 B.3. Re-establishing an IKE session . . . . . . . . . . . . . 18
B.4. Using MOBIKE between UDP and TCP Encapsulation . . . . . 19 B.4. Using MOBIKE between UDP and TCP Encapsulation . . . . . 19
Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . 20 Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . 21
1. Introduction 1. Introduction
IKEv2 [RFC7296] is a protocol for establishing IPsec tunnels, using IKEv2 [RFC7296] is a protocol for establishing IPsec Security
IKE messages over UDP for control traffic, and using Encapsulating Associations (SAs), using IKE messages over UDP for control traffic,
Security Payload (ESP) messages for tunneled data traffic. Many and using Encapsulating Security Payload (ESP) messages for encrypted
network middleboxes that filter traffic on public hotspots block all data traffic. Many network middleboxes that filter traffic on public
UDP traffic, including IKE and IPsec, but allow TCP connections hotspots block all UDP traffic, including IKE and IPsec, but allow
through since they appear to be web traffic. Devices on these TCP connections through since they appear to be web traffic. Devices
networks that need to use IPsec (to access private enterprise on these networks that need to use IPsec (to access private
networks, to route voice-over-IP calls to carrier networks, or enterprise networks, to route voice-over-IP calls to carrier
because of security policies) are unable to establish IPsec tunnels. networks, or because of security policies) are unable to establish
This document defines a method for encapsulating both the IKE control IPsec SAs. This document defines a method for encapsulating both the
messages as well as the IPsec data messages within a TCP connection. IKE control messages as well as the IPsec data messages within a TCP
connection.
Using TCP as a transport for IPsec packets adds a third option to the Using TCP as a transport for IPsec packets adds a third option to the
list of traditional IPsec transports: list of traditional IPsec transports:
1. Direct. Currently, IKE negotiations begin over UDP port 500. 1. Direct. Currently, IKE negotiations begin over UDP port 500.
If no NAT is detected between the initiator and the receiver, If no NAT is detected between the Initiator and the Responder,
then subsequent IKE packets are sent over UDP port 500 and then subsequent IKE packets are sent over UDP port 500 and
IPsec data packets are sent using ESP [RFC4303]. IPsec data packets are sent using ESP [RFC4303].
2. UDP Encapsulation [RFC3948]. If a NAT is detected between the 2. UDP Encapsulation [RFC3948]. If a NAT is detected between the
initiator and the receiver, then subsequent IKE packets are Initiator and the Responder, then subsequent IKE packets are
sent over UDP port 4500 with four bytes of zero at the start of sent over UDP port 4500 with four bytes of zero at the start of
the UDP payload and ESP packets are sent out over UDP port the UDP payload and ESP packets are sent out over UDP port
4500. Some peers default to using UDP encapsulation even when 4500. Some peers default to using UDP encapsulation even when
no NAT are detected on the path as some middleboxes do not no NAT are detected on the path as some middleboxes do not
support IP protocols other than TCP and UDP. support IP protocols other than TCP and UDP.
3. TCP Encapsulation. If both of the other two methods are not 3. TCP Encapsulation. If both of the other two methods are not
available or appropriate, both IKE negotiation packets as well available or appropriate, both IKE negotiation packets as well
as ESP packets can be sent over a single TCP connection to the as ESP packets can be sent over a single TCP connection to the
peer. peer.
skipping to change at page 4, line 26 skipping to change at page 4, line 26
IPsec in order to provide reliability. IPsec in order to provide reliability.
IKEv2 over TCP IKEv2 over TCP as described in IKEv2 over TCP IKEv2 over TCP as described in
[I-D.nir-ipsecme-ike-tcp] is used to avoid UDP fragmentation. [I-D.nir-ipsecme-ike-tcp] is used to avoid UDP fragmentation.
The goal of this specification is to provide a standardized method The goal of this specification is to provide a standardized method
for using TCP streams to transport IPsec that is compatible with the for using TCP streams to transport IPsec that is compatible with the
current IKE standard, and avoids the overhead of other alternatives current IKE standard, and avoids the overhead of other alternatives
that always rely on TCP or TLS. that always rely on TCP or TLS.
1.2. Requirements Language 1.2. Terminology and Notation
This document distinguishes between the IKE peer that initiates TCP
connections to be used for TCP encapsulation and the roles of
Initiator and Responder for particular IKE messages. During the
course of IKE exchanges, the role of IKE Initiator and Responder may
swap for a given SA (as with IKE SA Rekeys), while the initiator of
the TCP connection is still responsible for tearing down the TCP
connection and re-establishing it if necessary. For this reason,
this document will use the term "TCP Originator" to indicate the the
IKE peer that initiates TCP connections. The peer that receives TCP
connections will be referred to as the "TCP Responder". The TCP
Originator MUST be the same as the "Original Initiator", or the
Initiator of the first IKE SA exchange for a given IKE session.
The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT",
"SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this
document are to be interpreted as described in RFC 2119 [RFC2119]. document are to be interpreted as described in RFC 2119 [RFC2119].
2. Configuration 2. Configuration
One of the main reasons to use TCP encapsulation is that UDP traffic 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 pre-configured on both
the initiator and the responder. the TCP Originator and the TCP Responder.
The configuration defined on each peer should include the following The configuration defined on each peer should include the following
parameters: parameters:
o One or more TCP ports on which the responder will listen for o One or more TCP ports on which the TCP Responder will listen for
incoming connections. Note that the initiator may initiate TCP incoming connections. Note that the TCP Originator may initiate
connections to the responder from any local port. The ports on TCP connections to the TCP Responder from any local port. The
which the responder listens will likey be based on the ports ports on which the TCP Responder listens will likey be based on
commonly allowed on restricted networks. the ports commonly allowed on restricted networks.
o Optionally, an extra framing protocol to use on top of TCP to o Optionally, an extra framing protocol to use on top of TCP to
further encapsulate the stream of IKE and IPsec packets. See further encapsulate the stream of IKE and IPsec packets. See
Appendix A for a detailed discussion. Appendix A for a detailed discussion.
This document leaves the selection of TCP ports up to This document leaves the selection of TCP ports up to
implementations. It is suggested to use TCP port 4500, which is implementations. It is suggested to use TCP port 4500, which is
allocated for IPsec NAT Traversal. allocated for IPsec NAT Traversal.
Since TCP encapsulation of IKE and IPsec packets adds overhead and Since TCP encapsulation of IKE and IPsec packets adds overhead and
has potential performance trade-offs compared to direct or UDP- has potential performance trade-offs compared to direct or UDP-
encapsulated tunnels (as described in Performance Considerations, encapsulated SAs (as described in Performance Considerations,
Section 12), implementations SHOULD prefer ESP direct or UDP Section 12), implementations SHOULD prefer ESP direct or UDP
encapsulated tunnels over TCP encapsulated tunnels when possible. encapsulated SAs over TCP encapsulated SAs when possible.
3. TCP-Encapsulated Header Formats 3. TCP-Encapsulated Header Formats
Like UDP encapsulation, TCP encapsulation uses the first four bytes 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 length field to define the boundaries of encapsulation also adds a length field to define the boundaries of
messages within a stream. The message length is sent in a 16-bit messages within a stream. The message length is sent in a 16-bit
field that precedes every message. If the first 32-bits of the field that precedes every message. If the first 32-bits of the
message are zeros (a Non-ESP Marker), then the contents comprise an message are zeros (a Non-ESP Marker), then the contents comprise an
IKE message. Otherwise, the contents comprise an ESP message. IKE message. Otherwise, the contents comprise an ESP message.
skipping to change at page 6, line 45 skipping to change at page 7, line 12
o Length (2 octets, unsigned integer) - Length of the ESP packet o Length (2 octets, unsigned integer) - Length of the ESP packet
including the Length Field. including the Length Field.
4. TCP-Encapsulated Stream Prefix 4. TCP-Encapsulated Stream Prefix
Each stream of bytes used for IKE and IPsec encapsulation MUST begin 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 with a fixed sequence of six bytes as a magic value, containing the
characters "IKETCP" as ASCII values. This allows peers to characters "IKETCP" as ASCII values. This allows peers to
differentiate this protocol from other protocols that may be run over differentiate this protocol from other protocols that may be run over
the same TCP port. Since TCP encapsulated IPsec is not assigned to a the same TCP port. Since TCP encapsulated IPsec is not assigned to a
specific port, responders may be able to receive multiple protocols specific port, TCP Responders may be able to receive multiple
on the same port. The bytes of the stream prefix do not overlap with protocols on the same port. The bytes of the stream prefix do not
the valid start of any other known stream protocol. This value is overlap with the valid start of any other known stream protocol.
only sent once, by the Initiator only, at the beginning of any stream This value is only sent once, by the TCP Originator only, at the
of IKE and ESP messages. beginning of any stream of IKE and ESP messages.
If other framing protocols are used within TCP to further encapsulate 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 Initiator's IKE and ESP message stream within be at the start of the TCP Originator's IKE and ESP message stream
the added protocol layer [Appendix A]. Although some framing within the added protocol layer [Appendix A]. 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.
0 1 2 3 4 5 0 1 2 3 4 5
+------+------+------+------+------+------+ +------+------+------+------+------+------+
| 0x49 | 0x4b | 0x45 | 0x54 | 0x43 | 0x50 | | 0x49 | 0x4b | 0x45 | 0x54 | 0x43 | 0x50 |
+------+------+------+------+------+------+ +------+------+------+------+------+------+
Figure 3 Figure 3
5. Applicability 5. Applicability
TCP encapsulation is applicable only when it has been configured to TCP encapsulation is applicable only when it has been configured to
be used with specific IKE peers. If a responder is configured to use be used with specific IKE peers. If a Responder is configured to use
TCP encapsulation, it MUST listen on the configured port(s) in case TCP encapsulation, it MUST listen on the configured port(s) in case
any peers will initiate new IKE sessions. Initiators MAY use TCP any peers will initiate new IKE sessions. Initiators MAY 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
should only use TCP encapsulation when traffic over UDP is blocked. should only use TCP encapsulation when traffic over UDP is blocked.
Since the support of TCP encapsulation is a configured property, not 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, or endpoints used with IKE redirection), all of the endpoints
equally support TCP encapsulation. equally support TCP encapsulation.
If TCP encapsulation is being used for a specific IKE SA, all If TCP encapsulation is being used for a specific IKE SA, all
messages for that IKE SA and its Child SAs MUST be sent over a TCP messages for that IKE SA and its Child SAs MUST be sent over a TCP
connection until the SA is deleted or MOBIKE is used to change the SA connection until the SA is deleted or MOBIKE is used to change the SA
endpoints and/or encapsulation protocol. See Section 8 for more endpoints and/or encapsulation protocol. See Section 8 for more
details on using MOBIKE to transition between encapsulation modes. details on using MOBIKE to transition between encapsulation modes.
5.1. Recommended Fallback from UDP 5.1. Recommended Fallback from UDP
Since UDP is the preferred method of transport for IKE messages, 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 SHOULD
always attempt negotiate IKE over UDP first. IKEv2 defines how to always attempt negotiate IKE over UDP first. IKEv2 defines how to
use retransmission timers with IKE messages, and IKE_SA_INIT messages use retransmission timers with IKE messages, and IKE_SA_INIT messages
specifically [RFC7296]. Generally, this means that the specifically [RFC7296]. Generally, 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 is retransmitted at least once before initial message over UDP is 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.
6. Connection Establishment and Teardown 6. Connection Establishment and Teardown
When the IKE initiator uses TCP encapsulation for its negotiation, it When the IKE Initiator uses TCP encapsulation, it will initiate a TCP
will initiate a TCP connection to the responder using the configured connection to the Responder using the configured TCP port. The first
TCP port. The first bytes sent on the stream MUST be the stream bytes sent on the stream MUST be the stream prefix value [Section 4].
prefix value [Section 4]. After this prefix, encapsulated IKE After this prefix, encapsulated IKE messages will negotiate the IKE
messages will negotiate the IKE SA and initial Child SA [RFC7296]. SA and initial Child SA [RFC7296]. After this point, both
After this point, both encapsulated IKE Figure 1 and ESP Figure 2 encapsulated IKE Figure 1 and ESP Figure 2 messages will be sent over
messages will be sent over the TCP connection. The responder MUST the TCP connection. The TCP Responder MUST wait for the entire
wait for the entire stream prefix to be received on the stream before stream prefix to be received on the stream before trying to parse out
trying to parse out any IKE or ESP messages. The stream prefix is any IKE or ESP messages. The stream prefix is sent only once, and
sent only once, and only by the initiator. only by the TCP Originator.
In order to close an IKE session, either the initiator or responder In order to close an IKE session, either the Initiator or Responder
SHOULD gracefully tear down IKE SAs with DELETE payloads. Once all SHOULD gracefully tear down IKE SAs with DELETE payloads. Once all
SAs have been deleted, the initiator of the original connection the SA has been deleted, the TCP Originator SHOULD close the TCP
SHOULD close the TCP connection if it does not intend to use the connection if it does not intend to use the connection for another
connection for another IKE session to the responder. If the IKE session to the TCP Responder. If the connection is left idle,
connection is left idle, and the responder needs to clean up and the TCP Responder needs to clean up resources, the TCP Responder
resources, the responder MAY close the TCP connection. MAY close the TCP connection.
An unexpected FIN or a RST on the TCP connection may indicate either An unexpected FIN or a RST on the TCP connection may indicate either
a loss of connectivity, an attack, or some other error. If a DELETE a 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 SHOULD maintain the state for
their SAs for the standard lifetime or time-out period. The original their SAs for the standard lifetime or time-out period. The TCP
initiator (that is, the endpoint that initiated the TCP connection Originator is responsible for re-establishing the TCP connection if
and sent the first IKE_SA_INIT message) is responsible for re- it is torn down for any unexpected reason. Since new TCP connections
establishing the TCP connection if it is torn down for any unexpected may use different ports due to NAT mappings or local port allocations
reason. Since new TCP connections may use different ports due to NAT changing, the TCP Responder MUST allow packets for existing SAs to be
mappings or local port allocations changing, the responder MUST allow received from new source ports.
packets for existing SAs to be received from new source ports.
A peer MUST discard a partially received message due to a broken A peer MUST discard a partially received message due to a broken
connection. connection.
Whenever the initiator opens a new TCP connection to be used for an Whenever the TCP Originator opens a new TCP connection to be used for
existing IKE SA, it MUST send the stream prefix first, before any IKE an existing IKE SA, it MUST send the stream prefix first, before any
or ESP messages. This follows the same behavior as the initial TCP IKE or ESP messages. This follows the same behavior as the initial
connection. TCP connection.
If the connection is being used to resume a previous IKE session, the If a TCP connection is being used to resume a previous IKE session,
responder can recognize the session using either the IKE SPI from an the TCP Responder can recognize the session using either the IKE SPI
encapsulated IKE message or the ESP SPI from an encapsulated ESP from an encapsulated IKE message or the ESP SPI from an encapsulated
message. If the session had been fully established previously, it is ESP message. If the session had been fully established previously,
suggested that the initiator send an UPDATE_SA_ADDRESSES message if it is suggested that the TCP Originator send an UPDATE_SA_ADDRESSES
MOBIKE is supported, or an INFORMATIONAL message (a keepalive) message if MOBIKE is supported, or an INFORMATIONAL message (a
otherwise. If either initiator or responder receives a stream that keepalive) otherwise. If either TCP Originator or TCP Responder
cannot be parsed correctly (initiator stream missing the stream receives a stream that cannot be parsed correctly (for example, if
prefix, or message frames not parsable as IKE or ESP messages), it the TCP Originator stream is missing the stream prefix, or message
MUST close the TCP connection. If there is instead a syntax issue frames are not parsable as IKE or ESP messages), it MUST close the
within an IKE message, an implementation MUST send the INVALID_SYNTAX TCP connection. If there is instead a syntax issue within an IKE
notify payload and tear down the IKE session as ususal, rather than message, an implementation MUST send the INVALID_SYNTAX notify
tearing down the TCP connection directly. payload and tear down the IKE session as ususal, rather than tearing
down the TCP connection directly.
An initiator SHOULD only open one TCP connection per IKE SA, over An TCP Originator SHOULD only open one TCP connection per IKE SA,
which it sends all of the corresponding IKE and ESP messages. This over which it sends all of the corresponding IKE and ESP messages.
helps ensure that any firewall or NAT mappings allocated for the TCP This helps ensure that any firewall or NAT mappings allocated for the
connection apply to all of the traffic associated with the IKE SA TCP connection apply to all of the traffic associated with the IKE SA
equally. equally.
A responder SHOULD at any given time send packets for an IKE SA and Similarly, a TCP Responder SHOULD at any given time send packets for
its Child SAs over only one TCP connection. It SHOULD choose the TCP an IKE SA and its Child SAs over only one TCP connection. It SHOULD
connection on which it last received a valid and decryptable IKE or choose the TCP connection on which it last received a valid and
ESP message. In order to be considered valid for choosing a TCP decryptable IKE or ESP message. In order to be considered valid for
connection, an IKE message successfully decrypt and be authenticated, choosing a TCP connection, an IKE message must be successfully
not be a retransmission of a previously received message, and be decrypted and authenticated, not be a retransmission of a previously
within the expected window for IKE message IDs. Similarly, an ESP received message, and be within the expected window for IKE message
message must pass authentication checks and be decrypted, not be a IDs. Similarly, an ESP message must pass authentication checks and
replay of a previous message. be decrypted, not be a replay of a previous message.
Since a connection may be broken and a new connection re-established Since a connection may be broken and a new connection re-established
by the initiator without the responder being aware, a responder by the TCP Originator without the TCP Responder being aware, a TCP
SHOULD accept receiving IKE and ESP messages on both old and new Responder SHOULD accept receiving IKE and ESP messages on both old
connections until the old connection is closed by the initiator. A and new connections until the old connection is closed by the TCP
responder MAY close a TCP connection that it perceives as idle and Originator. A TCP Responder MAY close a TCP connection that it
extraneous (one previously used for IKE and ESP messages that has perceives as idle and extraneous (one previously used for IKE and ESP
been replaced by a new connection). messages that has been replaced by a new connection).
Multiple IKE SAs MUST NOT share a single TCP connection. Multiple IKE SAs MUST NOT share a single TCP connection, unless one
is a rekey of an existing IKE SA, in which case there will
temporarily be two IKE SAs on the same TCP connection.
7. Interaction with NAT Detection Payloads 7. Interaction with NAT Detection Payloads
When negotiating over UDP port 500, IKE_SA_INIT packets include When negotiating over UDP port 500, 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. IKE_SA_INIT packets sent on a TCP connection SHOULD include ports. IKE_SA_INIT packets sent on a TCP connection SHOULD include
these payloads, and SHOULD use the applicable TCP ports when creating these payloads, and SHOULD use the applicable TCP ports when creating
and checking the SHA-1 digests. and checking the SHA-1 digests.
skipping to change at page 10, line 20 skipping to change at page 10, line 35
supports NAT traversal. Implementations MAY use the information that supports NAT traversal. Implementations MAY use the information that
a NAT is present to influence keep-alive timer values. a NAT is present to influence keep-alive timer values.
If a NAT is detected, implementations need to handle transport mode If a NAT is detected, implementations need to handle transport mode
TCP and UDP packet checksum fixup as defined for UDP encapsulation TCP and UDP packet checksum fixup as defined for UDP encapsulation
[RFC3948]. [RFC3948].
8. Using MOBIKE with TCP encapsulation 8. Using MOBIKE with TCP encapsulation
When an IKE session that has negotiated MOBIKE [RFC4555] is When an IKE session that has negotiated MOBIKE [RFC4555] 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 MUST support dynamically enabling and disabling TCP encapsulation MUST support dynamically enabling and disabling TCP
encapsulation as interfaces change. encapsulation as interfaces change.
When a MOBIKE-enabled initiator changes networks, the When a MOBIKE-enabled Initiator changes networks, the
UPDATE_SA_ADDRESSES notification SHOULD be sent out first over UDP UPDATE_SA_ADDRESSES notification SHOULD be sent out first over UDP
before attempting over TCP. If there is a response to the before attempting over TCP. If there is a response to the
UPDATE_SA_ADDRESSES notification sent over UDP, then the ESP packets UPDATE_SA_ADDRESSES notification sent over UDP, then the ESP packets
should be sent directly over IP or over UDP port 4500 (depending on should be sent directly over IP or over UDP port 4500 (depending on
if a NAT was detected), regardless of if a connection on a previous if a NAT was detected), regardless of if a connection on a previous
network was using TCP encapsulation. Similarly, if the responder network was using TCP encapsulation. Similarly, if the Responder
only responds to the UPDATE_SA_ADDRESSES notification over TCP, then only responds to the UPDATE_SA_ADDRESSES notification 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.
9. Using IKE Message Fragmentation with TCP encapsulation 9. Using IKE Message Fragmentation with TCP encapsulation
IKE Message Fragmentation [RFC7383] is not required when using TCP IKE Message Fragmentation [RFC7383] is 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
skipping to change at page 11, line 49 skipping to change at page 12, line 15
this could be dropped by the security device. this could be dropped by the security device.
A network device that monitors the transport layer will track the A network device that monitors the transport layer will track the
state of TCP sessions, such as TCP sequence numbers. TCP state of TCP sessions, such as TCP sequence numbers. TCP
encapsulation of IKE should therefore use standard TCP behaviors to encapsulation of IKE should therefore use standard TCP behaviors to
avoid being dropped by middleboxes. avoid being dropped by middleboxes.
12. Performance Considerations 12. Performance Considerations
Several aspects of TCP encapsulation for IKE and IPsec packets may Several aspects of TCP encapsulation for IKE and IPsec packets may
negatively impact the performance of connections within the tunnel. negatively impact the performance of connections within a tunnel-mode
Implementations should be aware of these and take these into IPsec SA. Implementations should be aware of these and take these
consideration when determining when to use TCP encapsulation. into consideration when determining when to use TCP encapsulation.
12.1. TCP-in-TCP 12.1. TCP-in-TCP
If the outer connection between IKE peers is over TCP, inner TCP If the outer connection between IKE peers is over TCP, inner TCP
connections may suffer effects from using TCP within TCP. In connections may suffer effects from using TCP within TCP. In
particular, the inner TCP's round-trip-time estimation will be particular, the inner TCP's round-trip-time estimation will be
affected by the burstiness of the outer TCP. This will make loss- affected by the burstiness of the outer TCP. This will make loss-
recovery of the inner TCP traffic less reactive and more prone to recovery of the inner TCP traffic less reactive and more prone to
spurious retransmission timeouts. spurious retransmission timeouts.
skipping to change at page 12, line 39 skipping to change at page 13, line 7
differently and cause unnecessary delays in the connection. differently and cause unnecessary delays in the connection.
12.4. Maximum Segment Size 12.4. Maximum Segment Size
A TCP connection used for IKE encapsulation SHOULD negotiate its A TCP connection used for IKE encapsulation SHOULD negotiate its
maximum segment size (MSS) in order to avoid unnecessary maximum segment size (MSS) in order to avoid unnecessary
fragmentation of packets. fragmentation of packets.
13. Security Considerations 13. Security Considerations
IKE responders that support TCP encapsulation may become vulnerable 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. Responders should be aware of this as SYN-flooding attacks. TCP Responders should be aware of this
additional attack-surface. additional attack-surface.
Responders should be careful to ensure that the stream prefix TCP Responders should be careful to ensure that the stream prefix
"IKETCP" uniquely identifies streams using the TCP encapsulation "IKETCP" uniquely identifies streams using the TCP encapsulation
protocol. The prefix was chosen to not overlap with the start of any protocol. The prefix was chosen to not overlap with the start of any
known valid protocol over TCP, but implementations should make sure known valid protocol over TCP, but implementations should make sure
to validate this assumption in order to avoid unexpected processing to validate this assumption in order to avoid unexpected processing
of TCP connections. of TCP connections.
Attackers may be able to disrupt the TCP connection by sending Attackers may be able to disrupt the TCP connection by sending
spurious RST packets. Due to this, implementations SHOULD make sure spurious RST packets. Due to this, implementations SHOULD make sure
that IKE session state persists even if the underlying TCP connection that IKE session state persists even if the underlying TCP connection
is torn down. is torn down.
If MOBIKE is being used, all of the security considerations outlined If MOBIKE is being used, all of the security considerations outlined
for MOBIKE apply [[RFC4555]]. for MOBIKE apply [[RFC4555]].
Similarly to MOBIKE, TCP encapsulation requires a responder to handle Similarly to MOBIKE, TCP encapsulation requires a TCP Responder to
changing of source address and port due to network or connection handle changing of source address and port due to network or
disruption. The successful delivery of valid IKE or ESP messages connection disruption. The successful delivery of valid IKE or ESP
over a new TCP connection is used by the responder to determine where messages over a new TCP connection is used by the TCP Responder to
to send subsequent responses. If an attacker is able to send packets determine where to send subsequent responses. If an attacker is able
on a new TCP connection that pass the validation checks of the to send packets on a new TCP connection that pass the validation
responder, it can influence which path future packets take. For this checks of the TCP Responder, it can influence which path future
reason, the validation of messages on the responder must include packets take. For this reason, the validation of messages on the TCP
decryption, authentication, and replay checks. Responder must include decryption, authentication, and replay checks.
Since TCP provides a reliable, in-order delivery of ESP messages, the
ESP Anti-Replay Window size [RFC4303] SHOULD be set to 1. This
increases the protection of implementations against replay attacks.
14. IANA Considerations 14. IANA Considerations
This memo includes no request to IANA. This memo includes no request to IANA.
TCP port 4500 is already allocated to IPsec. This port MAY be used TCP port 4500 is already allocated to IPsec. This port MAY be used
for the protocol described in this document, but implementations MAY for the protocol described in this document, but implementations MAY
prefer to use other ports based on local policy. prefer to use other ports based on local policy.
15. Acknowledgments 15. Acknowledgments
skipping to change at page 15, line 15 skipping to change at page 15, line 35
Appendix A. Using TCP encapsulation with TLS Appendix A. Using TCP encapsulation with TLS
This section provides recommendations on the support of TLS with the This section provides recommendations on the support of TLS with the
TCP encapsulation. TCP encapsulation.
When using TCP encapsulation, implementations may choose to use TLS When using TCP encapsulation, implementations may choose to use TLS
[RFC5246], to be able to traverse middle-boxes, which may block non [RFC5246], to be able to traverse middle-boxes, which may block non
HTTP traffic. HTTP traffic.
If a web proxy is applied to the ports for the TCP connection, and If a web proxy is applied to the ports for the TCP connection, and
TLS is being used, the initiator can send an HTTP CONNECT message to TLS is being used, the TCP Originator can send an HTTP CONNECT
establish a tunnel through the proxy [RFC2817]. message to establish an SA through the proxy [RFC2817].
The use of TLS should be configurable on the peers. The responder The use of TLS should be configurable on the peers. The TCP
may expect to read encapsulated IKE and ESP packets directly from the Responder may expect to read encapsulated IKE and ESP packets
TCP connection, or it may expect to read them from a stream of TLS directly from the TCP connection, or it may expect to read them from
data packets. The initiator should be pre-configured to use TLS or a stream of TLS data packets. The TCP Originator should be pre-
not when communicating with a given port on the responder. configured to use TLS or not when communicating with a given port on
the TCP Responder.
When new TCP connections are re-established due to a broken When new TCP connections are re-established due to a broken
connection, TLS must be re-negotiated. TLS Session Resumption is connection, TLS must be re-negotiated. TLS Session Resumption is
recommended to improve efficiency in this case. recommended to improve efficiency in this case.
The security of the IKE session is entirely derived from the IKE 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 initiator and when TLS is used on the TCP connection, both the TCP Originator and
responder SHOULD allow the NULL cipher to be selected for performance TCP Responder SHOULD allow the NULL cipher to be selected for
reasons. performance reasons.
Implementations should be aware that the use of TLS introduces 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
middle-boxes. middle-boxes.
Appendix B. Example exchanges of TCP Encapsulation with TLS Appendix B. Example exchanges of TCP Encapsulation with TLS
skipping to change at page 16, line 50 skipping to change at page 17, line 23
repeat 1..N times repeat 1..N times
<------ Length + Non-ESP Marker <------ Length + Non-ESP Marker
IKE_AUTH + EAP IKE_AUTH + 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 Tunnel Established ---------------- -------------- IKE and IPsec SAs Established ------------
Length + ESP frame ----------> Length + ESP frame ---------->
Figure 4 Figure 4
1. Client establishes a TCP connection with the server on port 443 1. Client establishes a TCP connection with the server on port 443
or 4500. or 4500.
2. Client initiates TLS handshake. During TLS handshake, the 2. Client initiates TLS handshake. During TLS handshake, the
server SHOULD NOT request the client's' certificate, since server SHOULD NOT request the client's' certificate, since
authentication is handled as part of IKE negotiation. authentication is handled as part of IKE negotiation.
3. Client send the Stream Prefix for TCP encapsulated IKE 3. Client send the Stream Prefix for TCP encapsulated IKE
skipping to change at page 17, line 42 skipping to change at page 18, line 24
[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 ---------->
--------------------- Tunnel Deleted ------------------- --------------------- IKE SA Deleted -------------------
Figure 5 Figure 5
1. Client and server exchange INFORMATIONAL messages to notify IKE 1. Client and server exchange INFORMATIONAL messages to notify IKE
SA deletion. SA deletion.
2. Client and server negotiate TLS session deletion using TLS 2. Client and server negotiate TLS session deletion using TLS
CLOSE_NOTIFY. CLOSE_NOTIFY.
3. The TCP connection is torn down. 3. The TCP connection is torn down.
skipping to change at page 18, line 35 skipping to change at page 19, line 27
Finished Finished
3) ---------------------- Stream Prefix -------------------- 3) ---------------------- Stream Prefix --------------------
"IKETCP" ----------> "IKETCP" ---------->
4) <---------------------> IKE/ESP flow <------------------> 4) <---------------------> IKE/ESP flow <------------------>
Length + ESP frame ----------> Length + ESP frame ---------->
Figure 6 Figure 6
1. If a previous TCP connection was broken (for example, due to a 1. If a previous TCP connection was broken (for example, due to a
RST), the client is responsible for re-initiating the TCP RST), the client is responsible for re-initiating the TCP
connection. The initiator's address and port (IP_I and Port_I) connection. The TCP Originator's address and port (IP_I and
may be different from the previous connection's address and Port_I) may be different from the previous connection's address
port. and port.
2. In ClientHello TLS message, the client SHOULD send the Session 2. In ClientHello TLS message, the client SHOULD send the Session
ID it received in the previous TLS handshake if available. It ID it received in the previous TLS handshake if available. It
is up to the server to perform either an abbreviated handshake is up to the server to perform either an abbreviated handshake
or full handshake based on the session ID match. or full handshake based on the session ID match.
3. After TCP and TLS are complete, the client sends the Stream 3. After TCP and TLS are complete, the client sends the Stream
Prefix for TCP encapsulated IKE traffic [Section 4]. Prefix for TCP encapsulated IKE traffic [Section 4].
4. The IKE and ESP packet flow can resume. If MOBIKE is being 4. The IKE and ESP packet flow can resume. If MOBIKE is being
used, the initiator SHOULD send UPDATE_SA_ADDRESSES. used, the Initiator SHOULD send UPDATE_SA_ADDRESSES.
B.4. Using MOBIKE between UDP and TCP Encapsulation B.4. Using MOBIKE between UDP and TCP Encapsulation
Client Server Client Server
---------- ---------- ---------- ----------
(IP_I1:UDP500 -> IP_R:UDP500) (IP_I1:UDP500 -> IP_R:UDP500)
1) ----------------- IKE_SA_INIT Exchange ----------------- 1) ----------------- IKE_SA_INIT Exchange -----------------
(IP_I1:UDP4500 -> IP_R:UDP4500) (IP_I1:UDP4500 -> IP_R:UDP4500)
Non-ESP Marker -----------> Non-ESP Marker ----------->
Intial IKE_AUTH Intial IKE_AUTH
HDR, SK { IDi, CERT, AUTH, HDR, SK { IDi, CERT, AUTH,
CP(CFG_REQUEST), CP(CFG_REQUEST),
SAi2, TSi, TSr, SAi2, TSi, TSr,
N(MOBIKE_SUPPORTED) } N(MOBIKE_SUPPORTED) }
<----------- Non-ESP Marker <----------- Non-ESP Marker
Initial IKE_AUTH Initial IKE_AUTH
HDR, SK { IDr, CERT, AUTH, HDR, SK { IDr, CERT, AUTH,
EAP, SAr2, TSi, TSr, EAP, SAr2, TSi, TSr,
N(MOBIKE_SUPPORTED) } N(MOBIKE_SUPPORTED) }
<---------------- IKE tunnel establishment -------------> <------------------ IKE SA establishment --------------->
2) ------------ MOBIKE Attempt on new network -------------- 2) ------------ MOBIKE Attempt on new network --------------
(IP_I2:UDP4500 -> IP_R:UDP4500) (IP_I2:UDP4500 -> IP_R:UDP4500)
Non-ESP Marker -----------> 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) }
3) -------------------- TCP Connection ------------------- 3) -------------------- TCP Connection -------------------
 End of changes. 57 change blocks. 
148 lines changed or deleted 170 lines changed or added

This html diff was produced by rfcdiff 1.45. The latest version is available from http://tools.ietf.org/tools/rfcdiff/