<?xml version="1.0" encoding="utf-8"?>
<!-- name="GENERATOR" content="github.com/mmarkdown/mmark Mmark Markdown Processor - mmark.miek.nl" -->
<rfc version="3" ipr="trust200902" docName="draft-ietf-sidrops-publication-server-bcp-01" submissionType="IETF" category="bcp" xml:lang="en" xmlns:xi="http://www.w3.org/2001/XInclude" indexInclude="true" consensus="true">

<front>
<title abbrev="RPKI Publication Server Operations">RPKI Publication Server Best Current Practices</title><seriesInfo value="draft-ietf-sidrops-publication-server-bcp-01" status="bcp" name="Internet-Draft"></seriesInfo>
<author initials="T." surname="Bruijnzeels" fullname="Tim Bruijnzeels"><organization>RIPE NCC</organization><address><postal><street></street>
</postal><email>tim@ripe.net</email>
</address></author><author initials="T." surname="de Kock" fullname="Ties de Kock"><organization>RIPE NCC</organization><address><postal><street></street>
</postal><email>tdekock@ripe.net</email>
</address></author><author initials="F." surname="Hill" fullname="Frank Hill"><organization>ARIN</organization><address><postal><street></street>
</postal><email>frank@arin.net</email>
</address></author><author initials="T." surname="Harrison" fullname="Tom Harrison"><organization>APNIC</organization><address><postal><street></street>
</postal><email>tomh@apnic.net</email>
</address></author><date/>
<area>Internet</area>
<workgroup></workgroup>

<abstract>
<t>This document describes best current practices for operating an RFC 8181
RPKI Publication Server and its rsync (RFC 5781) and RRDP (RFC 8182) public
repositories.</t>
</abstract>

</front>

<middle>

<section anchor="requirements-notation"><name>Requirements notation</name>
<t>The key words &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;,
&quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;NOT RECOMMENDED&quot;, &quot;MAY&quot;, and &quot;OPTIONAL&quot; in
this document are to be interpreted as described in BCP 14 <xref target="RFC2119"></xref>
<xref target="RFC8174"></xref> when, and only when, they appear in all capitals, as shown here.</t>
</section>

<section anchor="introduction"><name>Introduction</name>
<t><xref target="RFC8181"></xref> describes the RPKI Publication Protocol used between
RPKI Certification Authorities (CAs) and their Publication Repository server.
The server is responsible for handling publication requests sent by the
CAs, called Publishers in this context, and ensuring that their data is
made available to RPKI Relying Parties (RPs) in (public) rsync and RRDP
<xref target="RFC8182"></xref> publication points.</t>
<t>In this document, we will describe best current practices based on the
operational experience of several implementers and operators.</t>
</section>

<section anchor="glossary"><name>Glossary</name>
<table>
<thead>
<tr>
<th>Term</th>
<th>Description</th>
</tr>
</thead>

<tbody>
<tr>
<td>Publication Server</td>
<td><xref target="RFC8181"></xref> Publication Repository server</td>
</tr>

<tr>
<td>Publishers</td>
<td><xref target="RFC8181"></xref> Publishers (Certification Authorities)</td>
</tr>

<tr>
<td>RRDP Repository</td>
<td>Public facing <xref target="RFC8182"></xref> RRDP repository</td>
</tr>

<tr>
<td>Rsync Repository</td>
<td>Public facing rsync server</td>
</tr>
</tbody>
</table></section>

<section anchor="publication-server"><name>Publication Server</name>
<t>The Publication Server handles the server side of the <xref target="RFC8181"></xref> Publication
Protocol. The Publication Server generates the content for the public-facing
RRDP and Rsync Repositories. It is strongly RECOMMENDED that these functions
are separated from serving the repository content.</t>

