<?xml version="1.0" encoding="UTF-8"?>
<!--
    This XML document is the output of clean-for-DTD.xslt; a tool that strips
    extensions to RFC2629(bis) from documents for processing with xml2rfc.
-->
<?xml-stylesheet type="text/xsl" href="rfc2629.xslt" ?><!-- generated by https://github.com/cabo/kramdown-rfc2629 version 1.0.36 -->
<?rfc toc="yes"?>
<?rfc tocindent="yes"?>
<?rfc sortrefs="yes"?>
<?rfc symrefs="yes"?>
<?rfc strict="yes"?>
<?rfc compact="yes"?>
<?rfc comments="yes"?>
<?rfc inline="yes"?>
<!DOCTYPE rfc
  SYSTEM "rfc2629.dtd">
<rfc ipr="trust200902" docName="draft-ietf-httpbis-http2-encryption-07" category="exp" obsoletes="" updates="" submissionType="IETF"><front><title abbrev="Opportunistic HTTP Security">Opportunistic Security for HTTP</title><author initials="M." surname="Nottingham" fullname="Mark Nottingham"><organization/><address><email>mnot@mnot.net</email><uri>https://www.mnot.net/</uri></address></author><author initials="M." surname="Thomson" fullname="Martin Thomson"><organization>Mozilla</organization><address><email>martin.thomson@gmail.com</email></address></author><date year="2016"/><area>Applications and Real-Time</area><workgroup>HTTP Working Group</workgroup><keyword>Internet-Draft</keyword><abstract><t>This document describes how <spanx style="verb" xml:space="preserve">http</spanx> URIs can be accessed using Transport Layer Security (TLS) to
mitigate pervasive monitoring attacks.</t></abstract><note title="Note to Readers"><t>Discussion of this draft takes place on the HTTP working group mailing list (ietf-http-wg@w3.org),
which is archived at <eref target="https://lists.w3.org/Archives/Public/ietf-http-wg/">https://lists.w3.org/Archives/Public/ietf-http-wg/</eref>.</t><t>Working Group information can be found at <eref target="http://httpwg.github.io/">http://httpwg.github.io/</eref>; source code and issues list
for this draft can be found at <eref target="https://github.com/httpwg/http-extensions/labels/opp-sec">https://github.com/httpwg/http-extensions/labels/opp-sec</eref>.</t></note></front><middle><section anchor="introduction" toc="default" title="Introduction"><t>This document describes a use of HTTP Alternative Services <xref target="RFC7838" format="default"/> to decouple
the URI scheme from the use and configuration of underlying encryption, allowing a <spanx style="verb" xml:space="preserve">http</spanx> URI
<xref target="RFC7230" format="default"/> to be accessed using Transport Layer Security (TLS) <xref target="RFC5246" format="default"/> opportunistically.</t><t>Serving <spanx style="verb" xml:space="preserve">https</spanx> URIs requires avoiding Mixed Content <xref target="W3C.CR-mixed-content-20160802" format="default"/>, which is
problematic in many deployments. This document describes a usage model whereby sites can serve
<spanx style="verb" xml:space="preserve">http</spanx> URIs over TLS, thereby avoiding these issues, while still providing protection against
passive attacks.</t><t>Opportunistic Security <xref target="RFC7435" format="default"/> does not provide the same guarantees as using TLS with <spanx style="verb" xml:space="preserve">https</spanx>
URIs; it is vulnerable to active attacks, and does not change the security context of the
connection. Normally, users will not be able to tell that it is in use (i.e., there will be no
“lock icon”).</t><section anchor="goals-and-non-goals" toc="default" title="Goals and Non-Goals"><t>The immediate goal is to make the use of HTTP more robust in the face of pervasive passive
monitoring <xref target="RFC7258" format="default"/>.</t><t>A secondary (but significant) goal is to provide for ease of implementation, deployment and
operation. This mechanism is expected to have a minimal impact upon performance, and require a
trivial administrative effort to configure.</t><t>Preventing active attacks (such as a Man-in-the-Middle) is a non-goal for this specification.
Furthermore, this specification is not intended to replace or offer an alternative to <spanx style="verb" xml:space="preserve">https</spanx>,
since it both prevents active attacks and invokes a more stringent security model in most clients.</t></section><section anchor="notational-conventions" toc="default" title="Notational Conventions"><t>The key words “MUST”, “MUST NOT”, “REQUIRED”, “SHALL”, “SHALL NOT”, “SHOULD”, “SHOULD NOT”,
“RECOMMENDED”, “MAY”, and “OPTIONAL” in this document are to be interpreted as described in
<xref target="RFC2119" format="default"/>.</t></section></section><section anchor="using-http-uris-over-tls" toc="default" title="Using HTTP URIs over TLS"><t>An origin server that supports the resolution of <spanx style="verb" xml:space="preserve">http</spanx> URIs can indicate support for this
specification by providing an alternative service advertisement <xref target="RFC7838" format="default"/> for a protocol
identifier that uses TLS, such as <spanx style="verb" xml:space="preserve">h2</spanx> <xref target="RFC7540" format="default"/>.</t><t>A client that receives such an advertisement MAY make future requests intended for the associated
origin (<xref target="RFC6454" format="default"/>) to the identified service (as specified by <xref target="RFC7838" format="default"/>), provided that the alternative service opts in as described in <xref target="auth" format="default"/>.</t><t>A client that places the importance of protection against passive attacks over performance might
choose to withhold requests until an encrypted connection is available. However, if such a
connection cannot be successfully established, the client can resume its use of the cleartext
connection.</t><t>A client can also explicitly probe for an alternative service advertisement by sending a request
that bears little or no sensitive information, such as one with the OPTIONS method. Likewise,
clients with existing alternative services information could make such a request before they expire,
in order minimize the delays that might be incurred.</t><t>Client certificates are not meaningful for URLs with the <spanx style="verb" xml:space="preserve">http</spanx> scheme, and therefore clients
creating new TLS connections to alternative services for the purposes of this specification MUST
NOT present them. Established connections with client certificates MAY be reused, however.</t><section anchor="auth" toc="default" title="Alternative Server Opt-In"><t>It is possible that the server might become confused about whether requests’ URLs have a <spanx style="verb" xml:space="preserve">http</spanx> or
<spanx style="verb" xml:space="preserve">https</spanx> scheme, for various reasons; see <xref target="confuse" format="default"/>. To ensure that the alternative service has
opted into serving <spanx style="verb" xml:space="preserve">http</spanx> URLs over TLS, clients are required to perform additional checks before
directing <spanx style="verb" xml:space="preserve">http</spanx> requests to it.</t><t>Clients MUST NOT send <spanx style="verb" xml:space="preserve">http</spanx> requests over a connection with the <spanx style="verb" xml:space="preserve">h2</spanx> protocol identifier, unless
they have obtained a valid http-opportunistic response for an origin (as per <xref target="well-known" format="default"/>), and:</t><t><list style="symbols"><t>The chosen alternative service presents a certificate that is valid for the origin, as per
<xref target="RFC2818" format="default"/> (this also establishes “reasonable assurances” for the purposes of {RFC7838}}), and</t><t>The origin object of the http-opportunistic response has a `tls-ports’ member, whose value is an
array of numbers, one of which matches the port of the alternative service in question, and</t><t>The chosen alternative service returns the same representation as the origin did for the
http-opportunistic resource.</t></list></t><t>For example, this request/response pair would allow reqeusts for the origin
“http://www.example.com” to be sent to an alternative service on port 443 or 8000 of the host
“www.example.com”:</t><figure suppress-title="false" align="left" alt="" width="" height=""><artwork type="example" xml:space="preserve" name="" align="left" alt="" width="" height=""><![CDATA[

GET /.well-known/http-opportunistic HTTP/1.1
Host: www.example.com

HTTP/1.1 200 OK
Content-Type: application/json
Connection: close

{
  "http://www.example.com": {
    "tls-ports": [443, 8000],
    "lifetime": 2592000
  }
}
]]></artwork></figure></section><section anchor="interaction-with-https-uris" toc="default" title="Interaction with “https” URIs"><t>When using alternative services, requests for resources identified by both <spanx style="verb" xml:space="preserve">http</spanx> and <spanx style="verb" xml:space="preserve">https</spanx> URIs
might use the same connection, because HTTP/2 permits requests for multiple origins on the same
connection.</t><t>Because of the risk of server confusion about individual requests’ schemes (see <xref target="confuse" format="default"/>),
clients MUST NOT send <spanx style="verb" xml:space="preserve">http</spanx> requests on a connection that has previously been used for <spanx style="verb" xml:space="preserve">https</spanx>
requests, unless the http-opportunistic origin object <xref target="well-known" format="default"/> fetched over that connection
has a “mixed-scheme” member whose value is “true”.</t></section><section anchor="well-known" toc="default" title="The “http-opportunistic” well-known URI"><t>This specification defines the “http-opportunistic” well-known URI <xref target="RFC5785" format="default"/>. A client is said
to have a valid http-opportunistic response for a given origin when:</t><t><list style="symbols"><t>The client has obtained a 200 (OK) response for the well-known URI from the origin, and it is
fresh <xref target="RFC7234" format="default"/> (potentially through revalidation <xref target="RFC7232" format="default"/>), and</t><t>That response has the media type “application/json”, and</t><t>That response’s payload, when parsed as JSON <xref target="RFC7159" format="default"/>, contains an object as the root, and</t><t>The root object contains a member whose name is a case-insensitive
character-for-character match for the origin in question, serialised into Unicode as per Section
6.1 of <xref target="RFC6454" format="default"/>, and whose value is an object (hereafter, the “origin object”),</t><t>The origin object has a “lifetime” member, whose value is a number indicating the number of
seconds which the origin object is valid for (hereafter, the “origin object lifetime”), and</t><t>The origin object lifetime is greater than the <spanx style="verb" xml:space="preserve">current_age</spanx> (as per <xref target="RFC7234" format="default"/>, Section 4.2.3).</t></list></t><t>Note that origin object lifetime might differ from the freshness lifetime of the response.</t></section></section><section anchor="iana-considerations" toc="default" title="IANA Considerations"><t>This specification registers a Well-Known URI <xref target="RFC5785" format="default"/>:</t><t><list style="symbols"><t>URI Suffix: http-opportunistic</t><t>Change Controller: IETF</t><t>Specification Document(s): <xref target="well-known" format="default"/> of [this specification]</t><t>Related Information:</t></list></t></section><section anchor="security" toc="default" title="Security Considerations"><section anchor="security-indicators" toc="default" title="Security Indicators"><t>User Agents MUST NOT provide any special security indicia when an <spanx style="verb" xml:space="preserve">http</spanx> resource is acquired using
TLS. In particular, indicators that might suggest the same level of security as <spanx style="verb" xml:space="preserve">https</spanx> MUST NOT be
used (e.g.,  a “lock device”).</t></section><section anchor="downgrade" toc="default" title="Downgrade Attacks"><t>A downgrade attack against the negotiation for TLS is possible.</t><t>For example, because the <spanx style="verb" xml:space="preserve">Alt-Svc</spanx> header field <xref target="RFC7838" format="default"/> likely appears in an unauthenticated
and unencrypted channel, it is subject to downgrade by network attackers. In its simplest form, an
attacker that wants the connection to remain in the clear need only strip the <spanx style="verb" xml:space="preserve">Alt-Svc</spanx> header
field from responses.</t></section><section anchor="privacy" toc="default" title="Privacy Considerations"><t>Cached alternative services can be used to track clients over time; e.g., using a user-specific
hostname. Clearing the cache reduces the ability of servers to track clients; therefore clients
MUST clear cached alternative service information when clearing other origin-based state (i.e.,
cookies).</t></section><section anchor="confuse" toc="default" title="Confusion Regarding Request Scheme"><t>HTTP implementations and applications sometimes use ambient signals to determine if a request is
for an <spanx style="verb" xml:space="preserve">https</spanx> resource; for example, they might look for TLS on the stack, or a server port number
of 443.</t><t>This might be due to limitations in the protocol (the most common HTTP/1.1 request form does
not carry an explicit indication of the URI scheme), or it may be because how the server and
application are implemented (often, they are two separate entities, with a variety of possible
interfaces between them).</t><t>Any security decisions based upon this information could be misled by the deployment of this
specification, because it violates the assumption that the use of TLS (or port 443) means that the
client is accessing a HTTPS URI, and operating in the security context implied by HTTPS.</t><t>Therefore, servers need to carefully examine the use of such signals before deploying this
specification.</t></section><section anchor="server-controls" toc="default" title="Server Controls"><t>This specification requires that a server send both an Alternative Service advertisement and host
content in a well-known location to send HTTP requests over TLS. Servers SHOULD take suitable
measures to ensure that the content of the well-known resource remains under their control.
Likewise, because the Alt-Svc header field is used to describe policies across an entire origin,
servers SHOULD NOT permit user content to set or modify the value of this header.</t></section></section></middle><back><references title="Normative References"><reference anchor="RFC2119" target="http://www.rfc-editor.org/info/rfc2119"><front><title>Key words for use in RFCs to Indicate Requirement Levels</title><author initials="S." surname="Bradner" fullname="S. Bradner"><organization/></author><date year="1997" month="March"/><abstract><t>In many standards track documents several words are used to signify the requirements in the specification.  These words are often capitalized. This document defines these words as they should be interpreted in IETF documents.  This document specifies an Internet Best Current Practices for the Internet Community, and requests discussion and suggestions for improvements.</t></abstract></front><seriesInfo name="BCP" value="14"/><seriesInfo name="RFC" value="2119"/><seriesInfo name="DOI" value="10.17487/RFC2119"/></reference><reference anchor="RFC2818" target="http://www.rfc-editor.org/info/rfc2818"><front><title>HTTP Over TLS</title><author initials="E." surname="Rescorla" fullname="E. Rescorla"><organization/></author><date year="2000" month="May"/><abstract><t>This memo describes how to use Transport Layer Security (TLS) to secure Hypertext Transfer Protocol (HTTP) connections over the Internet.  This memo provides information for the Internet community.</t></abstract></front><seriesInfo name="RFC" value="2818"/><seriesInfo name="DOI" value="10.17487/RFC2818"/></reference><reference anchor="RFC5246" target="http://www.rfc-editor.org/info/rfc5246"><front><title>The Transport Layer Security (TLS) Protocol Version 1.2</title><author initials="T." surname="Dierks" fullname="T. Dierks"><organization/></author><author initials="E." surname="Rescorla" fullname="E. Rescorla"><organization/></author><date year="2008" month="August"/><abstract><t>This document specifies Version 1.2 of the Transport Layer Security (TLS) protocol.  The TLS protocol provides communications security over the Internet.  The protocol allows client/server applications to communicate in a way that is designed to prevent eavesdropping, tampering, or message forgery.  [STANDARDS-TRACK]</t></abstract></front><seriesInfo name="RFC" value="5246"/><seriesInfo name="DOI" value="10.17487/RFC5246"/></reference><reference anchor="RFC5785" target="http://www.rfc-editor.org/info/rfc5785"><front><title>Defining Well-Known Uniform Resource Identifiers (URIs)</title><author initials="M." surname="Nottingham" fullname="M. Nottingham"><organization/></author><author initials="E." surname="Hammer-Lahav" fullname="E. Hammer-Lahav"><organization/></author><date year="2010" month="April"/><abstract><t>This memo defines a path prefix for "well-known locations", "/.well-known/", in selected Uniform Resource Identifier (URI) schemes.   [STANDARDS-TRACK]</t></abstract></front><seriesInfo name="RFC" value="5785"/><seriesInfo name="DOI" value="10.17487/RFC5785"/></reference><reference anchor="RFC6454" target="http://www.rfc-editor.org/info/rfc6454"><front><title>The Web Origin Concept</title><author initials="A." surname="Barth" fullname="A. Barth"><organization/></author><date year="2011" month="December"/><abstract><t>This document defines the concept of an "origin", which is often used as the scope of authority or privilege by user agents.  Typically, user agents isolate content retrieved from different origins to prevent malicious web site operators from interfering with the operation of benign web sites.  In addition to outlining the principles that underlie the concept of origin, this document details how to determine the origin of a URI and how to serialize an origin into a string.  It also defines an HTTP header field, named "Origin", that indicates which origins are associated with an HTTP request.   [STANDARDS-TRACK]</t></abstract></front><seriesInfo name="RFC" value="6454"/><seriesInfo name="DOI" value="10.17487/RFC6454"/></reference><reference anchor="RFC7159" target="http://www.rfc-editor.org/info/rfc7159"><front><title>The JavaScript Object Notation (JSON) Data Interchange Format</title><author initials="T." surname="Bray" fullname="T. Bray" role="editor"><organization/></author><date year="2014" month="March"/><abstract><t>JavaScript Object Notation (JSON) is a lightweight, text-based, language-independent data interchange format.  It was derived from the ECMAScript Programming Language Standard.  JSON defines a small set of formatting rules for the portable representation of structured data.</t><t>This document removes inconsistencies with other specifications of JSON, repairs specification errors, and offers experience-based interoperability guidance.</t></abstract></front><seriesInfo name="RFC" value="7159"/><seriesInfo name="DOI" value="10.17487/RFC7159"/></reference><reference anchor="RFC7230" target="http://www.rfc-editor.org/info/rfc7230"><front><title>Hypertext Transfer Protocol (HTTP/1.1): Message Syntax and Routing</title><author initials="R." surname="Fielding" fullname="R. Fielding" role="editor"><organization/></author><author initials="J." surname="Reschke" fullname="J. Reschke" role="editor"><organization/></author><date year="2014" month="June"/><abstract><t>The Hypertext Transfer Protocol (HTTP) is a stateless application-level protocol for distributed, collaborative, hypertext information systems.  This document provides an overview of HTTP architecture and its associated terminology, defines the "http" and "https" Uniform Resource Identifier (URI) schemes, defines the HTTP/1.1 message syntax and parsing requirements, and describes related security concerns for implementations.</t></abstract></front><seriesInfo name="RFC" value="7230"/><seriesInfo name="DOI" value="10.17487/RFC7230"/></reference><reference anchor="RFC7232" target="http://www.rfc-editor.org/info/rfc7232"><front><title>Hypertext Transfer Protocol (HTTP/1.1): Conditional Requests</title><author initials="R." surname="Fielding" fullname="R. Fielding" role="editor"><organization/></author><author initials="J." surname="Reschke" fullname="J. Reschke" role="editor"><organization/></author><date year="2014" month="June"/><abstract><t>The Hypertext Transfer Protocol (HTTP) is a stateless application- level protocol for distributed, collaborative, hypertext information systems.  This document defines HTTP/1.1 conditional requests, including metadata header fields for indicating state changes, request header fields for making preconditions on such state, and rules for constructing the responses to a conditional request when one or more preconditions evaluate to false.</t></abstract></front><seriesInfo name="RFC" value="7232"/><seriesInfo name="DOI" value="10.17487/RFC7232"/></reference><reference anchor="RFC7234" target="http://www.rfc-editor.org/info/rfc7234"><front><title>Hypertext Transfer Protocol (HTTP/1.1): Caching</title><author initials="R." surname="Fielding" fullname="R. Fielding" role="editor"><organization/></author><author initials="M." surname="Nottingham" fullname="M. Nottingham" role="editor"><organization/></author><author initials="J." surname="Reschke" fullname="J. Reschke" role="editor"><organization/></author><date year="2014" month="June"/><abstract><t>The Hypertext Transfer Protocol (HTTP) is a stateless \%application- level protocol for distributed, collaborative, hypertext information systems.  This document defines HTTP caches and the associated header fields that control cache behavior or indicate cacheable response messages.</t></abstract></front><seriesInfo name="RFC" value="7234"/><seriesInfo name="DOI" value="10.17487/RFC7234"/></reference><reference anchor="RFC7540" target="http://www.rfc-editor.org/info/rfc7540"><front><title>Hypertext Transfer Protocol Version 2 (HTTP/2)</title><author initials="M." surname="Belshe" fullname="M. Belshe"><organization/></author><author initials="R." surname="Peon" fullname="R. Peon"><organization/></author><author initials="M." surname="Thomson" fullname="M. Thomson" role="editor"><organization/></author><date year="2015" month="May"/><abstract><t>This specification describes an optimized expression of the semantics of the Hypertext Transfer Protocol (HTTP), referred to as HTTP version 2 (HTTP/2).  HTTP/2 enables a more efficient use of network resources and a reduced perception of latency by introducing header field compression and allowing multiple concurrent exchanges on the same connection.  It also introduces unsolicited push of representations from servers to clients.</t><t>This specification is an alternative to, but does not obsolete, the HTTP/1.1 message syntax.  HTTP's existing semantics remain unchanged.</t></abstract></front><seriesInfo name="RFC" value="7540"/><seriesInfo name="DOI" value="10.17487/RFC7540"/></reference><reference anchor="RFC7838" target="http://www.rfc-editor.org/info/rfc7838"><front><title>HTTP Alternative Services</title><author initials="M." surname="Nottingham" fullname="M. Nottingham"><organization/></author><author initials="P." surname="McManus" fullname="P. McManus"><organization/></author><author initials="J." surname="Reschke" fullname="J. Reschke"><organization/></author><date year="2016" month="April"/><abstract><t>This document specifies "Alternative Services" for HTTP, which allow an origin's resources to be authoritatively available at a separate network location, possibly accessed with a different protocol configuration.</t></abstract></front><seriesInfo name="RFC" value="7838"/><seriesInfo name="DOI" value="10.17487/RFC7838"/></reference></references><references title="Informative References"><reference anchor="RFC7258" target="http://www.rfc-editor.org/info/rfc7258"><front><title>Pervasive Monitoring Is an Attack</title><author initials="S." surname="Farrell" fullname="S. Farrell"><organization/></author><author initials="H." surname="Tschofenig" fullname="H. Tschofenig"><organization/></author><date year="2014" month="May"/><abstract><t>Pervasive monitoring is a technical attack that should be mitigated in the design of IETF protocols, where possible.</t></abstract></front><seriesInfo name="BCP" value="188"/><seriesInfo name="RFC" value="7258"/><seriesInfo name="DOI" value="10.17487/RFC7258"/></reference><reference anchor="RFC7435" target="http://www.rfc-editor.org/info/rfc7435"><front><title>Opportunistic Security: Some Protection Most of the Time</title><author initials="V." surname="Dukhovni" fullname="V. Dukhovni"><organization/></author><date year="2014" month="December"/><abstract><t>This document defines the concept "Opportunistic Security" in the context of communications protocols.  Protocol designs based on Opportunistic Security use encryption even when authentication is not available, and use authentication when possible, thereby removing barriers to the widespread use of encryption on the Internet.</t></abstract></front><seriesInfo name="RFC" value="7435"/><seriesInfo name="DOI" value="10.17487/RFC7435"/></reference><reference anchor="RFC7469" target="http://www.rfc-editor.org/info/rfc7469"><front><title>Public Key Pinning Extension for HTTP</title><author initials="C." surname="Evans" fullname="C. Evans"><organization/></author><author initials="C." surname="Palmer" fullname="C. Palmer"><organization/></author><author initials="R." surname="Sleevi" fullname="R. Sleevi"><organization/></author><date year="2015" month="April"/><abstract><t>This document defines a new HTTP header that allows web host operators to instruct user agents to remember ("pin") the hosts' cryptographic identities over a period of time.  During that time, user agents (UAs) will require that the host presents a certificate chain including at least one Subject Public Key Info structure whose fingerprint matches one of the pinned fingerprints for that host.  By effectively reducing the number of trusted authorities who can authenticate the domain during the lifetime of the pin, pinning may reduce the incidence of man-in-the-middle attacks due to compromised Certification Authorities.</t></abstract></front><seriesInfo name="RFC" value="7469"/><seriesInfo name="DOI" value="10.17487/RFC7469"/></reference><reference anchor="W3C.CR-mixed-content-20160802" target="https://www.w3.org/TR/2016/CR-mixed-content-20160802"><front><title>Mixed Content</title><author initials="M." surname="West" fullname="Mike West"><organization/></author><date month="August" day="2" year="2016"/></front><seriesInfo name="World Wide Web Consortium CR" value="CR-mixed-content-20160802"/><format type="HTML" target="https://www.w3.org/TR/2016/CR-mixed-content-20160802"/></reference></references><section anchor="acknowledgements" toc="default" title="Acknowledgements"><t>Mike Bishop contributed significant text to this document.</t><t>Thanks to Patrick McManus, Stefan Eissing, Eliot Lear, Stephen Farrell, Guy Podjarny, Stephen Ludin,
Erik Nygren, Paul Hoffman, Adam Langley, Eric Rescorla, Julian Reschke, Kari Hurtta, and Richard
Barnes for their feedback and suggestions.</t></section></back></rfc>
