<?xml version="1.0" encoding="US-ASCII"?>
<!-- This template is for creating an Internet Draft using xml2rfc,
     which is available here: http://xml.resource.org. -->
<!DOCTYPE rfc SYSTEM "rfc2629.dtd" [
<!-- One method to get references from the online citation libraries.
     There has to be one entity for each item to be referenced. 
     An alternate method (rfc include) is described in the references. -->


<!ENTITY RFC3779 SYSTEM "http://xml.resource.org/public/rfc/bibxml/reference.RFC.3779.xml">
<!ENTITY RFC5280 SYSTEM "http://xml.resource.org/public/rfc/bibxml/reference.RFC.5280.xml">          
<!ENTITY RFC2616 SYSTEM "http://xml.resource.org/public/rfc/bibxml/reference.RFC.2616.xml">      
<!ENTITY RFC2818 SYSTEM "http://xml.resource.org/public/rfc/bibxml/reference.RFC.2818.xml">
     
<!ENTITY I-D.ietf-sidr-res-certs SYSTEM "http://xml.resource.org/public/rfc/bibxml3/reference.I-D.ietf-sidr-res-certs.xml">
<!ENTITY I-D.ietf-sidr-rpki-manifests SYSTEM "http://xml.resource.org/public/rfc/bibxml3/reference.I-D.ietf-sidr-rpki-manifests.xml">

<!ENTITY I-D.draft-sidr-huston-repos-struct-01 SYSTEM "http://xml.resource.org/public/rfc/bibxml3/reference.I-D.draft-huston-sidr-repos-struct-01.xml">

]>
<?xml-stylesheet type='text/xsl' href='rfc2629.xslt' ?>
<!-- used by XSLT processors -->
<!-- For a complete list and description of processing instructions (PIs), 
     please see http://xml.resource.org/authoring/README.html. -->
<!-- Below are generally applicable Processing Instructions (PIs) that most I-Ds might want to use.
     (Here they are set differently than their defaults in xml2rfc v1.32) -->
<?rfc strict="yes" ?>
<!-- give errors regarding ID-nits and DTD validation -->
<!-- control the table of contents (ToC) -->
<?rfc toc="yes"?>
<!-- generate a ToC -->
<?rfc tocdepth="4"?>
<!-- the number of levels of subsections in ToC. default: 3 -->
<!-- control references -->
<?rfc symrefs="yes"?>
<!-- use symbolic references tags, i.e, [RFC2119] instead of [1] -->
<?rfc sortrefs="yes" ?>
<!-- sort the reference entries alphabetically -->
<!-- control vertical white space 
     (using these PIs as follows is recommended by the RFC Editor) -->
<?rfc compact="yes" ?>
<!-- do not start each main section on a new page -->
<?rfc subcompact="no" ?>
<!-- keep one blank line between list items -->
<!-- end of list of popular I-D processing instructions -->
<rfc category="std" docName="draft-manderson-sidr-fetch-00" ipr="full3978">
  <!-- category values: std, bcp, info, exp, and historic
     ipr values: full3667, noModification3667, noDerivatives3667
     you can add the attributes updates="NNNN" and obsoletes="NNNN" 
     they will automatically be output with "(if approved)" -->

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

  <front>
    <!-- The abbreviated title is used in the page header - it is only necessary if the 
         full title is longer than 39 characters -->

    <title abbrev="RRRM">RPKI Repository Retrieval Mechanism</title>

    <!-- add 'role="editor"' below for the editors if appropriate -->

    <!-- Another author who claims to be an editor -->

    <author fullname="Terry Manderson" initials="T.M."
            surname="Manderson">
      <organization>terrym.net pty ltd</organization>

      <address>
        <postal>
          <street></street>

          <!-- Reorder these if your country does things differently -->

          <city></city>

          <region></region>

          <code></code>

          <country>AU</country>
        </postal>

        <phone>+61 4 1127 5673</phone>

        <email>terry@terrym.net</email>

        <!-- uri and facsimile elements may also be added -->
      </address>
    </author>
    
    <author fullname="George Michaelson" initials="G.G.M"
            surname="Michaelson">
      <organization>APNIC</organization>

      <address>
        <postal>
          <street></street>

          <!-- Reorder these if your country does things differently -->

          <city></city>

          <region></region>

          <code></code>

          <country>AU</country>
        </postal>

        <phone>+61 7 3858 3100</phone>

        <email>ggm@apnic.net</email>

        <!-- uri and facsimile elements may also be added -->
      </address>
      </author>

    
    <date month="October" year="2008" />

    <!-- If the month and year are both specified and are the current ones, xml2rfc will fill 
         in the current day for you. If only the current year is specified, xml2rfc will fill 
	 in the current day and month for you. If the year is not the current one, it is 
	 necessary to specify at least a month (xml2rfc assumes day="1" if not specified for the 
	 purpose of calculating the expiry date).  With drafts it is normally sufficient to 
	 specify just the year. -->

    <!-- Meta-data Declarations -->

    <area>Routing</area>

    <workgroup>Secure Inter-Domain Routing</workgroup>

    <!-- WG name at the upperleft corner of the doc,
         IETF is fine for individual submissions.  
	 If this element is not present, the default is "Network Working Group",
         which is used by the RFC Editor as a nod to the history of the IETF. -->

    <keyword>RRRM</keyword>

    <!-- Keywords will be incorporated into HTML output
         files in a meta tag but they have no effect on text or nroff
         output. If you submit your draft to the RFC Editor, the
         keywords will be used for the search engine. -->

    <abstract>
      <t>This document proposes a mechanism for a relying party to synchronise
