Network Working Group                                           C. Daboo
Internet-Draft                                                Apple Inc.
Updates: 4791,XXXX-CardDAV                                 June 18, 2010
(if approved)
Intended status: Standards Track
Expires: December 20, 2010


      Use of SRV records for locating CalDAV and CardDAV services
                       draft-daboo-srv-caldav-05

Abstract

   This specification describes how SRV records and well-known URIs can
   be used to locate Calendaring Extensions to WebDAV (CalDAV) or vCard
   Extensions to WebDAV (CardDAV) services.

Status of This Memo

   This Internet-Draft is submitted to IETF in full conformance with the
   provisions of BCP 78 and BCP 79.

   Internet-Drafts are working documents of the Internet Engineering
   Task Force (IETF), its areas, and its working groups.  Note that
   other groups may also distribute working documents as Internet-
   Drafts.

   Internet-Drafts are draft documents valid for a maximum of six months
   and may be updated, replaced, or obsoleted by other documents at any
   time.  It is inappropriate to use Internet-Drafts as reference
   material or to cite them other than as "work in progress."

   The list of current Internet-Drafts can be accessed at
   http://www.ietf.org/ietf/1id-abstracts.txt.

   The list of Internet-Draft Shadow Directories can be accessed at
   http://www.ietf.org/shadow.html.

   This Internet-Draft will expire on December 20, 2010.

