idnits 2.17.1 draft-smyslov-ipsecme-tcp-guidelines-01.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 (December 18, 2018) is 1956 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 December 18, 2018 5 Expires: June 21, 2019 7 Clarifications and Implementation Guidelines for using TCP Encapsulation 8 in IKEv2 9 draft-smyslov-ipsecme-tcp-guidelines-01 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 http://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 June 21, 2019. 38 Copyright Notice 40 Copyright (c) 2018 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 (http://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 . . . . . . . . . . . . . . . . 3 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 . . . . . . . . . . . . . . . . . . 8 71 11.2. Informative References . . . . . . . . . . . . . . . . . 9 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 4. Falling back from UDP to TCP 137 Section 5.1 of [RFC8229] describes how the fallback from UDP to TCP 138 must be handled. It is recommended, that in the absence of prior 139 knowledge, implementations first try to use UDP and then fall back 140 TCP if no reply is received within some period of time after several 141 retransmissions. In this case a new IKE_SA_INIT exchange MUST be 142 initiated with new initiator's SPI and with recalculated content of 143 NAT_DETECTION_SOURCE_IP notification. 145 5. Retransmissions 147 Section 2.1 of [RFC7296] describes how IKEv2 deals with unreliability 148 of UDP protocol. In brief, exchange initiator is responsible for 149 retransmissions and must retransmit requests message until response 150 message is received. If no reply is received after several 151 retransmissions, the SA is deleted. The responder never retransmits 152 but must resend the response message in case it receives 153 retransmitted request. 155 When IKEv2 uses reliable transport protocol, most of these rules 156 become unnecessary. Since [RFC8229] doesn't provide clear guidance 157 on using retransmissions in case of TCP encapsulation, this memo 158 gives the following rules. 160 o the exchange initiator SHOULD NOT retransmit request message; if 161 no response is received within some reasonable period of time, the 162 IKE SA is deleted 164 o if TCP connection is broken and then restored while the exchange 165 initiator is waiting for the response, the initiator MUST 166 retransmit the request and continue to wait for the response 168 o the exchange responder acts as described in Section 2.1 of 169 [RFC7296], i.e. using TCP encapsulation doesn't change the 170 responder's behavior 172 6. Using Cookies and Puzzles 174 IKEv2 provides a DoS attack protection mechanism called Cookie, which 175 is described in Section 2.6 of [RFC7296]. [RFC8019] extends this 176 mechanism for protection against DDoS attacks by means of Client 177 Puzzles. Both mechanisms allow the responder to keep no state until 178 the initiator proves its IP address is real (and solves puzzle in the 179 latter case). 181 [RFC8229] gives no guidance on how these mechanisms should be used in 182 case of TCP encapsulation. However, the connection-oriented nature 183 of TCP brings additional considerations for using these mechanisms. 184 In general, Cookie provides less value in case of TCP encapsulation, 185 because when the responder receives the IKE_SA_INIT request the TCP 186 session has already been established, so the initiator's IP address 187 has been verified. Moreover, TCP Responder creates state as far as 188 the SYN packer is received (unless SYN Cookies described in [RFC4987] 189 are employed), that violates the stateless nature of IKEv2 Cookies. 190 So, it makes little sense to send Cookie request in this situation, 191 unless the responder in concerned with the possibility of TCP 192 Sequence Number attacks (see [RFC6528] for details). On the other 193 hand, Puzzles still remain useful and their use requires using 194 Cookies. 196 The following considerations are applicable for using Cookie and 197 Puzzle mechanisms in case of TCP encapsulation. 199 o the exchange responder SHOULD NOT request Cookie unless the 200 responder has good reason to do it (like a concern of the 201 possibility of TCP Sequence Number attacks or Puzzle request is 202 sent in the same message) 204 o if the responder chooses to send Cookie request (possibly along 205 with Puzzle request), then the TCP connection that the IKE_SA_INIT 206 request message was received over SHOULD be closed, so that the 207 responder remains stateless at least until the Cookie (or Puzzle 208 Solution) is returned 210 * note, that if this TCP connection is closed, then the responder 211 MUST NOT include the initiator's TCP port into the Cookie 212 calculation (*), since the Cookie will be returned over a new 213 TCP connection with a different port 215 o the exchange initiator acts as described in Section 2.6 of 216 [RFC7296] and Section 7 of [RFC8019], i.e. using TCP encapsulation 217 doesn't change the initiator's behavior 219 (*) Examples of Cookie calculation methods are given in Section 2.6 220 of [RFC7296] and in Section 7.1.1.3 of [RFC8019] and they don't 221 include transport protocol ports. However these examples are given 222 for illustrative purposes, since Cookie generation algorithm is a 223 local matter and some implementations might include port numbers, 224 that won't work with TCP encapsulation. 226 7. Error Handling in the IKE_SA_INIT 228 Section 2.21.1 of [RFC7296] describes how error notifications should 229 be handled in the IKE_SA_INIT exchange. In particular, it is advised 230 that the initiator should not act immediately after receiving error 231 notification and should instead wait some time for valid response, 232 since the IKE_SA_INIT messages are completely unauthenticated. This 233 advice has little sense in case of TCP encapsulation. If the 234 initiator receives the response message over TCP, then either this 235 message is genuine and was sent by the peer, or the TCP session was 236 hijacked and the message is forged, but in this case no genuine 237 messages from the responder will be received. 239 So, in case of TCP encapsulation the initiator SHOULD NOT wait for 240 additional messages in case it receives error notification from the 241 responder in the IKE_SA_INIT exchange. 243 8. Interaction with IKEv2 Extensions 245 8.1. MOBIKE Protocol 247 MOBIKE protocol, that allows IKEv2 SA to migrate between IP 248 addresses, is defined in [RFC4555], and [RFC4621] further clarifies 249 the details of the protocol. Section 8 of [RFC8229] describes how 250 interaction between MOBIKE and TCP encapsulation. This memo provides 251 clarifications and additional recommendations for using MOBIKE in 252 case of TCP encapsulation. 254 [RFC8229] recommends, that in case of IP address change, the 255 initiator first initiates the INFORMATIONAL exchange containing 256 UPDATE_SA_ADDRESSES notification using UDP transport and if no 257 response is received then send this notification over TCP transport. 258 However, this recommendation lacks some details. In particular, it 259 is not clear whether falling back from UDP to TCP requires initiating 260 a new INFORMATIONAL exchange or not. 262 From MOBIKE point of view UDP and TCP transports can be seen as two 263 different network attachments, so falling back from the former to the 264 latter is very similar to changing peer's IP address. For that 265 reason, the initiator first initiates the INFORMATIONAL exchange over 266 UDP, and if no response is received within some time after several 267 retransmissions, then the initiator changes transport from UDP to TCP 268 in this very exchange. New INFORMATIONAL exchange MUST NOT be 269 started in this situation. 271 It means that after switching to TCP the content of the 272 NAT_DETECTION_SOURCE_IP notification will in most cases be incorrect 273 (since UDP and TCP source ports will most probably be different), and 274 the peer will falsely think that there is a NAT in between. This 275 should not cause problems because in this case all traffic will be 276 encapsulated in TCP anyway, and TCP encapsulation is the same with 277 regardless of NAT presence. 279 MOBIKE protocol defined the NO_NATS_ALLOWED notification that can be 280 used to detect the presence of NAT between peer and to refuse to 281 communicate in this situation. In case of TCP the NO_NATS_ALLOWED 282 notification SHOULD be ignored because TCP generally has no problems 283 with NAT boxes. 285 Section 3.7 of [RFC4555] describes an additional optional step in the 286 process of changing IP addresses called Return Routability Check. It 287 is performed by the responder in order to be sure that the new 288 initiator's address is in fact routable. In case of TCP 289 encapsulation this check has little value, since TCP handshake proves 290 routability of the TCP Originator's address. So, in case of TCP 291 encapsulation the Return Routability Check SHOULD NOT be performed. 293 8.2. IKEv2 Redirect 295 Redirect mechanism for IKEv2 is defined in [RFC5685]. This mechanism 296 allows security gateways to redirect clients to another gateway 297 either during IKE SA establishment or after it is set up. If a 298 client is connecting to a security gateway using TCP transport and 299 then is being redirected to another security gateway, then the client 300 must disregard the current transport. In other words, the client 301 MUST again first try UDP and then fall back to TCP while establishing 302 a new IKE SA, regardless of the transport of the SA the redirect 303 notification was received over (unless the client's configuration 304 instructs it to instantly use TCP for the gateway it is redirected 305 to). 307 8.3. IKEv2 Session Resumption 309 Session resumption for IKEv2 is defined in [RFC5723]. Once IKE SA is 310 established the server creates a resumption ticket where information 311 about this SA is stored, and transfers this ticket to the client. 312 The ticket may be later used to resume the IKE SA if it is deleted. 313 In the event of resumption the client presents the ticket in a new 314 exchange, called IKE_SESSION_RESUME. For the new SA some parameters 315 are taken from the ticket and some are re-negotiated (more details 316 are given in Section 5 of [RFC5723]). If TCP encapsulation was used 317 in an old SA, then the client SHOULD resume this SA using TCP, 318 without first trying to connect over UDP. 320 8.4. IKEv2 Protocol Support for High Availability 322 [RFC6311] defines a support for High Availability in IKEv2. The core 323 idea is that in case of cluster failover a new active node 324 immediately initiates the special INFORMATION exchange containing the 325 IKEV2_MESSAGE_ID_SYNC notification, which instructs the client to 326 skip some number of Message IDs that might not be synchronized yet 327 between nodes at the time of failover. 329 The problem is that TCP states are much harder to synchronize than 330 IKE states - it requires access to TCP/IP stack internals, which is 331 not always available for IKE/IPsec implementations. If a cluster 332 implementation doesn't synchronize TCP states between nodes, then 333 after failover event the new active node will not have any TCP 334 connection with the client, so the node cannot initiate the 335 INFORMATIONAL exchange as required by [RFC6311]. Since the cluster 336 usually acts as TCP Responder, the new active node cannot re- 337 establish TCP connection, since only the TCP Originator can do it. 338 And for the client the situation of cluster failover may remain 339 unknown for long time if it has no IKE or ESP traffic to send. Once 340 the client sends any ESP or IKEv2 packet, the cluster node will reply 341 with TCP RST and the client (as TCP Originator) will restore the TCP 342 connection so that the node will be able to initiate the 343 INFORMATIONAL exchange informing the client about the cluster 344 failover. 346 This memo makes the following recommendation: if support for High 347 Availability in IKEv2 is negotiated and TCP transport is used and a 348 client is TCP Originator, then the client SHOULD periodically send 349 IKEv2 messages (e.g. by initiating liveness check exchange) whenever 350 there is no any IKEv2 or ESP traffic. This differs from the 351 recommendations given in Section 2.4 of [RFC7296] in the following: 352 the liveness check should be periodically performed even if the 353 client has nothing to send over ESP. The frequency of sending such 354 messages should be high enough to allow quick detection and restoring 355 of broken TCP connection. 357 9. Security Considerations 359 Security considerations concerning using TCP encapsulation in IKEv2 360 and ESP are given in [RFC8229]. This memo doesn't provide additional 361 security considerations. 363 10. Acknowledgements 365 Author would like to thank Tommy Pauly and Tero Kivinen for their 366 valuable comments. 368 11. References 370 11.1. Normative References 372 [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate 373 Requirement Levels", BCP 14, RFC 2119, 374 DOI 10.17487/RFC2119, March 1997, . 377 [RFC4555] Eronen, P., "IKEv2 Mobility and Multihoming Protocol 378 (MOBIKE)", RFC 4555, DOI 10.17487/RFC4555, June 2006, 379 . 381 [RFC5685] Devarapalli, V. and K. Weniger, "Redirect Mechanism for 382 the Internet Key Exchange Protocol Version 2 (IKEv2)", 383 RFC 5685, DOI 10.17487/RFC5685, November 2009, 384 . 386 [RFC5723] Sheffer, Y. and H. Tschofenig, "Internet Key Exchange 387 Protocol Version 2 (IKEv2) Session Resumption", RFC 5723, 388 DOI 10.17487/RFC5723, January 2010, . 391 [RFC6311] Singh, R., Ed., Kalyani, G., Nir, Y., Sheffer, Y., and D. 392 Zhang, "Protocol Support for High Availability of IKEv2/ 393 IPsec", RFC 6311, DOI 10.17487/RFC6311, July 2011, 394 . 396 [RFC8174] Leiba, B., "Ambiguity of Uppercase vs Lowercase in RFC 397 2119 Key Words", BCP 14, RFC 8174, DOI 10.17487/RFC8174, 398 May 2017, . 400 [RFC7296] Kaufman, C., Hoffman, P., Nir, Y., Eronen, P., and T. 401 Kivinen, "Internet Key Exchange Protocol Version 2 402 (IKEv2)", STD 79, RFC 7296, DOI 10.17487/RFC7296, October 403 2014, . 405 [RFC8019] Nir, Y. and V. Smyslov, "Protecting Internet Key Exchange 406 Protocol Version 2 (IKEv2) Implementations from 407 Distributed Denial-of-Service Attacks", RFC 8019, 408 DOI 10.17487/RFC8019, November 2016, . 411 [RFC8229] Pauly, T., Touati, S., and R. Mantha, "TCP Encapsulation 412 of IKE and IPsec Packets", RFC 8229, DOI 10.17487/RFC8229, 413 August 2017, . 415 11.2. Informative References 417 [RFC4621] Kivinen, T. and H. Tschofenig, "Design of the IKEv2 418 Mobility and Multihoming (MOBIKE) Protocol", RFC 4621, 419 DOI 10.17487/RFC4621, August 2006, . 422 [RFC4987] Eddy, W., "TCP SYN Flooding Attacks and Common 423 Mitigations", RFC 4987, DOI 10.17487/RFC4987, August 2007, 424 . 426 [RFC6528] Gont, F. and S. Bellovin, "Defending against Sequence 427 Number Attacks", RFC 6528, DOI 10.17487/RFC6528, February 428 2012, . 430 [RFC7383] Smyslov, V., "Internet Key Exchange Protocol Version 2 431 (IKEv2) Message Fragmentation", RFC 7383, 432 DOI 10.17487/RFC7383, November 2014, . 435 Author's Address 437 Valery Smyslov 438 ELVIS-PLUS 439 PO Box 81 440 Moscow (Zelenograd) 124460 441 RU 443 Phone: +7 495 276 0211 444 Email: svan@elvis.ru