idnits 2.17.1 draft-ietf-masque-connect-udp-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 -- The document date (12 December 2020) is 1221 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-01 == Outdated reference: A later version (-34) exists of draft-ietf-quic-transport-32 ** 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 12 December 2020 5 Expires: 15 June 2021 7 The CONNECT-UDP HTTP Method 8 draft-ietf-masque-connect-udp-01 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 15 June 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 Encoding of Proxied UDP Packets . . . . . . . . . . . 5 66 6. Proxy Handling . . . . . . . . . . . . . . . . . . . . . . . 6 67 7. HTTP Intermediaries . . . . . . . . . . . . . . . . . . . . . 6 68 8. Performance Considerations . . . . . . . . . . . . . . . . . 7 69 9. Security Considerations . . . . . . . . . . . . . . . . . . . 7 70 10. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 8 71 10.1. HTTP Method . . . . . . . . . . . . . . . . . . . . . . 8 72 10.2. URI Scheme Registration . . . . . . . . . . . . . . . . 8 73 10.3. Stream Chunk Type Registration . . . . . . . . . . . . . 8 74 11. Normative References . . . . . . . . . . . . . . . . . . . . 9 75 Acknowledgments . . . . . . . . . . . . . . . . . . . . . . . . . 10 76 Author's Address . . . . . . . . . . . . . . . . . . . . . . . . 10 78 1. Introduction 80 This document describes the CONNECT-UDP HTTP method. CONNECT-UDP is 81 similar to the HTTP CONNECT method (see section 4.3.6 of [RFC7231]), 82 but it uses UDP [UDP] instead of TCP [TCP]. 84 Discussion of this work is encouraged to happen on the MASQUE IETF 85 mailing list masque@ietf.org or on the GitHub repository which 86 contains the draft: https://github.com/ietf-wg-masque/draft-ietf- 87 masque-connect-udp. 89 1.1. Conventions and Definitions 91 The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", 92 "SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED", "MAY", and 93 "OPTIONAL" in this document are to be interpreted as described in BCP 94 14 [RFC2119] [RFC8174] when, and only when, they appear in all 95 capitals, as shown here. 97 In this document, we use the term "proxy" to refer to the HTTP server 98 that opens the UDP socket and responds to the CONNECT-UDP request. 99 If there are HTTP intermediaries (as defined in Section 2.3 of 100 [RFC7230]) between the client and the proxy, those are referred to as 101 "intermediaries" in this document. 103 2. Supported HTTP Versions 105 The CONNECT-UDP method is defined for all versions of HTTP. When the 106 HTTP version used runs over QUIC [QUIC], UDP payloads can be sent 107 over QUIC DATAGRAM frames [DGRAM]. Otherwise they are sent on the 108 stream where the CONNECT-UDP request was made. Note that, when the 109 HTTP version in use does not support multiplexing streams (such as 110 HTTP/1.1), then any reference to "stream" in this document is meant 111 to represent the entire connection. 113 3. The CONNECT-UDP Method 115 The CONNECT-UDP method requests that the recipient establish a tunnel 116 over a single HTTP stream to the destination origin server identified 117 by the request-target and, if successful, thereafter restrict its 118 behavior to blind forwarding of packets, in both directions, until 119 the tunnel is closed. Tunnels are commonly used to create an end-to- 120 end virtual connection, which can then be secured using QUIC or 121 another protocol running over UDP. 123 The request-target of a CONNECT-UDP request is a URI [RFC3986] which 124 uses the "masque" scheme and an immutable path of "/". For example: 126 CONNECT-UDP masque://target.example.com:443/ HTTP/1.1 127 Host: target.example.com:443 129 When using HTTP/2 [H2] or later, CONNECT-UDP requests use HTTP 130 pseudo-headers with the following requirements: 132 * The ":method" pseudo-header field is set to "CONNECT-UDP". 134 * The ":scheme" pseudo-header field is set to "masque". 136 * The ":path" pseudo-header field is set to "/". 138 * The ":authority" pseudo-header field contains the host and port to 139 connect to (similar to the authority-form of the request-target of 140 CONNECT requests; see [RFC7230], Section 5.3). 142 A CONNECT-UDP request that does not conform to these restrictions is 143 malformed (see [H2], Section 8.1.2.6). 145 The recipient proxy establishes a tunnel by directly opening a UDP 146 socket to the request-target. Any 2xx (Successful) response 147 indicates that the proxy has opened a socket to the request-target 148 and is willing to proxy UDP payloads. Any response other than a 149 successful response indicates that the tunnel has not yet been 150 formed. 152 A proxy MUST NOT send any Transfer-Encoding or Content-Length header 153 fields in a 2xx (Successful) response to CONNECT-UDP. A client MUST 154 treat a response to CONNECT-UDP containing any Content-Length or 155 Transfer-Encoding header fields as malformed. 157 A payload within a CONNECT-UDP request message has no defined 158 semantics; a CONNECT-UDP request with a non-empty payload is 159 malformed. Note that the CONNECT-UDP stream is used to convey UDP 160 packets, but they are not semantically part of the request or 161 response themselves. 163 Responses to the CONNECT-UDP method are not cacheable. 165 4. Datagram Encoding of Proxied UDP Packets 167 When the HTTP connection supports HTTP/3 datagrams [H3DGRAM], UDP 168 packets can be encoded using QUIC DATAGRAM frames. This support is 169 ascertained by checking the received value of the H3_DATAGRAM 170 SETTINGS Parameter. 172 If the client has both sent and received the H3_DATAGRAM SETTINGS 173 Parameter with value 1 on this connection, it SHOULD attempt to use 174 HTTP/3 datagrams. This is accomplished by requesting a datagram flow 175 identifier from the flow identifier allocation service [H3DGRAM]. 176 That service generates an even flow identifier, and the client sends 177 it to the proxy by using the "Datagram-Flow-Id" header; see 178 [H3DGRAM]. A CONNECT-UDP request with an odd flow identifier is 179 malformed. 181 The proxy that is creating the UDP socket to the destination responds 182 to the CONNECT-UDP request with a 2xx (Successful) response, and 183 indicates it supports datagram encoding by echoing the "Datagram- 184 Flow-Id" header. Once the client has received the "Datagram-Flow-Id" 185 header on the successful response, it knows that it can use the 186 HTTP/3 datagram encoding to send proxied UDP packets for this 187 particular request. It then encodes the payload of UDP datagrams 188 into the payload of HTTP/3 datagrams. Is the CONNECT-UDP response 189 does not carry the "Datagram-Flow-Id" header, then the datagram 190 encoding is not available for this request. A CONNECT-UDP response 191 that carries the "Datagram-Flow-Id" header but with a different flow 192 identifier than the one sent on the request is malformed. 194 When the proxy processes a new CONNECT-UDP request, it MUST ensure 195 that the datagram flow identifier is not equal to flow identifiers 196 from other requests: if it is, the proxy MUST reject the request with 197 a 4xx (Client Error) status code. Extensions MAY weaken or remove 198 this requirement. 200 Clients MAY optimistically start sending proxied UDP packets before 201 receiving the response to its CONNECT-UDP request, noting however 202 that those may not be processed by the proxy if it responds to the 203 CONNECT-UDP request with a failure or without echoing the "Datagram- 204 Flow-Id" header, or if the datagrams arrive before the CONNECT-UDP 205 request. 207 Note that a proxy can send the H3_DATAGRAM SETTINGS Parameter with a 208 value of 1 while disabling datagrams on a particular request by not 209 echoing the "Datagram-Flow-Id" header. If the proxy does this, it 210 MUST NOT treat receipt of datagrams as an error, because the client 211 could have sent them optimistically before receiving the response. 212 In this scenario, the proxy MUST discard those datagrams. 214 Extensions to CONNECT-UDP MAY leverage parameters on the "Datagram- 215 Flow-Id" header (parameters are defined in Section 3.1.2 of 216 [STRUCT-HDR]). Proxies MUST NOT echo parameters on the "Datagram- 217 Flow-Id" header if it does not understand their semantics. 219 5. Stream Encoding of Proxied UDP Packets 221 If HTTP/3 datagrams are not supported, the stream is used to convey 222 UDP payloads, by using the following format (using the notation from 223 the "Notational Conventions" section of [QUIC]): 225 CONNECT-UDP Stream Chunk { 226 CONNECT-UDP Stream Chunk Type (i) = 0x00, 227 UDP Payload Length (i), 228 UDP Payload (..), 229 } 231 Figure 1: CONNECT-UDP Stream Chunk Format 233 CONNECT-UDP Stream Chunk Type: A variable-length integer indicating 234 the Type of the CONNECT-UDP Stream Chunk, set to 0x00 to indicate 235 a UDP Payload. 237 UDP Payload Length: The length of the UDP Payload field following 238 this field. 240 UDP Payload: The payload of the UDP datagram. 242 The bidirectional stream that the CONNECT-UDP request was sent on is 243 a sequence of CONNECT-UDP Stream Chunks. The CONNECT-UDP Stream 244 Chunk Type is designed to allow future extensibility. Endpoints that 245 receive a chunk with an unknown CONNECT-UDP Stream Chunk Type MUST 246 silently skip over that chunk. 248 6. Proxy Handling 250 Unlike TCP, UDP is connection-less. The proxy that opens the UDP 251 socket has no way of knowing whether the destination is reachable. 252 Therefore it needs to respond to the CONNECT-UDP request without 253 waiting for a TCP SYN-ACK. 255 Proxies can use connected UDP sockets if their operating system 256 supports them, as that allows the proxy to rely on the kernel to only 257 send it UDP packets that match the correct 5-tuple. If the proxy 258 uses a non-connected socket, it MUST validate the IP source address 259 and UDP source port on received packets to ensure they match the 260 client's CONNECT-UDP request. Packets that do not match MUST be 261 discarded by the proxy. 263 The lifetime of the socket is tied to the CONNECT-UDP stream. The 264 proxy MUST keep the socket open while the CONNECT-UDP stream is open. 265 Proxies MAY choose to close sockets due to a period of inactivity, 266 but they MUST close the CONNECT-UDP stream before closing the socket. 268 7. HTTP Intermediaries 270 HTTP/3 DATAGRAM flow identifiers are specific to a given HTTP/3 271 connection. However, in some cases, an HTTP request may travel 272 across multiple HTTP connections if there are HTTP intermediaries 273 involved; see Section 2.3 of [RFC7230]. 275 Intermediaries that support both CONNECT-UDP and HTTP/3 datagrams 276 MUST negotiate flow identifiers separately on the client-facing and 277 server-facing connections. This is accomplished by having the 278 intermediary parse the "Datagram-Flow-Id" header on all CONNECT-UDP 279 requests it receives, and sending the same value in the "Datagram- 280 Flow-Id" header on the response. The intermediary then ascertains 281 whether it can use datagrams on the server-facing connection. If 282 they are supported (as indicated by the H3_DATAGRAM SETTINGS 283 parameter), the intermediary uses its own flow identifier allocation 284 service to allocate a flow identifier for the server-facing 285 connection, and waits for the server's reply to see if the server 286 sent the "Datagram-Flow-Id" header on the response. The intermediary 287 then translates datagrams between the two connections by using the 288 flow identifier specific to that connection. An intermediary MAY 289 also choose to use datagrams on only one of the two connections, and 290 translate between datagrams and streams. 292 8. Performance Considerations 294 Proxies SHOULD strive to avoid increasing burstiness of UDP traffic: 295 they SHOULD NOT queue packets in order to increase batching. 297 When the protocol running over UDP that is being proxied uses 298 congestion control (e.g., [QUIC]), the proxied traffic will incur at 299 least two nested congestion controllers. This can reduce performance 300 but the underlying HTTP connection MUST NOT disable congestion 301 control unless it has an out-of-band way of knowing with absolute 302 certainty that the inner traffic is congestion-controlled. 304 When the protocol running over UDP that is being proxied uses loss 305 recovery (e.g., [QUIC]), and the underlying HTTP connection runs over 306 TCP, the proxied traffic will incur at least two nested loss recovery 307 mechanisms. This can reduce performance as both can sometimes 308 independently retransmit the same data. To avoid this, HTTP/3 309 datagrams SHOULD be used. 311 9. Security Considerations 313 There are significant risks in allowing arbitrary clients to 314 establish a tunnel to arbitrary servers, as that could allow bad 315 actors to send traffic and have it attributed to the proxy. Proxies 316 that support CONNECT-UDP SHOULD restrict its use to authenticated 317 users. 319 Because the CONNECT method creates a TCP connection to the target, 320 the target has to indicate its willingness to accept TCP connections 321 by responding with a TCP SYN-ACK before the proxy can send it 322 application data. UDP doesn't have this property, so a CONNECT-UDP 323 proxy could send more data to an unwilling target than a CONNECT 324 proxy. However, in practice denial of service attacks target open 325 TCP ports so the TCP SYN-ACK does not offer much protection in real 326 scenarios. Proxies MUST NOT introspect the contents of UDP payloads 327 as that would lead to ossification of UDP-based protocols by proxies. 329 10. IANA Considerations 331 10.1. HTTP Method 333 This document will request IANA to register "CONNECT-UDP" in the HTTP 334 Method Registry (IETF review) maintained at 335 . 337 +-------------+------+------------+---------------+ 338 | Method Name | Safe | Idempotent | Reference | 339 +-------------+------+------------+---------------+ 340 | CONNECT-UDP | no | no | This document | 341 +-------------+------+------------+---------------+ 343 10.2. URI Scheme Registration 345 This document will request IANA to register the URI scheme "masque". 347 The syntax definition below uses Augmented Backus-Naur Form (ABNF) 348 [RFC5234]. The definitions of "host" and "port" are adopted from 349 [RFC3986]. The syntax of a MASQUE URI is: 351 masque-URI = "masque:" "//" host ":" port "/" 353 The "host" and "port" component MUST NOT be empty, and the "port" 354 component MUST NOT be 0. 356 10.3. Stream Chunk Type Registration 358 This document will request IANA to create a "CONNECT-UDP Stream Chunk 359 Type" registry. This registry governs a 62-bit space, and follows 360 the registration policy for QUIC registries as defined in [QUIC]. In 361 addition to the fields required by the QUIC policy, registrations in 362 this registry MUST include the following fields: 364 Type: A short mnemonic for the type. 366 Description: A brief description of the type semantics, which MAY be 367 a summary if a specification reference is provided. 369 The initial contents of this registry are: 371 +-------+------------+-----------------------+---------------+ 372 | Value | Type | Description | Reference | 373 +-------+------------+-----------------------+---------------+ 374 | 0x00 | UDP_PACKET | Payload of UDP packet | This document | 375 +-------+------------+-----------------------+---------------+ 377 Each value of the format "37 * N + 23" for integer values of N (that 378 is, 23, 60, 97, ...) are reserved; these values MUST NOT be assigned 379 by IANA and MUST NOT appear in the listing of assigned values. 381 11. Normative References 383 [DGRAM] Pauly, T., Kinnear, E., and D. Schinazi, "An Unreliable 384 Datagram Extension to QUIC", Work in Progress, Internet- 385 Draft, draft-ietf-quic-datagram-01, 24 August 2020, 386 . 389 [H2] Belshe, M., Peon, R., and M. Thomson, Ed., "Hypertext 390 Transfer Protocol Version 2 (HTTP/2)", RFC 7540, 391 DOI 10.17487/RFC7540, May 2015, 392 . 394 [H3DGRAM] Schinazi, D., "Using QUIC Datagrams with HTTP/3", Work in 395 Progress, Internet-Draft, draft-schinazi-masque-h3- 396 datagram-01, 12 December 2020, . 399 [QUIC] Iyengar, J. and M. Thomson, "QUIC: A UDP-Based Multiplexed 400 and Secure Transport", Work in Progress, Internet-Draft, 401 draft-ietf-quic-transport-32, 20 October 2020, 402 . 405 [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate 406 Requirement Levels", BCP 14, RFC 2119, 407 DOI 10.17487/RFC2119, March 1997, 408 . 410 [RFC3986] Berners-Lee, T., Fielding, R., and L. Masinter, "Uniform 411 Resource Identifier (URI): Generic Syntax", STD 66, 412 RFC 3986, DOI 10.17487/RFC3986, January 2005, 413 . 415 [RFC5234] Crocker, D., Ed. and P. Overell, "Augmented BNF for Syntax 416 Specifications: ABNF", STD 68, RFC 5234, 417 DOI 10.17487/RFC5234, January 2008, 418 . 420 [RFC7230] Fielding, R., Ed. and J. Reschke, Ed., "Hypertext Transfer 421 Protocol (HTTP/1.1): Message Syntax and Routing", 422 RFC 7230, DOI 10.17487/RFC7230, June 2014, 423 . 425 [RFC7231] Fielding, R., Ed. and J. Reschke, Ed., "Hypertext Transfer 426 Protocol (HTTP/1.1): Semantics and Content", RFC 7231, 427 DOI 10.17487/RFC7231, June 2014, 428 . 430 [RFC8174] Leiba, B., "Ambiguity of Uppercase vs Lowercase in RFC 431 2119 Key Words", BCP 14, RFC 8174, DOI 10.17487/RFC8174, 432 May 2017, . 434 [STRUCT-HDR] 435 Nottingham, M. and P. Kamp, "Structured Field Values for 436 HTTP", Work in Progress, Internet-Draft, draft-ietf- 437 httpbis-header-structure-19, 3 June 2020, 438 . 441 [TCP] Postel, J., "Transmission Control Protocol", STD 7, 442 RFC 793, DOI 10.17487/RFC0793, September 1981, 443 . 445 [UDP] Postel, J., "User Datagram Protocol", STD 6, RFC 768, 446 DOI 10.17487/RFC0768, August 1980, 447 . 449 Acknowledgments 451 This proposal was inspired directly or indirectly by prior work from 452 many people. The author would like to thank Eric Rescorla for 453 suggesting to use an HTTP method to proxy UDP. Thanks to Lucas 454 Pardue for their inputs on this document. 456 Author's Address 458 David Schinazi 459 Google LLC 460 1600 Amphitheatre Parkway 461 Mountain View, California 94043, 462 United States of America 464 Email: dschinazi.ietf@gmail.com