<section anchor="self-hosted-publication-server"><name>Self Hosted Publication Server</name>
<t>Some organisations that use a self-hosted CA, rather than for example a hosted
CA as service provided by their RIR or NIR, also run a self-hosted Publication
Server for their CA. In this case, the organisation is responsible for ensuring
the availability of the RRDP and rsync content as described in section 5 and 6
of this document.</t>
<t>Because RPs use cached data, short outages don't need to cause immediate issues
if these organisations fix their repositories before objects expire and ensure
that their Publication Server (<xref target="RFC8181"></xref>) is available when there is a need to
update RPKI objects such as ROAs.</t>
<t>However, availability issues with such repositories are frequent
and negatively impact RPs, and the greater the number of separate
repositories, the greater the chance of such problems.  Therefore, CAs
that act as parents of other CAs are RECOMMENDED to provide a
publication service for their child CAs, and CAs with a parent who
offers a publication service are RECOMMENDED to use that service,
instead of running their own.</t>
<t>For the case of a 'grandchild' CA, where CA1 is a TA, CA2 is a child
CA of CA1, and CA3 is a child CA of CA2, there are several options for
providing publication service to CA3:</t>

<ol>
<li><t>RFC 8183 defines a 'referral' mechanism as part of the out-of-band
CA setup protocol.  If supported by CA1 and CA2, then this simplifies
the process of registering CA3 as a direct publication client of CA1.</t>
</li>
<li><t>CA1 may support the registration of multiple publishers by CA2, by
using the publisher_request/repository_response XML exchange defined
in RFC 8183.  CA2 would then be able to register a separate publisher
on behalf of CA3.</t>
</li>
<li><t>CA2 may operate a publication proxy service (per e.g.
<xref target="rpki-publication-proxy"></xref>), which acts as the publication server for
CA3.  This proxy would set aside part of CA2's namespace at CA1 for
the publication of CA3's objects, adjusting and forwarding requests
from CA3 to CA1 accordingly.</t>
</li>
</ol>
<t>For options 1 and 2, CAs operating as CA1 should consider the
implications of providing direct publication service to CA3 in this
way: for example, CA3 may expect publication service technical support
from CA1 directly.</t>
</section>

<section anchor="publication-server-as-a-service"><name>Publication Server as a Service</name>
<t>The Publication Server and repository content have different demands on their
availability and reachability. While the repository content MUST be highly
available to any RP worldwide, only publishers need to access the Publication
Server. Dependent on the specific setup, this may allow for additional access
restrictions in this context. For example, the Publication Server can limit
access to known source IP addresses or apply rate limits.</t>
<t>If the Publication Server is unavailable for some reason, this will prevent
Publishers from publishing any updated RPKI objects. The most immediate impact
of this is that the publisher cannot update their ROAs, ASPAs or BGPSec Router
Certificates during this outage. Thus, it cannot authorise changes in its
routing operations. If the outage persists for a more extended period, then the
RPKI manifests and CRLs published will expire, resulting in the RPs rejecting
CA publication points.</t>
<t>For this reason, the Publication Server MUST have a high availability.
Measuring the availability of the Publication Server in a round-trip fashion is
recommended by monitoring the publication of objects. Maintenance windows
SHOULD be planned and communicated to publishers. This makes publishers aware
of the root cause for disruption in the Publication Server that effectively is
part of their infrastructure, and helps publishers avoid - if possible -
changes in published RPKI objects that are needed during these windows.</t>
</section>
</section>

<section anchor="rrdp-repository"><name>RRDP Repository</name>

<section anchor="distinct-hostnames"><name>Distinct Hostnames</name>
<t>It is RECOMMENDED that the public RRDP Repository URI uses a different
hostname from both the <xref target="RFC8181"></xref> service_uri used by publishers and the
hostname used in rsync URIs (<tt>sia_base</tt>).</t>
<t>Using a unique hostname will allow the operator to use dedicated infrastructure
and/or a Content Delivery Network for its RRDP content without interfering with
the other functions.</t>
</section>

<section anchor="same-origin-uris"><name>Same Origin URIs</name>
<t>Publication Servers need to take note of the normative updates to <xref target="RFC8182"></xref> in
section 3.1 of <xref target="I-D.ietf-sidrops-rrdp-same-origin"></xref>. In short this means that
all URIs need to use the same host and redirects are not allowed.</t>
</section>

