<?xml version="1.0" encoding="US-ASCII"?>

<!DOCTYPE rfc SYSTEM "rfc2629.dtd" [
<!ENTITY RFC2119 SYSTEM "http://xml.resource.org/public/rfc/bibxml/reference.RFC.2119.xml">
<!ENTITY RFC2616 SYSTEM "http://xml.resource.org/public/rfc/bibxml/reference.RFC.2616.xml">
<!ENTITY RFC2617 SYSTEM "http://xml.resource.org/public/rfc/bibxml/reference.RFC.2617.xml">
<!ENTITY RFC5849 SYSTEM "http://xml.resource.org/public/rfc/bibxml/reference.RFC.5849.xml">
<!ENTITY RFC5988 SYSTEM "http://xml.resource.org/public/rfc/bibxml/reference.RFC.5988.xml">
<!ENTITY RFC6415 SYSTEM "http://xml.resource.org/public/rfc/bibxml/reference.RFC.6415.xml">
<!ENTITY WEBFINGER SYSTEM "http://xml.resource.org/public/rfc/bibxml3/reference.I-D.draft-jones-appsawg-webfinger-06.xml">
<!ENTITY AUTHSCHEME SYSTEM "http://xml.resource.org/public/rfc/bibxml3/reference.I-D.draft-ietf-httpbis-p7-auth-20.xml">
]>

<?xml-stylesheet type='text/xsl' href='rfc2629.xslt' ?>
<?rfc strict="yes" ?>
<?rfc toc="yes"?>
<?rfc tocdepth="4"?>
<?rfc symrefs="yes"?>
<?rfc sortrefs="yes" ?>
<?rfc compact="yes" ?>
<?rfc subcompact="no" ?>

<rfc category="exp" docName="draft-prodromou-dialback-00" ipr="trust200902">

  <!-- ***** FRONT MATTER ***** -->

  <front>

    <title abbrev="Dialback Authentication">HTTP Authentication: Dialback Access Authentication</title>

    <author fullname="Evan Prodromou" initials="E.S.P."
            surname="Prodromou">

      <organization>StatusNet, Inc.</organization>

      <address>

        <email>evan@status.net</email>
        <uri>http://evan.status.net/</uri>

      </address>
    </author>

    <date year="2012" month="September" day="6" />

    <area>General</area>

    <workgroup>Internet Engineering Task Force</workgroup>

    <keyword>http</keyword>
    <keyword>dialback</keyword>
    <keyword>authentication</keyword>
    <keyword>hostmeta</keyword>
    <keyword>webfinger</keyword>

    <abstract>

      <t>This specification defines the Dialback Access Authentication
      Scheme. It provides a way for HTTP clients to identify an
      Internet host or account responsible for an HTTP request, and
      for HTTP servers to verify that identity by sending a token to a
      declared dialback endpoint.</t>

      <t>The specification defines a new HTTP authentication scheme,
      "Dialback". It also defines a new link relation, "dialback", to
      specify the endpoint for the dialback verification. Finally, it
      defines the interface for the dialback endpoint.</t>

    </abstract>

  </front>

  <middle>

    <section title="Introduction">

      <t><xref target="RFC2616">HTTP/1.1</xref> has an extensible
      authentication mechanism using the "Authorization" header. <xref
      target="RFC2617">Basic and Digest Authentication</xref> are two
      authentication schemes for HTTP/1.1. <xref target="RFC5849">OAuth
      1.0</xref> is another.</t>

      <t>All of these authentication schemes assume that the HTTP
      server is able to validate the authentication credentials. With
      distributed publishing and social networking applications,
      however, the security domain may be separate from the resource
      domain. In addition, the resource and security domains may have
      no previously-negotiated relationship.</t>

      <t>With dialback authentication, an HTTP client can authenticate
      as a host or Webfinger address without creating a previous
      relationship. The HTTP server verifies the identity using a
      dialback endpoint specified by the host or Webfinger address.</t>

      <t>Because dialback authentication requires one or more
      additional requests from server to client, its intended use is
      for bootstrapping longer-term relationships, such as dynamic
      registration of OAuth clients. It can also be useful for single
      use requests.</t>

      <section title="Requirements Language">
        <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">RFC 2119</xref>.</t>
      </section>

    </section>
    
    <section title="Authentication scheme">

      <t>This spec adds a new Authorization type, "Dialback".</t>

      <t>The header has the following optional elements:

      <list hangIndent="8" style="hanging">
        <t hangText="host">The host authorizing the request.</t>
        <t hangText="webfinger">The webfinger account authorizing the request.</t>
        <t hangText="token">An opaque value used to confirm the request authorization</t>
      </list>
      </t>
      
      <t>Exactly one of "host" or "webfinger" is required.</t>

      <t>"token" is always required.</t>

    </section>

    <section title="Dialback endpoint discovery">

      <t>To validate the token, the server must identify a dialback
      endpoint for the host or Webfinger address.</t>

      <t>For a host parameter, the server SHOULD use <xref
      target="RFC6415">Web Host Metadata</xref> to find the
      endpoint. It will have the link relation "dialback".</t>

      <t>For a webfinger parameter, the server SHOULD use <xref
      target="I-D.jones-appsawg-webfinger">Webfinger</xref> to find the
      endpoint with the link relation "dialback".</t>

    </section>

    <section title="Dialback verification endpoint">

      <t>To confirm, the server makes an HTTP POST request to the
      dialback endpoint. The request MUST have the Content-Type
      application/x-www-url-encoded.</t>

      <t>The HTTP request has the following parameters.

      <list hangIndent="8" style="hanging">
        <t hangText="host">The host value provided in the original Authorization header.</t>
        <t hangText="webfinger">The webfinger value provided in the original Authorization header.</t>
        <t hangText="token">The token provided in the original Authorization header.</t>
        <t hangText="url">The URL that the original request was made to.</t>
        <t hangText="date">The Date header on the original request.</t>
      </list>
      </t>

      <t>The request MUST include exactly one of "host" or "webfinger".</t>
      <t>The request MUST include the "token", "url" and "date" parameters.</t>

      <t>All parameters MUST be encoded in the body of the request.</t>

      <t>If the token is valid, the endpoint SHOULD return a 200 OK or 204 No Content result.</t>

      <t>If the token is invalid, the endpoint SHOULD return a 400 Bad Request result.</t>

    </section>

    <section title="Examples">

      <section title="Host authentication">

        <t>
          <list style="symbols">
            <t>The client sends an HTTP request with an Authorization header:
            <figure align="left" anchor="host_authorization">
