<?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-06"
     updates="6480,6481,7730">

<?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 protocol which provides
            relying parties with a mechanism to query a repository for
            incremental updates using the <xref target="RFC2818">HTTP Over TLS
            (HTTPS)</xref> protocol, thus enabling the RP to keep its state in
            sync with the repository using a secure transport channel. This
            document updates <xref target="RFC6480"/>, <xref
                target="RFC6481"/>, and <xref target="RFC7730"/>, to remove the
            dependency on <xref target="rsync" /> as the only mandatory RPKI
            repository distribution mechanism.
        </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 <xref target="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. We call this the RPKI Repository Delta Protocol, or RRDP in short.
      </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>
      <t>In order to facilitate transition to this new protocol, this
        document updates the texts of <xref target="RFC6480"/>, <xref
          target="RFC6481"/>, and <xref target="RFC7730"/>, removing the
        dependency on <xref target="rsync" /> as the only mandatory RPKI
        repository distribution mechanism, and allowing use of a non-rsync
        URI in a Trust Anchor Locator file.
      </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 (<xref target="RFC4122"/>), 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 records 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 performs a full
          resynchronisation instead.</t>

        <t>As soon as the RP fetches new content in this way it could 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 could use caching infrastructure to reduce its
          load, particularly because 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_considerations" />:
        </t>
        <t>
          <figure>
            <artwork><![CDATA[
  id-pkix OBJECT IDENTIFIER ::= { iso(1) identified-organization(3)
    dod(6) internet(1) security(5) mechanisms(5) pkix(7) }

  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>
      </section>

    <section title="Repository Server Use">

        <section title="Initialisation" anchor="Initialise">
          <t>When the repository server initialises it performs the following
            actions:
            <list style="symbols">
              <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. 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. 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" anchor="publishing-updates">
          <t>Whenever the repository server receives updates from a CA it MUST generate new snapshot and delta files within
          one minute. 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 ensure that publication never postponed for
          longer than one minute for any of the CAs involved.</t>

          <t>Updates are 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>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 to avoid that RPs download more data
                than necessary.</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 use this protocol
            as follows.</t>

         	<t>The RP MUST download the update notification file, unless an update notification
         	file was already downloaded and processed from the same location in this validation
         	run, or because a polling strategy was used (see <xref target="polling_notification"/>).</t>

           <t>It is RECOMMENDED that RP uses 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. It is useful to 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 and RRDP cannot be used. See
         	<xref target="operational_failures" /> for considerations.</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>

         </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 performs 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 delta 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. The RP could use
                additional strategies to determine if an object is still relevant for validation before removing
                it from its local storage. In particular objects should not be removed if they are included
                in a current validated manifest.</t>

              </list>
            </t>

            <t>If any delta file is rejected RPs MUST process the current Snapshot File instead, as described
            in <xref target="process-snapshot" />.</t>
         </section>

        <section title="Processing a Snapshot File" anchor="process-snapshot">

            <t>Snapshot Files MUST only be used if Delta Files are unavailable,
            or were rejected. As is ensured, if the process described
            in <xref target="validation" /> is followed.</t>

         	<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 performs 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>

         	<t>If a Snapshot File is rejected that means that RRDP cannot be used. See
         	<xref target="operational_failures" /> for considerations.</t>
         </section>

         <section title="Polling the Update Notification File" anchor="polling_notification">

           <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 RPKI object validation
           process. However, a detailed description of the RPKI object validation process itself
           is out of scope of this document.</t>

         </section>

         <section title="Considerations Regarding Operational Failures in RRDP" anchor="operational_failures">

            <t>If an RP experiences any issues with retrieving or processing any of the files
            used in this protocol, it will be unable to retrieve new RPKI data from the affected
            publication server.</t>

           <t>Relying Parties could attempt to use alternative repository access
             mechanisms, if they are available, according to the accessMethod
             element value(s) specified in the SIA of the associated
             certificate (see Section 4.8.8 of <xref target="RFC6487"/>).
           </t>

           <t>Furthermore Relying Parties may wish to employ re-try strategies
             while fetching RRDP files. Relying Parties are also advised to keep
             old objects in their local cache
            so that validation can be done using old objects.</t>

            <t>It is also recommendable that re-validation and retrieval is performed pro-actively
            before manifests or CRLs go stale, or certificates expire, to ensure that problems
            on the side of the RP can be identified and resolved before they cause major concerns.</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 SHOULD 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, than 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"
             (see Section 5.2 of <xref target="RFC7234"/>). 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>In case of a high load on a repository server or its distribution
            network, the Cache-Control HTTP header, or a similar mechanism, MAY
            be used to suggest an optimal (for the repository server) poll
            interval for Relying Parties. However, setting it to an interval
            longer than 1 hour is NOT RECOMMENDED. Relying parties SHOULD align
            the suggested interval with their operational practices and the
            expected update frequency of RPKI repository data, and MAY discard
            suggested value.
          </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
                  (<xref target="RFC4122" />), 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. Note that the elements may not be ordered.</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 similar to the publish element defined in the publication protocol
                 <xref target="I-D.ietf-sidr-publication"/>. However, the "tag" attribute is not used here because it is not
                 relevant to relying parties. The "hash" attribute is not used here because this file represents
                 a complete current state of the repository, and therefore it is not relevant to know which existing RPKI
                 object (if any) is updated.</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 (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 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 element is similar to the publish element defined in the publication protocol
                 <xref target="I-D.ietf-sidr-publication"/>. However, the "tag" attribute is not used here because it is not
                 relevant to relying parties.</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:positiveInteger
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="Updates">
      <t>This section provides updates to several paragraphs in
        <xref target="RFC6480"/>, <xref target="RFC6481"/>, and
        <xref target="RFC7730"/>. For clarity, the original text and the
        replacement text are shown.
      </t>

      <section title="Updates to RFC6480">
        <section title="Update in Section 4.3, Access Protocols">
          <t>OLD:
            <list>
              <t>To ensure all relying parties are able to acquire all RPKI
                signed objects, all publication points MUST be accessible via
                rsync (see [RFC5781] and [RSYNC]), although other download
                protocols MAY also be supported. A repository publication point
                may provide update/change/delete functionality via (set of)
                access protocols that it desires, provided that the supported
                protocols are clearly communicated to all certification
                authorities publishing data at a given publication point.
              </t>
            </list>
            NEW:
            <list>
              <t>To ensure all relying parties are able to acquire all RPKI
                signed objects, all publication points MUST be accessible using
                retrieval mechanism(s) consistent with the accessMethod element
                value(s). Multiple retrieval mechanisms MAY be supported at the
                repository operator’s discretion. A repository publication point
                may provide update/change/delete functionality via (set of)
                access protocols that it desires, provided that the supported
                protocols are clearly communicated to all certification
                authorities publishing data at a given publication point.
              </t>
            </list>
          </t>
        </section>
        <section title="Update in Section 11.1, Normative References">
          <t>Remove the reference to RFC5781, "The rsync URI Scheme".</t>
        </section>
        <section title="Update in Section 11.2, Informative References">
          <t>Remove the reference to rsync, "rsync web pages".</t>
        </section>
      </section>

      <section title="Updates to RFC6481">
        <section
          title="Update in Section 3, Resource Certificate Publication Repository Considerations">
          <t>OLD:
            <list>
              <t>The publication repository MUST be available using rsync
                [RFC5781] [RSYNC]. Support of additional retrieval mechanisms is
                the choice of the repository operator. The supported retrieval
                mechanisms MUST be consistent with the accessMethod element
                value(s) specified in the SIA of the associated CA or EE
                certificate.
              </t>
            </list>
            NEW:
            <list>
              <t>The publication repository MUST be available using retrieval
                mechanism(s) consistent with the accessMethod element value(s)
                specified in the SIA of the associated CA or EE certificate.
                Support of multiple retrieval mechanisms is the choice of the
                repository operator.
              </t>
            </list>
          </t>
        </section>
        <section title="Update in Section 9.1, Normative References">
          <t>Remove the reference to RFC5781, "The rsync URI Scheme".</t>
        </section>
        <section title="Update in Section 9.2, Informative References">
          <t>Remove the reference to rsync, "rsync web pages".</t>
        </section>
      </section>

      <section title="Updates to RFC7730">
        <section title="Update in Section 2.1, Trust Anchor Locator Format">
          <t>OLD:
            <list>
              <t>where the URI section is comprised of one of more of the
                ordered sequence of:
                <list>
                  <t>1.1) an rsync URI [RFC5781],</t>
                  <t>1.2) a &lt;CRLF&gt; or &lt;LF&gt; line break.</t>
                </list>
              </t>
            </list>
          </t>
          <t>NEW:
            <list>
              <t>where the URI section is comprised of one of more of the
                ordered sequence of:
                <list>
                  <t>1.1) a URI [RFC3986],</t>
                  <t>1.2) a &lt;CRLF&gt; or &lt;LF&gt; line break.</t>
                </list>
              </t>
            </list>
          </t>
        </section>
        <section
          title="Update in Section 2.2, TAL and Trust Anchor Certificate Considerations">
          <t>OLD:
            <list>
              <t>Each rsync URI in the TAL MUST reference a single object. It
                MUST NOT reference a directory or any other form of collection
                of objects.
              </t>
              <t>...</t>
              <t>Where the TAL contains two or more rsync URIs, then the same
                self-signed CA certificate MUST be found at each referenced
                location.
              </t>
            </list>
          </t>
          <t>NEW:
            <list>
              <t>Each URI in the TAL MUST reference a single object. It MUST NOT
                reference a directory or any other form of collection of
                objects.
              </t>
              <t>...</t>
              <t>Where the TAL contains two or more URIs, then the same
                self-signed CA certificate MUST be found at each referenced
                location.
              </t>
            </list>
          </t>
        </section>
        <section title="Update in Section 5.1, Normative References">
          <t>Remove the reference to RFC5781, "The rsync URI Scheme".</t>
          <t>Add a reference to RFC3986, "Uniform Resource Identifier (URI):
            Generic Syntax".
          </t>
        </section>
      </section>
    </section>

    <section title="Operational Considerations"
             anchor="operational-considerations">
      <section title="Compatibility with previous standards">
        <t>This protocol has been designed to replace rsync as a distribution
          mechanism of an RPKI repository. However, it is also designed to
          co-exist with existing implementations based on rsync, to enable
          smooth transition from one distribution mechanism to another.
        </t>
        <t>For every repository object listed in the snapshot and delta files
          both the hash of the object's content and the <xref
            target="RFC5781">rsync URI</xref> of its location in the repository
          are listed. This
          makes it possible to distribute the same RPKI repository, represented
          by a set of files on a filesystem, using both rsync and RRDP. It also
          enables Relying Parties tools to query, combine, and consequently
          validate objects from repositories of different types. (For an example
          of such implementation see <xref
            target="I-D.ietf-sidrops-rpki-tree-validation"/>.)
        </t>
      </section>

      <section title="Distribution considerations">
        <t>One of the design goals of RRDP was to minimise load on a repository
          server while serving clients. To achieve this, neither the content,
          nor the URLs of the snapshot and delta files are modified after they
          have been published in the notification file. This allows their
          effective distribution, either by a single HTTP server, or using a
          Content Distribution Network (CDN).
        </t>
        <t>The RECOMMENDED way for RPs to keep up with the repository updates is
          to poll the Update Notification File for changes. The content of that
          file is updated with every new serial version of a repository (while
          its URL remains stable). To effectively implement distribution of the
          notification file, an "If-Modified-Since" HTTP request header is
          required to be present in all requests for notification file (see
          <xref target="polling_notification"/>.) Therefore it is RECOMMENDED
          that RP tools implement a mechanism to keep track of a previous
          successful fetch of a notification file.
        </t>
        <t>Implementations of RRDP should also take care of not producing new
          versions of the repository (and subsequently, new Notification,
          Snapshot and Delta files) too often. Usually the maintenance of the
          RPKI repository includes regular updates of manifest and CRL objects,
          performed on a schedule. This often results in bursts of repository
          updates during a short period of time. Since the RPs are required to
          poll for the Update Notification File not more often than once per
          minute (<xref target="polling_notification"/>), it is not practical to
          generate new serial versions of the repository much more often than 1
          per minute. It is allowed to combine multiple updates, possibly from
          different CAs, into a new serial repository version (<xref
            target="publishing-updates"/>). This will significantly shorten the
          size of the Update Notification File and total amount of data
          distributed to all RPs.
        </t>
      </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) <xref target="RFC2818"/>.</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>RP tools SHOULD log any TLS certificate or host name validation issues
          they find, so that an operator can investigate the cause. However, such
          validation issues are often due to configuration errors, or a lack of a
          common TLS trust anchor. In these cases it is better if the RP
          retrieves the signed RPKI data regardless, and performs validation on
          it. Therefore RP MUST continue to retrieve the data in case of errors.
          The RP MAY choose to log encountered issues 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>

    <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 that 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 protocol 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 anchor="iana_considerations" 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.6487.xml"?>
        <?rfc include="reference.RFC.6480.xml"?>
        <?rfc include="reference.RFC.6481.xml"?>
        <?rfc include="reference.RFC.7231.xml"?>
        <?rfc include="reference.RFC.7232.xml"?>
        <?rfc include="reference.RFC.7234.xml"?>
        <?rfc include="reference.RFC.7525.xml"?>
        <?rfc include="reference.RFC.7730.xml"?>
        <?rfc include="reference.RFC.5781.xml"?>
        <?rfc include="reference.I-D.ietf-sidr-publication"?>
        <?rfc include="reference.RFC.4122.xml"?>
        <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>
    <references title="Informative References">
        <?rfc include="reference.RFC.6486.xml"?>
        <?rfc include="reference.RFC.6488.xml"?>
        <reference anchor="rsync" target="https://rsync.samba.org">
            <front>
              <title>Rsync home page</title>
              <author/>
              <date />
            </front>
        </reference>
      <?rfc include="reference.I-D.ietf-sidrops-rpki-tree-validation"?>
    </references>
  </back>

</rfc>