<section anchor="endpoint-protection"><name>Endpoint Protection</name>
<t>Repository operators SHOULD use access control to protect the RRDP endpoints.
E.g. if the repository operator knows HTTP GET parameters are not in use, then
all requests containing GET parameters can be blocked.</t>
</section>

<section anchor="bandwidth-and-data-usage"><name>Bandwidth and Data Usage</name>
<t>The bandwidth needed for RRDP evolves and depends on many parameters. These
consist of three main groups:</t>

<ol spacing="compact">
<li>RRDP-specific repository properties, such as the size of notification-,
  delta-, and snapshot files.</li>
<li>Properties of the CAs publishing in a repository, such as the number of
  updates, number of objects, and size of objects.</li>
<li>Relying party behaviour, e.g. using HTTP compression or not, timeouts or
  minimum transfer speed for downloads, using conditional HTTP requests for
  <tt>notification.xml</tt>.</li>
</ol>
<t>When an RRDP repository server is overloaded, for example, if the bandwidth
demands exceed capacity, this causes a negative feedback loop (i.e. the
aggregate load increases), and the efficiency of RRDP degrades. For example,
when an RP attempts to download one or more delta files, and one fails, it
causes them to try to download the snapshot (larger than the sum of the size of
the deltas). If this also fails, the RP falls back to rsync. Furthermore, when
the RP tries to use RRDP again on the next run, it typically starts by
downloading the snapshot.</t>
<t>A Publication Server SHOULD attempt to prevent these issues by closely
monitoring performance (e.g. bandwidth, performance on an RP outside their
network, unexpected fallback to snapshot). Besides increasing the capacity, we
will discuss several other measures to reduce bandwidth demands. Which measures
are most effective is situational.</t>
<t>Publication Servers SHOULD support compression. As the RRDP XML and
embedded base64 content is highly compressible, this can reduce transferred
data by about 50%. Servers SHOULD at least support either deflate or gzip content
encoding as described in sections 8.4.1.2 and 8.4.1.3 of <xref target="RFC9110"></xref> in addition
to any other popular compression types that the server can support.</t>
</section>

<section anchor="content-availability"><name>Content Availability</name>
<t>Publication Servers MUST ensure the high availability of their RRDP repository
content.</t>
<t>If possible, it is strongly RECOMMENDED that a Content Delivery Network (CDN) is
used to serve the RRDP content. Care MUST be taken to ensure that the
Notification File is not cached for longer than 1 minute unless the back-end
RRDP Repository is unavailable, in which case it is RECOMMENDED that stale files
are served.</t>
<t>A CDN will likely cache 404s for files not found on the back-end server. Because
of this, the Publication Server SHOULD use randomized, unpredictable paths for
Snapshot and Delta Files to avoid the CDN caching such 404s for future updates.
Alternatively, the Publication Server can clear the CDN cache for any new files
it publishes.</t>
<t>Note that some organisations that run a Publication Server may be able to attain
a similar level of availability themselves without the use of a third-party CDN.
This document makes no specific recommendations on achieving this, as this is
highly dependent on local circumstances and operational preferences.</t>
<t>Also note that small repositories that serve a single CA, and which serve a
small amount of data that does not change frequently, may attain high
availability using a modest setup. Short downtime would not lead to immediate
issues for the CA, provided that the issues get resolved before their manifest
and CRL expire. This may be acceptable to the CA operator, however, because this
can negatively impact RPs it is RECOMMENDED that these CAs use a Publication
Server that is provided as a service, e.g. by their RIR or NIR, instead if they
can.</t>
</section>