<artwork><![CDATA[
POST /some/endpoint HTTP/1.1
Host: photo.example
Date: Tue, 28 Aug 2012 09:41:21 -0400
Content-Type: application/x-www-url-form-encoded
Authorization: Dialback
               host="checkin.example",
               token="4430086d"

arg1=186&arg2=50
]]></artwork>
            </figure>
            </t>
            <t>The server checks that the Date: header is within an acceptable window (+/- 5 minutes recommended).</t>
            <t>The server checks that it hasn't seen this (host, url, token, date) tuple before.</t>
            <t>The server discovers a dialback confirmation endpoint at checkin.example. Its rel type is "dialback".</t>
            <t>The server posts an HTTP request to confirm the token:
            <figure align="left" anchor="host_dialback">
<artwork><![CDATA[
POST /dialback HTTP/1.1
Host: checkin.example
Date: Tue, 28 Aug 2012 09:41:43 -0400
Content-Type: application/x-www-url-form-encoded

host=checkin.example&\
token=4430086d&\
url=http://photo.example/some/endpoint&\
date=Tue%2C%2028%20Aug%202012%2009%3A41%3A21%20-0400
]]></artwork>
            </figure>
            Note: the "\" character is used here to indicate the line wrapping in the request content and is not part of the content itself.</t>
            <t>checkin.example returns 200 OK for a confirmation, 4xx for confirmation failure, 5xx for server failure.</t>
          </list>
        </t>
      </section>

      <section title="Webfinger authentication">
        <t>
          <list style="symbols">
            <t>The client sends an HTTP request with an Authorization header:
            <figure align="left" anchor="webfinger_authorization">
<artwork><![CDATA[
GET /some/resource HTTP/1.1
Host: photo.example
Date: Tue, 28 Aug 2012 09:41:21 -0400
Authorization: Dialback 
               webfinger="alice@checkin.example",
               token="b3265cd5"
]]></artwork>
            </figure>
            </t>
            <t>The server checks that the Date: header is within an acceptable window (+/- 5 minutes recommended).</t>
            <t>The server checks that it hasn't seen this (webfinger, url, token, date) tuple before.</t>
            <t>The server discovers a dialback confirmation endpoint for alice@checkin.example. Its rel type is "dialback".</t>
            <t>The server posts an HTTP request to confirm the token:
            <figure align="left" anchor="webfinger_dialback">
