idnits 2.17.1 draft-schinazi-masque-connect-udp-00.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 (16 April 2020) is 1469 days in the past. Is this intentional? Checking references for intended status: Experimental ---------------------------------------------------------------------------- == Outdated reference: A later version (-10) exists of draft-ietf-quic-datagram-00 ** Obsolete normative reference: RFC 7540 (ref. 'H2') (Obsoleted by RFC 9113) == Outdated reference: A later version (-34) exists of draft-ietf-quic-http-27 == Outdated reference: A later version (-05) exists of draft-schinazi-quic-h3-datagram-03 == Outdated reference: A later version (-34) exists of draft-ietf-quic-transport-27 ** Obsolete normative reference: RFC 7230 (Obsoleted by RFC 9110, RFC 9112) ** Obsolete normative reference: RFC 7231 (Obsoleted by RFC 9110) == Outdated reference: A later version (-19) exists of draft-ietf-httpbis-header-structure-17 ** Obsolete normative reference: RFC 793 (ref. 'TCP') (Obsoleted by RFC 9293) Summary: 4 errors (**), 0 flaws (~~), 6 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: Experimental 16 April 2020 5 Expires: 18 October 2020 7 The CONNECT-UDP HTTP Method 8 draft-schinazi-masque-connect-udp-00 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/DavidSchinazi/masque-drafts. 19 Status of This Memo 21 This Internet-Draft is submitted in full conformance with the 22 provisions of BCP 78 and BCP 79. 24 Internet-Drafts are working documents of the Internet Engineering 25 Task Force (IETF). Note that other groups may also distribute 26 working documents as Internet-Drafts. The list of current Internet- 27 Drafts is at https://datatracker.ietf.org/drafts/current/. 29 Internet-Drafts are draft documents valid for a maximum of six months 30 and may be updated, replaced, or obsoleted by other documents at any 31 time. It is inappropriate to use Internet-Drafts as reference 32 material or to cite them other than as "work in progress." 34 This Internet-Draft will expire on 18 October 2020. 36 Copyright Notice 38 Copyright (c) 2020 IETF Trust and the persons identified as the 39 document authors. All rights reserved. 41 This document is subject to BCP 78 and the IETF Trust's Legal 42 Provisions Relating to IETF Documents (https://trustee.ietf.org/ 43 license-info) in effect on the date of publication of this document. 44 Please review these documents carefully, as they describe your rights 45 and restrictions with respect to this document. Code Components 46 extracted from this document must include Simplified BSD License text 47 as described in Section 4.e of the Trust Legal Provisions and are 48 provided without warranty as described in the Simplified BSD License. 50 Table of Contents 52 1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . 2 53 1.1. Conventions and Definitions . . . . . . . . . . . . . . . 2 54 2. Supported HTTP Versions . . . . . . . . . . . . . . . . . . . 2 55 3. The CONNECT-UDP Method . . . . . . . . . . . . . . . . . . . 3 56 4. Encoding of Proxied UDP Packets . . . . . . . . . . . . . . . 4 57 5. Datagram-Flow-Id Header Definition . . . . . . . . . . . . . 5 58 6. Server Handling . . . . . . . . . . . . . . . . . . . . . . . 5 59 7. Security Considerations . . . . . . . . . . . . . . . . . . . 5 60 8. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 5 61 8.1. HTTP Method . . . . . . . . . . . . . . . . . . . . . . . 5 62 8.2. HTTP Header . . . . . . . . . . . . . . . . . . . . . . . 6 63 9. Normative References . . . . . . . . . . . . . . . . . . . . 6 64 Acknowledgments . . . . . . . . . . . . . . . . . . . . . . . . . 7 65 Author's Address . . . . . . . . . . . . . . . . . . . . . . . . 7 67 1. Introduction 69 This document describes the CONNECT-UDP HTTP method. CONNECT-UDP is 70 similar to the HTTP CONNECT method (see section 4.3.6 of [RFC7231]), 71 but it uses UDP [UDP] instead of TCP [TCP]. 73 Discussion of this work is encouraged to happen on the MASQUE IETF 74 mailing list masque@ietf.org or on the GitHub repository which 75 contains the draft: https://github.com/DavidSchinazi/masque-drafts. 77 1.1. Conventions and Definitions 79 The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", 80 "SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED", "MAY", and 81 "OPTIONAL" in this document are to be interpreted as described in BCP 82 14 [RFC2119] [RFC8174] when, and only when, they appear in all 83 capitals, as shown here. 85 2. Supported HTTP Versions 87 The CONNECT-UDP method is defined for all versions of HTTP. When the 88 HTTP version used runs over QUIC [QUIC], UDP payloads can be sent 89 over QUIC DATAGRAM frames [DGRAM]. Otherwise they are sent on the 90 stream where the CONNECT-UDP request was made. Note that when 91 multiple proxies are involved in a CONNECT-UDP request, all the HTTP 92 connections along the path need to be using HTTP/3 [H3] or later in 93 order for UDP payloads to be sent over QUIC DATAGRAM frames. 94 Additionally, when the HTTP version in use does not support 95 multiplexing streams (such as HTTP/1.1), then any reference to 96 "stream" in this document is meant to represent the entire 97 connection. 99 3. The CONNECT-UDP Method 101 The CONNECT-UDP method requests that the recipient establish a tunnel 102 over a single HTTP stream to the destination origin server identified 103 by the request-target and, if successful, thereafter restrict its 104 behavior to blind forwarding of packets, in both directions, until 105 the tunnel is closed. Tunnels are commonly used to create an end-to- 106 end virtual connection, through one or more proxies, which can then 107 be secured using QUIC or another protocol running over UDP. 109 A client sending a CONNECT-UDP request MUST send the authority form 110 of request-target (Section 5.3 of [RFC7230]); i.e., the request- 111 target consists of only the host name and port number of the tunnel 112 destination, separated by a colon. For example, 114 CONNECT-UDP server.example.com:443 HTTP/1.1 115 Host: server.example.com:443 117 When using HTTP/2 [H2] or later, CONNECT-UDP requests use HTTP 118 pseudo-headers with the following requirements: 120 * The ":method" pseudo-header field is set to "CONNECT-UDP". 122 * The ":scheme" and ":path" pseudo-header fields MUST be omitted. 124 * The ":authority" pseudo-header field contains the host and port to 125 connect to (equivalent to the authority-form of the request-target 126 of CONNECT-UDP requests (see [RFC7230], Section 5.3)). 128 A CONNECT-UDP request that does not conform to these restrictions is 129 malformed (see [H2], Section 8.1.2.6). 131 The recipient proxy can establish a tunnel either by directly opening 132 a UDP socket to the request-target or, if configured to use another 133 proxy, by forwarding the CONNECT-UDP request to the next inbound 134 proxy. Any 2xx (Successful) response indicates that the sender (and 135 all inbound proxies) will switch to tunnel mode immediately after the 136 blank line that concludes the successful response's header section; 137 data received after that blank line is from the server identified by 138 the request-target. Any response other than a successful response 139 indicates that the tunnel has not yet been formed and that the 140 connection remains governed by HTTP. 142 A tunnel is closed when a tunnel intermediary detects that either 143 side has closed its connection: the intermediary MUST attempt to send 144 any outstanding data that came from the closed side to the other 145 side, close both connections, and then discard any remaining data 146 left undelivered. 148 A server MUST NOT send any Transfer-Encoding or Content-Length header 149 fields in a 2xx (Successful) response to CONNECT. A client MUST 150 treat a response to CONNECT-UDP containing any Content-Length or 151 Transfer-Encoding header fields as malformed. 153 A payload within a CONNECT-UDP request message has no defined 154 semantics; a CONNECT-UDP request with a non-empty payload is 155 malformed. 157 Responses to the CONNECT-UDP method are not cacheable. 159 4. Encoding of Proxied UDP Packets 161 When the HTTP connection between client and proxy supports HTTP/3 162 datagrams [H3DGRAM], UDP packets can be encoded using QUIC DATAGRAM 163 frames. This support is ascertained by checking receipt of the 164 H3_DATAGRAM SETTINGS Parameter. Note that when there are multiple 165 proxies involved, this support needs to be ascertained on all the 166 HTTP connections that will carry proxied UDP packets. 168 If the client supports HTTP/3 datagrams and has received the 169 H3_DATAGRAM SETTINGS Parameter on this connection, it SHOULD attempt 170 to use HTTP/3 datagrams. This is accomplished by requesting a 171 datagram flow identifier from the flow identifier allocation service 172 [H3DGRAM]. That service generates an even flow identifier, and the 173 client sends it to the server by using the "Datagram-Flow-Id" header 174 (see Section 5). 176 If there are multiple proxies involved, proxies along the chain MUST 177 check whether their upstream connection supports HTTP/3 datagrams. 178 If it does not, that proxy MUST remove the "Datagram-Flow-Id" header 179 before forwarding the CONNECT-UDP request. 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 MUST 183 echo the "Datagram-Flow-Id" header. Once the client has received the 184 "Datagram-Flow-Id" header on the successful response, it knows that 185 it can use the HTTP/3 datagram encoding to send proxied UDP packets 186 for this particular destination. It then encodes the payload of UDP 187 datagrams into the payload of HTTP/3 datagrams. 189 Clients MAY optimistically start sending proxied UDP packets before 190 receiving the response to its CONNECT-UDP request, noting however 191 that those may not be processed by the proxy if it responds to the 192 CONNECT-UDP request with a failure, or if they arrive before the 193 CONNECT-UDP request. 195 If HTTP/3 datagrams are not supported, the stream is used to convey 196 UDP payloads, by prefixing them with a 16-bit length. 198 5. Datagram-Flow-Id Header Definition 200 "Datagram-Flow-Id" is a Item Structured Header [STRUCT-HDR]. Its 201 value MUST be an Integer. Its ABNF is: 203 Datagram-Flow-Id = sh-integer 205 6. Server Handling 207 Unlike TCP, UDP is connection-less. The HTTP server that opens the 208 UDP socket has no way of knowing whether the destination is 209 reachable. Therefore it needs to respond to the CONNECT-UDP request 210 without waiting for a TCP SYN-ACK. 212 Servers can use connected UDP sockets if their operating system 213 supports them, as that allows the HTTP server to rely on the kernel 214 to only send it UDP packets that match the correct 5-tuple. If the 215 server uses a non-connected socket, it MUST validate the IP source 216 address and UDP source port on received packets to ensure they match 217 the client's CONNECT-UDP request. Packets that do not match MUST be 218 discarded by the server. 220 7. Security Considerations 222 There are significant risks in allowing arbitrary clients to 223 establish a tunnel to arbitrary servers, as that could allow bad 224 actors to send traffic and have it attributed to the proxy. Proxies 225 that support CONNECT-UDP SHOULD restrict its use to authenticated 226 users. 228 8. IANA Considerations 230 8.1. HTTP Method 232 This document will request IANA to register "CONNECT-UDP" in the HTTP 233 Method Registry (IETF review) maintained at 234 . 236 +-------------+------+------------+---------------+ 237 | Method Name | Safe | Idempotent | Reference | 238 +-------------+------+------------+---------------+ 239 | CONNECT-UDP | no | no | This document | 240 +-------------+------+------------+---------------+ 242 8.2. HTTP Header 244 This document will request IANA to register the "Datagram-Flow-Id" 245 header in the "Permanent Message Header Field Names" registry 246 maintained at . 248 +-------------------+----------+--------+---------------+ 249 | Header Field Name | Protocol | Status | Reference | 250 +-------------------+----------+--------+---------------+ 251 | Datagram-Flow-Id | http | exp | This document | 252 +-------------------+----------+--------+---------------+ 254 9. Normative References 256 [DGRAM] Pauly, T., Kinnear, E., and D. Schinazi, "An Unreliable 257 Datagram Extension to QUIC", Work in Progress, Internet- 258 Draft, draft-ietf-quic-datagram-00, 26 February 2020, 259 . 262 [H2] Belshe, M., Peon, R., and M. Thomson, Ed., "Hypertext 263 Transfer Protocol Version 2 (HTTP/2)", RFC 7540, 264 DOI 10.17487/RFC7540, May 2015, 265 . 267 [H3] Bishop, M., "Hypertext Transfer Protocol Version 3 268 (HTTP/3)", Work in Progress, Internet-Draft, draft-ietf- 269 quic-http-27, 21 February 2020, . 272 [H3DGRAM] Schinazi, D., "Using QUIC Datagrams with HTTP/3", Work in 273 Progress, Internet-Draft, draft-schinazi-quic-h3-datagram- 274 03, 12 March 2020, . 277 [QUIC] Iyengar, J. and M. Thomson, "QUIC: A UDP-Based Multiplexed 278 and Secure Transport", Work in Progress, Internet-Draft, 279 draft-ietf-quic-transport-27, 21 February 2020, 280 . 283 [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate 284 Requirement Levels", BCP 14, RFC 2119, 285 DOI 10.17487/RFC2119, March 1997, 286 . 288 [RFC7230] Fielding, R., Ed. and J. Reschke, Ed., "Hypertext Transfer 289 Protocol (HTTP/1.1): Message Syntax and Routing", 290 RFC 7230, DOI 10.17487/RFC7230, June 2014, 291 . 293 [RFC7231] Fielding, R., Ed. and J. Reschke, Ed., "Hypertext Transfer 294 Protocol (HTTP/1.1): Semantics and Content", RFC 7231, 295 DOI 10.17487/RFC7231, June 2014, 296 . 298 [RFC8174] Leiba, B., "Ambiguity of Uppercase vs Lowercase in RFC 299 2119 Key Words", BCP 14, RFC 8174, DOI 10.17487/RFC8174, 300 May 2017, . 302 [STRUCT-HDR] 303 Nottingham, M. and P. Kamp, "Structured Field Values for 304 HTTP", Work in Progress, Internet-Draft, draft-ietf- 305 httpbis-header-structure-17, 15 March 2020, 306 . 309 [TCP] Postel, J., "Transmission Control Protocol", STD 7, 310 RFC 793, DOI 10.17487/RFC0793, September 1981, 311 . 313 [UDP] Postel, J., "User Datagram Protocol", STD 6, RFC 768, 314 DOI 10.17487/RFC0768, August 1980, 315 . 317 Acknowledgments 319 This proposal was inspired directly or indirectly by prior work from 320 many people. The author would like to thank Eric Rescorla for 321 suggesting to use an HTTP method to proxy UDP. 323 Author's Address 325 David Schinazi 326 Google LLC 327 1600 Amphitheatre Parkway 328 Mountain View, California 94043, 329 United States of America 331 Email: dschinazi.ietf@gmail.com