<section anchor="limit-notification-file-size"><name>Limit Notification File Size</name>
<t>Nowadays, most RPs use conditional requests for notification files, which
reduces the traffic for repositories that do not often update relative to the
update frequency of RPs. On the other hand, for repositories that update
frequently, the content uses the most traffic. For example, for a large
repository in January 2024, with a notification file with 144 deltas covering 14
hours, the requests for the notification file used 251GB out of 55.5TB/less than
0.5% of total traffic during a period.</t>
<t>However, for some servers, this ratio may be different. <xref target="RFC8182"></xref> stipulated
that the sum of the size of deltas MUST not exceed the snapshot size to avoid
Relying Parties downloading more data than necessary. However, this does not
account for the size of the notification file all RPs download. Keeping many
deltas present may allow RPs to recover more efficiently if they are
significantly out of sync. Still, including <em>all</em> such deltas can also increase
the total data transfer because it increases the size of the notification file.</t>
<t>The Notification File size SHOULD be reduced by removing delta files that have
been available for a long time to prevent this situation. Because some RPs will
only update every 1-2 hours (in 2024), the Publication Server SHOULD include
deltas for at least 4 hours.</t>
<t>Furthermore, we RECOMMEND that Publication Servers do not produce Delta Files
more frequently than once per minute. A possible approach for this is that the
Publication Server SHOULD publish changes at a regular (one-minute) interval.
The Publication Server then publishes the updates received from all Publishers
in this interval in a single RRDP Delta File.</t>
<t>While, the latter may not reduce the amount of data due to changed objects,
this will result in shorter notification files, and will reduce the number of
delta files that RPs need to fetch and process.</t>
</section>

<section anchor="manifest-and-crl-update-times"><name>Manifest and CRL Update Times</name>
<t>The manifest and CRL nextUpdate time and expiry are determined by the issuing
CA rather than the Publication Server.</t>
<t>From the CA's point of view a longer period used between scheduled Manifest and
CRL re-issuance ensures that they will have more time to resolve unforeseen
operational issues. Their current RPKI objects would still remain valid. On
the other hand, CAs may wish to avoid using excessive periods because it would
make them vulnerable to RPKI data replay attacks.</t>
<t>From the Publication Server's point of view shorter update times result in
more data churn due to manifest and CRL refreshes only. As said, the choice
is made by the CAs, but in certain setups - particularly hosted RPKI services -
it may be possible to tweak the manifest and CRL re-signing timing. One large
repository has found that increasing the re-signing cycle from once every 24
hours, to once every 48 hours (still deemed acceptable) reduced the data
usage with approximately 50% as most changes in the system are due to re-signing
rather than e.g. ROA changes.</t>
</section>

<section anchor="consistent-load-balancing"><name>Consistent load-balancing</name>

<section anchor="notification-file-timing"><name>Notification File Timing</name>
<t>Notification Files MUST NOT be available to RPs before the referenced snapshot
and delta files are available.</t>
<t>As a result, when using a load-balancing setup, care SHOULD be taken to ensure
that RPs that make multiple subsequent requests receive content from the same
node (e.g. consistent hashing). This way, clients view the timeline on one node
where the referenced snapshot and delta files are available. Alternatively,
publication infrastructure SHOULD ensure a particular ordering of the
visibility of the snapshot plus delta and notification file. All nodes should
receive the new snapshot and delta files before any node receives the new
notification file.</t>
<t>When using a load-balancing setup with multiple backends, each backend MUST
provide a consistent view and MUST update more frequently than the typical
refresh rate for rsync repositories used by RPs. When these conditions hold,
RPs observe the same RRDP session with the serial monotonically increasing.
Unfortunately, <xref target="RFC8182"></xref> does not specify RP behavior if the serial regresses.
As a result, some RPs download the snapshot to re-sync if they observe a serial
regression.</t>
</section>

<section anchor="l4-load-balancing"><name>L4 load-balancing</name>
<t>If an RRDP repository uses L4 load-balancing, some load-balancer
implementations will keep connections to a node in the pool that is no longer
active (e.g. disabled because of maintenance). Due to HTTP keepalive, requests
from an RP (or CDN) may continue to use the disabled node for an extended
period. This issue is especially prominent with CDNs that use HTTP proxies
internally when connecting to the origin while also load-balancing over
multiple proxies. As a result, some requests may use a connection to the
disabled server and retrieve stale content, while other connections load data
from another server. Depending on the exact configuration <u format="char-num">–</u> for example, nodes
behind the LB may have different RRDP sessions <u format="char-num">–</u> this can lead to an
inconsistent RRDP repository.</t>
<t>Because of this issue, we RECOMMEND to (1) limit HTTP keepalive to a short
period on the webservers in the pool and (2) limit the number of HTTP requests
per connection. When applying these recommendations, this issue is limited (and
effectively less impactful when using a CDN due to caching) to a fail-over
between RRDP sessions, where clients also risk reading a notification file for
which some of the content is unavailable.</t>
</section>
</section>
</section>

