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

<?rfc sortrefs="yes"?>
<?rfc subcompact="no"?>
<?rfc symrefs="yes"?>
<?rfc toc="yes"?>
<?rfc tocdepth="3"?>
<?rfc compact="yes"?>
<?rfc subcompact="no"?>

<rfc xmlns:xi="http://www.w3.org/2001/XInclude"
  category="std"
  docName="draft-spaghetti-sidrops-cms-signing-time-00"
  updates="6488"
  ipr="trust200902"
  submissionType="IETF"
  consensus="true">

<front>

  <title abbrev="RPKI CMS Signing-Time">On the use of the CMS signing-time attribute in RPKI Signed Objects</title>

  <author fullname="Job Snijders" initials="J." surname="Snijders">
    <organization>Fastly</organization>
    <address>
      <postal>
        <street />
        <city>Amsterdam</city>
        <code />
        <country>Netherlands</country>
      </postal>
      <email>job@fastly.com</email>
    </address>
  </author>

  <author fullname="Tom Harrison" initials="T." surname="Harrison">
    <organization abbrev="APNIC">Asia Pacific Network Information Centre</organization>
    <address>
      <postal>
        <street>6 Cordelia St</street>
        <city>South Brisbane</city>
        <code>4101</code>
        <country>Australia</country>
        <region>QLD</region>
      </postal>
      <phone/>
      <email>tomh@apnic.net</email>
    </address>
  </author>

  <date />

  <area>RPKI</area>
  <workgroup>SIDROPS</workgroup>
  <keyword>CMS</keyword>
  <keyword>signing-time</keyword>

  <abstract>

    <t>
      RFC 6488 standardized a template for specifying Signed Objects that can be validated using the RPKI.
      Since the publication of that document, a new additional protocol for distribution of RPKI repositories was developed (RFC 8182), and new insights arose how to query and combine the different distribution mechanisms.
      This document describes how Publishers and Relying Parties can use the CMS signing-time attribute for seamless transitions from RRDP to RSYNC.
      Additionally, this document updates RFC 6488 by mandating the presence of the CMS signing-time attribute and disallowing the binary-signing-time attribute.
    </t>

  </abstract>

  <note title="Requirements Language">
      <t>
        The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in BCP 14 <xref target="RFC2119"/> <xref target="RFC8174"/> when, and only when, they appear in all capitals, as shown here.
      </t>
  </note>

</front>

