<?xml version="1.0" encoding="US-ASCII"?>
<!DOCTYPE rfc SYSTEM "rfc2629.dtd" [
<!ENTITY rfc1918 SYSTEM "http://xml.resource.org/public/rfc/bibxml/reference.RFC.1918.xml">
<!ENTITY rfc2119 SYSTEM "http://xml.resource.org/public/rfc/bibxml/reference.RFC.2119.xml">
<!ENTITY rfc4941 SYSTEM "http://xml.resource.org/public/rfc/bibxml/reference.RFC.4941.xml">
<!ENTITY return SYSTEM "http://xml.resource.org/public/rfc/bibxml3/reference.I-D.ietf-rtcweb-return.xml">
]>
<?xml-stylesheet type="text/xsl" href="rfc2629.xslt" ?>
<?rfc toc="yes" ?>
<?rfc symrefs="yes" ?>
<?rfc iprnotified="no" ?>
<?rfc strict="yes" ?>
<?rfc compact="yes" ?>
<?rfc sortrefs="yes" ?>
<?rfc colonspace="yes" ?>
<?rfc rfcedstyle="no" ?>
<?rfc tocdepth="4"?>

<rfc category="std" docName="draft-ietf-rtcweb-ip-handling-00" ipr="trust200902">
  <front>
    <title abbrev="WebRTC IP Handling">WebRTC IP Address Handling Recommendations</title>

     <author fullname="Guo-wei Shieh" initials="G." surname="Shieh">
      <organization>Google</organization>

      <address>
        <postal>
          <street>747 6th St S</street>

          <city>Kirkland</city>

          <region>WA</region>

          <code>98033</code>

          <country>USA</country>
        </postal>

        <email>guoweis@google.com</email>
      </address>
    </author>

    <author fullname="Justin Uberti" initials="J." surname="Uberti">
      <organization>Google</organization>

      <address>
        <postal>
          <street>747 6th St S</street>

          <city>Kirkland</city>

          <region>WA</region>

          <code>98033</code>

          <country>USA</country>
        </postal>

        <email>justin@uberti.name</email>
      </address>
    </author>

    <date day="20" month="March" year="2016" />

    <area>RAI</area>

    <abstract>
      <t>This document provides best practices for how
      IP addresses should be handled by WebRTC applications.</t>
    </abstract>
  </front>

  <middle>
    <section title="Introduction">
      <t>As a technology that supports peer-to-peer connections, WebRTC may send data over different network paths than the path used for HTTP traffic. This may allow a web application to learn additional information about the user, which may be problematic in certain cases. This document summarizes the concerns, and makes recommendations on how best to handle the tradeoff between privacy and media performance.</t>
    </section>

    <section title="Problem Statement">
      <t>WebRTC enables real-time peer-to-peer communications by enumerating network interfaces and discovering the best route
        through the ICE protocol. During the ICE process, the peers involved in a session gather and exchange all the IP addresses
        they can discover, so that the connectivity of each IP pair can be checked, and the best path chosen. The addresses that
        are gathered usually consist of an endpoint's private physical/virtual addresses, and its public Internet addresses.
      </t>

      <t>These addresses are exposed upwards to the web application, so that they can be communicated to the remote endpoint. This allows the application to learn more about the local network configuration than it would from a typical HTTP scenario, in which the web server would only see a single public Internet address, i.e. the address from which the HTTP request was sent.
      </t>

      <t>The information revealed falls into three categories:
        <list style="format (%d)">
          <t>If the client is behind a NAT, the client's private IP addresses, typically <xref target="RFC1918"/> addresses, can be learned.</t>
          <t>If the client tries to hide its physical location through a VPN, and the VPN and local OS supports routing over multiple interfaces, WebRTC will discover the public address associated with both the VPN as well as the ISP public address over that the VPN runs over.</t>
          <t>If the client is behind a proxy, but direct access to the Internet is also supported, WebRTC's STUN checks will bypass the proxy and reveal the public address of the client.</t>
        </list>
      </t>

      <t>Of these three concerns, #2 is the most significant concern, since for some users, the purpose of using a VPN is for anonymity. However, different VPN users will have different needs, and some VPN users (e.g. corporate VPN users) may in fact prefer WebRTC to send media traffic directly, i.e. not through the VPN.
      </t>

      <t>#3 is a less common concern, as proxy administrators can control this behavior through local firewall policy if desired, coupled with the fact that forcing WebRTC traffic through a proxy will have negative effects on both the proxy and on media quality. For situations where
      this is an important consideration, use of a RETURN proxy, as described below, can be an effective solution.
      </t>

      <t>#1 is considered to be the least significant concern, given that the local address values often contain minimal information (e.g. 192.168.0.2), or have built-in privacy protection (e.g. <xref target="RFC4941"/> IPv6 addresses).
      </t>

      <t>Note also that these concerns predate WebRTC; Adobe Flash Player has provided similar functionality since the introduction of RTMFP in 2008.
      </t>
    </section>

    <section title="Goals">
      <t>Being peer-to-peer, WebRTC represents a privacy-enabling technology, and therefore we want to avoid solutions that disable WebRTC or make it harder to use. This means that WebRTC should be configured by default to only reveal the minimum amount of information needed to establish a performant WebRTC session, while providing options to reveal additional information upon user consent, or further limit this information if the user has specifically requested this. Specifically, WebRTC should:
        <list style="symbols">
          <t>Provide a privacy-friendly default behavior which strikes the right balance between privacy and media performance for most users and use cases.</t>
          <t>For users who care more about one versus the other, provide a means to customize the experience.</t>
        </list>
      </t>
    </section>

    <section title="Detailed Design">
      <t>The main ideas for the design are the following:
        <list style="symbols">
          <t>By default, WebRTC should follow the route for HTTP traffic, when this is easy to determine (i.e. not considering proxies). This is accomplished by binding local sockets to the wildcard addresses (0.0.0.0 for IPv4, :: for IPv6), which allows the OS to route WebRTC traffic the same way as normal HTTP traffic, and allows only the 'typical' public addresses to be discovered.</t>
          <t>By default, support for host-host connections should be maintained. Even when binding to the wildcard addresses, the local IPv4 and IPv6 addresses of the interface used for outgoing STUN traffic should still be surfaced as candidates; this is necessary for certain peer-to-peer data channel apps to function correctly. The appropriate addresses here can be discovered by binding sockets to the wildcard addresses, connect()ing those sockets to a public destination (e.g. "8.8.8.8"), and then reading the bound local addresses via getsockname().</t>
          <t>WebRTC incorporates an explicit permission grant for access to local audio and video, which are typically much more sensitive than the aforementioned IP address information. If the user has consented to media access, this should also allow WebRTC to gather all possible candidates and determine the absolute best route for media traffic.</t>
          <t>Determining whether a web proxy is in use is a complex process, as the answer can depend on the exact site or address being contacted. Furthermore, web proxies that support UDP are not widely deployed today. Therefore, the only way to ensure that WebRTC traffic traverses a proxy is to force WebRTC to use ICE-TCP or TURN-over-TCP, and always try to make the TCP connection through the proxy, if one exists. Naturally, this will have attendant costs on media quality and also proxy performance.</t>
          <t>RETURN <xref target="I-D.ietf-rtcweb-return"/> is a new proposal for explicit proxying of WebRTC media traffic. When RETURN proxies are
          deployed, media and STUN checks will go through the proxy, but without the performance issues associated with sending through a web proxy.</t>
        </list>
      </t>

      <t>Based on these ideas, we define four modes of WebRTC behavior, reflecting different privacy/media tradeoffs:
        <list style="format Mode %d">
          <t>Enumerate all addresses: WebRTC will bind to all interfaces individually and use them all to ping STUN servers or peers. This will converge on the best media path, and is ideal when media performance is the highest priority, but it discloses the most information. As such, this should only be performed when the user has explicitly given consent for local media access, as indicated in design idea #3 above.</t>
          <t>Default route + the single associated local address: By binding solely to the wildcard address, media packets will flow through the same route as normal HTTP traffic. In addition, the associated private address is discovered through getsockname, as mentioned above. This ensures that direct connections can still be established even when local media access is not granted, e.g. for data channel applications.</t>
          <t>Default route only: This is the the same as Mode 2, except that the associated private address is not provided, which may cause traffic to hairpin through NAT or fall back to the application TURN server, with resulting quality implications.</t>
          <t>Force TCP and proxy: This disables any use of UDP and forces use of TCP to connect to the TURN server or peer. If a web proxy server is configured, the TCP traffic will be sent through the proxy, with resulting quality implications.</t>
        </list>
      </t>

      <t>We recommend Mode 1 as the default behavior only if cam/mic permission has been granted, or Mode 2 if this is not the case.</t>

      <t>Users who prefer Mode 3 or 4 should be able to select a preference or install an extension to force their browser to operate in the specified mode. For example, Chrome users can install the WebRTC Network Limiter extension for this configuration.
      </t>

      <t>Note that when a RETURN proxy is configured for the interface associated with the default route, Mode 2 and 3 will cause any external media traffic to go through the RETURN proxy. This provides an effective solution to the proxy concern mentioned in the problem statement, but without the performance issues associated with Mode 4.</t>
    </section>

    <section title="Application Guidance">
      <t>The recommendations mentioned in this document may cause breakage to certain WebRTC applications. In order to be robust in all scenarios, applications should follow the following guidelines:
        <list style="symbols">
          <t>Applications should deploy a TURN server with support for both UDP and TCP connections to the server. This ensures that connectivity can still be established, even when Mode 3 or 4 are in use.</t>
          <t>Applications can detect when they don't have access to the full set of ICE candidates by checking for the presence of host candidates. If no host candidates are present, Mode 3 or 4 above is in use.</t>
          <t>Future versions of browsers may present an indicator to signify that the page is using WebRTC to set up a peer-to-peer connection. Applications should be careful to only use WebRTC in a fashion that is consistent with user expectations.</t>
        </list>
      </t>
    </section>

    <section title="Security Considerations">
      <t>This document is entirely devoted to security considerations.</t>
    </section>

    <section title="IANA Considerations">
      <t>This document requires no actions from IANA.</t>
    </section>

    <section title="Acknowledgements">
      <t>Several people provided input into this document, including
      Harald Alvestrand, Ted Hardie, Matthew Kaufmann, and Eric Rescorla.</t>
    </section>
  </middle>

  <back>
    <references title="Informative References">
      &rfc1918;
      &rfc4941;
      &return;
    </references>

    <section title="Change log">
      <t>Changes in draft -00: <list style="symbols">
        <t>Published as WG draft.</t>
      </list></t>
    </section>
  </back>
</rfc>