<section anchor="rsync-repository"><name>Rsync Repository</name>
<t>In this section, we will elaborate on the following recommendations:</t>

<ul spacing="compact">
<li>Use symlinks to provide consistent content</li>
<li>Use deterministic timestamps for files</li>
<li>Load balancing and testing</li>
</ul>

<section anchor="consistent-content"><name>Consistent Content</name>
<t>A naive implementation of the Rsync Repository might change the repository
content while RPs transfer files. Even when the repository is consistent from
the repository server's point of view, clients may read an inconsistent set of
files. Clients may get a combination of newer and older files. This &quot;phantom
read&quot; can lead to unpredictable and unreliable results. While modern RPs will
treat such inconsistencies as a &quot;Failed Fetch&quot; (<xref target="RFC9286"></xref>), it is best to
avoid this situation since a failed fetch for one repository can cause the
rejection of the publication point for a sub-CA when resources change.</t>
<t>One way to ensure that rsyncd serves connected clients (RPs) with a consistent
view of the repository is by configuring the rsyncd 'module' path to a path
that contains a symlink that the repository-writing process updates for every
repository publication.</t>
<t>Following this process, when an update is published:</t>

<ol spacing="compact">
<li>write the complete updated repository into a new directory</li>
<li>fix the timestamps of files (see next section)</li>
<li>change the symlink to point to the new directory</li>
</ol>
<t>Multiple implementations implement this behavior (<xref target="krill-sync"></xref>, <xref target="rpki-core"></xref>,
<xref target="rsyncit"></xref>, the rpki.apnic.net repositories, a supporting shellscript
<xref target="rsync-move"></xref>).</t>
<t>Because rsyncd resolves this symlink when it <tt>chdir</tt>s into the module directory
when a client connects, any connected RPs can read a consistent state. To limit
the amount of disk space a repository uses, a Rsync Repository must clean up
copies of the repository; this is a trade-off between providing service to slow
clients and disk space.</t>
<t>A repository can safely remove old directories when no RP fetching at a
reasonable rate is reading that data. Since the last moment an RP can start
reading from a copy is when it last &quot;current&quot;, the time a client has to read a
copy begins when it was last current (c.f. since written).</t>
<t>Empirical data suggests that Rsync Repositories MAY assume it is safe to do so
after one hour. We recommend monitoring for &quot;file has vanished&quot; lines in the
rsync log file to detect how many clients are affected by this cleanup process.</t>
</section>

<section anchor="deterministic-timestamps"><name>Deterministic Timestamps</name>
<t>By default, rsync uses the modification time and file size to determine if it
should transfer a file. Therefore, throughout a file's lifetime, the
modification time SHOULD NOT change unless the file's content changes.</t>
<t>We RECOMMEND the following deterministic heuristics for objects' timestamps
when written to disk. These heuristics assume that a CA is compliant with
<xref target="RFC9286"></xref> and uses &quot;one-time-use&quot; EE certificates:</t>

<ul spacing="compact">
<li>For CRLs, use the value of thisUpdate.</li>
<li>For RPKI Signed Objects, use the CMS signing-time (see
(<xref target="I-D.spaghetti-sidrops-cms-signing-time"></xref>))</li>
<li>For CA and BGPSec Router Certificates, use the value of notBefore</li>
<li>For directories, use any constant value.</li>
</ul>
</section>