<artwork><![CDATA[
POST /dialback HTTP/1.1
Host: checkin.example
Date: Tue, 28 Aug 2012 09:41:43 -0400
Content-Type: application/x-www-url-form-encoded

webfinger=alice@checkin.example&\
token=b3265cd5&\
url=http://photo.example/some/resource&\
date=Tue%2C%2028%20Aug%202012%2009%3A41%3A21%20-0400
]]></artwork>
            </figure>
            Note: the "\" character is used here to indicate the line wrapping in the request content and is not part of the content itself.</t>
            <t>checkin.example returns 200 OK for a confirmation, 4xx for confirmation failure, 5xx for server failure.</t>
          </list>
        </t>
      </section>
    </section>

    <section anchor="IANA" title="IANA Considerations">

      <section title="Authentication scheme">

        <t>This specification defines a new HTTP authentication
        scheme, "Dialback", per <xref
        target="I-D.ietf-httpbis-p7-auth">HTTP/1.1, part 7:
        Authentication</xref> to be registered at
        http://www.iana.org/assignments/http-authschemes.</t>

        <t>
          <list style="symbols">
            <t>Authentication Scheme Name: Dialback</t>
            <t>Reference: (this document)</t>
          </list> 
        </t>

      </section>

      <section title="Link relation">

        <t>This specification defines a new link relation type to be registered at 
        http://www.iana.org/assignments/link-relations according to <xref target="RFC5988">RFC 5988</xref>.</t>

        <t>
          <list style="symbols">
            <t>Relation Name: dialback</t>
            <t>Description: a dialback token verification endpoint</t>
            <t>Reference: (this document)</t>
          </list> 
        </t>
      </section>

    </section>

    <section anchor="Security" title="Security Considerations">

      <section title="Replay attacks">

        <t>An attacker could capture the Authorization header of a
        request and replay the header for another payload.</t>

        <t>To prevent replay attacks, the server MUST NOT accept a
        request if it has already seen a request with the same host or
        webfinger, url, token, and date.</t>

        <t>Servers MAY mitigate storage requirements by rejecting
        requests with a Date: outside a fixed window. +/- 5 minutes
        from server time is reasonable.</t>

      </section>

      <section title="Link discovery">

        <t>An attacker could use DNS poisoning techniques to provide
        links to a false dialback endpoint.</t>

        <t>Clients supporting dialback SHOULD support TLS for
        host-meta and Webfinger discovery.</t>

        <t>HTTP servers SHOULD use the TLS endpoint for host-meta and
        Webfinger. HTTP servers MAY fall back to the unencrypted
        equivalent.</t>

      </section>

      <section title="Endpoint">

        <t>An attacker could use DNS poisoning techniques to provide
        false responses to requests to the dialback verification
        endpoint.</t>

        <t>HTTP clients support dialback SHOULD use TLS for dialback
        endpoints.</t>

        <t>HTTP servers SHOULD require valid certificates for dialback
        endpoints.</t>

      </section>

      <section title="Confidentiality">

        <t>The dialback endpoint confirms that the host or Webfinger
        account is responsible for the HTTP request.</t>

        <t>An attacker could use brute-force methods to determine if
        the host or Webfinger account has made an HTTP request to a
        given URL.</t>

        <t>The dialback endpoint SHOULD NOT verify requests for dates
        outside a small window around the current time (+/- five
        minutes).</t>

        <t>The dialback endpoint SHOULD use large enough tokens to
        make brute-force attacks impractical.</t>

      </section>

      <section title="Data integrity">

        <t>Dialback authentication does not confirm the contents of
        the HTTP request. For example, man-in-the-middle attack could
        replace the contents of a POST request with another payload,
        which would be verified.</t>

        <t>Servers SHOULD use TLS to prevent man-in-the-middle
        attacks.</t>

      </section>

      <section title="Denial of service">

        <t>Dialback authentication lets the HTTP client induce the
        HTTP server to make additional verification requests.</t>

        <t>By making requests with a host or webfinger parameter
        referring to a third party, a malicious client can cause extra
        HTTP requests to that third party.</t>

        <t>To avoid denial-of-service attacks, HTTP servers SHOULD
        cache the results of host-meta and Webfinger requests.</t>

      </section>

    </section>

  </middle>

  <!--  *****BACK MATTER ***** -->

  <back>

    <references title="Normative References">

      &RFC2119;

      &RFC2616;

      &RFC2617;

      &RFC5988;

      &RFC6415;

      &WEBFINGER;

      &AUTHSCHEME;

    </references>

    <references title="Informative References">

      &RFC5849;

    </references>

  </back>

</rfc>
