<?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 rfc2617 PUBLIC '' 'bibxml/reference.RFC.2617.xml'><!ENTITY rfc2782 PUBLIC '' 'bibxml/reference.RFC.2782.xml'><!ENTITY rfc2818 PUBLIC '' 'bibxml/reference.RFC.2818.xml'><!ENTITY rfc3744 PUBLIC '' 'bibxml/reference.RFC.3744.xml'><!ENTITY rfc3986 PUBLIC '' 'bibxml/reference.RFC.3986.xml'><!ENTITY rfc4791 PUBLIC '' 'bibxml/reference.RFC.4791.xml'><!ENTITY rfc4918 PUBLIC '' 'bibxml/reference.RFC.4918.xml'><!ENTITY rfc5246 PUBLIC '' 'bibxml/reference.RFC.5246.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 rfc5785 PUBLIC '' 'bibxml/reference.RFC.5785.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'><!ENTITY idDNSSD PUBLIC '' 'bibxml3/reference.I-D.cheshire-dnsext-dns-sd.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-10' updates="4791,CardDAV-RFC-to-be">  <front>    <title abbrev="SRV for CalDAV &amp; CardDAV">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 DNS SRV records, DNS TXT records and well-known URIs can be used together or separately to locate Calendaring Extensions to WebDAV (CalDAV) or vCard Extensions to WebDAV (CardDAV) services.      </t>    </abstract>  </front>  <middle>    <section title='Introduction'>      <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 the fully qualified domain name (FQDN) and port number for their servers.      </t>      <t>      	<xref target='I-D.ietf-vcarddav-carddav'/> defines the CardDAV address book 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>        <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 DNS SRV Resource Records (RRs). This has been enhanced to provide additional service meta-data by use of DNS TXT Resource Records as per <xref target='I-D.cheshire-dnsext-dns-sd'/>.      </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 might not be located at the "root" URI of the HTTP server hosting it. Thus a client needs to be able to determine the complete path component of the Request-URI to use in HTTP requests: the "context path". 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 number 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="RFC5785">"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 is simply a "stub" resource that provides a redirect to the actual "context path" resource representing the service endpoint.      </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 Labels'>		<t>			This specification adds two SRV service labels for use with CalDAV:			<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 MUST honor "Priority" and "Weight" values in the SRV RRs, 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 TXT Records'>    	<t>    		When SRV RRs are used to advertise CalDAV and CardDAV services, it is also convenient to be able to specify a "context path" in the DNS to be retrieved at the same time. To enable that, this specification uses a TXT RR that follows the syntax defined in Section 6 of <xref target='I-D.cheshire-dnsext-dns-sd'/> and defines a "path" key for use in that record. The value of the key MUST be the actual "context path" to the corresponding service on the server.    	</t>    	<t>    		A site might provide TXT records in addition to SRV records for each service. When present, clients MUST use the "path" value as the "context path" for the service in HTTP requests. When not present, clients use the ".well-known" URI approach described next.    	</t>		<figure>			<preamble>				Example: text record for service with transport layer security			</preamble>			<artwork>    _caldavs._tcp    TXT path=/caldav</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 initial "context path" for the service they are trying to connect to. The server MUST redirect HTTP requests for that resource to the actual "context path"	using one of the available mechanisms provided by HTTP (e.g., using a 301, 303, 307 response). Clients MUST handle HTTP redirects on the ".well-known" URI. Servers MUST NOT locate the actual CalDAV or CardDAV service endpoint at the ".well-known" URI as per Section 1.1 of <xref target='RFC5785'/>.		</t>		<t>		  Servers SHOULD set an appropriate Cache-Control header value (as per Section 14.9 of <xref target='RFC2616'/>) in the redirect response to ensure caching occurs or does not occur as needed, or as required by the type of response generated. For example, if it is anticipated that the location of the redirect might change over time, then a "no-cache" value would be used.		</t>		<t>		  To facilitate "context path's" that might differ from user to user, the server MAY require authentication when a client tries to access the ".well-known" URI (i.e., the server would return a 401 status response to the unauthenticated request from the client, then return the redirect response only after a successful authentication by the client).		</t>		<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 FQDN and port number via an SRV lookup or via manual entry of information by the user which the client can parse suitable information from. When the client makes an HTTP request against "/.well-known/caldav", the server would issue an HTTP 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" Procedures'>		<t>			This section describes a procedure that CalDAV or CardDAV clients SHOULD 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 <xref target='RFC3744'/>.			<list style='numbers'>				<t>Processing user input:				<list style='symbols'>					<t>						For a CalDAV server:						<list style='symbols'>							<t>								Minimal input from a user would consist of a calendar user address and a password. 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.							</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 <xref target="RFC3986">URI</xref> is extracted.							</t>						</list>					</t>					<t>						For a CardDAV server:						<list style='symbols'>							<t>Minimal input from a user would consist of their <xref target='RFC5322'>email address</xref> for the domain where the CardDAV service is hosted, and a password. The "mailbox" portion of the email address is examined and the "local-part" and "domain" portions extracted.</t>						</list>					</t>				</list>				</t>				<t>Determination of service FQDN and port number:				<list style='symbols'>					<t>						An SRV lookup for _caldavs._tcp (for CalDAV) or _carddavs._tcp (for CardDAV) is done with the extracted "domain" as the service domain.					</t>					<t>						If no result is found, 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 target FQDN and port number. 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 <xref target='RFC2782'/>).					</t>					<t>						If an SRV record is not found, the client will need to prompt the user to enter the FQDN and port number information directly, or use some other heuristic, for example using the extracted "domain" as the FQDN and default HTTPS or HTTP port numbers. In this situation clients MUST first attempt an HTTP connection with transport layer security.					</t>				</list>				</t>				<t>Determination of initial "context path":				<list style='symbols'>					<t>						When an SRV lookup is done and a valid SRV record returned, the client MUST also query for a corresponding TXT record and check for the presence of a "path" key in its response. If present, the value of the "path" key is used for the initial "context path".					</t>					<t>						When an initial "context path" has not been determined from a TXT record, the initial "context path" is taken to be "/.well-known/caldav" (for CalDAV) or "/.well-known/carddav" (for CardDAV). 					</t>					<t>						If the initial "context path" derived from a TXT record generates HTTP errors when targeted by requests, the client SHOULD repeat its bootstrap procedure using the appropriate ".well-known" URI instead.					</t>				</list>				</t>				<t>Determination of user identifier:				<list style='symbols'>					<t>						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 <xref target="service_provider"/>. If these user identifiers result in authentication failure, the client SHOULD prompt the user for a valid identifier.					</t>				</list>				</t>				<t>Connecting to the service:				<list style='symbols'>					<t>						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. The client MUST do certificate verification using the procedure outlined in Section 4 of <xref target='I-D.saintandre-tls-server-id-check'/> in regard to verification with an SRV RR as the starting point.					</t>					<t>						The client does a <xref target="RFC4918">"PROPFIND"</xref> request with the request URI set to the initial "context path". 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. The server will use the HTTP authentication procedure outlined in <xref target="RFC2617"/> or use some other appropriate authentication schemes to authenticate the user.					</t>					<t>						If the server returns a 404 Not Found HTTP status response to the request on the initial "context path", clients MAY try repeating the request on the "root" URI "/" or prompt the user for a suitable path.					</t>					<t>						If the DAV:current-user-principal property is returned on the 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" collections).					</t>					<t>						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.					</t>				</list>				</t>			</list>		</t>      <t>		Once a successful account discovery step has been done, clients SHOULD cache the service details that were successfully used (user identity, principal-URL with full scheme/host/port details), and re-use those when connecting again at a later time.	  </t>	  <t>		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.	  </t>	</section>    <section title='Guidance for Service Providers' anchor='service_provider'>    	<t>    		Service providers wanting to offer CalDAV or CardDAV services that can be configured by clients using SRV records need to follow certain procedures to ensure proper operation.    	</t>    	<t>    		<list style='symbols'>    			<t>CalDAV or CardDAV servers SHOULD be configured to allow authentication with calendar user addresses (just taking the "mailbox" portion of any "mailto:" URI) or email addresses respectively, 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.</t>    			<t>Servers MUST force authentication for "PROPFIND" requests that retrieve the DAV:current-user-principal property to ensure that the value of the DAV:current-user-principal property returned corresponds to the principal-URL of the user making the request.</t>    			<t>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 4 of <xref target='I-D.saintandre-tls-server-id-check'/> in regard to verification with an SRV RR as the starting point.</t>    			<t>Install the appropriate SRV records for the offered services. Optionally include TXT records.</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, 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 4 of <xref target='I-D.saintandre-tls-server-id-check'/> to verify the service.      </t>      <t>		Implementations of <xref target="RFC5246">TLS</xref>, used as the basis for transport layer security (<xref target="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 <xref target="RFC5246"/> for further details.      </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='RFC5785'/>.      </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 title='SRV Service Label Registration'>			<t>Service labels have been registered according to <eref target='http://www.dns-sd.org/ServiceTypes.html'>&lt;http://www.dns-sd.org/ServiceTypes.html&gt;</eref> and will be incorporated into IANA once a new registry is available there.</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 author thanks the following for their contributions: Stuart Cheshire, Bernard Desruisseaux, Eran Hammer-Lahav, Helge Hess, Arnaud Quillaud, Wilfredo Sanchez, and Joe Touch.      </t>    </section>  </middle>  <back>    <references title='Normative References'>      &rfc2119;       &rfc2368;      &rfc2616;      &rfc2617;      &rfc2782;      &rfc2818;      &rfc3744;      &rfc3986;      &rfc4791;      &rfc4918;      &rfc5246;      &rfc5322;      &rfc5397;      &rfc5785;      &idCardDAV;      &idCertCheck;      &idDNSSD;    </references>    <references title='Informative References'>      &rfc5545;    </references><section title='Change History (to be removed prior to publication as an RFC)'><t>Changes in -09:<list style='numbers'>	<t>IESG Review: minor editorial changes.</t>	<t>GenART Review: minor editorial changes.</t>	<t>GenART Review: "guideline" -> "procedure".</t>	<t>GenART Review: "port" -> "port number".</t>	<t>GenART Review: added definition of "context path".</t>	<t>GenART Review: clarified OPTIONAL nature of suggested client procedure.</t>	<t>GenART Review: clarified that TXT lookup is an additional query.</t>	<t>IESG Review: now allow any HTTP redirect response, not just 301.</t>	<t>IESG Review: added text on cache interaction with redirect.</t></list></t><t>Changes in -10:<list style='numbers'>	<t>AD Review: make client procedure a SHOULD.</t></list></t><t>Changes in -08:<list style='numbers'>	<t>Clarify that email address is a valid input in Section 7 for CardDAV.</t>	<t>Clarified aspects of DAV:current-user-principal handling for servers.</t>	<t>Added additional text to indicate TXT being used in abstract and introduction.</t></list></t><t>Changes in -07:<list style='numbers'>	<t>Add password to required minimal user input</t>	<t>Section 3 -> Section 4 of server-id check draft.</t></list></t><t>Changes in -06:<list style='numbers'>	<t>Last call comments: Revised title, abstract and text to indicate that SRV and .well-known can be done separately.</t>	<t>Revised IANA section to use dns-sd registry for now.</t>	<t>Added optional TXT RR with path key for service context path in the DNS</t>	<t>Re-organized client bootstrap to take account of TXT and to call-out the different "phases" involved via a numbered list.</t></list></t><t>Changes in -05:<list style='numbers'>	<t>AD Review: Added "Updates" for 4791 and CardDAV.</t>	<t>AD Review: Changed SHOULD to MUST for honoring priority and weight.</t>	<t>AD Review: Added additional reference to 3986 when talking about userinfo/host portions of the URI.</t>	<t>AD Review: Changed section reference for tls-server-id-check draft.</t>	<t>AD Review: Changed should to SHOULD when describing PROPFIND request and made 5397 normative.</t>	<t>AD Review: Made 3744 and 5322 normative references.</t>	<t>AD Review: Added IANA SRV registration request.</t></list></t><t>Changes in -04:<list style='numbers'>	<t>Added addition text to client guidelines indicating that clients cache the discovery details and can re-do discovery if connections later fail.</t>	<t>Changed principal-URI to principal-URL.</t></list></t><t>Changes in -03:<list style='numbers'>	<t>Updated to RFC 5785 reference.</t>	<t>Added SSL v2 restriction from srv-email document added after IESG review.</t>	<t>Tweaked client/server guidelines to better match HTTP challenge/response authentication mechanism.</t></list></t><t>Changes in -02:<list style='numbers'>	<t>Re-organized introduction.</t>	<t>Brought terminology into line with srv-email document which has been through last call.</t>	<t>Brought security section into line with srv-email document which has been through last call.</t></list></t><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>
