idnits 2.17.1 draft-ietf-quic-load-balancers-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 : ---------------------------------------------------------------------------- No issues found here. Miscellaneous warnings: ---------------------------------------------------------------------------- == The copyright year in the IETF Trust and authors Copyright Line does not match the current year == Line 883 has weird spacing: '...boolean first...' -- The document date (January 29, 2020) is 1547 days in the past. Is this intentional? -- Found something which looks like a code comment -- if you have code sections in the document, please surround them with '' and '' lines. Checking references for intended status: Proposed Standard ---------------------------------------------------------------------------- (See RFCs 3967 and 4897 for information about using normative references to lower-maturity documents in RFCs) -- Looks like a reference, but probably isn't: '16' on line 913 -- Looks like a reference, but probably isn't: '19' on line 899 == Unused Reference: 'QUIC-TRANSPORT' is defined on line 970, but no explicit reference was found in the text Summary: 0 errors (**), 0 flaws (~~), 3 warnings (==), 4 comments (--). Run idnits with the --verbose option for more detailed information about the items above. -------------------------------------------------------------------------------- 2 QUIC M. Duke 3 Internet-Draft F5 Networks, Inc. 4 Intended status: Standards Track N. Banks 5 Expires: August 1, 2020 Microsoft 6 January 29, 2020 8 QUIC-LB: Generating Routable QUIC Connection IDs 9 draft-ietf-quic-load-balancers-01 11 Abstract 13 QUIC connection IDs allow continuation of connections across address/ 14 port 4-tuple changes, and can store routing information for stateless 15 or low-state load balancers. They also can prevent linkability of 16 connections across deliberate address migration through the use of 17 protected communications between client and server. This creates 18 issues for load-balancing intermediaries. This specification 19 standardizes methods for encoding routing information given a small 20 set of configuration parameters. This framework also enables offload 21 of other QUIC functions to trusted intermediaries, given the explicit 22 cooperation of the QUIC server. 24 Status of This Memo 26 This Internet-Draft is submitted in full conformance with the 27 provisions of BCP 78 and BCP 79. 29 Internet-Drafts are working documents of the Internet Engineering 30 Task Force (IETF). Note that other groups may also distribute 31 working documents as Internet-Drafts. The list of current Internet- 32 Drafts is at https://datatracker.ietf.org/drafts/current/. 34 Internet-Drafts are draft documents valid for a maximum of six months 35 and may be updated, replaced, or obsoleted by other documents at any 36 time. It is inappropriate to use Internet-Drafts as reference 37 material or to cite them other than as "work in progress." 39 This Internet-Draft will expire on August 1, 2020. 41 Copyright Notice 43 Copyright (c) 2020 IETF Trust and the persons identified as the 44 document authors. All rights reserved. 46 This document is subject to BCP 78 and the IETF Trust's Legal 47 Provisions Relating to IETF Documents 48 (https://trustee.ietf.org/license-info) in effect on the date of 49 publication of this document. Please review these documents 50 carefully, as they describe your rights and restrictions with respect 51 to this document. Code Components extracted from this document must 52 include Simplified BSD License text as described in Section 4.e of 53 the Trust Legal Provisions and are provided without warranty as 54 described in the Simplified BSD License. 56 Table of Contents 58 1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . 3 59 1.1. Terminology . . . . . . . . . . . . . . . . . . . . . . . 4 60 2. Protocol Objectives . . . . . . . . . . . . . . . . . . . . . 4 61 2.1. Simplicity . . . . . . . . . . . . . . . . . . . . . . . 4 62 2.2. Security . . . . . . . . . . . . . . . . . . . . . . . . 5 63 2.3. Load Balancer Chains . . . . . . . . . . . . . . . . . . 5 64 3. First CID octet . . . . . . . . . . . . . . . . . . . . . . . 5 65 3.1. Config Rotation . . . . . . . . . . . . . . . . . . . . . 6 66 3.2. Configuration Failover . . . . . . . . . . . . . . . . . 6 67 3.3. Length Self-Description . . . . . . . . . . . . . . . . . 7 68 4. Routing Algorithms . . . . . . . . . . . . . . . . . . . . . 7 69 4.1. Plaintext CID Algorithm . . . . . . . . . . . . . . . . . 8 70 4.1.1. Configuration Agent Actions . . . . . . . . . . . . . 8 71 4.1.2. Load Balancer Actions . . . . . . . . . . . . . . . . 9 72 4.1.3. Server Actions . . . . . . . . . . . . . . . . . . . 9 73 4.2. Obfuscated CID Algorithm . . . . . . . . . . . . . . . . 9 74 4.2.1. Configuration Agent Actions . . . . . . . . . . . . . 9 75 4.2.2. Load Balancer Actions . . . . . . . . . . . . . . . . 10 76 4.2.3. Server Actions . . . . . . . . . . . . . . . . . . . 10 77 4.3. Stream Cipher CID Algorithm . . . . . . . . . . . . . . . 10 78 4.3.1. Configuration Agent Actions . . . . . . . . . . . . . 11 79 4.3.2. Load Balancer Actions . . . . . . . . . . . . . . . . 11 80 4.3.3. Server Actions . . . . . . . . . . . . . . . . . . . 12 81 4.4. Block Cipher CID Algorithm . . . . . . . . . . . . . . . 12 82 4.4.1. Configuration Agent Actions . . . . . . . . . . . . . 12 83 4.4.2. Load Balancer Actions . . . . . . . . . . . . . . . . 13 84 4.4.3. Server Actions . . . . . . . . . . . . . . . . . . . 13 85 5. Retry Service . . . . . . . . . . . . . . . . . . . . . . . . 13 86 5.1. Common Requirements . . . . . . . . . . . . . . . . . . . 14 87 5.2. No-Shared-State Retry Service . . . . . . . . . . . . . . 14 88 5.2.1. Service Requirements . . . . . . . . . . . . . . . . 14 89 5.2.2. Server Requirements . . . . . . . . . . . . . . . . . 16 90 5.3. Shared-State Retry Service . . . . . . . . . . . . . . . 16 91 5.3.1. Configuration Agent Actions . . . . . . . . . . . . . 18 92 5.3.2. Service Requirements . . . . . . . . . . . . . . . . 18 93 5.3.3. Server Requirements . . . . . . . . . . . . . . . . . 18 94 6. Configuration Requirements . . . . . . . . . . . . . . . . . 18 95 7. Security Considerations . . . . . . . . . . . . . . . . . . . 20 96 7.1. Attackers not between the load balancer and server . . . 21 97 7.2. Attackers between the load balancer and server . . . . . 21 98 8. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 21 99 9. References . . . . . . . . . . . . . . . . . . . . . . . . . 21 100 9.1. Normative References . . . . . . . . . . . . . . . . . . 21 101 9.2. Informative References . . . . . . . . . . . . . . . . . 22 102 Appendix A. Acknowledgments . . . . . . . . . . . . . . . . . . 22 103 Appendix B. Change Log . . . . . . . . . . . . . . . . . . . . . 22 104 B.1. since-draft-ietf-quic-load-balancers-00 . . . . . . . . . 22 105 B.2. Since draft-duke-quic-load-balancers-06 . . . . . . . . . 22 106 B.3. Since draft-duke-quic-load-balancers-05 . . . . . . . . . 22 107 B.4. Since draft-duke-quic-load-balancers-04 . . . . . . . . . 23 108 B.5. Since draft-duke-quic-load-balancers-03 . . . . . . . . . 23 109 B.6. Since draft-duke-quic-load-balancers-02 . . . . . . . . . 23 110 B.7. Since draft-duke-quic-load-balancers-01 . . . . . . . . . 23 111 B.8. Since draft-duke-quic-load-balancers-00 . . . . . . . . . 23 112 Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . 23 114 1. Introduction 116 QUIC packets usually contain a connection ID to allow endpoints to 117 associate packets with different address/port 4-tuples to the same 118 connection context. This feature makes connections robust in the 119 event of NAT rebinding. QUIC endpoints usually designate the 120 connection ID which peers use to address packets. Server-generated 121 connection IDs create a potential need for out-of-band communication 122 to support QUIC. 124 QUIC allows servers (or load balancers) to designate an initial 125 connection ID to encode useful routing information for load 126 balancers. It also encourages servers, in packets protected by 127 cryptography, to provide additional connection IDs to the client. 128 This allows clients that know they are going to change IP address or 129 port to use a separate connection ID on the new path, thus reducing 130 linkability as clients move through the world. 132 There is a tension between the requirements to provide routing 133 information and mitigate linkability. Ultimately, because new 134 connection IDs are in protected packets, they must be generated at 135 the server if the load balancer does not have access to the 136 connection keys. However, it is the load balancer that has the 137 context necessary to generate a connection ID that encodes useful 138 routing information. In the absence of any shared state between load 139 balancer and server, the load balancer must maintain a relatively 140 expensive table of server-generated connection IDs, and will not 141 route packets correctly if they use a connection ID that was 142 originally communicated in a protected NEW_CONNECTION_ID frame. 144 This specification provides common algorithms for encoding the server 145 mapping in a connection ID given some shared parameters. The mapping 146 is generally only discoverable by observers that have the parameters, 147 preserving unlinkability as much as possible. 149 Aside from load balancing, a QUIC server may also desire to offload 150 other protocol functions to trusted intermediaries. These 151 intermediaries might include hardware assist on the server host 152 itself, without access to fully decrypted QUIC packets. For example, 153 this document specifies a means of offloading stateless retry to 154 counter Denial of Service attacks. It also proposes a system for 155 self-encoding connection ID length in all packets, so that crypto 156 offload can consistently look up key information. 158 While this document describes a small set of configuration parameters 159 to make the server mapping intelligible, the means of distributing 160 these parameters between load balancers, servers, and other trusted 161 intermediaries is out of its scope. There are numerous well-known 162 infrastructures for distribution of configuration. 164 1.1. Terminology 166 The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", 167 "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this 168 document are to be interpreted as described in RFC 2119 [RFC2119]. 170 In this document, these words will appear with that interpretation 171 only when in ALL CAPS. Lower case uses of these words are not to be 172 interpreted as carrying significance described in RFC 2119. 174 In this document, "client" and "server" refer to the endpoints of a 175 QUIC connection unless otherwise indicated. A "load balancer" is an 176 intermediary for that connection that does not possess QUIC 177 connection keys, but it may rewrite IP addresses or conduct other IP 178 or UDP processing. 180 Note that stateful load balancers that act as proxies, by terminating 181 a QUIC connection with the client and then retrieving data from the 182 server using QUIC or another protocol, are treated as a server with 183 respect to this specification. 185 2. Protocol Objectives 187 2.1. Simplicity 189 QUIC is intended to provide unlinkability across connection 190 migration, but servers are not required to provide additional 191 connection IDs that effectively prevent linkability. If the 192 coordination scheme is too difficult to implement, servers behind 193 load balancers using connection IDs for routing will use trivially 194 linkable connection IDs. Clients will therefore be forced choose 195 between terminating the connection during migration or remaining 196 linkable, subverting a design objective of QUIC. 198 The solution should be both simple to implement and require little 199 additional infrastructure for cryptographic keys, etc. 201 2.2. Security 203 In the limit where there are very few connections to a pool of 204 servers, no scheme can prevent the linking of two connection IDs with 205 high probability. In the opposite limit, where all servers have many 206 connections that start and end frequently, it will be difficult to 207 associate two connection IDs even if they are known to map to the 208 same server. 210 QUIC-LB is relevant in the region between these extremes: when the 211 information that two connection IDs map to the same server is helpful 212 to linking two connection IDs. Obviously, any scheme that 213 transparently communicates this mapping to outside observers 214 compromises QUIC's defenses against linkability. 216 Though not an explicit goal of the QUIC-LB design, concealing the 217 server mapping also complicates attempts to focus attacks on a 218 specific server in the pool. 220 2.3. Load Balancer Chains 222 While it is possible to construct a scheme that supports multiple 223 low-state load balancers in the path, by using different parts of the 224 connection ID to encode routing information for each load balancer, 225 this use case is out of scope for QUIC-LB. 227 3. First CID octet 229 The first octet of a Connection ID is reserved for two special 230 purposes, one mandatory (config rotation) and one optional (length 231 self-description). 233 Subsequent sections of this document refer to the contents of this 234 octet as the "first octet." 236 3.1. Config Rotation 238 The first two bits of any connection-ID MUST encode the configuration 239 phase of that ID. QUIC-LB messages indicate the phase of the 240 algorithm and parameters that they encode. 242 A new configuration may change one or more parameters of the old 243 configuration, or change the algorithm used. 245 It is possible for servers to have mutually exclusive sets of 246 supported algorithms, or for a transition from one algorithm to 247 another to result in Fail Payloads. The four states encoded in these 248 two bits allow two mutually exclusive server pools to coexist, and 249 for each of them to transition to a new set of parameters. 251 When new configuration is distributed to servers, there will be a 252 transition period when connection IDs reflecting old and new 253 configuration coexist in the network. The rotation bits allow load 254 balancers to apply the correct routing algorithm and parameters to 255 incoming packets. 257 Servers MUST NOT generate new connection IDs using an old 258 configuration when it has sent an Ack payload for a new 259 configuration. 261 Load balancers SHOULD NOT use a codepoint to represent a new 262 configuration until it takes precautions to make sure that all 263 connections using IDs with an old configuration at that codepoint 264 have closed or transitioned. They MAY drop connection IDs with the 265 old configuration after a reasonable interval to accelerate this 266 process. 268 3.2. Configuration Failover 270 If a server has not received a valid QUIC-LB configuration, and 271 believes that low-state, Connection-ID aware load balancers are in 272 the path, it SHOULD generate connection IDs with the config rotation 273 bits set to '11' and SHOULD use the "disable_migration" transport 274 parameter in all new QUIC connections. It SHOULD NOT send 275 NEW_CONNECTION_ID frames with new values. 277 A load balancer that sees a connection ID with config rotation bits 278 set to '11' MUST revert to 5-tuple routing. 280 3.3. Length Self-Description 282 Local hardware cryptographic offload devices may accelerate QUIC 283 servers by receiving keys from the QUIC implementation indexed to the 284 connection ID. However, on physical devices operating multiple QUIC 285 servers, it is impractical to efficiently lookup these keys if the 286 connection ID does not self-encode its own length. 288 Note that this is a function of particular server devices and is 289 irrelevant to load balancers. As such, load balancers MAY omit this 290 from their configuration. However, the remaining 6 bits in the first 291 octet of the Connection ID are reserved to express the length of the 292 following connection ID, not including the first octet. 294 A server not using this functionality SHOULD make the six bits appear 295 to be random. 297 4. Routing Algorithms 299 In QUIC-LB, load balancers do not generate individual connection IDs 300 to servers. Instead, they communicate the parameters of an algorithm 301 to generate routable connection IDs. 303 The algorithms differ in the complexity of configuration at both load 304 balancer and server. Increasing complexity improves obfuscation of 305 the server mapping. 307 As clients sometimes generate the DCIDs in long headers, these might 308 not conform to the expectations of the routing algorithm. These are 309 called "non-compliant DCIDs": 311 o The DCID might not be long enough for the routing algorithm to 312 process. 314 o The extracted server mapping might not correspond to an active 315 server. 317 o A field that should be all zeroes after decryption may not be so. 319 Load balancers MUST forward packets with long headers with non- 320 compliant DCIDs to an active server using an algorithm of its own 321 choosing. It need not coordinate this algorithm with the servers. 322 The algorithm SHOULD be deterministic over short time scales so that 323 related packets go to the same server. For example, a non-compliant 324 DCID might be converted to an integer and divided by the number of 325 servers, with the modulus used to forward the packet. The number of 326 servers is usually consistent on the time scale of a QUIC connection 327 handshake. 329 Load balancers SHOULD drop packets with non-compliant DCIDs in a 330 short header. 332 Load balancers MUST forward packets with compliant DCIDs to a server 333 in accordance with the chosen routing algorithm. 335 The load balancer MUST NOT make the routing behavior dependent on any 336 bits in the first octet of the QUIC packet header, except the first 337 bit, which indicates a long header. All other bits are QUIC version- 338 dependent and intermediaries would cannot build their design on 339 version-specific templates. 341 There are situations where a server pool might be operating two or 342 more routing algorithms or parameter sets simultaneously. The load 343 balancer uses the first two bits of the connection ID to multiplex 344 incoming DCIDs over these schemes. 346 This section describes three participants: the configuration agent, 347 the load balancer, and the server. 349 4.1. Plaintext CID Algorithm 351 The Plaintext CID Algorithm makes no attempt to obscure the mapping 352 of connections to servers, significantly increasing linkability. The 353 format is depicted in the figure below. 355 0 1 2 3 356 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 357 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 358 | First octet | Server ID (X=8..152) | 359 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 360 | Any (0..152-X) | 361 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 363 Figure 1: Plaintext CID Format 365 4.1.1. Configuration Agent Actions 367 The configuration agent selects a number of bytes of the server 368 connection ID (SCID) to encode individual server IDs, called the 369 "routing bytes". The number of bytes MUST have enough entropy to 370 have a different code point for each server. 372 It also assigns a server ID to each server. 374 4.1.2. Load Balancer Actions 376 On each incoming packet, the load balancer extracts consecutive 377 octets, beginning with the second octet. These bytes represent the 378 server ID. 380 4.1.3. Server Actions 382 The server chooses a connection ID length. This MUST be at least one 383 byte longer than the routing bytes. 385 When a server needs a new connection ID, it encodes its assigned 386 server ID in consecutive octets beginning with the second. All other 387 bits in the connection ID, except for the first octet, MAY be set to 388 any other value. These other bits SHOULD appear random to observers. 390 4.2. Obfuscated CID Algorithm 392 The Obfuscated CID Algorithm makes an attempt to obscure the mapping 393 of connections to servers to reduce linkability, while not requiring 394 true encryption and decryption. The format is depicted in the figure 395 below. 397 0 1 2 3 398 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 399 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 400 | First octet | Mixed routing and non-routing bits (64..152) | 401 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 403 Figure 2: Obfuscated CID Format 405 4.2.1. Configuration Agent Actions 407 The configuration agent selects an arbitrary set of bits of the 408 server connection ID (SCID) that it will use to route to a given 409 server, called the "routing bits". The number of bits MUST have 410 enough entropy to have a different code point for each server, and 411 SHOULD have enough entropy so that there are many codepoints for each 412 server. 414 The configuration agent MUST NOT select a routing mask with more than 415 136 routing bits set to 1, which allows for the first octet and up to 416 2 octets for server purposes in a maximum-length connection ID. 418 The configuration agent selects a divisor that MUST be larger than 419 the number of servers. It SHOULD be large enough to accommodate 420 reasonable increases in the number of servers. The divisor MUST be 421 an odd integer so certain addition operations do not always produce 422 an even number. 424 The configuration agent also assigns each server a "modulus", an 425 integer between 0 and the divisor minus 1. These MUST be unique for 426 each server, and SHOULD be distributed across the entire number space 427 between zero and the divisor. 429 4.2.2. Load Balancer Actions 431 Upon receipt of a QUIC packet, the load balancer extracts the 432 selected bits of the SCID and expresses them as an unsigned integer 433 of that length. The load balancer then divides the result by the 434 chosen divisor. The modulus of this operation maps to the modulus 435 for the destination server. 437 Note that any SCID that contains a server's modulus, plus an 438 arbitrary integer multiple of the divisor, in the routing bits is 439 routable to that server regardless of the contents of the non-routing 440 bits. Outside observers that do not know the divisor or the routing 441 bits will therefore have difficulty identifying that two SCIDs route 442 to the same server. 444 Note also that not all Connection IDs are necessarily routable, as 445 the computed modulus may not match one assigned to any server. These 446 DCIDs are non-compliant as described above. 448 4.2.3. Server Actions 450 The server chooses a connection ID length. This MUST contain all of 451 the routing bits and MUST be at least 9 octets to provide adequate 452 entropy. 454 When a server needs a new connection ID, it adds an arbitrary 455 nonnegative integer multiple of the divisor to its modulus, without 456 exceeding the maximum integer value implied by the number of routing 457 bits. The choice of multiple should appear random within these 458 constraints. 460 The server encodes the result in the routing bits. It MAY put any 461 other value into bits that used neither for routing nor config 462 rotation. These bits SHOULD appear random to observers. 464 4.3. Stream Cipher CID Algorithm 466 The Stream Cipher CID algorithm provides true cryptographic 467 protection, rather than mere obfuscation, at the cost of additional 468 per-packet processing at the load balancer to decrypt every incoming 469 connection ID. The CID format is depicted below. 471 0 1 2 3 472 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 473 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 474 | First Octet | Nonce (X=64..144) | 475 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 476 | Encrypted Server ID (Y=8..152-X) | 477 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 478 | For server use (0..152-X-Y) | 479 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 481 Figure 3: Stream Cipher CID Format 483 4.3.1. Configuration Agent Actions 485 The configuration agent assigns a server ID to every server in its 486 pool, and determines a server ID length (in octets) sufficiently 487 large to encode all server IDs, including potential future servers. 489 The configuration agent also selects a nonce length and an 16-octet 490 AES-ECB key to use for connection ID decryption. The nonce length 491 MUST be at least 8 octets and no more than 16 octets. The nonce 492 length and server ID length MUST sum to 19 or fewer octets. 494 4.3.2. Load Balancer Actions 496 Upon receipt of a QUIC packet that is not of type Initial or 0-RTT, 497 the load balancer extracts as many of the earliest octets from the 498 destination connection ID as necessary to match the nonce length. 499 The server ID immediately follows. 501 The load balancer decrypts the server ID using 128-bit AES Electronic 502 Codebook (ECB) mode, much like QUIC header protection. The nonce 503 octets are zero-padded to 16 octets. AES-ECB encrypts this nonce 504 using its key to generate a mask which it applies to the encrypted 505 server id. 507 server_id = encrypted_server_id ^ AES-ECB(key, padded-nonce) 509 For example, if the nonce length is 10 octets and the server ID 510 length is 2 octets, the connection ID can be as small as 13 octets. 511 The load balancer uses the the second through eleventh of the 512 connection ID for the nonce, zero-pads it to 16 octets using the 513 first 6 octets of the token, and uses this to decrypt the server ID 514 in the twelfth and thirteenth octet. 516 The output of the decryption is the server ID that the load balancer 517 uses for routing. 519 4.3.3. Server Actions 521 When generating a routable connection ID, the server writes arbitrary 522 bits into its nonce octets, and its provided server ID into the 523 server ID octets. Servers MAY opt to have a longer connection ID 524 beyond the nonce and server ID. The nonce and additional bits MAY 525 encode additional information, but SHOULD appear essentially random 526 to observers. 528 The server decrypts the server ID using 128-bit AES Electronic 529 Codebook (ECB) mode, much like QUIC header protection. The nonce 530 octets are zero-padded to 16 octets using the as many of the first 531 octets of the token as necessary. AES-ECB encrypts this nonce using 532 its key to generate a mask which it applies to the server id. 534 encrypted_server_id = server_id ^ AES-ECB(key, padded-nonce) 536 4.4. Block Cipher CID Algorithm 538 The Block Cipher CID Algorithm, by using a full 16 octets of 539 plaintext and a 128-bit cipher, provides higher cryptographic 540 protection and detection of non-compliant connection IDs. However, 541 it also requires connection IDs of at least 17 octets, increasing 542 overhead of client-to-server packets. 544 0 1 2 3 545 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 546 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 547 | First octet | Encrypted server ID (X=8..144) | 548 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 549 | Encrypted Zero Padding (Y=0..144-X) | 550 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 551 | Encrypted bits for server use (144-X-Y) | 552 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 553 | Unencrypted bits for server use (0..24) | 554 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 556 Figure 4: Block Cipher CID Format 558 4.4.1. Configuration Agent Actions 560 The configuration agent assigns a server ID to every server in its 561 pool, and determines a server ID length (in octets) sufficiently 562 large to encode all server IDs, including potential future servers. 564 The server ID will start in the second octet of the decrypted 565 connection ID and occupy continuous octets beyond that. 567 The configuration agent selects a zero-padding length. This SHOULD 568 be at least four octets to allow detection of non-compliant DCIDs. 569 The server ID and zero- padding length MUST sum to no more than 16 570 octets. They SHOULD sum to no more than 12 octets, to provide 571 servers adequate space to encode their own opaque data. 573 The configuration agent also selects an 16-octet AES-ECB key to use 574 for connection ID decryption. 576 4.4.2. Load Balancer Actions 578 Upon receipt of a QUIC packet, the load balancer reads the first 579 octet to obtain the config rotation bits. It then decrypts the 580 subsequent 16 octets using AES-ECB decryption and the chosen key. 582 The decrypted plaintext contains the server id, zero padding, and 583 opaque server data in that order. The load balancer uses the server 584 ID octets for routing. 586 4.4.3. Server Actions 588 When generating a routable connection ID, the server MUST choose a 589 connection ID length between 17 and 20 octets. The server writes its 590 provided server ID into the server ID octets, zeroes into the zero- 591 padding octets, and arbitrary bits into the remaining bits. These 592 arbitrary bits MAY encode additional information. Bits in the first, 593 eighteenth, nineteenth, and twentieth octets SHOULD appear 594 essentially random to observers. The first octet is reserved as 595 described in Section 3. 597 The server then encrypts the second through seventeenth octets using 598 the 128-bit AES-ECB cipher. 600 5. Retry Service 602 When a server is under load, QUICv1 allows it to defer storage of 603 connection state until the client proves it can receive packets at 604 its advertised IP address. Through the use of a Retry packet, a 605 token in subsequent client Initial packets, and the 606 original_connection_id transport parameter, servers verify address 607 ownership and clients verify that there is no "man in the middle" 608 generating Retry packets. 610 As a trusted Retry Service is literally a "man in the middle," the 611 service must communicate the original_connection_id back to the 612 server so that in can pass client verification. It also must either 613 verify the address itself (with the server trusting this 614 verification) or make sure there is common context for the server to 615 verify the address using a service-generated token. 617 There are two different mechanisms to allow offload of DoS mitigation 618 to a trusted network service. One requires no shared state; the 619 server need only be configured to trust a retry service, though this 620 imposes other operational constraints. The other requires shared 621 key, but has no such constraints. 623 Retry services MUST forward all non-Initial QUIC packets, as well as 624 Initial packets from the server. 626 5.1. Common Requirements 628 Regardless of mechanism, a retry service has an active mode, where it 629 is generating Retry packets, and an inactive mode, where it is not, 630 based on its assessment of server load and the likelihood an attack 631 is underway. The choice of mode MAY be made on a per-packet basis, 632 through a stochastic process or based on client address. 634 A retry service MUST forward all packets for a QUIC version it does 635 not understand. Note that if servers support versions the retry 636 service does not, this may unacceptably increase loads on the 637 servers. However, dropping these packets would introduce chokepoints 638 to block deployment of new QUIC versions. Note that future versions 639 of QUIC might not have Retry packets, or require different 640 information. 642 5.2. No-Shared-State Retry Service 644 The no-shared-state retry service requires no coordination, except 645 that the server must be configured to accept this service. The 646 scheme uses the first bit of the token to distinguish between tokens 647 from Retry packets (codepoint '0') and tokens from NEW_TOKEN frames 648 (codepoint '1'). 650 5.2.1. Service Requirements 652 A no-shared-state retry service MUST be present on all paths from 653 potential clients to the server. These paths MUST fail to pass QUIC 654 traffic should the service fail for any reason. That is, if the 655 service is not operational, the server MUST NOT be exposed to client 656 traffic. Otherwise, servers that have already disabled their Retry 657 capability would be vulnerable to attack. 659 The path between service and server MUST be free of any potential 660 attackers. Note that this and other requirements above severely 661 restrict the operational conditions in which a no-shared-state retry 662 service can safely operate. 664 Retry tokens generated by the service MUST have the format below. 666 0 1 2 3 667 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 668 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 669 |0| ODCIL (7) | Original Destination Connection ID (0..160) | 670 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 671 | Original Destination Connection ID (...) | 672 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 673 ... 674 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 675 | Opaque Data (variable) | 676 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 678 Figure 5: Format of non-shared-state retry service tokens 680 The first bit of retry tokens generated by the service must be zero. 681 The token has the following additional fields: 683 ODCIL: The length of the original destination connection ID from the 684 triggering Initial packet. This is in cleartext to be readable for 685 the server, but authenticated later in the token. 687 Original Destination Connection ID: This also in cleartext and 688 authenticated later. 690 Opaque Data: This data MUST contain encrypted information that allows 691 the retry service to validate the client's IP address, in accordance 692 with the QUIC specification. It MUST also encode a secure hash of 693 the original destination connection ID field to verify that this 694 field has not been edited. 696 Upon receipt of an Initial packet with a token that begins with '0', 697 the retry service MUST validate the token in accordance with the QUIC 698 specification. It must also verify that the secure hash of the 699 Connect ID is correct. If incorrect, the token is invalid. 701 In active mode, the service MUST issue Retry packets for all Client 702 initial packets that contain no token, or a token that has the first 703 bit set to '1'. It MUST NOT forward the packet to the server. The 704 service MUST validate all tokens with the first bit set to '0'. If 705 successful, the service MUST forward the packet with the token 706 intact. If unsuccessful, it MUST drop the packet. 708 Note that this scheme has a performance drawback. When the retry 709 service is in active mode, clients with a token from a NEW_TOKEN 710 frame will suffer a 1-RTT penalty even though it has proof of address 711 with its token. 713 In inactive mode, the service MUST forward all packets that have no 714 token or a token with the first bit set to '1'. It MUST validate all 715 tokens with the first bit set to '0'. If successful, the service 716 MUST forward the packet with the token intact. If unsuccessful, it 717 MUST either drop the packet or forward it with the token removed. 718 The latter requires decryption and re-encryption of the entire 719 Initial packet to avoid authentication failure. Forwarding the 720 packet causes the server to respond without the 721 original_connection_id transport parameter, which preserves the 722 normal QUIC signal to the client that there is an unauthorized man in 723 the middle. 725 5.2.2. Server Requirements 727 A server behind a non-shared-state retry service MUST NOT send Retry 728 packets. 730 Tokens sent in NEW_TOKEN frames MUST have the first bit be set to 731 '1'. 733 If a server receives an Initial Packet with the first bit set to '1', 734 it could be from a server-generated NEW_TOKEN frame and should be 735 processed in accordance with the QUIC specification. If a server 736 receives an Initial Packet with the first bit to '0', it is a Retry 737 token and the server MUST NOT attempt to validate it. Instead, it 738 MUST assume the address is validated and MUST extract the Original 739 Destination Connection ID, assuming the format described in 740 Section 5.2.1. 742 5.3. Shared-State Retry Service 744 A shared-state retry service uses a shared key, so that the server 745 can decode the service's retry tokens. It does not require that all 746 traffic pass through the Retry service, so servers MAY send Retry 747 packets in response to Initial packets that don't include a valid 748 token. 750 Both server and service must have access to Universal time, though 751 tight synchronization is not necessary. 753 All tokens, generated by either the server or retry service, MUST use 754 the following format. This format is the cleartext version. On the 755 wire, these fields are encrypted using an AES-ECB cipher and the 756 token key. If the token is not a multiple of 16 octets, the last 757 block is padded with zeroes. 759 0 1 2 3 760 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 761 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 762 | ODCIL | Original Destination Connection ID (0..160) | 763 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 764 | ... | 765 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 766 | | 767 + + 768 | | 769 + Client IP Address (128) + 770 | | 771 + + 772 | | 773 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 774 | | 775 + + 776 | | 777 + + 778 | date-time (160) | 779 + + 780 | | 781 + + 782 | | 783 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 784 | Opaque Data (optional) | 785 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 787 Figure 6: Cleartext format of shared-state retry tokens 789 The tokens have the following fields: 791 ODCIL: The original destination connection ID length. Tokens in 792 NEW_TOKEN frames SHOULD set this field to zero. 794 Original Destination Connection ID: This is copied from the field in 795 the client Initial packet. 797 Client IP Address: The source IP address from the triggering Initial 798 packet. The client IP address is 16 octets. If an IPv4 address, the 799 last 12 octets are zeroes. 801 date-time: The date-time string is a total of 20 octets and encodes 802 the time the token was generated. The format of date-time is 803 described in Section 5.6 of [RFC3339]. This ASCII field MUST use the 804 "Z" character for time-offset. 806 Opaque Data: The server may use this field to encode additional 807 information, such as congestion window, RTT, or MTU. Opaque data 808 SHOULD also allow servers to distinguish between retry tokens (which 809 trigger use of the original_connection_id transport parameter) and 810 NEW_TOKEN frame tokens. 812 5.3.1. Configuration Agent Actions 814 The configuration agent generates and distributes a "token key." 816 5.3.2. Service Requirements 818 When in active mode, the service MUST generate Retry tokens with the 819 format described above when it receives a client Initial packet with 820 no token. 822 In active mode, the service SHOULD decrypt incoming tokens. The 823 service SHOULD drop packets with an IP address that does not match, 824 and SHOULD forward packets that do, regardless of the other fields. 826 In inactive mode, the service SHOULD forward all packets to the 827 server so that the server can issue an up-to-date token to the 828 client. 830 5.3.3. Server Requirements 832 The server MUST validate all tokens that arrive in Initial packets, 833 as they may have bypassed the Retry service. It SHOULD use the date- 834 time field to apply its expiration limits for tokens. This need not 835 be synchronized with the retry service. However, servers MAY allow 836 retry tokens marked as being a few seconds in the future, due to 837 possible clock synchronization issues. 839 A server MUST NOT send a Retry packet in response to an Initial 840 packet that contains a retry token. 842 6. Configuration Requirements 844 QUIC-LB requires common configuration to synchronize understanding of 845 encodings and guarantee explicit consent of the server. 847 The load balancer and server MUST agree on a routing algorithm and 848 the relevant parameters for that algorithm. 850 For Plaintext CID Routing, this consists of the Server ID and the 851 routing bytes. The Server ID is unique to each server, and the 852 routing bytes are global. 854 For Obfuscated CID Routing, this consists of the Routing Bits, 855 Divisor, and Modulus. The Modulus is unique to each server, but the 856 others MUST be global. 858 For Stream Cipher CID Routing, this consists of the Server ID, Server 859 ID Length, Key, and Nonce Length. The Server ID is unique to each 860 server, but the others MUST be global. The authentication token MUST 861 be distributed out of band for this algorithm to operate. 863 For Block Cipher CID Routing, this consists of the Server ID, Server 864 ID Length, Key, and Zero-Padding Length. The Server ID is unique to 865 each server, but the others MUST be global. 867 A full QUIC-LB configuration MUST also specify the information 868 content of the first CID octet and the presence and mode of any Retry 869 Service. 871 The following pseudocode depicts the data items necessary to store a 872 full QUIC-LB configuration at the server. It is meant to describe 873 the conceptual range and not specify the presentation of such 874 configuration in an internet packet. The comments signify the range 875 of acceptable values where applicable. 877 uint2 config_rotation_bits; 878 enum { in_band_config, out_of_band_config } config_method; 879 select (config_method) { 880 case in_band_config: uint64 config_token; 881 case out_of_band_config: null; 882 } config-method 883 boolean first_octet_encodes_cid_length; 884 enum { none, non_shared_state, shared_state } retry_service; 885 select (retry_service) { 886 case none: null; 887 case non_shared_state: null; 888 case shared_state: uint8 key[16]; 889 } retry_service_config; 890 enum { none, plaintext, obfuscated, stream_cipher, block_cipher } 891 routing_algorithm; 892 select (routing_algorithm) { 893 case none: null; 894 case plaintext: struct { 895 uint8 server_id_length; /* 1..19 */ 896 uint8 server_id[server_id_length]; 897 } plaintext_config; 898 case obfuscated: struct { 899 uint8 routing_bit_mask[19]; 900 uint16 divisor; /* Must be odd */ 901 uint16 modulus; /* 0..(divisor - 1) */ 902 } obfuscated_config; 903 case stream_cipher: struct { 904 uint8 nonce_length; /* 8..16 */ 905 uint8 server_id_length; /* 1..(19 - nonce_length) */ 906 uint8 server_id[server_id_length]; 907 uint8 key[16]; 908 } stream_cipher_config; 909 case block_cipher: struct { 910 uint8 server_id_length; 911 uint8 zero_padding_length; /* 0..(16 - server_id_length) */ 912 uint8 server_id[server_id_length]; 913 uint8 key[16]; 914 } block_cipher_config; 915 } routing_algorithm_config; 917 7. Security Considerations 919 QUIC-LB is intended to prevent linkability. Attacks would therefore 920 attempt to subvert this purpose. 922 Note that the Plaintext CID algorithm makes no attempt to obscure the 923 server mapping, and therefore does not address these concerns. It 924 exists to allow consistent CID encoding for compatibility across a 925 network infrastructure. Servers that are running the Plaintext CID 926 algorithm SHOULD only use it to generate new CIDs for the Server 927 Initial Packet and SHOULD NOT send CIDs in QUIC NEW_CONNECTION_ID 928 frames. Doing so might falsely suggest to the client that said CIDs 929 were generated in a secure fashion. 931 A linkability attack would find some means of determining that two 932 connection IDs route to the same server. As described above, there 933 is no scheme that strictly prevents linkability for all traffic 934 patterns, and therefore efforts to frustrate any analysis of server 935 ID encoding have diminishing returns. 937 7.1. Attackers not between the load balancer and server 939 Any attacker might open a connection to the server infrastructure and 940 aggressively retire connection IDs to obtain a large sample of IDs 941 that map to the same server. It could then apply analytical 942 techniques to try to obtain the server encoding. 944 The Encrypted CID algorithm provides robust entropy to making any 945 sort of linkage. The Obfuscated CID obscures the mapping and 946 prevents trivial brute-force attacks to determine the routing 947 parameters, but does not provide robust protection against 948 sophisticated attacks. 950 Were this analysis to obtain the server encoding, then on-path 951 observers might apply this analysis to correlating different client 952 IP addresses. 954 7.2. Attackers between the load balancer and server 956 Attackers in this privileged position are intrinsically able to map 957 two connection IDs to the same server. The QUIC-LB algorithms do 958 prevent the linkage of two connection IDs to the same individual 959 connection if servers make reasonable selections when generating new 960 IDs for that connection. 962 8. IANA Considerations 964 There are no IANA requirements. 966 9. References 968 9.1. Normative References 970 [QUIC-TRANSPORT] 971 Iyengar, J., Ed. and M. Thomson, Ed., "QUIC: A UDP-Based 972 Multiplexed and Secure Transport", draft-ietf-quic- 973 transport (work in progress). 975 [RFC3339] Klyne, G. and C. Newman, "Date and Time on the Internet: 976 Timestamps", RFC 3339, DOI 10.17487/RFC3339, July 2002, 977 . 979 9.2. Informative References 981 [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate 982 Requirement Levels", BCP 14, RFC 2119, 983 DOI 10.17487/RFC2119, March 1997, 984 . 986 Appendix A. Acknowledgments 988 Appendix B. Change Log 990 *RFC Editor's Note:* Please remove this section prior to 991 publication of a final version of this document. 993 B.1. since-draft-ietf-quic-load-balancers-00 995 o Removed in-band protocol from the document 997 B.2. Since draft-duke-quic-load-balancers-06 999 o Switch to IETF WG draft. 1001 B.3. Since draft-duke-quic-load-balancers-05 1003 o Editorial changes 1005 o Made load balancer behavior independent of QUIC version 1007 o Got rid of token in stream cipher encoding, because server might 1008 not have it 1010 o Defined "non-compliant DCID" and specified rules for handling 1011 them. 1013 o Added psuedocode for config schema 1015 B.4. Since draft-duke-quic-load-balancers-04 1017 o Added standard for retry services 1019 B.5. Since draft-duke-quic-load-balancers-03 1021 o Renamed Plaintext CID algorithm as Obfuscated CID 1023 o Added new Plaintext CID algorithm 1025 o Updated to allow 20B CIDs 1027 o Added self-encoding of CID length 1029 B.6. Since draft-duke-quic-load-balancers-02 1031 o Added Config Rotation 1033 o Added failover mode 1035 o Tweaks to existing CID algorithms 1037 o Added Block Cipher CID algorithm 1039 o Reformatted QUIC-LB packets 1041 B.7. Since draft-duke-quic-load-balancers-01 1043 o Complete rewrite 1045 o Supports multiple security levels 1047 o Lightweight messages 1049 B.8. Since draft-duke-quic-load-balancers-00 1051 o Converted to markdown 1053 o Added variable length connection IDs 1055 Authors' Addresses 1057 Martin Duke 1058 F5 Networks, Inc. 1060 Email: martin.h.duke@gmail.com 1061 Nick Banks 1062 Microsoft 1064 Email: nibanks@microsoft.com