<section anchor="load-balancing-and-testing"><name>Load Balancing and Testing</name>
<t>To increase availability, during both regular maintenance and exceptional
situations, a rsync repository that strives for high availability should be
deployed on multiple nodes load-balanced by an L4 load-balancer.  Because Rsync
sessions use a single TCP connection per session, there is no need for
consistent load-balancing between multiple rsyncd servers as long as they each
provide a consistent view. While it is RECOMMENDED that repositories are
updated more frequently than the typical refresh rate for rsync repositories
used by RPs to ensure that the repository continuously moves forward from a
client's point of view, breaking not holding this constraint does not cause
degraded behavior.</t>
<t>It is RECOMMENDED that the Rsync Repository is load tested to ensure that it
can handle the requests by all RPs in case they need to fall back from using
RRDP (as is currently preferred).</t>
<t>We RECOMMEND serving rsync repositories from local storage so the host
operating system can optimally use its I/O cache. Using network storage is NOT
RECOMMENDED because it may not benefit from this cache. For example, when using
NFS, the operating system cannot cache the directory listing(s) of the
repository.</t>
<t>We RECOMMENDED setting the &quot;max connections&quot; to a value that a single node can
handle with (1) the available memory and (2) the IO performance available to
be able to serve this number of connections in the time RPs allow for rsync to
fetch data. Load-testing results show that machine memory is likely the limiting
factor for large repositories that are not IO limited.</t>
<t>The number of rsyncd servers needed depends on the number of RPs, their refresh
rate, and the &quot;max connections&quot; used. These values are subject to change over
time, so we cannot give clear recommendations here except to restate that we
RECOMMEND load-testing rsync and re-evaluating these parameters over time.</t>
</section>
</section>

<section anchor="acknowledgments"><name>Acknowledgments</name>
<t>This document is the result of many informal discussions between implementers.</t>
<t>The authors would like to thank Job Snijders for their helpful review of this
document.</t>
</section>

</middle>

<back>
<references><name>Normative References</name>
<xi:include href="https://xml2rfc.ietf.org/public/rfc/bibxml-ids/reference.I-D.ietf-sidrops-rrdp-same-origin.xml"/>
<xi:include href="https://xml2rfc.ietf.org/public/rfc/bibxml-ids/reference.I-D.spaghetti-sidrops-cms-signing-time.xml"/>
<xi:include href="https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.2119.xml"/>
<xi:include href="https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.8174.xml"/>
<xi:include href="https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.8181.xml"/>
<xi:include href="https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.8182.xml"/>
<xi:include href="https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.9110.xml"/>
<xi:include href="https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.9286.xml"/>
</references>
<references><name>Informative References</name>
<reference anchor="krill-sync" target="https://github.com/NLnetLabs/krill-sync">
  <front>
    <title>krill-sync</title>
    <author fullname="Tim Bruijnzeels" initials="T." surname="Bruijnzeels">
      <organization>NLnet Labs</organization>
    </author>
    <date year="2023"></date>
  </front>
</reference>
<reference anchor="rpki-core" target="https://github.com/RIPE-NCC/rpki-core">
  <front>
    <title>rpki-core</title>
    <author fullname="RPKI Team">
      <organization>RIPE NCC</organization>
    </author>
    <date year="2023"></date>
  </front>
</reference>
<reference anchor="rpki-publication-proxy" target="https://github.com/APNIC-net/rpki-publication-proxy">
  <front>
    <title>rpki-publication-proxy</title>
    <author fullname="APNIC">
      <organization>APNIC</organization>
    </author>
    <date year="2018"></date>
  </front>
</reference>
<reference anchor="rsync-move" target="http://sobornost.net/~job/rpki-rsync-move.sh.txt">
  <front>
    <title>rpki-rsync-move.sh.txt</title>
    <author fullname="Job Snijders" initials="J." surname="Snijders">
      <organization>Fastly</organization>
    </author>
    <date year="2023"></date>
  </front>
</reference>
<reference anchor="rsyncit" target="https://github.com/RIPE-NCC/rsyncit">
  <front>
    <title>rpki-core</title>
    <author fullname="RPKI Team">
      <organization>RIPE NCC</organization>
    </author>
    <date year="2023"></date>
  </front>
</reference>
</references>

</back>

</rfc>