<middle>

  <section title="Introduction">
    <t>
      <xref target="RFC6488"/> standardized a template for specifying Signed Objects that can be validated using the RPKI.
      Since the publication of that document, a new additional protocol for distribution of RPKI repositories was developed <xref target="RFC8182"/>, and new insights arose how to query and combine the different distribution mechanisms.
      This document describes how Publishers and Relying Parties can use the CMS signing-time <xref target="RFC5652"/> attribute for seamless transitions between RRDP and RSYNC.
      Additionally, this document updates <xref target="RFC6488"/> by mandating the presence of the CMS signing-time attribute and disallowing the binary-signing-time attribute.
    </t>
  </section>

  <section title="Seamless transitions from RRDP to RSYNC">
    <t>
      To avoid needless re-transfers of unchanged files in consecutive RSYNC synchronizations, <xref target="I-D.timbru-sidrops-publication-server-bcp"/> recommends the use of so-called 'deterministic' (normalized) timestamps for files: as long as a file's contents are unchanged, Publishers SHOULD ensure the file's last modification timestamp also doesn't change.
      This document advances the aforementioned concept by describing a synchronization strategy through which needless transfers also are avoided when RSYNC is used for the first time, by leveraging previously cached data retrieved via RRDP.
    </t>
    <t>
      As described in <xref target="I-D.ietf-sidrops-prefer-rrdp"/>, RP implementations are expected to first try synchronization via RRDP, and if only if that fails for some reason (malformed XML, expired TLS certificate, TCP connection timeout, etc), then attempt to synchronize via RSYNC instead.
    </t>
    <t>
      In the RSYNC synchronization protocol, a file's last modification timestamp (from here on 'mod-time') and the filesize are used to determine whether sending a copy the file copy over the wire is needed.
      Using mod-time plus filesize (the default mode for both GPL <xref target="rsync"/> and <xref target="openrsync"/>) consumes far less CPU cycles than calculating and comparing the 128-bit MD4 checksum of the file (rsync's '-c' command line option) for the purpose of determining the list of files to be transferred.
    </t>
    <t>
      In order to reduce the burden of the RSYNC synchronization (following a RRDP failure), Publishers and Relying Parties SHOULD adhere to the following guidelines.
    </t>
    <section title="Guidance for Publishers">
      <t>
        When serializing RPKI Signed Objects to a filesystem hierarchy for RSYNC consumption, the mod-time of the file containing the Signed Object MUST be set to the CMS signing-time contained within the Signed Object.
      </t>
    </section>
    <section title="Guidance for Relaying Parties" anchor="rpguidance">
      <t>
        When serializing RPKI Signed Objects retrieved via RRDP to a filesystem hierarchy, the mod-time of the file containing the Signed Object MUST be set to the CMS signing-time contained within the Signed Object.
      </t>
      <t>
        Relying Parties SHOULD use the '--compare-dest=DIR' rsync feature to take advantage of the normalized mod-times.
        The DIR variable SHOULD point at the directory containing previously fetched and validated RPKI data (in its original form, to ensure the filesize parameter matches).
      </t>
      <t>
        Quoted from the GPL rsync man page:
      </t>
      <t>
        <list style="empty">
          <t>
            This option instructs rsync to use DIR on the destination machine as an additional hierarchy to compare destination files against doing transfers (if the files are missing in the destination directory).
            If a file is found in DIR that is identical to the sender's file, the file will NOT be transferred to the destination directory.
            This is useful for creating a sparse backup of just files that have changed from an earlier backup. 
          </t>
        </list>
      </t>
      <t>
        Quoted from the openrsync man page:
      </t>
      <t>
        <list style="empty">
          <t>
             Use directory as an alternate base directory to compare files against on the destination machine.
             If file in directory is found and identical to the sender's file, the file will not be transferred.
          </t>
        </list>
      </t>
    </section>
  </section>

  <section title="Presence of CMS signing-time attribute in the field">
    <t>
      Analysing an archive <xref target="rpkiviews"/> containing valid RPKI Signed Objects discovered via the five RIR Trust Anchors in the last two weeks (2023-05-24 to 2023-06-06), 100% of Signed Objects contain a CMS signing-time attribute.
      [NOTE: a job is running to analyse the milions of objects going back to 2022-06-06 - might take a few more days to parse all that data]
    </t>
    <t>
      The above means that already today, all Certificate Authorities produce Signed Objects which contain a CMS signing-time attribute. <!-- and have done so for quite a while. -->
      Thus, making the CMS signing-time attribute mandatory would not make any existing CA operations non-compliant.
    </t>
    <t>
      As of June 3rd, 2023, for 25.8% of Signed Objects the CMS signing-time timestamp exactly matched the file's mod-time observed via RSYNC.
      This means that already today, Relying Parties would see a significant reduction in the list of to-be-transferred files if they adopt the strategy outlined in <xref target="rpguidance"/>.
    </t>
    <t>
      In the above mentioned period of time, zero Signed Objects were discovered with a CMS binary-signing-time <xref target="RFC6019"/> attribute.
      Therefor, disallowing the CMS binary-signing-time attribute would not make any existing CA operations non-compliant.
    </t>
  </section>

  <section title="Considerations and Alternative Approaches">
    <t>
      A slightly different approach suggested to normalize file mod-times based on the Signed Object's embedded End-Entity (EE) X.509 notBefore timestamp value.
      A downside of that approach is that some CAs backdate the notBefore timestamp to increase the validity window of the Signed Object, which at the same time decreases insight for RPKI operators as to when exactly the Signed Object purportedly came into existence.
    </t>
    <t>
      Another downside of using notBefore is that Publishers would need to deserialize both the CMS envelope and the therein contained X.509 EE certificate to extract a timestamp.
    </t>
    <t>
      Ensuring the mod-time is set to the CMS signing-time gives RPKI operators a headstart when using tools like <xref target="ls"/>.
    </t>
    <t>
      The CMS signing-time attribute proved to be useful in researching and tracking delays in various layers of the RPKI <xref target="PAM23"/>.
      Mandating the CMS signing-time to be present might aid future researchers studying the RPKI ecosystem.
    </t>
  </section>

  <section title="Update to RFC 6488">
    <t>
      This section updates <xref target="RFC6488"/> to make the CMS signing-time attribute mandatory and disallow the presence of the CMS binary-signing-time attribute.
    </t>
    <t>
      In section 2.1.6.4 the third paragraph starting with "The signedAttrs element MUST be present and ..." and ending in "Other signed attributes MUST NOT be included." is replaced with the following text:
    </t>
    <t>
      <list style="empty">
        <t>
          The signedAttrs element MUST be present and MUST include the content-type, message-digest, and signing-time attributes <xref target="RFC5652"/>.
          Other signed attributes MUST NOT be included.
        </t>
      </list>
    </t>
  </section>

  <section title="Security Considerations">
    <t>
      This document has no Security Considerations.
    </t>
  </section>

  <section title="IANA Considerations">
    <t>
      This document has no IANA actions.
    </t>
  </section>

  <section title="Acknowledgements">
    <t>
      The authors would like to thank
      TBD
      for their helpful review of this document.
    </t>
  </section>

</middle>

<back>

  <references title="Normative References">
    <?rfc include="reference.RFC.2119.xml"?>
    <?rfc include="reference.RFC.8174.xml"?>
    <?rfc include="reference.RFC.8182.xml"?>
    <?rfc include="reference.RFC.5652.xml"?>
    <?rfc include="reference.RFC.6488.xml"?>
  </references>

  <references title="Informative References">

    <?rfc include="reference.RFC.6019.xml"?>

    <xi:include href="https://bib.ietf.org/public/rfc/bibxml3/reference.I-D.timbru-sidrops-publication-server-bcp.xml"/>
    <xi:include href="https://bib.ietf.org/public/rfc/bibxml3/reference.I-D.ietf-sidrops-prefer-rrdp.xml"/>

    <reference anchor="rsync" target="https://rsync.samba.org/">
      <front>
        <title>rsync</title>
        <author fullname="Andrew Tridgell"/>
        <author fullname="Paul Mackerras"/>
        <author fullname="Wayne Davison"/>
        <date year="2022" />
      </front>
    </reference>

    <reference anchor="openrsync" target="https://www.openrsync.org/">
      <front>
        <title>openrsync</title>
        <author fullname="Claudio Jeker"/>
        <author fullname="Florian Obser"/>
        <author fullname="Kristaps Dzonsons"/>
        <date year="2023" />
      </front>
    </reference>

    <reference anchor="rpkitouch" target="https://github.com/job/rpkitouch">
      <front>
        <title>rpkitouch</title>
        <author fullname="Job Snijders">
          <organization>Fastly</organization>
        </author>
        <date month="June" year="2023" />
      </front>
    </reference>

    <reference anchor="rpkiviews" target="http://www.rpkiviews.org/">
      <front>
        <title>rpkiviews</title>
        <author fullname="Job Snijders"/>
        <date month="June" year="2023" />
      </front>
    </reference>

    <reference anchor="rpki-client" target="https://www.rpki-client.org/">
      <front>
        <title>rpki-client</title>
        <author fullname="Claudio Jeker"/>
        <author fullname="Job Snijders"/>
        <author fullname="Kristaps Dzonsons"/>
        <author fullname="Theo Buehler"/>
        <date month="June" year="2023" />
      </front>
    </reference>

    <reference anchor="PAM23" target="https://www.iijlab.net/en/members/romain/pdf/romain_pam23.pdf">
      <front>
        <title>RPKI Time-of-Flight: Tracking Delays in the Management, Control, and Data Planes</title>
        <author fullname="Romain Fontugne"/>
        <author fullname="Amreesh Phokeer"/>
        <author fullname="Cristel Pelsser"/>
        <author fullname="Kevin Vermeulen"/>
        <author fullname="Randy Bush"/>
        <date month="February" year="2023" />
      </front>
    </reference>

    <reference anchor="ls" target="https://pubs.opengroup.org/onlinepubs/9699919799/utilities/ls.html">
      <front>
        <title>ls - The Open Group Base Specifications Issue 7, 2018 edition</title>
        <author fullname="IEEE and The Open Group"/>
        <date year="2018"/>
      </front>
    </reference>

  </references>

  <section title="Implementation status - RFC EDITOR: REMOVE BEFORE PUBLICATION">
    <t>
      This section records the status of known implementations of the protocol defined by this specification at the time of posting of this Internet-Draft, and is based on a proposal described in RFC 7942.
      The description of implementations in this section is intended to assist the IETF in its decision processes in progressing drafts to RFCs.
      Please note that the listing of any individual implementation here does not imply endorsement by the IETF.
      Furthermore, no effort has been spent to verify the information presented here that was supplied by IETF contributors.
      This is not intended as, and must not be construed to be, a catalog of available implementations or their features.
      Readers are advised to note that other implementations may exist.
    </t>

    <t>
      According to RFC 7942, "this will allow reviewers and working groups to assign due consideration to documents that have the benefit of running code, which may serve as evidence of valuable experimentation and feedback that have made the implemented protocols more mature.
      It is up to the individual working groups to use this information as they see fit".
    </t>

    <t>
      <list style="symbols">
        <t>For the Publication side of the house: <xref target="rpkitouch"/></t>
        <t>For the Relying Party side of the house: OpenBSD <xref target="rpki-client"/></t>
      </list>
    </t>

  </section>

</back>

</rfc>
