<?xml version="1.0" encoding="UTF-8"?>

<!DOCTYPE rfc SYSTEM "rfc2629.dtd" [
    <!ENTITY rfc2119 PUBLIC '' 
      'http://xml.resource.org/public/rfc/bibxml/reference.RFC.2119.xml'>
]>

<rfc category="std" ipr="trust200902" docName="draft-ietf-sidr-delta-protocol-04">

<?xml-stylesheet type='text/xsl' href='rfc2629.xslt' ?>

<?rfc toc="yes" ?>
<?rfc symrefs="yes" ?>
<?rfc sortrefs="yes"?>
<?rfc iprnotified="no" ?>
<?rfc strict="yes" ?>
<?rfc compact="yes" ?>

  <front>
    <title>RPKI Repository Delta Protocol</title>
    <author initials='T.' surname="Bruijnzeels" fullname='Tim Bruijnzeels'>
      <organization>RIPE NCC</organization>
      <address>
        <email>tim@ripe.net</email>
      </address>
    </author>
    <author initials='O.' surname="Muravskiy" fullname='Oleg Muravskiy'>
      <organization>RIPE NCC</organization>
      <address>
        <email>oleg@ripe.net</email>
      </address>
    </author>
    <author initials='B.' surname="Weber" fullname='Bryan Weber'>
      <organization>Cobenian</organization>
      <address>
        <email>bryan@cobenian.com</email>
      </address>
    </author>
    <author initials='R.' surname="Austein" fullname='Rob Austein'>
      <organization>Dragon Research Labs</organization>
      <address>
        <email>sra@hactrn.net</email>
      </address>
    </author>
    <date />
    <abstract>
        <t>In the Resource Public Key Infrastructure (RPKI), certificate authorities publish certificates, including end
            entity certificates, Certificate Revocation Lists (CRL), and RPKI signed objects to repositories. Relying
            Parties (RP) retrieve the published information from those repositories. This document specifies a delta
            protocol which provides relying parties with a mechanism to query a repository for incremental updates, thus
            enabling the RP to keep its state in sync with the repository.
        </t>
    </abstract>
  </front>

  <middle>
    <section title="Requirements notation">
      <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="Introduction">
      <t>In the Resource Public Key Infrastructure (RPKI), Certificate Authorities (CAs) publish certificates  <xref target="RFC6487" />,
        RPKI signed objects <xref target="RFC6488" />, manifests <xref target="RFC6486" />, and CRLs to repositories.
        CAs may have an embedded mechanism to publish to these repositories, or they may use a separate repository server
        and publication protocol. RPKI repositories are currently accessible using the rsync protocol, allowing Relying
        Parties (RPs) to synchronise a local copy of the RPKI repository used for validation with the remote repositories 
        <xref target="RFC6481" />.
      </t>
      <t>This document specifies an alternative repository access protocol based on notification, snapshot and delta
        files that a RP can retrieve over the HTTPS protocol. This allows RPs to perform either a full (re-)synchronisation
        of their local copy of the repository using snapshot files, or use delta files to keep their local repository
        updated after initial synchronisation.
      </t>
      <t>This protocol is designed to be consistent (in terms of data structures) with the publication protocol <xref
        target="I-D.ietf-sidr-publication"/>
        and treats publication events of one or more repository objects as discrete events that can be communicated to
        relying parties. This approach helps to minimize the amount of data that traverses the network and thus helps
        minimize the amount of time until repository convergence occurs. This protocol also provides a standards based way
        to obtain consistent, point in time views of a single repository, eliminating a number of consistency related issues.
        Finally, this approach allows these discrete events to be communicated as immutable files, so that caching infrastructure
        can be used to reduce the load on a repository server when a large number of relying parties are querying it.</t>
    </section>

    <section title="RPKI Repository Delta Protocol Implementation">

      <section title="Informal Overview">
        <t>Certification Authorities (CA) in the RPKI use a repository server to publish their RPKI products, such as
          manifests, CRLs, signed certificates and RPKI signed objects. This repository server may be remote, or embedded
          in the CA engine itself. Certificates in the RPKI that use a repository server that supports this delta protocol
          include a special Subject Information Access (SIA) pointer referring to a notification file.</t>
        
        <t>The notification file includes a globally unique session_id in the form of a version 4 UUID, and serial number that can be
          used by the Relying Party (RP) to determine if it and the repository are synchronised. Furthermore it includes a link to the
          most recent complete snapshot of current objects that are published by the repository server, and a list of links to delta
          files, for each revision starting at a point determined by the repository server, up to the current revision of the repository.</t>
          
       <t>A RP that learns about a notification file location for the first time can download it, and then proceed to download
          the latest snapshot file, and thus create a local copy of the repository that is in sync with the repository
          server. The RP should remember the location of this notification file, the session_id and current serial number.</t>
          
        <t>RPs are encouraged to re-fetch this notification file at regular intervals, but not more often than once per minute.
          After re-fetching the notification file, the RP may find that there are one or more delta files available that allow it to
          synchronise its local repository with the current state of the repository server. If no contiguous chain of deltas from RP's
          serial to the latest repository serial is available, or if the session_id has changed, the RP should perform a full
          resynchronisation instead.</t>
          
        <t>As soon as the RP fetches new content in this way it should start a validation process. An example of a reason why a RP may not do this immediately is because it has learned of more than one
          notification location and it prefers to complete all its updates before validating.</t>

        <t>The repository server may use caching infrastructure to reduce its load. It should be noted that snapshots
          and deltas for any given session_id and serial number contain an immutable record of the state of the repository
          server at a certain point in time. For this reason these files can be cached indefinitely. Notification files
          are polled by RPs to discover if updates exist, and for this reason notification files may not be cached for
          longer than one minute.</t>
       
      </section>

      <section title="Certificate Authority Use">
      
        <t>
          Certificate Authorities that use this delta protocol MUST include an instance of an SIA
          AccessDescription extension in resource certificates they produce, in addition to the ones defined in <xref
          target="RFC6487" />,
        </t>
        <t> 
        <figure>
            <artwork><![CDATA[
          AccessDescription ::= SEQUENCE {
            accessMethod OBJECT IDENTIFIER,
            accessLocation GeneralName }
            ]]></artwork>
          </figure>
        </t>
        <t>
          This extension MUST use an accessMethod of id-ad-rpkiNotify, see: <xref target="IANA-AD-NUMBERS" />,
        </t>
        <t>
          <figure>
            <artwork><![CDATA[
            id-ad OBJECT IDENTIFIER ::= { id-pkix 48 }
            id-ad-rpkiNotify OBJECT IDENTIFIER ::= { id-ad 13 }
            ]]></artwork>
          </figure>
        </t>
        <t>
           The accessLocation MUST be an HTTPS URI as defined in <xref target="RFC2818" />, that will point
           to the update notification file for the repository server that publishes the products of this CA certificate.</t>
        <t>Relying Parties that do not support this delta protocol MUST NOT reject a CA certificate merely because it 
           has an SIA extension containing this new kind of AccessDescription.</t>
      </section>
      
    <section title="Repository Server Use">
    
        <section title="Initialisation" anchor="Initialise">
          <t>When the repository server initialises it must perform the following actions:
            <list>
              <t>The server MUST generate a new random version 4 UUID to be used as the session_id</t>
              <t>The server MUST then generate a snapshot file for serial number ONE for this new session that includes 
              all currently known published objects that the repository server is responsible for. Note that this snapshot
              file MAY contain zero publish elements at this point if no objects have been submitted for publication yet.</t>
              <t>This snapshot file MUST be made available at a URL that is unique to this session_id and serial number,
              so that it can be cached indefinitely.</t>
              <t>The format and caching concerns for snapshot files are explained in more detail in <xref target="Snapshot"/>.</t>
              <t>After the snapshot file has been published the repository server MUST publish a new notification file
              that contains the new session_id, has serial number ONE, has one reference to the snapshot file that was
              just published, and that contains no delta references.</t>
              <t>The format and caching concerns for update notification files are explained in more detail in <xref target="notification"/>.</t>
            </list>
          </t> 
          
        </section>
        
        <section title="Publishing Updates">
          <t>Whenever the repository server receives updates from a CA it SHOULD generate new snapshot and delta files.
          However, if a publication server services a large number of CAs it MAY choose to combine updates from multiple
          CAs. If a publication server combines updates in this way, it MUST NOT postpone publishing for longer than
          one minute.</t>
          
          <t>Updates must be processed as follows:
             <list style="symbols">
              <t>The new repository serial number MUST be one greater than the current repository serial number.</t>
              <t>A new delta file MUST be generated for this new serial. This delta file MUST include all new, replaced and
                 withdrawn objects for multiple CAs if applicable, as a single change set.</t>
              <t>This delta file MUST be made available at a URL that is unique to the current session_id and serial number,
                so that it can be cached indefinitely.</t>
              <t>The format and caching concerns for delta files are explained in more detail in <xref target="Delta"/>.</t>
              <t>The repository server MUST also generate a new snapshot file for this new serial. This file MUST contain all "publish"
                 elements for all current objects.</t>
              <t>The snapshot file MUST be made available at a URL that is unique to this session and new serial, so
                that it can be cached indefinitely. </t>
               <t>The format and caching concerns for snapshot files are explained in more detail in <xref
                 target="Snapshot" />.</t>
               <t>The update notification file SHOULD be kept small, and in order to do so the repository server needs
                 to make a decision about which delta files to support. Any older delta files that, when combined with
                 all more recent delta files, will result in total size of deltas exceeding the size of the snapshot,
                 MUST be excluded.</t>
               <t>The server MAY also exclude more recent delta files if it finds that their usage by a small number of
                 RPs that would be forced to perform a full synchronisation is outweighed by the performance penalty
                 for all RPs in having a large update notification file. However the repository server SHOULD include
                 all deltas for the last two hours.</t>
              <t>A new notification file MUST now be created by the repository server. This new notification file MUST
                 include a reference to the new snapshot file, and all delta files selected in the previous steps.</t>
               <t>The format and caching concerns for update notification files are explained in more detail in <xref
                 target="notification" />.</t>
             </list>
          </t>

          <t>If the repository server is not capable of performing the above for some reason, then it MUST perform a full
             re-initialisation, as explained above in <xref target="Initialise"/>.</t>
        </section>    
    
    </section>      

    <section title="Relying Party Use">
          
         <section title="Processing the Update Notification File" anchor="validation">
            <t>When a Relying Party (RP) performs RPKI validation and learns about a valid
            certificate with an SIA entry for the RRDP protocol, it SHOULD prefer to use
            this protocol as follows.</t>
            
         	<t>The RP SHOULD download the update notification file, unless an update notification
         	file was already downloaded and processed from the same location in this validation
         	run.</t>
         	
         	<t>The RP MAY use a "User-Agent" header explained in section 5.5.3. of <xref target="RFC7231" />
         	to identify the name and version of the RP software used. This is not required, but
         	would be useful to help track capabilities of Relying Parties in the event of changes
         	to the RPKI standards.</t>
         	
         	<t>When the RP downloads an update notification file it MUST verify the file format
         	and validation steps described in section <xref target="notification-file-validation" />.
         	If this verification fails, the file MUST be rejected.</t>
         	
         	<t>The RP MUST verify whether the session_id in this update notification file matches
         	the last known session_id for this update notification file location. If the session_id
         	matches the last known session_id, then an RP MAY download and process missing delta files
         	as described in section <xref target="process-deltas"/>, provided that all delta files
         	for serial numbers between the last processed serial number and the current serial number
         	in the notification file can be processed this way.</t>
         	
         	<t>If the session_id was not previously known, or if delta files could not be used,
         	then the RP MUST update its last known session_id to this session_id and download and process
         	snapshot file on the update notification file as described in section <xref target="process-snapshot" />.</t>
         	
         	<t>If neither update notification file and one snapshot file or delta files could be
         	processed this way, the RP MUST issue an operator error, and SHOULD use an alternate
         	repository retrieval mechanism if it is available.</t>
         	
         </section>
         
         <section title="Processing a Snapshot File" anchor="process-snapshot">        	
         	<t>When the RP downloads a snapshot file it MUST verify the file format
         	and validation steps described in <xref target="snapshot-file-validation" />.
         	If this verification fails, the file MUST be rejected.</t>
         	
         	<t>Furthermore the RP MUST verify that the hash of the contents of this file
         	matches the hash on the update notification file that referenced it. In case
         	of a mismatch of this hash, the file MUST be rejected.</t>
         	
         	<t>If an RP retrieved a snapshot file that is valid according to the above
         	criteria, it should perform the following actions:
              <list>
                
                <t>The RP MUST verify that the session_id matches the session_id of the notification file.
                If the session_id values do not match the file MUST be rejected.</t>
                
                <t>The RP MUST verify that the serial number of this snapshot file is greater than the last 
                processed serial number for this session_id. If this fails the file MUST be rejected.</t>
                
                <t>The RP SHOULD then add all publish elements to a local storage and update its last
                processed serial number to the serial number of this snapshot file.</t>
                
         	  </list>
         	</t>
         </section>

         <section title="Processing Delta Files" anchor="process-deltas">
         
			<t>If an update notification file contains a contiguous chain of links to delta files from
			the last processed serial number to the current serial number, then RPs MUST attempt to download
			and process all delta files in order of serial number as follows.</t>

         <t>When the RP downloads a delta file it MUST verify the file format and perform validation steps
         described in <xref target="delta-file-validation" />. If this verification fails,
         the file MUST be rejected.</t>
         	
			<t>Furthermore the RP MUST verify that the hash of the contents of this file matches the hash on
			the update notification file that referenced it. In case of a mismatch of this hash, the file
			MUST be rejected.</t>

			<t>If an RP retrieved a delta file that is valid according to the above
         	criteria, it should perform the following actions:
              <list>
                
                <t>The RP MUST verify that the session_id matches the session_id of the notification file.
                If the session_id values do not match the file MUST be rejected.</t>
                
                <t>The RP MUST verify that the serial number of this delta file is exactly one greater
                than the last processed serial number for this session_id, and if not this file MUST be rejected.</t>
                
                <t>The RP SHOULD add all publish elements to a local storage and update its last processed
                serial number to the serial number of this snapshot file.</t>
                
                <t>The RP SHOULD NOT remove objects from its local storage solely because it encounters 
                a "withdraw" element, because this would enable a publication server to withdraw any object
                without the signing Certificate Authority consent. Instead it is RECOMMENDED that a RP uses
                additional strategies to determine if an object is still relevant for validation before removing
                it from its local storage.</t>
                
              </list>
            </t>
         </section>
      
         <section title="Polling the Update Notification File">
           
           <t>Once a Relying Party has learned about the location, session_id and
           last processed serial number of repository that uses the RRDP protocol,
           the RP MAY start polling the repository server for updates. However the RP
           MUST NOT poll for updates more often than once every 1 minute, and in order
           to reduce data usage RPs MUST use the "If-Modified-Since" header explained
           in section 3.3 of <xref target="RFC7232" />in requests.</t>
           
           <t>If an RP finds that updates are available it SHOULD download and process the file
           as described in <xref target="validation"/>, and initiate a new validation
           process. A detailed description of the validation process itself is out of scope of
           this document.</t>
           
         </section>
         

         
      
    </section>

      <section title="File Definitions">

      <section title="Update Notification File" anchor="notification">
      
        <section title="Purpose">
          <t>The update notification file is used by RPs to discover whether any changes exist between the state of the
            repository and the RP's cache. It describes the location of the files containing the
            snapshot and incremental deltas which can be used by the RP to synchronise with the repository.</t>
        </section>
      
        <section title="Cache Concerns" anchor="Notify-Cache">
          <t>A repository server MAY use caching infrastructure to cache the notification file and reduce the load
             of HTTPS requests. However, since this file is used by RPs to determine whether any updates are available
             the repository server MUST ensure that this file is not cached for longer than 1 minute. An exception to
             this rule is that it is better to serve a stale notification file, then no notification file.</t>

          <t>How this is achieved exactly depends on the caching infrastructure used. In general a repository
             server may find certain HTTP headers to be useful, such as: Cache-Control: max-age=60. Another approach
             can be to have the repository server push out new versions of the notification file to the caching
             infrastructure when appropriate.</t>
        
          <t>Relying Parties SHOULD NOT cache the notification file for longer than 1 minute, regardless of the
             headers set by the repository server or CDN.</t>     

        </section>
        
        <section title="File Format and Validation" anchor="notification-file-validation">

          <t>Example notification file:</t>
        
          <figure>
            <artwork> <![CDATA[
   <notification xmlns="http://www.ripe.net/rpki/rrdp"
         version="1"
         session_id="9df4b597-af9e-4dca-bdda-719cce2c4e28"
         serial="3">
     <snapshot uri="https://host/9d-8/3/snapshot.xml" hash="AB"/>
     <delta serial="3" uri="https://host/9d-8/3/delta.xml" hash="CD"/>
     <delta serial="2" uri="https://host/9d-8/2/delta.xml" hash="EF"/>
   </notification>            
]]></artwork>
          </figure>
          
          <t>Note: URIs and hash values in this example are shortened because of formatting.</t>
           
          <t>The following validation rules must be observed when creating or parsing notification files:
            <list style="symbols">
              <t>A RP MUST reject any update notification file that is not well-formed, or which
              does not conform to the RELAX NG schema outlined in <xref target="Relax-NG" /> of this
              document.</t>
              <t>The XML namespace MUST be http://www.ripe.net/rpki/rrdp</t>
              <t>The encoding MUST be US-ASCII</t>
              <t>The version attribute in the notification root element MUST be 1</t>
              <t>The session_id attribute MUST be a random version 4 UUID unique to this session</t>
              <t>The serial attribute must be an unbounded, unsigned positive integer in decimal format
              indicating the current version of the repository.</t>
              <t>The notification file MUST contain exactly one 'snapshot' element for the current
              repository version.</t>
              <t>If delta elements are included they MUST form a contiguous sequence of serial numbers
              starting at a revision determined by the repository server, up to the serial number
              mentioned in the notification element.</t>
              <t>The hash attribute in snapshot and delta elements must be the hexadecimal encoding
              of the SHA-256 hash of the referenced file. The RP MUST verify this hash when the
              file is retrieved and reject the file if the hash does not match.</t>
            </list>
          </t>
           
        </section>
      </section>

      <section title="Snapshot File" anchor="Snapshot">
      
        <section title="Purpose">
          <t>A snapshot is intended to reflect the complete and current contents of the repository for a specific session and version.
             Therefore it  MUST contain all objects from the repository current as of the time of the publication.</t>
        </section>
        
        <section title="Cache Concerns" anchor="Snapshot-Cache">
          <t>A snapshot reflects the content of the repository at a specific point in time, and for that reason
             can be considered immutable data. Snapshot files MUST be published at a URL that is unique to the
             specific session and serial.</t>
             
          <t>Because these files never change, they MAY be cached indefinitely. However, in order to prevent that
             these files use a lot of space in caching infrastructure it is RECOMMENDED that a limited interval
             is used in the order of hours or days.</t>
             
          <t>To avoid race conditions where an RP downloads a notification file moments before it's updated,
             Repository Servers SHOULD retain old snapshot files for at least 5 minutes after a new notification file
             is published.</t>
             
        </section>
        
        <section title="File Format and Validation" anchor="snapshot-file-validation">
        
          <t>Example snapshot file:</t>

          <figure>
            <artwork> <![CDATA[
   <snapshot xmlns="http://www.ripe.net/rpki/rrdp"
          version="1"
          session_id="9df4b597-af9e-4dca-bdda-719cce2c4e28"
          serial="2">
     <publish uri="rsync://rpki.ripe.net/Alice/Bob.cer">
       ZXhhbXBsZTE=
     </publish>
     <publish uri="rsync://rpki.ripe.net/Alice/Alice.mft">
       ZXhhbXBsZTI=
     </publish>
     <publish uri="rsync://rpki.ripe.net/Alice/Alice.crl">
       ZXhhbXBsZTM=
     </publish>
   </snapshot>]]></artwork>
        </figure>       
        
          <t>The following rules must be observed when creating or parsing snapshot files:
            <list style="symbols">
              <t>A RP MUST reject any snapshot file that is not well-formed, or which does not conform to the RELAX NG
                 schema outlined in <xref target="Relax-NG" /> of this document.</t>
              <t>The XML namespace MUST be http://www.ripe.net/rpki/rrdp.</t>
              <t>The encoding MUST be US-ASCII.</t>
              <t>The version attribute in the notification root element MUST be 1</t>
              <t>The session_id attribute MUST match the expected session_id in the reference in the notification file.</t>
              <t>The serial attribute MUST match the expected serial in the reference in the notification file.</t>
              <t>Note that the publish element is defined in the publication protocol <xref target="I-D.ietf-sidr-publication"/></t>
            </list>
          </t>       
        
        
        </section>
      </section>

      <section title="Delta File" anchor="Delta">
      
        <section title="Purpose">
	        <t>An incremental delta file contains all changes for exactly one serial increment of the repository server.
	           In other words a single delta will typically include all the new objects, updated objects and withdrawn objects
	           that a Certification Authority sent to the repository server. In its simplest form the update could concern
	           only a single object, but it is recommended that CAs send all changes for one of their key pairs: i.e. updated
	           objects as well as a new manifest and CRL as one atomic update message.  
	        </t>
        </section>
        
        <section title="Cache Concerns" anchor="Delta-Cache">
        
          <t>Deltas reflect the difference between two consecutive versions of a repository for a given session. For
             that reason deltas can be considered immutable data. Delta files MUST be published at a URL that is unique
             to the specific session and serial.</t>
             
          <t>Because these files never change, they MAY be cached indefinitely. However, in order to prevent these files
             from using a lot of space in caching infrastructure it is RECOMMENDED that a limited interval is used in the
             order of hours or days.</t>
             
          <t>To avoid race conditions where an RP downloads a notification file moments before it's updated,
             Repository Servers SHOULD retain old delta files for at least 5 minutes after they are no no longer included
             in the latest notification file.</t>

         </section>
                
        <section title="File Format and Validation" anchor="delta-file-validation">

          <t>Example delta file:</t>
          
          <figure>
            <artwork> <![CDATA[
  <delta xmlns="http://www.ripe.net/rpki/rrdp"
         version="1"
         session_id="9df4b597-af9e-4dca-bdda-719cce2c4e28"
         serial="3">
    <publish uri="rsync://rpki.ripe.net/repo/Alice/Alice.mft"
             hash="50d8...545c">
      ZXhhbXBsZTQ=
    </publish>
    <publish uri="rsync://rpki.ripe.net/repo/Alice/Alice.crl"
             hash="5fb1...6a56">
      ZXhhbXBsZTU=
    </publish>
    <withdraw uri="rsync://rpki.ripe.net/repo/Alice/Bob.cer"
              hash="caeb...15c1"/>
  </delta>]]></artwork>
          </figure>        
          
          <t>Note that a formal RELAX NG specification of this file format is included later in this document. A RP MUST
             NOT process any delta file that is incomplete or not well-formed.</t>
             
          <t>The following validation rules must be observed when creating or parsing delta files:
            <list style="symbols">
              <t>A RP MUST reject any delta file that is not well-formed, or which does not conform to the RELAX NG
                 schema outlined in <xref target="Relax-NG" /> of this document.</t>
              <t>The XML namespace MUST be http://www.ripe.net/rpki/rrdp.</t>
              <t>The encoding MUST be US-ASCII.</t>
              <t>The version attribute in the delta root element MUST be 1</t>
              <t>The session_id attribute MUST be a random version 4 UUID unique to this session</t>
              <t>The session_id attribute MUST match the expected session_id in the reference in the notification file.</t>
              <t>The serial attribute MUST match the expected serial in the reference in the notification file.</t>
              <t>Note that the publish and withdraw elements are defined in the publication protocol <xref target="I-D.ietf-sidr-publication"/></t>
            </list>
          </t> 
        
        </section>
      </section>

    <section title="XML Schema" anchor="Relax-NG">
      <t>The following is a RELAX NG compact form schema describing version 1 of this protocol.</t>
      <figure>
        <artwork><![CDATA[
#
# RelaxNG schema for RPKI Repository Delta Protocol (RRDP).
#

default namespace = "http://www.ripe.net/rpki/rrdp"

version = xsd:positiveInteger   { maxInclusive="1" }
serial  = xsd:nonNegativeInteger
uri     = xsd:anyURI
uuid    = xsd:string            { pattern = "[\-0-9a-fA-F]+" }
hash    = xsd:string            { pattern = "[0-9a-fA-F]+" }
base64  = xsd:base64Binary

# Notification file: lists current snapshots and deltas

start |= element notification {
  attribute version    { version },
  attribute session_id { uuid },
  attribute serial     { serial },
  element snapshot {
    attribute uri  { uri },
    attribute hash { hash }
  },
  element delta {
    attribute serial { serial },
    attribute uri    { uri },
    attribute hash   { hash }
  }*
}

# Snapshot segment: think DNS AXFR.

start |= element snapshot {
  attribute version    { version },
  attribute session_id { uuid },
  attribute serial     { serial },
  element publish      {
    attribute uri { uri },
    base64
  }*
}

# Delta segment: think DNS IXFR.

start |= element delta {
  attribute version    { version },
  attribute session_id { uuid },
  attribute serial     { serial },
  delta_element+
}

delta_element |= element publish  {
  attribute uri  { uri },
  attribute hash { hash }?,
  base64
}

delta_element |= element withdraw {
  attribute uri  { uri },
  attribute hash { hash }
}

# Local Variables:
# indent-tabs-mode: nil
# comment-start: "# "
# comment-start-skip: "#[ \t]*"
# End:
        ]]></artwork>
      </figure>
    
    </section>



      </section>
      
    </section>
    
    <section title="HTTPS considerations" anchor="https_concerns">
       <t>It is RECOMMENDED that Relying Parties and Publication Servers follow
       the Best Current Practices outlined in <xref target="RFC7525" /> on the
       use of HTTP over TLS (https).</t>
       <t>Note that a Man-in-the-Middle (MITM) cannot produce validly signed
       RPKI data, but they can perform withhold or replay attacks targeting an
       RP, and keep the RP from learning about changes in the RPKI. Because of
       this RPs SHOULD do TLS certificate and host name validation when they
       fetch from an RRDP Publication Server</t>
       <t>However, such validation issues are often due to configuration errors,
       or a lack of a common TLS trust anchor. In these cases it would be better
       that the RP retrieves the signed RPKI data regardless, and performs
       validation on it.</t>
       <t>Therefore RPs SHOULD log any TLS certificate or host name validation
       issues they find, so that an operator can investigate the cause. But the
       RP MUST continue to retrieve the data. The RP MAY choose to log this
       issue only when fetching the notification update file, but not when
       it subsequently fetches snapshot or delta files from the same host.
       Furthermore the RP MAY provide a way for operators to accept untrusted
       connections for a given host, after the cause has been identified.</t>
    </section>

    <section title="Security Considerations">
      <t>RRDP deals exclusively with transfer of RPKI objects from a repository
      server to a relying party. The trust relation between a CA and its
      repository server is out of scope for this document. However, it
      should be noted the from a relying party point of view all RPKI objects
      (certificates, CRLs, and CMS-wrapped objects) are already covered by
      object security mechanisms including signed manifests. This allows
      validation of these objects even though the repository server itself is
      not trusted. This document makes no change to RPKI validation procedures
      per se.</t>
     
      <t>The original RPKI transport mechanism is rsync, which offers no channel
      security mechanism. RRDP replaces the use of rsync by HTTPS; while the
      channel security mechanism underlying RRDP (HTTPS) is not a cure-all, it
      does make some forms of denial of service attack more difficult for the
      attacker. HTTPS issues are discussed in more detail in
      <xref target="https_concerns" />.</t>
      
      <t>Supporting both RRDP and rsync necessarily increases the number of
      opportunities for a malicious RPKI CA to perform denial of service attacks
      on relying parties, by expanding the number of URIs which the RP may need
      to contact in order to complete a validation run. However, other than the
      relative cost of HTTPS versus rsync, adding RRDP to the mix does not
      change this picture significantly: with either RRDP or rsync a malicious
      CA can supply an effectively infinite series of URIs for the RP to follow.
      The only real solution to this is for the RP to apply some kind of bound
      to the amount of work it is willing to do.  Note also that the attacker in
      this scenario must be an RPKI CA, since otherwise the normal RPKI object
      security checks would reject the malicious URIs.</t>
      
      <t>Processing costs for objects retrieved using RRDP may be somewhat
      different from the same objects retrieved using rsync: because RRDP treats
      an entire set of changes as a unit (one "delta"), it may not be practical
      to start processing any of the objects in the delta until the entire delta
      has been received.  With rsync, by contrast, incremental processing may be
      easy, but the overall cost of transfer may be higher, as may be the number
      of corner cases in which the RP retrieves some but not all of the updated
      objects.  Overall, RRDP's behavior is closer to a proper transactional
      system, which (probably) leads to an overall reliability increase.</t>
      
      <t>RRDP is designed to scale much better than rsync.  In particular, RRDP
      is designed to allow use of HTTPS caching infrastructure to reduce load on
      primary publication servers and increase resilience against denial of
      service attacks on the RPKI publication service.</t>

    </section>
    <section title="IANA Considerations">
      <t>IANA is requested to update the reference for id-ad-rpkiNotify to this
      document in the PKIX Access Descriptor registry
      <xref target="IANA-AD-NUMBERS" />.</t>
    </section>
    <section title="Acknowledgements">
      <t>The authors would like to thank David Mandelberg for reviewing this
      document.</t>
    </section>
  </middle>

  <back>
    <references title="Normative References">
        <?rfc include="reference.RFC.2119.xml"?>
        <?rfc include="reference.RFC.2818.xml"?>
        <?rfc include="reference.RFC.6481.xml"?>
        <?rfc include="reference.RFC.6486.xml"?>
        <?rfc include="reference.RFC.6488.xml"?>
        <?rfc include="reference.RFC.6487.xml"?>
        <?rfc include="reference.RFC.7231.xml"?>
        <?rfc include="reference.RFC.7232.xml"?>
        <?rfc include="reference.RFC.7525.xml"?>        
        <?rfc include="reference.I-D.ietf-sidr-publication"?>
        <reference anchor="IANA-AD-NUMBERS" target="http://www.iana.org/assignments/smi-numbers/smi-numbers.xhtml#smi-numbers-1.3.6.1.5.5.7.48">
          <front>
            <title>SMI Security for PKIX Access Descriptor</title>
            <author/>
            <date/>
          </front>
        </reference>
    </references>

  </back>

</rfc>