Copyright Notice

   Copyright (c) 2010 IETF Trust and the persons identified as the
   document authors.  All rights reserved.

   This document is subject to BCP 78 and the IETF Trust's Legal
   Provisions Relating to IETF Documents
   (http://trustee.ietf.org/license-info) in effect on the date of



Daboo                   Expires December 20, 2010               [Page 1]


Internet-Draft               SRV for CalDAV                    June 2010


   publication of this document.  Please review these documents
   carefully, as they describe your rights and restrictions with respect
   to this document.  Code Components extracted from this document must
   include Simplified BSD License text as described in Section 4.e of
   the Trust Legal Provisions and are provided without warranty as
   described in the BSD License.

Table of Contents

   1.  Introduction . . . . . . . . . . . . . . . . . . . . . . . . .  3
   2.  Conventions Used in This Document  . . . . . . . . . . . . . .  4
   3.  CalDAV SRV Service Labels  . . . . . . . . . . . . . . . . . .  4
   4.  CalDAV and CardDAV Service Well-Known URI  . . . . . . . . . .  4
     4.1.  Example: well-known URI as context path  . . . . . . . . .  4
     4.2.  Example: well-known URI redirects to actual context
           path . . . . . . . . . . . . . . . . . . . . . . . . . . .  5
   5.  Client "Bootstrapping" Guidelines  . . . . . . . . . . . . . .  5
   6.  Guidance for Service Providers . . . . . . . . . . . . . . . .  7
   7.  Security Considerations  . . . . . . . . . . . . . . . . . . .  7
   8.  IANA Considerations  . . . . . . . . . . . . . . . . . . . . .  8
     8.1.  caldav Well-Known URI Registration . . . . . . . . . . . .  8
     8.2.  carddav Well-Known URI Registration  . . . . . . . . . . .  8
     8.3.  SRV Service Label Registration . . . . . . . . . . . . . .  9
   9.  Acknowledgments  . . . . . . . . . . . . . . . . . . . . . . .  9
   10. References . . . . . . . . . . . . . . . . . . . . . . . . . .  9
     10.1. Normative References . . . . . . . . . . . . . . . . . . .  9
     10.2. Informative References . . . . . . . . . . . . . . . . . . 11
   Appendix A.  Change History (to be removed prior to
                publication as an RFC)  . . . . . . . . . . . . . . . 11






















Daboo                   Expires December 20, 2010               [Page 2]


Internet-Draft               SRV for CalDAV                    June 2010


1.  Introduction

   [RFC4791] defines the CalDAV Calendar Access protocol, based on HTTP
   [RFC2616], for accessing calendar data stored on a server.  CalDAV
   clients need to be able to discover appropriate CalDAV servers within
   their local area network and at other domains, e.g., to minimize the
   need for end users to know specific details such as the fully
   qualified domain name (FQDN) and port for their servers.

   [I-D.ietf-vcarddav-carddav] defines the CardDAV vCard Access protocol
   based on HTTP [RFC2616], for accessing contact data stored on a
   server.  As with CalDAV, clients also need to be able to discover
   CardDAV servers.

   [RFC2782] defines a DNS-based service discovery protocol that has
   been widely adopted as a means of locating particular services within
   a local area network and beyond, using DNS SRV Resource Records
   (RRs).

   This specification defines new SRV service types for the CalDAV
   protocol, and gives an example of how clients can use this together
   with other protocol features to enable simple client configuration.
   SRV service types for CardDAV are already defined in Section 11 of
   [I-D.ietf-vcarddav-carddav].

   Another issue with CalDAV or CardDAV service discovery is that the
   service may not be located at the "root" URI of the HTTP server
   hosting it.  For example, if CalDAV is implemented as a "servlet" in
   a web server "container", the servlet "context path" might be
   "/caldav/".  So the URI for the CalDAV service would be, e.g.,
   "http://caldav.example.com/caldav/" rather than
   "http://caldav.example.com/".  SRV RRs by themselves only provide a
   FQDN and port for the service, not a path.  Since the client
   "bootstrapping" process requires initial access to the "context path"
   of the service, there needs to be a simple way for clients to also
   discover what that path is.

   This specification makes use of the "well known URI" feature
   [RFC5785] of HTTP servers to provide a well known URI for CalDAV or
   CardDAV services that clients can make use of.  The well known URI
   will point to a resource on the server that might be the actual
   "context path" of the CalDAV or CardDAV service, or it might simply
   be a "stub" resource that provides a redirect to the actual "context
   path".







Daboo                   Expires December 20, 2010               [Page 3]


Internet-Draft               SRV for CalDAV                    June 2010


2.  Conventions Used in This Document

   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 [RFC2119].

3.  CalDAV SRV Service Labels

   This specification adds two SRV service labels for use with CalDAV:

   _caldav:  Identifies a CalDAV server that uses HTTP without transport
      layer security ([RFC2818]).

   _caldavs:  Identifies a CalDAV server that uses HTTP with transport
      layer security ([RFC2818]).

   Clients MUST honor "Priority" and "Weight" values in the SRV RRs, as
   described by [RFC2782].

   Example: service record for server without transport layer security

       _caldav._tcp     SRV 0 1 80 calendar.example.com.

   Example: service record for server with transport layer security

       _caldavs._tcp    SRV 0 1 443 calendar.example.com.

4.  CalDAV and CardDAV Service Well-Known URI

   Two "well-known" URIs are registered by this specification for CalDAV
   and CardDAV services, "caldav" and "carddav" respectively (see
   Section 8).  These URIs point to a resource that the client can use
   as the "context path" for the service they are trying to connect to.
   The actual service could be located at that specific path.
   Alternatively the server MAY redirect HTTP requests for that resource
   (using the "301 Moved Permanently" status response) to the actual
   "context path".  Clients MUST handle HTTP redirects on the well-known
   URI.

4.1.  Example: well-known URI as context path

   A CalDAV server has a "context path" that is the same as the well-
   known URI, so the client will use "/.well-known/caldav" as the path
   for its "bootstrapping" process after it has first found the FQDN and
   port via an SRV lookup.






Daboo                   Expires December 20, 2010               [Page 4]


Internet-Draft               SRV for CalDAV                    June 2010


4.2.  Example: well-known URI redirects to actual context path

   A CalDAV server has a "context path" that is "/servlet/caldav".  The
   client will use "/.well-known/caldav" as the path for its
   "bootstrapping" process after it has first found the FQDN and port
   via an SRV lookup.  When the client makes its initial HTTP request
   against "/.well-known/caldav", the server would issue an HTTP 301
   redirect response with a Location response header using the path
   "/servlet/caldav".  The client would then "follow" this redirect to
   the new resource and continue making HTTP requests there to complete
   its "bootstrapping" process.

5.  Client "Bootstrapping" Guidelines

   This section describes a procedure that CalDAV or CardDAV clients MAY
   use to do their initial configuration based on minimal user input.
   The goal is to determine an http: or https: URI that describes the
   full path to the user's principal-URL [RFC3744].

   For a CalDAV server, minimal input from a user would consist of a
   calendar user address.  A calendar user address is defined by
   iCalendar [RFC5545] to be a URI [RFC3986].  Provided a user
   identifier and a domain name can be extracted from the URI, this
   simple "bootstrap" configuration can be done.

   If the calendar user address is a "mailto:" [RFC2368] URI, the
   "mailbox" portion of the URI is examined and the "local-part" and
   "domain" portions extracted.

   If the calendar user address is an "http:" [RFC2616] or "https:"
   [RFC2818] URI, the "userinfo" and "host" portion of the URI [RFC3986]
   is extracted.

   For a CardDAV server, minimal input from a user would consist of
   their email address [RFC5322] for the domain where the CardDAV
   service is hosted.  The "mailbox" portion of the email address is
   examined and the "local-part" and "domain" portions extracted.

   Once the user input has been processed, the following is done:

   o  An SRV lookup for _caldavs._tcp (for CalDAV) or _carddavs._tcp
      (for CardDAV) is done with the user provided "domain" as the
      service domain.

   o  If no result is found for that, the client can try _caldav._tcp
      (for CalDAV) or _carddav._tcp (for CardDAV) provided non-SSL
      connections are appropriate.




Daboo                   Expires December 20, 2010               [Page 5]


Internet-Draft               SRV for CalDAV                    June 2010


   o  If an SRV record is returned, the client extracts the target FQDN
      and port number.  If an SRV record is not found, the client will
      need to prompt the user to enter the FQDN and port information
      directly, or use some other heuristic.  In the case of multiple
      SRV records returned, the client MUST use the priority and weight
      fields in the record to determine which one to pick (as per
      [RFC2782]).

   o  Subsequent to configuration, the client will make HTTP requests to
      the service.  When using "_caldavs" or "_carddavs" services, a
      transport layer security negotiation is done immediately upon
      connection.  Certificate verification MUST use the procedure
      outlined in Section 3 of [I-D.saintandre-tls-server-id-check] in
      regard to verification with an SRV RR as the starting point.

   o  The client will need to make authenticated HTTP requests to the
      service.  Typically a "user identifier" is required for some form
      of user/password authentication.  When a user identifier is
      required, clients MUST first use the "mailbox" portion of the
      calendar user address provided by the user in the case of a
      "mailto:" address, and if that results in an authentication
      failure, SHOULD fall back to using the "local-part" extracted from
      the "mailto:" address.  For an "http:" or "https:" calendar user
      address, the "userinfo" portion is used as the user identifier for
      authentication.  This is in line with the guidance outlined in
      Section 6.  If these user identifiers result in authentication
      failure, the client SHOULD prompt the user for a valid identifier.

   o  The client does an initial "PROPFIND" [RFC4918] request with a
      request URI of "/.well-known/caldav" (for CalDAV) or "/.well-
      known/carddav" (for CardDAV).  The body of the request SHOULD
      include the DAV:current-user-principal [RFC5397] property as one
      of the properties to return.  Note that clients MUST properly
      handle HTTP redirect responses for the request.  The server will
      need to authenticate the user for the initial request and MAY
      follow the HTTP authentication procedure outlined in [RFC2617] or
      use other appropriate authentication schemes.

   o  If the server returns a 404 Not Found HTTP status response to the
      request on the well-known URI, clients MAY try repeating the
      request on the "root" URI "/" or prompt the user for a suitable
      path.

   o  If the DAV:current-user-principal property is returned on the
      initial request, the client uses that value for the principal-URL
      of the authenticated user.  With that, it can execute a "PROPFIND"
      request on the principal-URL and discover additional properties
      for configuration (e.g., calendar or address book "home"



Daboo                   Expires December 20, 2010               [Page 6]


Internet-Draft               SRV for CalDAV                    June 2010


      collections).

   o  If the DAV:current-user-principal property is not returned, then
      the client will need to request the principal-URL path from the
      user in order to continue with configuration.

   Once a successful account discovery step have been done, clients
   SHOULD cache the service details (user identity, principal-URL with
   full scheme/host/port details) that were successfully used, and re-
   use those when connecting again at a later time.

   If a subsequent connection attempt fails, or authentication fails
   persistently, clients SHOULD re-try the SRV lookup and account
   discovery to "refresh" the cached data.

6.  Guidance for Service Providers

   Service providers wanting to offer CalDAV or CardDAV services that
   can be configured by clients using SRV records need to follow certain
   guidelines to ensure proper operation.

   o  CalDAV or CardDAV servers SHOULD be configured to allow
      authentication with calendar user addresses (just the "mailbox"
      portion of a "mailto:" URI) or "user identifiers" extracted from
      them.  In the former case, the addresses MUST NOT conflict with
      other forms of permitted user login name.  In the latter case, the
      extracted "user identifiers" need to be unique across the server
      and MUST NOT conflict with any login name on the server.

   o  Servers MUST force authentication for the initial client request
      ("PROPFIND" with a DAV:current-user-principal property requested)
      to ensure that the value of DAV:current-user-principal property
      returned corresponds to the principal-URL of the user making the
      request.

   o  If the service provider uses transport layer security, the service
      provider MUST ensure a certificate is installed that can be
      verified by clients using the procedure outlined in Section 3 of
      [I-D.saintandre-tls-server-id-check] in regard to verification
      with an SRV RR as the starting point.

   o  Install the appropriate SRV records for the offered services.

7.  Security Considerations

   Clients that support transport layer security as defined by [RFC2818]
   SHOULD try the "_caldavs" or "_carddavs" services first before trying
   the "_caldav" or "_carddav" services respectively.  If a user has



Daboo                   Expires December 20, 2010               [Page 7]


Internet-Draft               SRV for CalDAV                    June 2010


   explicitly requested a connection with transport layer security, the
   client MUST NOT use any service information returned for the
   "_caldav" or "_carddav" services.  Clients MUST follow the
   certificate verification process specified in
   [I-D.saintandre-tls-server-id-check].

   A malicious attacker with access to the DNS server data, or able to
   get spoofed answers cached in a recursive resolver, can potentially
   cause clients to connect to any server chosen by the attacker.  In
   the absence of a secure DNS option, clients SHOULD check that the
   target FQDN returned in the SRV record matches the original service
   domain that was queried.  If the target FQDN is not in the queried
   domain, clients SHOULD verify with the user that the SRV target FQDN
   is suitable for use before executing any connections to the host.
   Alternatively, if transport layer security is being used for the
   service, clients MUST use the procedure outlined in Section 3 of
   [I-D.saintandre-tls-server-id-check] to verify the service.

   Implementations of TLS [RFC5246], used as the basis for transport
   layer security ([RFC2818]), typically support multiple versions of
   the protocol as well as the older Secure Sockets Layer (SSL)
   protocol.  Because of known security vulnerabilities, clients and
   servers MUST NOT request, offer, or use SSL 2.0.  See Appendix E.2 of
   [RFC5246] for further details.

8.  IANA Considerations

   This document defines two "well-known" URIs using the registration
   procedure and template from Section 5.1 of [RFC5785].

8.1.  caldav Well-Known URI Registration

   URI suffix:  caldav

   Change controller:  IETF.

   Specification document(s):  This RFC.

   Related information:  See also [RFC4791].

8.2.  carddav Well-Known URI Registration

   URI suffix:  carddav

   Change controller:  IETF.






Daboo                   Expires December 20, 2010               [Page 8]


Internet-Draft               SRV for CalDAV                    June 2010


   Specification document(s):  This RFC.

   Related information:  See also [I-D.ietf-vcarddav-carddav].

8.3.  SRV Service Label Registration

   IANA is requested to add "caldav" and "caldavs" service labels as
   aliases for "http" and "https" respectively.

9.  Acknowledgments

   This specification was suggested by discussion that took place within
   the Calendaring and Scheduling Consortium's CalDAV Technical
   Committee.  The author thanks the following for their contributions:
   Bernard Desruisseaux, Helge Hess, Arnaud Quillaud and Wilfredo
   Sanchez.

10.  References

10.1.  Normative References

   [I-D.ietf-vcarddav-carddav]           Daboo, C., "vCard Extensions to
                                         WebDAV (CardDAV)",
                                         draft-ietf-vcarddav-carddav-10
                                         (work in progress),
                                         November 2009.

   [I-D.saintandre-tls-server-id-check]  Saint-Andre, P. and J. Hodges,
                                         "Representation and
                                         Verification of Domain-Based
                                         Application Server Identity in
                                         Certificates Used with
                                         Transport Layer Security", draf
                                         t-saintandre-tls-server-id-
                                         check-06 (work in progress),
                                         June 2010.

   [RFC2119]                             Bradner, S., "Key words for use
                                         in RFCs to Indicate Requirement
                                         Levels", BCP 14, RFC 2119,
                                         March 1997.

   [RFC2368]                             Hoffman, P., Masinter, L., and
                                         J. Zawinski, "The mailto URL
                                         scheme", RFC 2368, July 1998.

   [RFC2616]                             Fielding, R., Gettys, J.,
                                         Mogul, J., Frystyk, H.,



Daboo                   Expires December 20, 2010               [Page 9]


Internet-Draft               SRV for CalDAV                    June 2010


                                         Masinter, L., Leach, P., and T.
                                         Berners-Lee, "Hypertext
                                         Transfer Protocol -- HTTP/1.1",
                                         RFC 2616, June 1999.

   [RFC2617]                             Franks, J., Hallam-Baker, P.,
                                         Hostetler, J., Lawrence, S.,
                                         Leach, P., Luotonen, A., and L.
                                         Stewart, "HTTP Authentication:
                                         Basic and Digest Access
                                         Authentication", RFC 2617,
                                         June 1999.

   [RFC2782]                             Gulbrandsen, A., Vixie, P., and
                                         L. Esibov, "A DNS RR for
                                         specifying the location of
                                         services (DNS SRV)", RFC 2782,
                                         February 2000.

   [RFC2818]                             Rescorla, E., "HTTP Over TLS",
                                         RFC 2818, May 2000.

   [RFC3744]                             Clemm, G., Reschke, J., Sedlar,
                                         E., and J. Whitehead, "Web
                                         Distributed Authoring and
                                         Versioning (WebDAV)
                                         Access Control Protocol",
                                         RFC 3744, May 2004.

   [RFC3986]                             Berners-Lee, T., Fielding, R.,
                                         and L. Masinter, "Uniform
                                         Resource Identifier (URI):
                                         Generic Syntax", STD 66,
                                         RFC 3986, January 2005.

   [RFC4791]                             Daboo, C., Desruisseaux, B.,
                                         and L. Dusseault, "Calendaring
                                         Extensions to WebDAV (CalDAV)",
                                         RFC 4791, March 2007.

   [RFC4918]                             Dusseault, L., "HTTP Extensions
                                         for Web Distributed Authoring
                                         and Versioning (WebDAV)",
                                         RFC 4918, June 2007.

   [RFC5246]                             Dierks, T. and E. Rescorla,
                                         "The Transport Layer Security
                                         (TLS) Protocol Version 1.2",



Daboo                   Expires December 20, 2010              [Page 10]


Internet-Draft               SRV for CalDAV                    June 2010


                                         RFC 5246, August 2008.

   [RFC5322]                             Resnick, P., Ed., "Internet
                                         Message Format", RFC 5322,
                                         October 2008.

   [RFC5397]                             Sanchez, W. and C. Daboo,
                                         "WebDAV Current Principal
                                         Extension", RFC 5397,
                                         December 2008.

   [RFC5785]                             Nottingham, M. and E. Hammer-
                                         Lahav, "Defining Well-Known
                                         Uniform Resource Identifiers
                                         (URIs)", RFC 5785, April 2010.

10.2.  Informative References

   [RFC5545]                             Desruisseaux, B., "Internet
                                         Calendaring and Scheduling Core
                                         Object Specification
                                         (iCalendar)", RFC 5545,
                                         September 2009.

Appendix A.  Change History (to be removed prior to publication as an
             RFC)

   Changes in -05:

   1.  AD Review: Added "Updates" for 4791 and CardDAV.

   2.  AD Review: Changed SHOULD to MUST for honoring priority and
       weight.

   3.  AD Review: Added additional reference to 3986 when talking about
       userinfo/host portions of the URI.

   4.  AD Review: Changed section reference for tls-server-id-check
       draft.

   5.  AD Review: Changed should to SHOULD when describing PROPFIND
       request and made 5397 normative.

   6.  AD Review: Made 3744 and 5322 normative references.

   7.  AD Review: Added IANA SRV registration request.

   Changes in -04:



Daboo                   Expires December 20, 2010              [Page 11]


Internet-Draft               SRV for CalDAV                    June 2010


   1.  Added addition text to client guidelines indicating that clients
       cache the discovery details and can re-do discovery if
       connections later fail.

   2.  Changed principal-URI to principal-URL.

   Changes in -03:

   1.  Updated to RFC 5785 reference.

   2.  Added SSL v2 restriction from srv-email document added after IESG
       review.

   3.  Tweaked client/server guidelines to better match HTTP challenge/
       response authentication mechanism.

   Changes in -02:

   1.  Re-organized introduction.

   2.  Brought terminology into line with srv-email document which has
       been through last call.

   3.  Brought security section into line with srv-email document which
       has been through last call.

   Changes in -01:

   1.  Added discovery of CardDAV service.

   2.  Now makes use of well-known URIs for the service "context path".

   3.  Updated to RFC 5545 reference.

   4.  Added reference to certificate verification spec.

Author's Address

   Cyrus Daboo
   Apple Inc.
   1 Infinite Loop
   Cupertino, CA  95014
   USA

   EMail: cyrus@daboo.name
   URI:   http://www.apple.com/





Daboo                   Expires December 20, 2010              [Page 12]