<?xml version="1.0" encoding="UTF-8"?><?xml-stylesheet type="text/xsl" href="../rfc2629.xslt"?><!DOCTYPE rfc SYSTEM 'rfc2629.dtd' [<!ENTITY rfc2119 PUBLIC '' 'bibxml/reference.RFC.2119.xml'><!ENTITY rfc2368 PUBLIC '' 'bibxml/reference.RFC.2368.xml'><!ENTITY rfc2616 PUBLIC '' 'bibxml/reference.RFC.2616.xml'><!ENTITY rfc2782 PUBLIC '' 'bibxml/reference.RFC.2782.xml'><!ENTITY rfc2818 PUBLIC '' 'bibxml/reference.RFC.2818.xml'><!ENTITY rfc3986 PUBLIC '' 'bibxml/reference.RFC.3986.xml'><!ENTITY rfc4791 PUBLIC '' 'bibxml/reference.RFC.4791.xml'><!ENTITY rfc5322 PUBLIC '' 'bibxml/reference.RFC.5322.xml'><!ENTITY rfc5397 PUBLIC '' 'bibxml/reference.RFC.5397.xml'><!ENTITY rfc5545 PUBLIC '' 'bibxml/reference.RFC.5545.xml'><!ENTITY idSiteMeta PUBLIC '' 'bibxml3/reference.I-D.nottingham-site-meta.xml'><!ENTITY idCardDAV PUBLIC '' 'bibxml3/reference.I-D.ietf-vcarddav-carddav.xml'><!ENTITY idCertCheck PUBLIC '' 'bibxml3/reference.I-D.saintandre-tls-server-id-check.xml'>]> <?rfc rfcedstyle="yes" ?><?rfc toc="yes"?><?rfc tocdepth="4"?><!-- default = 3 --><?rfc symrefs="yes"?><?rfc sortrefs="yes"?><?rfc compact="yes"?><?rfc subcompact="no"?><!-- <?rfc strict="yes"?> --><!-- <?rfc comments="yes"?> --><!-- <?rfc inline="yes"?> --><rfc category='std' ipr='trust200902' docName='draft-daboo-srv-caldav-01'>  <front>    <title abbrev="SRV for CalDAV">Use of SRV records for locating CalDAV and CardDAV services</title>    <author initials="C." surname="Daboo" fullname="Cyrus Daboo">      <organization abbrev="Apple Inc.">        Apple Inc.       </organization>      <address>        <postal>          <street>            1 Infinite Loop           </street>          <city>            Cupertino           </city>          <region>            CA           </region>          <code> 95014 </code>           <country>            USA           </country>        </postal>        <email>          cyrus@daboo.name         </email>        <uri>          http://www.apple.com/         </uri>      </address>    </author>    <date />    <area>      Applications     </area>    <abstract>      <t>        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.      </t>    </abstract>  </front>  <middle>    <section title='Introduction'>      <t>        <xref target="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 SRV RR records.      </t>      <t>        <xref target="RFC4791"/> defines the CalDAV Calendar Access protocol, based on HTTP <xref target="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 hostname and port for their servers.      </t>      <t>      	<xref target='I-D.ietf-vcarddav-carddav'/> defines the CardDAV vCard Access protocol based on HTTP <xref target="RFC2616"/>, for accessing contact data stored on a server. As with CalDAV, clients also need to be able to discover CardDAV servers.      </t>      <t>        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 <xref target='I-D.ietf-vcarddav-carddav'/>.      </t>      <t>      	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 records by themselves only provide a hostname 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.      </t>      <t>        This specification makes use of the <xref target="I-D.nottingham-site-meta">"well known URI" feature</xref> 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".      </t>    </section>    <section title='Conventions Used in This Document'>      <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' />.       </t>    </section>    <section title='CalDAV SRV Service Types'>		<t>			This specification adds two service types for use with SRV records:			<list style="hanging">				<t hangText="caldav:">					Identifies a CalDAV server that uses HTTP without transport layer security (<xref target="RFC2818"/>).				</t>				<t hangText="caldavs:">					Identifies a CalDAV server that uses HTTP with transport layer security (<xref target="RFC2818"/>).				</t>			</list>		</t>		<t>			Clients SHOULD honor "TTL", "Priority" and "Weight" values in the SRV records, as described by <xref target="RFC2782"/>.		</t>		<figure>			<preamble>				Example: service record for server without transport layer security			</preamble>			<artwork>    _caldav._tcp     SRV 0 1 80 calendar.example.com.</artwork>		</figure>		<figure>			<preamble>				Example: service record for server with transport layer security			</preamble>			<artwork>    _caldavs._tcp    SRV 0 1 443 calendar.example.com.</artwork>		</figure>    </section>	<section title='CalDAV and CardDAV Service Well-Known URI'>		<t>		  Two "well-known" URIs are registered by this specification for CalDAV and CardDAV services, "caldav" and "carddav" respectively (see <xref target='iana'/>). These URIs point to a resource that the client can use as the "context path" for the service they are trying to use. 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.		</t>		<section title='Example: well-known URI as context path'>			<t>				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 hostname and port via an SRV lookup.			</t>		</section>		<section title='Example: well-known URI redirects to actual context path'>			<t>				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 hostname 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.			</t>		</section>	</section>	<section title='Client "Bootstrapping" Guidelines'>		<t>			This section describes a procedure that CalDAV or CardDAV clients MAY use to do their initial configuration based on minimal user input.		</t>		<t>			For a CalDAV server, minimal input from a user would consist of a calendar user address. A calendar user address is defined by <xref target="RFC5545">iCalendar</xref> to be a <xref target="RFC3986">URI</xref>. Provided a user identifier and a domain name can be extracted from the URI, this simple "bootstrap" configuration can be done.		</t>		<t>			If the calendar user address is a <xref target="RFC2368">"mailto:"</xref> URI, the "mailbox" portion of the URI is examined and the "local-part" and "domain" portions extracted. The "local-part" is used for the user identifier and the "domain" is used as the service domain.		</t>		<t>			If the calendar user address is an <xref target="RFC2616">"http:"</xref> or <xref target="RFC2818">"https:"</xref> URI, the "userinfo" and "host" portion of the URI is extracted. The "userinfo" is used for the user identifier and the "host" is used as the service domain.		</t>		<t>			For a CardDAV server, minimal input from a user would consist of their <xref target='RFC5322'>email address</xref> 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. The "local-part" is used for the user identifier and the "domain" is used as the service domain.		</t>		<t>			Once the user identifier and service domain have been extracted, the following is done:			<list style='numbers'>				<t>					An SRV lookup for _caldavs._tcp (for CalDAV) or _carddavs._tcp (for CardDAV) is done against the extracted service domain.				</t>				<t>					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.				</t>				<t>					If an SRV record is returned the client extracts the server host name and port number.				</t>				<t>					The client does an authenticated <xref target="RFC4791">"PROPFIND"</xref> request using the user identifier, host name and port number and a request URI of "/.well-known/caldav" (for CalDAV) or "/.well-known/carddav" (for CardDAV).  The body of the request should include the <xref target='RFC5397'>DAV:current-user-principal</xref> property as one of the properties to return. Note that clients MUST properly handle HTTP redirect responses for the request.				</t>				<t>					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 "/".				</t>				<t>					If the DAV:current-user-principal property is returned on the initial request, the client uses that value for the principal-URI of the authenticated user. With that, it can do a "PROPFIND" on the principal-URI and discover additional properties for configuration.				</t>				<t>					If the DAV:current-user-principal property is not returned, then the client will need to request the principal-URI path from the user in order to continue with configuration.				</t>			</list>		</t>	</section>    <section title='Security Considerations'>      <t>      	Clients that support transport layer security as defined by <xref target="RFC2818"/> SHOULD try the "caldavs" or "carddavs" services first before trying the "caldav" or "carddav" services respectively. If a user has 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 <xref target='I-D.saintandre-tls-server-id-check'/>.      </t>      <t>        A malicious attacker with access to the DNS server data 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 host name returned in the SRV record matches the original service domain that was queried. If the host is not in the queried domain, clients SHOULD verify with the user that the SRV host name is suitable for use before executing any CalDAV or CardDAV requests against the host.      </t>    </section>    <section title='IANA Considerations' anchor='iana'>      <t>        This document defines two "well-known" URIs using the registration procedure and template from Section 5.1 of <xref target='I-D.nottingham-site-meta'/>.      </t>		<section title='caldav Well-Known URI Registration'>			<t>				<list style='hanging'>				   <t hangText="URI suffix:">caldav</t>						   <t hangText="Change controller:">IETF.</t>						   <t hangText="Specification document(s):">This RFC.</t>						   <t hangText="Related information:">See also <xref target='RFC4791'/>.</t>				</list>			</t>		</section>		<section title='carddav Well-Known URI Registration'>			<t>				<list style='hanging'>				   <t hangText="URI suffix:">carddav</t>						   <t hangText="Change controller:">IETF.</t>						   <t hangText="Specification document(s):">This RFC.</t>						   <t hangText="Related information:">See also <xref target='I-D.ietf-vcarddav-carddav'/>.</t>				</list>			</t>		</section>    </section>    <section title='Acknowledgments'>      <t>        This specification was suggested by discussion that took place within the Calendaring and Scheduling Consortium's CalDAV Technical Committee. The authors thank the participants of that group for their input. The "bootstrapping" process is based on diagrams developed by Wilfredo Sanchez.      </t>    </section>  </middle>  <back>    <references title='Normative References'>      &rfc2119;       &rfc2368;      &rfc2616;      &rfc2782;      &rfc2818;      &rfc3986;      &rfc4791;      &idSiteMeta;      &idCardDAV;      &idCertCheck;    </references>    <references title='Informative References'>      &rfc5322;      &rfc5397;      &rfc5545;    </references><section title='Change History (to be removed prior to publication as an RFC)'><t>Changes in -01:<list style='numbers'>	<t>Added discovery of CardDAV service.</t>	<t>Now makes use of well-known URIs for the service "context path".</t>	<t>Updated to RFC 5545 reference.</t>	<t>Added reference to certificate verification spec.</t></list></t></section>  </back></rfc>