a local cache of the RPKI repository using a HTTPS retrieval mechanism.</t>
    </abstract>
  </front>

  <middle>
    <section title="Introduction">
      
       <t>
      This document details a mechanism and algorithm for a relying party to synchronise a local
cache of RPKI objects against the collection of original publication
points.
      </t>

	  <section title="Terminology">
        <t>It is assumed that the reader is familiar with the terms and concepts described in  
         <xref target="RFC5280">"Internet X.509 Public Key Infrastructure Certificate
             and Certificate Revocation List (CRL) Profile"</xref>,
         <xref target="I-D.ietf-sidr-res-certs"> "A Profile for X.509 PKIX Resource Certificates"</xref> 
         <xref target="I-D.ietf-sidr-rpki-manifests">"Manifests for the Resource Public Key Infrastructure"</xref>,
        <!-- <xref target="I-D.draft-sidr-huston-repos-struct-01">"A Profile for Resource Certificate Repository Structure"</xref>, -->
         <xref target="RFC3779">"X.509 Extensions for IP  Addresses and AS Identifiers"</xref>, 
         <xref target="RFC2616">"Hypertext Transfer Protocol -- HTTP/1.1"</xref>,  
         <xref target="RFC2818">"HTTP Over TLS"</xref>,
          and related regional Internet registry address management policy documents.
        </t>
      </section>

      <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 RFC 2119.</t>
      </section>
    </section>

	<section title="Overview">
		<section title="RPKI Repository">
			<t>An RPKI Repository is a collection of RPKI Publication Points. </t>
		</section>
		
		<section title="Publication Points">
			<t>A Publication Point is the location where RPKI objects exist for public use. 
				The Publication Point also contains a manifest of all the RPKI objects that are published at that location. The Publication Point URI is held in the SIA of the 
			RPKI Certificate that signed the objects at that Publication Point.</t>
		</section>
		<section title="RPKI Manifests">
			<t>A manifest is a signed object, listing of all of the RPKI objects at a publication point in the
   RPKI Repository, excluding the manifest itself. The manifest contains the file name and a hash of the contents of the RPKI object file.</t>
   			<t>The URI to the manifest exists in the manifest SIA from the Certificate that signed the manifest.</t>
   			<t>Manifest validation SHOULD be done according to <xref target="I-D.ietf-sidr-rpki-manifests">"Manifests for the Resource Public Key Infrastructure"</xref>.</t>
		</section>

		<section title="Object URI">
			<t>The object location URI is constructed by using the Publish Point from the Signing RPKI Certificate SIA and the File (name) in the manifest signed by the Signing RPKI Certificate.
			The exception to this is the Certificate Authority (CA) certificate and manifest relationship.</t>
		</section>
		<section title="CA and Manifest Relationship">
			<t>In the situation that the certificate in focus is the Certificate Authority (CA) certificate:
				<list style="symbols">
					<t>Like all <xref target="I-D.ietf-sidr-res-certs">RPKI certificates</xref> the CA contains a SIA that identifies a Publish Point and a Manifest.</t>
					<t>The CA signs an End Entity (EE) Certificate for the single purpose of signing the CA manifest.</t>
					<t>The EE certificate has an SIA that also identifies the manifest.</t>
				</list>
			</t>
		</section>
		<section title="Traversing a RPKI Repository">
			<t>A generalised RPKI hierarchy structure of a resource repository, including the out of band collected Trust Anchor (CA), can be represented as:</t>
			
			
			<figure>
				<preamble>
				
				</preamble>
				<artwork>
					<![CDATA[
						
CA Certificate                  CA Publication Point
SIA --Repository------->+------------------------------+
    --Manifest-----------> manifest.cms<-------------------------+
                        |  CRL                         |         |
                        |  subord CA certs             |         |
                        |  subord multi-sign EE certs  |         |
                        |         SIA ------Repository-------+   |
                        |             ------Manifest-------+ |   |
                        |  subord 1:1 Manifest EE cert |   | |   |
                        |         SIA --Object-------------------+
                        |  subord 1:1 EE certs         |   | |
                        |         SIA --Object--+      |   | |
                        |                       |      |   | |
                        |           +-----------+      |   | |
                        |           V                  |   | |
                        |  signed Object               |   | |
                        |                              |   | |
                        +------------------------------+   | |
                                                           | |
                                     ----------------------+ |
                                     |                       |
                        +------------|---------------------+<
                        |            V                     |
                        |         manifest.cms             |
                        |         signed objects           |
                        +----------------------------------+
                              EE Publication Point
                              (for multi-sign EEs)
						
						]]>
				
				</artwork>
			
			
			</figure>
			
			
			<t>The following broad algorithm MAY be used to traverse the hierarchy, starting with the Trust Anchor or CA RPKI Certificate.</t>
			<t><list style="numbers">
				<t>Collect the manifest referenced in the <xref target="I-D.ietf-sidr-res-certs">id-ad-rpkiManifest</xref> Manifest AccessMethod of the SIA of the Certificate.</t>
				<t>Collect, from the Publication Point, every valid object listed in the manifest.</t>
				<t>For each subordinate object with <xref target="I-D.ietf-sidr-res-certs">id-ad-signedObjectRepository</xref> and id-ad-rpkiManifest
				 access method SIA values repeat fom step 1.</t>
			</list></t>
			<t>Processing of each subordinate Publish Point MAY be done in parallel, provided sufficient RPKI material has been collected for Manifest and RPKI validation.</t>
		</section>
			
	</section>

    <section title="Transport Protocol">
  		<section title="HTTPS">
      		<t>When transferring a RPKI objects <xref target="RFC2818">HTTPS</xref> based transfers MUST be used in order to ensure the integrity of the repository site or to 
      		encrypt the retrieval of the RPKI objects. Various HTTPS methods MAY be used to minimise the number of simultaneous fetches and data transfers over the transport connection.
      		It is further recommended that the RRRM client make efforts to reduce the number of simultaneous connections such that a balance exists between the number of open
      		TCP connections and the number of objects retrieved per connection for each publication point.</t>
      	</section>
      	<section title="Other Protocols">
      		<t>The retrieval algorithm specified in this document can also be used by other protocols as an effecient way to synchronise the RPKI repository with a local cache, provided 
      			HTTP specifics such as (and not limited to) redirects, http pragma, connection behaviours and pipe-lining are addresed.</t>
      	</section>
    </section>
     
    
    <section title="Retrieval">
    	
    	
    	<section title="Retrieval Algorithm">
    	
    	<t>If the SIA for the Publish Point of the RPKI Certificate Authority (CA) Certificate or End Entity Certificate defines a HTTPS access method in the URI then 
    	the following algorithm MAY be used by a Retrieval Client for any
   initial and subsequent fetch of certificates and signed outcomes (objects) from an RPKI
   Repository Server (RRS).
		</t>
    	

    	<section title="Post-Fetch Validated (PFV)">
    	<t>
    	<list style="letters">

    		<t>Fetch the appropriate <xref target="I-D.ietf-sidr-rpki-manifests">manifest</xref> from the RRS. 
    		The RC MAY maintain the connection to the RRS with a persistent connection. </t>
    		
    		<t>Confirm the manifest's validity.
    	
    				<list style="symbols">
    					<t>If the manifest is invalid, or the manifest is empty, terminate processing and close any RRS connections</t>
    				</list>

    		</t>
    		
    		<t>Construct a list of URIs to be retrieved by comparing 
    			hash values in the downloaded manifest, with the hash values of the locally cached object:
    		 
    		   <list style="symbols">
    		   	<t>If a local manifest does not exist then all objects
    		 contained in the manifest MUST be listed for retrieval.
    		   </t>
    		 
    		   <t>If an object entry in the downloaded manifest does not exist locally, the URI SHOULD be added to the retrieval list.
    		   </t>
    		   
    		   <t>If an object exists locally and does not appear in the manifest, it SHOULD be deleted from the local cache.
    		   </t>
    		   
    		   <t>If the hash value of the object in the downloaded manifest does not match the hash value of the local copy of the object, 
    		   	the URI of the object SHOULD be added to the retrieval list.
    		   </t>
    		   	
    		   <t>If the retrieval list is empty, terminate processing and close any RRS connections.
    		   </t>
    		   </list>
    		   
    		 </t>
    		 
   			
    		<t>Fetch the list of objects using pipe-lined GET requests. 
    			<list style="symbols">
    				<t>HTTP redirects SHOULD be honoured by the client and followed using a separate RRS connection for the object if located at a different RSS endpoint.
    				</t>
    			</list>
    		</t> 
    		<t>Confirm that all of the objects listed in the downloaded manifest have been retrieved. Should one or more objects fail to retrieve, it is then a matter of local cache policy to 
    			continue with the intent of RPKI validating retrieved objects. The client (and cache policy) should realise that it would be unlikely that enough RPKI
    		    information would then exist locally to fully validate objects from that publication point, and as such processing in this condition may be wasteful. It is also possible that 
    		    an object may have been removed from the publication point between retrival of the manifest and the attempted retrieval of the object.</t>
    		
    		<t>Confirm the hash of the downloaded object file contents matches the hash stored in the downloaded manifest
    			<list style="symbols">
    				<t>If the hash does not match, the object MAY be newer than the manifest and the object SHOULD be RPKI validated.
    				</t>
    				
    			</list>
    		</t>
    		<t>Close any RRS connections.</t>
    		
    		<t>RPKI Validate the retrieved objects and store the validated objects in the local cache.</t>	 
    		
    	</list>
    	</t>
    	</section>
    		 	
    </section>   
    

	
	
    </section>
    
        <section title="Client Considerations">
			
			<section title="Hash Comparison">
			<t>As described in the PFV algorithm, if the hash does not match, the object may be newer than the manifest. 
				It is RECOMMENDED that suitable warnings be generated by the retrieval client to alert to any issues of a hash mismatch.</t>
			</section>
			
			<section title="Hash Mismatch">
			<t>To minimise the occurrences of hash values that do not match, the RC MAY consider postponing retrieval of a RPKI Repository for some period of time either 
				side of the "nextUpdate" time detailed in the manifest.</t>
			
			</section>
			
    </section>

    <!-- This PI places the pagebreak correctly (before the section title) in the text output. -->

    <?rfc needLines="8" ?>


    <section anchor="Acknowledgements" title="Acknowledgements">
      <t>Due recognition needs to be given to all the individuals involved in the inter-RIR Resource Certificate working group.</t>
    </section>

    <!-- Possibly a 'Contributors' section ... -->

    <section anchor="IANA" title="IANA Considerations">
      <t>This memo includes no request to IANA.</t>

    </section>

    <section anchor="Security" title="Security Considerations">
      
      <section title="RRS and Manifest Integrity">
      	<t>A scenario exists where a malicious attack could place an invalid RPKI certificate on the RRS in the Publication Point prior to the 
      		manifest creation. While this does not represent a high risk to the overall Resource Certificate system as the object will fail to validate, 
      		it may affect the Relying Party as:
      		<list style="symbols">
      			<t>An object is extremely large and RC retrieval of the object may cause resource, network, or other types of congestion.</t>
      			<t>Many invalid objects, which the RC must download, may affect overall performance or the RC or the overall Resource Certificate system.</t>
      		</list>
      	</t>

      </section>
      
    </section>
 
  </middle>

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

  <back>
    <!-- References split into informative and normative -->

    <!-- There are 2 ways to insert reference entries from the citation libraries:
     1. define an ENTITY at the top, and use "ampersand character"RFC2629; here (as shown)
     2. simply use a PI "less than character"?rfc include="reference.RFC.2119.xml"?> here
        (for I-Ds: include="reference.I-D.narten-iana-considerations-rfc2434bis.xml")

     Both are cited textually in the same manner: by using xref elements.
     If you use the PI option, xml2rfc will, by default, try to find included files in the same
     directory as the including file. You can also define the XML_LIBRARY environment variable
     with a value containing a set of directories to search.  These can be either in the local
     filing system or remote ones accessed by http (http://domain/dir/... ).-->

    <references title="Normative References">
      <!--?rfc include="http://xml.resource.org/public/rfc/bibxml/reference.RFC.2119.xml"?-->
      
      &RFC3779;
      
      &RFC5280;
      
      &RFC2616;
      
      &RFC2818;
      
      &I-D.ietf-sidr-res-certs;
      
      &I-D.ietf-sidr-rpki-manifests;
      
      &I-D.draft-sidr-huston-repos-struct-01;
     
    </references>
    
   
  </back>
</rfc>