idnits 2.17.1 draft-ietf-masque-connect-udp-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 : ---------------------------------------------------------------------------- No issues found here. Miscellaneous warnings: ---------------------------------------------------------------------------- == The copyright year in the IETF Trust and authors Copyright Line does not match the current year -- The document date (30 December 2020) is 1212 days in the past. Is this intentional? Checking references for intended status: Proposed Standard ---------------------------------------------------------------------------- (See RFCs 3967 and 4897 for information about using normative references to lower-maturity documents in RFCs) == Outdated reference: A later version (-10) exists of draft-ietf-quic-datagram-01 ** Obsolete normative reference: RFC 7540 (ref. 'H2') (Obsoleted by RFC 9113) == Outdated reference: A later version (-04) exists of draft-schinazi-masque-h3-datagram-02 == Outdated reference: A later version (-34) exists of draft-ietf-quic-transport-33 ** Obsolete normative reference: RFC 7230 (Obsoleted by RFC 9110, RFC 9112) ** Obsolete normative reference: RFC 7231 (Obsoleted by RFC 9110) ** Obsolete normative reference: RFC 793 (ref. 'TCP') (Obsoleted by RFC 9293) Summary: 4 errors (**), 0 flaws (~~), 4 warnings (==), 1 comment (--). Run idnits with the --verbose option for more detailed information about the items above. -------------------------------------------------------------------------------- 2 Network Working Group D. Schinazi 3 Internet-Draft Google LLC 4 Intended status: Standards Track 30 December 2020 5 Expires: 3 July 2021 7 The CONNECT-UDP HTTP Method 8 draft-ietf-masque-connect-udp-02 10 Abstract 12 This document describes the CONNECT-UDP HTTP method. CONNECT-UDP is 13 similar to the HTTP CONNECT method, but it uses UDP instead of TCP. 15 Discussion of this work is encouraged to happen on the MASQUE IETF 16 mailing list masque@ietf.org or on the GitHub repository which 17 contains the draft: https://github.com/ietf-wg-masque/draft-ietf- 18 masque-connect-udp. 20 Discussion Venues 22 This note is to be removed before publishing as an RFC. 24 Source for this draft and an issue tracker can be found at 25 https://github.com/ietf-wg-masque/draft-ietf-masque-connect-udp. 27 Status of This Memo 29 This Internet-Draft is submitted in full conformance with the 30 provisions of BCP 78 and BCP 79. 32 Internet-Drafts are working documents of the Internet Engineering 33 Task Force (IETF). Note that other groups may also distribute 34 working documents as Internet-Drafts. The list of current Internet- 35 Drafts is at https://datatracker.ietf.org/drafts/current/. 37 Internet-Drafts are draft documents valid for a maximum of six months 38 and may be updated, replaced, or obsoleted by other documents at any 39 time. It is inappropriate to use Internet-Drafts as reference 40 material or to cite them other than as "work in progress." 42 This Internet-Draft will expire on 3 July 2021. 44 Copyright Notice 46 Copyright (c) 2020 IETF Trust and the persons identified as the 47 document authors. All rights reserved. 49 This document is subject to BCP 78 and the IETF Trust's Legal 50 Provisions Relating to IETF Documents (https://trustee.ietf.org/ 51 license-info) in effect on the date of publication of this document. 52 Please review these documents carefully, as they describe your rights 53 and restrictions with respect to this document. Code Components 54 extracted from this document must include Simplified BSD License text 55 as described in Section 4.e of the Trust Legal Provisions and are 56 provided without warranty as described in the Simplified BSD License. 58 Table of Contents 60 1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . 2 61 1.1. Conventions and Definitions . . . . . . . . . . . . . . . 2 62 2. Supported HTTP Versions . . . . . . . . . . . . . . . . . . . 3 63 3. The CONNECT-UDP Method . . . . . . . . . . . . . . . . . . . 3 64 4. Datagram Encoding of Proxied UDP Packets . . . . . . . . . . 4 65 5. Stream Chunks . . . . . . . . . . . . . . . . . . . . . . . . 5 66 6. Stream Encoding of Proxied UDP Packets . . . . . . . . . . . 6 67 7. Proxy Handling . . . . . . . . . . . . . . . . . . . . . . . 6 68 8. HTTP Intermediaries . . . . . . . . . . . . . . . . . . . . . 6 69 9. Performance Considerations . . . . . . . . . . . . . . . . . 7 70 10. Security Considerations . . . . . . . . . . . . . . . . . . . 7 71 11. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 8 72 11.1. HTTP Method . . . . . . . . . . . . . . . . . . . . . . 8 73 11.2. URI Scheme Registration . . . . . . . . . . . . . . . . 8 74 11.3. Stream Chunk Type Registration . . . . . . . . . . . . . 8 75 12. Normative References . . . . . . . . . . . . . . . . . . . . 9 76 Acknowledgments . . . . . . . . . . . . . . . . . . . . . . . . . 10 77 Author's Address . . . . . . . . . . . . . . . . . . . . . . . . 10 79 1. Introduction 81 This document describes the CONNECT-UDP HTTP method. CONNECT-UDP is 82 similar to the HTTP CONNECT method (see section 4.3.6 of [RFC7231]), 83 but it uses UDP [UDP] instead of TCP [TCP]. 85 Discussion of this work is encouraged to happen on the MASQUE IETF 86 mailing list masque@ietf.org or on the GitHub repository which 87 contains the draft: https://github.com/ietf-wg-masque/draft-ietf- 88 masque-connect-udp. 90 1.1. Conventions and Definitions 92 The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", 93 "SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED", "MAY", and 94 "OPTIONAL" in this document are to be interpreted as described in BCP 95 14 [RFC2119] [RFC8174] when, and only when, they appear in all 96 capitals, as shown here. 98 In this document, we use the term "proxy" to refer to the HTTP server 99 that opens the UDP socket and responds to the CONNECT-UDP request. 100 If there are HTTP intermediaries (as defined in Section 2.3 of 101 [RFC7230]) between the client and the proxy, those are referred to as 102 "intermediaries" in this document. 104 2. Supported HTTP Versions 106 The CONNECT-UDP method is defined for all versions of HTTP. When the 107 HTTP version used runs over QUIC [QUIC], UDP payloads can be sent 108 over QUIC DATAGRAM frames [DGRAM]. Otherwise they are sent on the 109 stream where the CONNECT-UDP request was made. Note that, when the 110 HTTP version in use does not support multiplexing streams (such as 111 HTTP/1.1), then any reference to "stream" in this document is meant 112 to represent the entire connection. 114 3. The CONNECT-UDP Method 116 The CONNECT-UDP method requests that the recipient establish a tunnel 117 over a single HTTP stream to the destination origin server identified 118 by the request-target and, if successful, thereafter restrict its 119 behavior to blind forwarding of packets, in both directions, until 120 the tunnel is closed. Tunnels are commonly used to create an end-to- 121 end virtual connection, which can then be secured using QUIC or 122 another protocol running over UDP. 124 The request-target of a CONNECT-UDP request is a URI [RFC3986] which 125 uses the "masque" scheme and an immutable path of "/". For example: 127 CONNECT-UDP masque://target.example.com:443/ HTTP/1.1 128 Host: target.example.com:443 130 When using HTTP/2 [H2] or later, CONNECT-UDP requests use HTTP 131 pseudo-headers with the following requirements: 133 * The ":method" pseudo-header field is set to "CONNECT-UDP". 135 * The ":scheme" pseudo-header field is set to "masque". 137 * The ":path" pseudo-header field is set to "/". 139 * The ":authority" pseudo-header field contains the host and port to 140 connect to (similar to the authority-form of the request-target of 141 CONNECT requests; see [RFC7230], Section 5.3). 143 A CONNECT-UDP request that does not conform to these restrictions is 144 malformed (see [H2], Section 8.1.2.6). 146 The recipient proxy establishes a tunnel by directly opening a UDP 147 socket to the request-target. Any 2xx (Successful) response 148 indicates that the proxy has opened a socket to the request-target 149 and is willing to proxy UDP payloads. Any response other than a 150 successful response indicates that the tunnel has not yet been 151 formed. 153 A proxy MUST NOT send any Transfer-Encoding or Content-Length header 154 fields in a 2xx (Successful) response to CONNECT-UDP. A client MUST 155 treat a response to CONNECT-UDP containing any Content-Length or 156 Transfer-Encoding header fields as malformed. 158 A payload within a CONNECT-UDP request message has no defined 159 semantics; a CONNECT-UDP request with a non-empty payload is 160 malformed. Note that the CONNECT-UDP stream is used to convey UDP 161 packets, but they are not semantically part of the request or 162 response themselves. 164 Responses to the CONNECT-UDP method are not cacheable. 166 4. Datagram Encoding of Proxied UDP Packets 168 When the HTTP connection supports HTTP/3 datagrams [H3DGRAM], UDP 169 packets can be encoded using QUIC DATAGRAM frames. This support is 170 ascertained by checking the received value of the H3_DATAGRAM 171 SETTINGS Parameter. 173 If the client has both sent and received the H3_DATAGRAM SETTINGS 174 Parameter with value 1 on this connection, it SHOULD attempt to use 175 HTTP/3 datagrams. This is accomplished by requesting a datagram flow 176 identifier from the flow identifier allocation service [H3DGRAM]. 177 That service generates an even flow identifier, and the client sends 178 it to the proxy by using the "Datagram-Flow-Id" header; see 179 [H3DGRAM]. A CONNECT-UDP request with an odd flow identifier is 180 malformed. 182 The proxy that is creating the UDP socket to the destination responds 183 to the CONNECT-UDP request with a 2xx (Successful) response, and 184 indicates it supports datagram encoding by echoing the "Datagram- 185 Flow-Id" header. Once the client has received the "Datagram-Flow-Id" 186 header on the successful response, it knows that it can use the 187 HTTP/3 datagram encoding to send proxied UDP packets for this 188 particular request. It then encodes the payload of UDP datagrams 189 into the payload of HTTP/3 datagrams. Is the CONNECT-UDP response 190 does not carry the "Datagram-Flow-Id" header, then the datagram 191 encoding is not available for this request. A CONNECT-UDP response 192 that carries the "Datagram-Flow-Id" header but with a different flow 193 identifier than the one sent on the request is malformed. 195 When the proxy processes a new CONNECT-UDP request, it MUST ensure 196 that the datagram flow identifier is not equal to flow identifiers 197 from other requests: if it is, the proxy MUST reject the request with 198 a 4xx (Client Error) status code. Extensions MAY weaken or remove 199 this requirement. 201 Clients MAY optimistically start sending proxied UDP packets before 202 receiving the response to its CONNECT-UDP request, noting however 203 that those may not be processed by the proxy if it responds to the 204 CONNECT-UDP request with a failure or without echoing the "Datagram- 205 Flow-Id" header, or if the datagrams arrive before the CONNECT-UDP 206 request. 208 Note that a proxy can send the H3_DATAGRAM SETTINGS Parameter with a 209 value of 1 while disabling datagrams on a particular request by not 210 echoing the "Datagram-Flow-Id" header. If the proxy does this, it 211 MUST NOT treat receipt of datagrams as an error, because the client 212 could have sent them optimistically before receiving the response. 213 In this scenario, the proxy MUST discard those datagrams. 215 Extensions to CONNECT-UDP MAY leverage parameters on the "Datagram- 216 Flow-Id" header (parameters are defined in Section 3.1.2 of 217 [STRUCT-HDR]). Proxies MUST NOT echo parameters on the "Datagram- 218 Flow-Id" header if it does not understand their semantics. 220 5. Stream Chunks 222 The bidirectional stream that the CONNECT-UDP request was sent on is 223 a sequence of CONNECT-UDP Stream Chunks, which are defined as a 224 sequence of type-length-value tuples using the following format 225 (using the notation from the "Notational Conventions" section of 226 [QUIC]): 228 CONNECT-UDP Stream { 229 CONNECT-UDP Stream Chunk (..) ..., 230 } 232 Figure 1: CONNECT-UDP Stream Format 234 CONNECT-UDP Stream Chunk { 235 CONNECT-UDP Stream Chunk Type (i), 236 CONNECT-UDP Stream Chunk Length (i), 237 CONNECT-UDP Stream Chunk Value (..), 238 } 240 Figure 2: CONNECT-UDP Stream Chunk Format 242 CONNECT-UDP Stream Chunk Type: A variable-length integer indicating 243 the Type of the CONNECT-UDP Stream Chunk. Endpoints that receive 244 a chunk with an unknown CONNECT-UDP Stream Chunk Type MUST 245 silently skip over that chunk. 247 CONNECT-UDP Stream Chunk Length: The length of the CONNECT-UDP 248 Stream Chunk Value field following this field. Note that this 249 field can have a value of zero. 251 CONNECT-UDP Stream Chunk Value: The payload of this chunk. Its 252 semantics are determined by the value of the CONNECT-UDP Stream 253 Chunk Type field. 255 6. Stream Encoding of Proxied UDP Packets 257 CONNECT-UDP Stream Chunks can be used to convey UDP payloads, by 258 using a CONNECT-UDP Stream Chunk Type of UDP_PACKET (value 0x00). 259 The payload of UDP packets is encoded in its unmodified entirety in 260 the CONNECT-UDP Stream Chunk Value field. This is necessary when the 261 version of HTTP in use does not support QUIC DATAGRAM frames, but MAY 262 also be used when datagrams are supported. Note that empty UDP 263 payloads are allowed. 265 7. Proxy Handling 267 Unlike TCP, UDP is connection-less. The proxy that opens the UDP 268 socket has no way of knowing whether the destination is reachable. 269 Therefore it needs to respond to the CONNECT-UDP request without 270 waiting for a TCP SYN-ACK. 272 Proxies can use connected UDP sockets if their operating system 273 supports them, as that allows the proxy to rely on the kernel to only 274 send it UDP packets that match the correct 5-tuple. If the proxy 275 uses a non-connected socket, it MUST validate the IP source address 276 and UDP source port on received packets to ensure they match the 277 client's CONNECT-UDP request. Packets that do not match MUST be 278 discarded by the proxy. 280 The lifetime of the socket is tied to the CONNECT-UDP stream. The 281 proxy MUST keep the socket open while the CONNECT-UDP stream is open. 282 Proxies MAY choose to close sockets due to a period of inactivity, 283 but they MUST close the CONNECT-UDP stream before closing the socket. 285 8. HTTP Intermediaries 287 HTTP/3 DATAGRAM flow identifiers are specific to a given HTTP/3 288 connection. However, in some cases, an HTTP request may travel 289 across multiple HTTP connections if there are HTTP intermediaries 290 involved; see Section 2.3 of [RFC7230]. 292 Intermediaries that support both CONNECT-UDP and HTTP/3 datagrams 293 MUST negotiate flow identifiers separately on the client-facing and 294 server-facing connections. This is accomplished by having the 295 intermediary parse the "Datagram-Flow-Id" header on all CONNECT-UDP 296 requests it receives, and sending the same value in the "Datagram- 297 Flow-Id" header on the response. The intermediary then ascertains 298 whether it can use datagrams on the server-facing connection. If 299 they are supported (as indicated by the H3_DATAGRAM SETTINGS 300 parameter), the intermediary uses its own flow identifier allocation 301 service to allocate a flow identifier for the server-facing 302 connection, and waits for the server's reply to see if the server 303 sent the "Datagram-Flow-Id" header on the response. The intermediary 304 then translates datagrams between the two connections by using the 305 flow identifier specific to that connection. An intermediary MAY 306 also choose to use datagrams on only one of the two connections, and 307 translate between datagrams and streams. 309 9. Performance Considerations 311 Proxies SHOULD strive to avoid increasing burstiness of UDP traffic: 312 they SHOULD NOT queue packets in order to increase batching. 314 When the protocol running over UDP that is being proxied uses 315 congestion control (e.g., [QUIC]), the proxied traffic will incur at 316 least two nested congestion controllers. This can reduce performance 317 but the underlying HTTP connection MUST NOT disable congestion 318 control unless it has an out-of-band way of knowing with absolute 319 certainty that the inner traffic is congestion-controlled. 321 When the protocol running over UDP that is being proxied uses loss 322 recovery (e.g., [QUIC]), and the underlying HTTP connection runs over 323 TCP, the proxied traffic will incur at least two nested loss recovery 324 mechanisms. This can reduce performance as both can sometimes 325 independently retransmit the same data. To avoid this, HTTP/3 326 datagrams SHOULD be used. 328 10. Security Considerations 330 There are significant risks in allowing arbitrary clients to 331 establish a tunnel to arbitrary servers, as that could allow bad 332 actors to send traffic and have it attributed to the proxy. Proxies 333 that support CONNECT-UDP SHOULD restrict its use to authenticated 334 users. 336 Because the CONNECT method creates a TCP connection to the target, 337 the target has to indicate its willingness to accept TCP connections 338 by responding with a TCP SYN-ACK before the proxy can send it 339 application data. UDP doesn't have this property, so a CONNECT-UDP 340 proxy could send more data to an unwilling target than a CONNECT 341 proxy. However, in practice denial of service attacks target open 342 TCP ports so the TCP SYN-ACK does not offer much protection in real 343 scenarios. Proxies MUST NOT introspect the contents of UDP payloads 344 as that would lead to ossification of UDP-based protocols by proxies. 346 11. IANA Considerations 348 11.1. HTTP Method 350 This document will request IANA to register "CONNECT-UDP" in the HTTP 351 Method Registry (IETF review) maintained at 352 . 354 +-------------+------+------------+---------------+ 355 | Method Name | Safe | Idempotent | Reference | 356 +-------------+------+------------+---------------+ 357 | CONNECT-UDP | no | no | This document | 358 +-------------+------+------------+---------------+ 360 11.2. URI Scheme Registration 362 This document will request IANA to register the URI scheme "masque". 364 The syntax definition below uses Augmented Backus-Naur Form (ABNF) 365 [RFC5234]. The definitions of "host" and "port" are adopted from 366 [RFC3986]. The syntax of a MASQUE URI is: 368 masque-URI = "masque:" "//" host ":" port "/" 370 The "host" and "port" component MUST NOT be empty, and the "port" 371 component MUST NOT be 0. 373 11.3. Stream Chunk Type Registration 375 This document will request IANA to create a "CONNECT-UDP Stream Chunk 376 Type" registry. This registry governs a 62-bit space, and follows 377 the registration policy for QUIC registries as defined in [QUIC]. In 378 addition to the fields required by the QUIC policy, registrations in 379 this registry MUST include the following fields: 381 Type: A short mnemonic for the type. 383 Description: A brief description of the type semantics, which MAY be 384 a summary if a specification reference is provided. 386 The initial contents of this registry are: 388 +-------+------------+-----------------------+---------------+ 389 | Value | Type | Description | Reference | 390 +-------+------------+-----------------------+---------------+ 391 | 0x00 | UDP_PACKET | Payload of UDP packet | This document | 392 +-------+------------+-----------------------+---------------+ 394 Each value of the format "37 * N + 23" for integer values of N (that 395 is, 23, 60, 97, ...) are reserved; these values MUST NOT be assigned 396 by IANA and MUST NOT appear in the listing of assigned values. 398 12. Normative References 400 [DGRAM] Pauly, T., Kinnear, E., and D. Schinazi, "An Unreliable 401 Datagram Extension to QUIC", Work in Progress, Internet- 402 Draft, draft-ietf-quic-datagram-01, 24 August 2020, 403 . 406 [H2] Belshe, M., Peon, R., and M. Thomson, Ed., "Hypertext 407 Transfer Protocol Version 2 (HTTP/2)", RFC 7540, 408 DOI 10.17487/RFC7540, May 2015, 409 . 411 [H3DGRAM] Schinazi, D. and L. Pardue, "Using QUIC Datagrams with 412 HTTP/3", Work in Progress, Internet-Draft, draft-schinazi- 413 masque-h3-datagram-02, 14 December 2020, 414 . 417 [QUIC] Iyengar, J. and M. Thomson, "QUIC: A UDP-Based Multiplexed 418 and Secure Transport", Work in Progress, Internet-Draft, 419 draft-ietf-quic-transport-33, 13 December 2020, 420 . 423 [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate 424 Requirement Levels", BCP 14, RFC 2119, 425 DOI 10.17487/RFC2119, March 1997, 426 . 428 [RFC3986] Berners-Lee, T., Fielding, R., and L. Masinter, "Uniform 429 Resource Identifier (URI): Generic Syntax", STD 66, 430 RFC 3986, DOI 10.17487/RFC3986, January 2005, 431 . 433 [RFC5234] Crocker, D., Ed. and P. Overell, "Augmented BNF for Syntax 434 Specifications: ABNF", STD 68, RFC 5234, 435 DOI 10.17487/RFC5234, January 2008, 436 . 438 [RFC7230] Fielding, R., Ed. and J. Reschke, Ed., "Hypertext Transfer 439 Protocol (HTTP/1.1): Message Syntax and Routing", 440 RFC 7230, DOI 10.17487/RFC7230, June 2014, 441 . 443 [RFC7231] Fielding, R., Ed. and J. Reschke, Ed., "Hypertext Transfer 444 Protocol (HTTP/1.1): Semantics and Content", RFC 7231, 445 DOI 10.17487/RFC7231, June 2014, 446 . 448 [RFC8174] Leiba, B., "Ambiguity of Uppercase vs Lowercase in RFC 449 2119 Key Words", BCP 14, RFC 8174, DOI 10.17487/RFC8174, 450 May 2017, . 452 [STRUCT-HDR] 453 Nottingham, M. and P. Kamp, "Structured Field Values for 454 HTTP", Work in Progress, Internet-Draft, draft-ietf- 455 httpbis-header-structure-19, 3 June 2020, 456 . 459 [TCP] Postel, J., "Transmission Control Protocol", STD 7, 460 RFC 793, DOI 10.17487/RFC0793, September 1981, 461 . 463 [UDP] Postel, J., "User Datagram Protocol", STD 6, RFC 768, 464 DOI 10.17487/RFC0768, August 1980, 465 . 467 Acknowledgments 469 This document is a product of the MASQUE Working Group, and the 470 author thanks all MASQUE enthusiasts for their contibutions. This 471 proposal was inspired directly or indirectly by prior work from many 472 people. In particular, the author would like to thank Eric Rescorla 473 for suggesting to use an HTTP method to proxy UDP. Thanks to Lucas 474 Pardue for their inputs on this document. 476 Author's Address 478 David Schinazi 479 Google LLC 480 1600 Amphitheatre Parkway 481 Mountain View, California 94043, 482 United States of America 484 Email: dschinazi.ietf@gmail.com