idnits 2.17.1 draft-smyslov-ipsecme-tcp-guidelines-02.txt: Checking boilerplate required by RFC 5378 and the IETF Trust (see https://trustee.ietf.org/license-info): ---------------------------------------------------------------------------- No issues found here. Checking nits according to https://www.ietf.org/id-info/1id-guidelines.txt: ---------------------------------------------------------------------------- No issues found here. Checking nits according to https://www.ietf.org/id-info/checklist : ---------------------------------------------------------------------------- ** The document seems to lack an IANA Considerations section. (See Section 2.2 of https://www.ietf.org/id-info/checklist for how to handle the case when there are no actions for IANA.) ** The abstract seems to contain references ([RFC8229], [RFC7296]), which it shouldn't. Please replace those with straight textual mentions of the documents in question. Miscellaneous warnings: ---------------------------------------------------------------------------- == The copyright year in the IETF Trust and authors Copyright Line does not match the current year -- The document date (June 18, 2019) is 1772 days in the past. Is this intentional? Checking references for intended status: Informational ---------------------------------------------------------------------------- ** Obsolete normative reference: RFC 8229 (Obsoleted by RFC 9329) -- Obsolete informational reference (is this intentional?): RFC 6528 (Obsoleted by RFC 9293) Summary: 3 errors (**), 0 flaws (~~), 1 warning (==), 2 comments (--). Run idnits with the --verbose option for more detailed information about the items above. -------------------------------------------------------------------------------- 2 Network Working Group V. Smyslov 3 Internet-Draft ELVIS-PLUS 4 Intended status: Informational June 18, 2019 5 Expires: December 20, 2019 7 Clarifications and Implementation Guidelines for using TCP Encapsulation 8 in IKEv2 9 draft-smyslov-ipsecme-tcp-guidelines-02 11 Abstract 13 The Internet Key Exchange Protocol version 2 (IKEv2) defined in 14 [RFC7296] uses UDP transport for its messages. [RFC8229] specifies a 15 way to encapsulate IKEv2 and ESP (Encapsulating Security Payload) 16 messages in TCP, thus making possible to use them in network 17 environments that block UDP traffic. However, some nuances of using 18 TCP in IKEv2 are not covered by that specification. This document 19 provides clarifications and implementation guidelines for [RFC8229]. 21 Status of This Memo 23 This Internet-Draft is submitted in full conformance with the 24 provisions of BCP 78 and BCP 79. 26 Internet-Drafts are working documents of the Internet Engineering 27 Task Force (IETF). Note that other groups may also distribute 28 working documents as Internet-Drafts. The list of current Internet- 29 Drafts is at https://datatracker.ietf.org/drafts/current/. 31 Internet-Drafts are draft documents valid for a maximum of six months 32 and may be updated, replaced, or obsoleted by other documents at any 33 time. It is inappropriate to use Internet-Drafts as reference 34 material or to cite them other than as "work in progress." 36 This Internet-Draft will expire on December 20, 2019. 38 Copyright Notice 40 Copyright (c) 2019 IETF Trust and the persons identified as the 41 document authors. All rights reserved. 43 This document is subject to BCP 78 and the IETF Trust's Legal 44 Provisions Relating to IETF Documents 45 (https://trustee.ietf.org/license-info) in effect on the date of 46 publication of this document. Please review these documents 47 carefully, as they describe your rights and restrictions with respect 48 to this document. Code Components extracted from this document must 49 include Simplified BSD License text as described in Section 4.e of 50 the Trust Legal Provisions and are provided without warranty as 51 described in the Simplified BSD License. 53 Table of Contents 55 1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . 2 56 2. Terminology and Notation . . . . . . . . . . . . . . . . . . 3 57 3. TCP Encapsulation Format . . . . . . . . . . . . . . . . . . 3 58 4. Falling back from UDP to TCP . . . . . . . . . . . . . . . . 4 59 5. Retransmissions . . . . . . . . . . . . . . . . . . . . . . . 4 60 6. Using Cookies and Puzzles . . . . . . . . . . . . . . . . . . 4 61 7. Error Handling in the IKE_SA_INIT . . . . . . . . . . . . . . 5 62 8. Interaction with IKEv2 Extensions . . . . . . . . . . . . . . 6 63 8.1. MOBIKE Protocol . . . . . . . . . . . . . . . . . . . . . 6 64 8.2. IKEv2 Redirect . . . . . . . . . . . . . . . . . . . . . 7 65 8.3. IKEv2 Session Resumption . . . . . . . . . . . . . . . . 7 66 8.4. IKEv2 Protocol Support for High Availability . . . . . . 7 67 9. Security Considerations . . . . . . . . . . . . . . . . . . . 8 68 10. Acknowledgements . . . . . . . . . . . . . . . . . . . . . . 8 69 11. References . . . . . . . . . . . . . . . . . . . . . . . . . 8 70 11.1. Normative References . . . . . . . . . . . . . . . . . . 9 71 11.2. Informative References . . . . . . . . . . . . . . . . . 10 72 Author's Address . . . . . . . . . . . . . . . . . . . . . . . . 10 74 1. Introduction 76 The Internet Key Exchange version 2 (IKEv2) as it is defined in 77 [RFC7296] uses UDP as a transport protocol. As time passed the 78 network environment has been evolved and sometimes this evolution has 79 resulted in situations when UDP messages are dropped by network 80 infrastructure. This may happen either by incapability of network 81 devices to properly handle them (e.g. non-initial fragments of UDP 82 messages) of by deliberate configuration of network devices that 83 blocks UDP traffic. 85 Several standard solutions have been developed to deal with such 86 situations. In particular, [RFC7383] defines a way to avoid IP 87 fragmentation of large IKE messages and [RFC8229] specifies a way to 88 transfer IKEv2 and ESP (Encapsulated Security Payload) messages over 89 a stream protocol like TCP. This document focuses on the latter 90 specification and its goal is to give implementers guidelines how to 91 properly use reliable connection-oriented stream transport in IKEv2. 93 Since originally IKEv2 relied on unreliable transport, it was 94 designed to deal with this unreliability. IKEv2 has its own 95 retransmission timers, replay detection logic etc. Using reliable 96 transport makes many of such things unnecessary. On the other hand, 97 connection-oriented transport require IKEv2 to keep the connection 98 alive and to restore it in case it is broken, the tasks that were not 99 needed before. [RFC8229] gives recommendations how peers must behave 100 in different situations to keep the connection. However, 101 implementation experience has revealed that not all situations are 102 covered in [RFC8229], that may lead to interoperability problems or 103 to suboptimal performance. This memo gives implementers more 104 guidelines how to use reliable stream transport in IKEv2 in 105 situations, which are not covered in [RFC8229]. 107 2. Terminology and Notation 109 This document shares the terminology with [RFC8229]. In particular, 110 it uses terms "TCP Originator" and "TCP Responder" to refer to the 111 parties that initiate or responded to the TCP connection created for 112 the initial IKE SA (in a possible series of successive rekeys). More 113 details are given in Section 1.2 of [RFC8229]. 115 The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", 116 "SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED", "MAY", and 117 "OPTIONAL" in this document are to be interpreted as described in BCP 118 14 [RFC2119] [RFC8174] when, and only when, they appear in all 119 capitals, as shown here. 121 3. TCP Encapsulation Format 123 Section 3 of [RFC8229] describes how IKE and ESP packets are 124 encapsulated in TCP stream. For this purpose every IKE or ESP packet 125 is prepended with 16-bit Length field. However, the text in the 126 first para of the section is not very explicit on what the Length 127 field means - whether it indicates only the length of the following 128 IKE or ESP message or the length of field itself is also counted. 129 The following text in the same section clarifies it - the value of 130 the Length field includes the length of the field itself (2 octets). 131 It means that values 0 and 1 must never appear there. The receiver 132 MUST treat these values in the Length field as fatal error and MUST 133 close TCP session in this case. 135 Note, that since TCP header is longer than UDP header, and TCP 136 encapsulation also requires prepending of 16-bit Length field, some 137 very long ESP and IKE messages that could be sent over UDP cannot be 138 encapsulated in TCP, because their total length after encapsulation 139 would exceed 65535 and thus could not be represented in Length field. 141 4. Falling back from UDP to TCP 143 Section 5.1 of [RFC8229] describes how the fallback from UDP to TCP 144 must be handled. It is recommended, that in the absence of prior 145 knowledge, implementations first try to use UDP and then fall back 146 TCP if no reply is received within some period of time after several 147 retransmissions. In this case a new IKE_SA_INIT exchange MUST be 148 initiated with new initiator's SPI and with recalculated content of 149 NAT_DETECTION_SOURCE_IP notification. 151 5. Retransmissions 153 Section 2.1 of [RFC7296] describes how IKEv2 deals with unreliability 154 of UDP protocol. In brief, exchange initiator is responsible for 155 retransmissions and must retransmit requests message until response 156 message is received. If no reply is received after several 157 retransmissions, the SA is deleted. The responder never retransmits 158 but must resend the response message in case it receives 159 retransmitted request. 161 When IKEv2 uses reliable transport protocol, most of these rules 162 become unnecessary. Since [RFC8229] doesn't provide clear guidance 163 on using retransmissions in case of TCP encapsulation, this memo 164 gives the following rules. 166 o the exchange initiator SHOULD NOT retransmit request message; if 167 no response is received within some reasonable period of time, the 168 IKE SA is deleted 170 o if TCP connection is broken and then restored while the exchange 171 initiator is waiting for the response, the initiator MUST 172 retransmit the request and continue to wait for the response 174 o the exchange responder acts as described in Section 2.1 of 175 [RFC7296], i.e. using TCP encapsulation doesn't change the 176 responder's behavior 178 6. Using Cookies and Puzzles 180 IKEv2 provides a DoS attack protection mechanism called Cookie, which 181 is described in Section 2.6 of [RFC7296]. [RFC8019] extends this 182 mechanism for protection against DDoS attacks by means of Client 183 Puzzles. Both mechanisms allow the responder to keep no state until 184 the initiator proves its IP address is real (and solves puzzle in the 185 latter case). 187 [RFC8229] gives no guidance on how these mechanisms should be used in 188 case of TCP encapsulation. However, the connection-oriented nature 189 of TCP brings additional considerations for using these mechanisms. 190 In general, Cookie provides less value in case of TCP encapsulation, 191 because when the responder receives the IKE_SA_INIT request the TCP 192 session has already been established, so the initiator's IP address 193 has been verified. Moreover, TCP Responder creates state as far as 194 the SYN packer is received (unless SYN Cookies described in [RFC4987] 195 are employed), that violates the stateless nature of IKEv2 Cookies. 196 So, it makes little sense to send Cookie request in this situation, 197 unless the responder in concerned with the possibility of TCP 198 Sequence Number attacks (see [RFC6528] for details). On the other 199 hand, Puzzles still remain useful and their use requires using 200 Cookies. 202 The following considerations are applicable for using Cookie and 203 Puzzle mechanisms in case of TCP encapsulation. 205 o the exchange responder SHOULD NOT request Cookie unless the 206 responder has good reason to do it (like a concern of the 207 possibility of TCP Sequence Number attacks or Puzzle request is 208 sent in the same message) 210 o if the responder chooses to send Cookie request (possibly along 211 with Puzzle request), then the TCP connection that the IKE_SA_INIT 212 request message was received over SHOULD be closed, so that the 213 responder remains stateless at least until the Cookie (or Puzzle 214 Solution) is returned 216 * note, that if this TCP connection is closed, then the responder 217 MUST NOT include the initiator's TCP port into the Cookie 218 calculation (*), since the Cookie will be returned over a new 219 TCP connection with a different port 221 o the exchange initiator acts as described in Section 2.6 of 222 [RFC7296] and Section 7 of [RFC8019], i.e. using TCP encapsulation 223 doesn't change the initiator's behavior 225 (*) Examples of Cookie calculation methods are given in Section 2.6 226 of [RFC7296] and in Section 7.1.1.3 of [RFC8019] and they don't 227 include transport protocol ports. However these examples are given 228 for illustrative purposes, since Cookie generation algorithm is a 229 local matter and some implementations might include port numbers, 230 that won't work with TCP encapsulation. 232 7. Error Handling in the IKE_SA_INIT 234 Section 2.21.1 of [RFC7296] describes how error notifications should 235 be handled in the IKE_SA_INIT exchange. In particular, it is advised 236 that the initiator should not act immediately after receiving error 237 notification and should instead wait some time for valid response, 238 since the IKE_SA_INIT messages are completely unauthenticated. This 239 advice has little sense in case of TCP encapsulation. If the 240 initiator receives the response message over TCP, then either this 241 message is genuine and was sent by the peer, or the TCP session was 242 hijacked and the message is forged, but in this case no genuine 243 messages from the responder will be received. 245 So, in case of TCP encapsulation the initiator SHOULD NOT wait for 246 additional messages in case it receives error notification from the 247 responder in the IKE_SA_INIT exchange. 249 8. Interaction with IKEv2 Extensions 251 8.1. MOBIKE Protocol 253 MOBIKE protocol, that allows IKEv2 SA to migrate between IP 254 addresses, is defined in [RFC4555], and [RFC4621] further clarifies 255 the details of the protocol. Section 8 of [RFC8229] describes how 256 interaction between MOBIKE and TCP encapsulation. This memo provides 257 clarifications and additional recommendations for using MOBIKE in 258 case of TCP encapsulation. 260 [RFC8229] recommends, that in case of IP address change, the 261 initiator first initiates the INFORMATIONAL exchange containing 262 UPDATE_SA_ADDRESSES notification using UDP transport and if no 263 response is received then send this notification over TCP transport. 264 However, this recommendation lacks some details. In particular, it 265 is not clear whether falling back from UDP to TCP requires initiating 266 a new INFORMATIONAL exchange or not. 268 From MOBIKE point of view UDP and TCP transports can be seen as two 269 different network attachments, so falling back from the former to the 270 latter is very similar to changing peer's IP address. For that 271 reason, the initiator first initiates the INFORMATIONAL exchange over 272 UDP, and if no response is received within some time after several 273 retransmissions, then the initiator changes transport from UDP to TCP 274 in this very exchange. New INFORMATIONAL exchange MUST NOT be 275 started in this situation. 277 It means that after switching to TCP the content of the 278 NAT_DETECTION_SOURCE_IP notification will in most cases be incorrect 279 (since UDP and TCP source ports will most probably be different), and 280 the peer will falsely think that there is a NAT in between. This 281 should not cause problems because in this case all traffic will be 282 encapsulated in TCP anyway, and TCP encapsulation is the same with 283 regardless of NAT presence. 285 MOBIKE protocol defined the NO_NATS_ALLOWED notification that can be 286 used to detect the presence of NAT between peer and to refuse to 287 communicate in this situation. In case of TCP the NO_NATS_ALLOWED 288 notification SHOULD be ignored because TCP generally has no problems 289 with NAT boxes. 291 Section 3.7 of [RFC4555] describes an additional optional step in the 292 process of changing IP addresses called Return Routability Check. It 293 is performed by the responder in order to be sure that the new 294 initiator's address is in fact routable. In case of TCP 295 encapsulation this check has little value, since TCP handshake proves 296 routability of the TCP Originator's address. So, in case of TCP 297 encapsulation the Return Routability Check SHOULD NOT be performed. 299 8.2. IKEv2 Redirect 301 Redirect mechanism for IKEv2 is defined in [RFC5685]. This mechanism 302 allows security gateways to redirect clients to another gateway 303 either during IKE SA establishment or after it is set up. If a 304 client is connecting to a security gateway using TCP transport and 305 then is being redirected to another security gateway, then the client 306 must disregard the current transport. In other words, the client 307 MUST again first try UDP and then fall back to TCP while establishing 308 a new IKE SA, regardless of the transport of the SA the redirect 309 notification was received over (unless the client's configuration 310 instructs it to instantly use TCP for the gateway it is redirected 311 to). 313 8.3. IKEv2 Session Resumption 315 Session resumption for IKEv2 is defined in [RFC5723]. Once IKE SA is 316 established the server creates a resumption ticket where information 317 about this SA is stored, and transfers this ticket to the client. 318 The ticket may be later used to resume the IKE SA if it is deleted. 319 In the event of resumption the client presents the ticket in a new 320 exchange, called IKE_SESSION_RESUME. For the new SA some parameters 321 are taken from the ticket and some are re-negotiated (more details 322 are given in Section 5 of [RFC5723]). If TCP encapsulation was used 323 in an old SA, then the client SHOULD resume this SA using TCP, 324 without first trying to connect over UDP. 326 8.4. IKEv2 Protocol Support for High Availability 328 [RFC6311] defines a support for High Availability in IKEv2. The core 329 idea is that in case of cluster failover a new active node 330 immediately initiates the special INFORMATION exchange containing the 331 IKEV2_MESSAGE_ID_SYNC notification, which instructs the client to 332 skip some number of Message IDs that might not be synchronized yet 333 between nodes at the time of failover. 335 The problem is that TCP states are much harder to synchronize than 336 IKE states - it requires access to TCP/IP stack internals, which is 337 not always available for IKE/IPsec implementations. If a cluster 338 implementation doesn't synchronize TCP states between nodes, then 339 after failover event the new active node will not have any TCP 340 connection with the client, so the node cannot initiate the 341 INFORMATIONAL exchange as required by [RFC6311]. Since the cluster 342 usually acts as TCP Responder, the new active node cannot re- 343 establish TCP connection, since only the TCP Originator can do it. 344 And for the client the situation of cluster failover may remain 345 unknown for long time if it has no IKE or ESP traffic to send. Once 346 the client sends any ESP or IKEv2 packet, the cluster node will reply 347 with TCP RST and the client (as TCP Originator) will restore the TCP 348 connection so that the node will be able to initiate the 349 INFORMATIONAL exchange informing the client about the cluster 350 failover. 352 This memo makes the following recommendation: if support for High 353 Availability in IKEv2 is negotiated and TCP transport is used and a 354 client is TCP Originator, then the client SHOULD periodically send 355 IKEv2 messages (e.g. by initiating liveness check exchange) whenever 356 there is no any IKEv2 or ESP traffic. This differs from the 357 recommendations given in Section 2.4 of [RFC7296] in the following: 358 the liveness check should be periodically performed even if the 359 client has nothing to send over ESP. The frequency of sending such 360 messages should be high enough to allow quick detection and restoring 361 of broken TCP connection. 363 9. Security Considerations 365 Security considerations concerning using TCP encapsulation in IKEv2 366 and ESP are given in [RFC8229]. This memo doesn't provide additional 367 security considerations. 369 10. Acknowledgements 371 Author would like to thank Tommy Pauly and Tero Kivinen for their 372 valuable comments. 374 11. References 375 11.1. Normative References 377 [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate 378 Requirement Levels", BCP 14, RFC 2119, 379 DOI 10.17487/RFC2119, March 1997, 380 . 382 [RFC4555] Eronen, P., "IKEv2 Mobility and Multihoming Protocol 383 (MOBIKE)", RFC 4555, DOI 10.17487/RFC4555, June 2006, 384 . 386 [RFC5685] Devarapalli, V. and K. Weniger, "Redirect Mechanism for 387 the Internet Key Exchange Protocol Version 2 (IKEv2)", 388 RFC 5685, DOI 10.17487/RFC5685, November 2009, 389 . 391 [RFC5723] Sheffer, Y. and H. Tschofenig, "Internet Key Exchange 392 Protocol Version 2 (IKEv2) Session Resumption", RFC 5723, 393 DOI 10.17487/RFC5723, January 2010, 394 . 396 [RFC6311] Singh, R., Ed., Kalyani, G., Nir, Y., Sheffer, Y., and D. 397 Zhang, "Protocol Support for High Availability of IKEv2/ 398 IPsec", RFC 6311, DOI 10.17487/RFC6311, July 2011, 399 . 401 [RFC8174] Leiba, B., "Ambiguity of Uppercase vs Lowercase in RFC 402 2119 Key Words", BCP 14, RFC 8174, DOI 10.17487/RFC8174, 403 May 2017, . 405 [RFC7296] Kaufman, C., Hoffman, P., Nir, Y., Eronen, P., and T. 406 Kivinen, "Internet Key Exchange Protocol Version 2 407 (IKEv2)", STD 79, RFC 7296, DOI 10.17487/RFC7296, October 408 2014, . 410 [RFC8019] Nir, Y. and V. Smyslov, "Protecting Internet Key Exchange 411 Protocol Version 2 (IKEv2) Implementations from 412 Distributed Denial-of-Service Attacks", RFC 8019, 413 DOI 10.17487/RFC8019, November 2016, 414 . 416 [RFC8229] Pauly, T., Touati, S., and R. Mantha, "TCP Encapsulation 417 of IKE and IPsec Packets", RFC 8229, DOI 10.17487/RFC8229, 418 August 2017, . 420 11.2. Informative References 422 [RFC4621] Kivinen, T. and H. Tschofenig, "Design of the IKEv2 423 Mobility and Multihoming (MOBIKE) Protocol", RFC 4621, 424 DOI 10.17487/RFC4621, August 2006, 425 . 427 [RFC4987] Eddy, W., "TCP SYN Flooding Attacks and Common 428 Mitigations", RFC 4987, DOI 10.17487/RFC4987, August 2007, 429 . 431 [RFC6528] Gont, F. and S. Bellovin, "Defending against Sequence 432 Number Attacks", RFC 6528, DOI 10.17487/RFC6528, February 433 2012, . 435 [RFC7383] Smyslov, V., "Internet Key Exchange Protocol Version 2 436 (IKEv2) Message Fragmentation", RFC 7383, 437 DOI 10.17487/RFC7383, November 2014, 438 . 440 Author's Address 442 Valery Smyslov 443 ELVIS-PLUS 444 PO Box 81 445 Moscow (Zelenograd) 124460 446 RU 448 Phone: +7 495 276 0211 449 Email: svan@elvis.ru