<?xml version='1.0' encoding='utf-8'?>
<!DOCTYPE rfc [
  <!ENTITY nbsp    "&#160;">
  <!ENTITY zwsp   "&#8203;">
  <!ENTITY nbhy   "&#8209;">
  <!ENTITY wj     "&#8288;">
]>
<!-- name="GENERATOR" content="github.com/mmarkdown/mmark Mmark Markdown Processor - mmark.miek.nl" -->
<rfc xmlns:xi="http://www.w3.org/2001/XInclude" version="3" ipr="trust200902" docName="draft-ietf-acme-ari-04" submissionType="IETF" category="std" xml:lang="en" indexInclude="true">

<front>
<title abbrev="ACME ARI">Automated Certificate Management Environment (ACME) Renewal Information (ARI) Extension</title><seriesInfo value="draft-ietf-acme-ari-04" stream="IETF" status="standard" name="Internet-Draft"/>
<author initials="A." surname="Gable"><organization>Internet Security Research Group</organization><address><postal><street/>
</postal><email>aaron@letsencrypt.org</email>
</address></author><date/>
<area>Security Area (sec)</area>
<workgroup>ACME Working Group</workgroup>
<keyword>Internet-Draft</keyword>

<abstract>
<t>This document specifies how an ACME server may provide suggestions to ACME clients as to when they should attempt to renew their certificates. This allows servers to mitigate load spikes, and ensures clients do not make false assumptions about appropriate certificate renewal periods.</t>
</abstract>

<note><name>Current Implementations</name>
<t>Draft note: this section will be removed by the editor before final publication.</t>
<t>Let's Encrypt's <eref target="https://github.com/letsencrypt/boulder">Boulder</eref> software fully implements the server side of an earlier version of this draft, and that implementation is deployed in both the <eref target="https://acme-v02.api.letsencrypt.org/directory">Production</eref> and <eref target="https://acme-staging-v02.api.letsencrypt.org/directory">Staging</eref> environments. Google Trust Services has <eref target="https://security.googleblog.com/2023/05/google-trust-services-acme-api_0503894189.html">done the same</eref>. The <eref target="https://github.com/letsencrypt/pebble">Pebble</eref> ACME server intended for testing client ACME implementations also supports ARI.</t>
<t>Client implementations include <eref target="https://github.com/go-acme/lego">Lego</eref>, <eref target="https://github.com/eggsampler/acme">eggsampler</eref>, <eref target="https://github.com/caddyserver/caddy/releases/tag/v2.8.0">Caddy</eref>, <eref target="https://github.com/caddyserver/certmagic/pull/286">CertMagic</eref>, <eref target="https://github.com/mholt/acmez/blob/master/acme/ari.go">ACMEz</eref>, <eref target="https://github.com/win-acme/win-acme">win-acme</eref>, <eref target="https://letsencrypt.org/2024/05/01/ari-in-tailscale">Tailscale</eref>, <eref target="https://github.com/webprofusion/certify">Ceritfy the Web</eref>, <eref target="https://github.com/shred/acme4j/commit/48c32f612d1f87203e4a10d8fa7d36a924bca31b">acme4j</eref>, and <eref target="https://github.com/ansible-collections/community.crypto/">Ansible's community.crypto</eref>.</t>
</note>

</front>

<middle>

<section anchor="introduction"><name>Introduction</name>
<t>Most ACME <xref target="RFC8555"/> clients today choose when to attempt to renew a certificate in one of three ways. They may be configured to renew at a specific interval (e.g. via <tt>cron</tt>); they may parse the issued certificate to determine its expiration date and renew a specific amount of time before then; or they may parse the issued certificate and renew when some percentage of its validity period has passed. The first two techniques create significant barriers against the issuing Certification Authority (CA) changing certificate lifetimes. All three techniques lead to load clustering for the issuing CA.</t>
<t>Allowing issuing CAs to suggest a period in which clients should renew their certificates enables for dynamic time-based load balancing. This allows a CA to better respond to exceptional circumstances. For example, a CA could suggest that clients renew prior to a mass-revocation event to mitigate the impact of the revocation, or a CA could suggest that clients renew earlier than they normally would to reduce the size of an upcoming mass-renewal spike.</t>
<t>This document specifies a mechanism by which ACME servers may provide suggested renewal windows to ACME clients, and by which ACME clients may inform ACME servers that a certificate has been renewed and replaced.</t>
</section>

<section anchor="conventions-and-definitions"><name>Conventions and Definitions</name>
<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>
<t>Throughout this document, the word "renewal" and its variants are taken to encompass any combination of "Renewal", "Re-Key", and "Modification" as defined in <xref target="RFC3647"/>.</t>
<t>This document assumes that the certificates being issued by the ACME server are in compliance with <xref target="RFC5280"/>, and in particular contain the Authority Key Identifier extension and the keyIdentifier field within that extension.</t>
</section>

<section anchor="extensions-to-the-directory-object"><name>Extensions to the Directory Object</name>
<t>An ACME server which wishes to provide renewal information <bcp14>MUST</bcp14> include a new field, <tt>renewalInfo</tt>, in its directory object.</t>
<table>
<thead>
<tr>
<th>Field</th>
<th>URL in Value</th>
</tr>
</thead>

<tbody>
<tr>
<td>renewalInfo</td>
<td>Renewal info</td>
</tr>
</tbody>
</table>
<sourcecode type="json"><![CDATA[HTTP/1.1 200 OK
Content-Type: application/json

{
  "newNonce": "https://example.com/acme/new-nonce",
  "newAccount": "https://example.com/acme/new-account",
  "newOrder": "https://example.com/acme/new-order",
  "newAuthz": "https://example.com/acme/new-authz",
  "revokeCert": "https://example.com/acme/revoke-cert",
  "keyChange": "https://example.com/acme/key-change",
  "renewalInfo": "https://example.com/acme/renewal-info",
  "meta": {
    "termsOfService": "https://example.com/acme/terms/2021-10-05",
    "website": "https://www.example.com/",
    "caaIdentities": ["example.com"],
    "externalAccountRequired": false
  }
}
]]>
</sourcecode>
</section>

<section anchor="getting-renewal-information"><name>Getting Renewal Information</name>

<section anchor="the-renewalinfo-resource"><name>The "renewalInfo" Resource</name>
<t>The "<tt>renewalInfo</tt>" resource is a new resource type introduced to ACME protocol. This new resource allows clients to query the server for suggestions on when they should renew certificates.</t>
<t>To request the suggested renewal information for a certificate, the client sends a GET request to a path under the server's <tt>renewalInfo</tt> URL.</t>
<t>The path component is a unique identifier for the certificate in question. The unique identifer is constructed by concatenating the base64url-encoding <xref target="RFC4648"/> of the bytes of the <tt>keyIdentifier</tt> field of certificate's Authority Key Identifier (AKI) <xref target="RFC5280"/> extension, a literal period, and the base64url-encoding of the bytes of the DER encoding of the certificate's Serial Number (without the tag and length bytes). All trailing "<tt>=</tt>" characters MUST be stripped from both parts of the unique identifier.</t>
<t>Thus the full request url is constructed as follows, where the "<tt>||</tt>" operator indicates string concatenation and the renewalInfo url is taken from the Directory object:</t>

<sourcecode type="text"><![CDATA[url = renewalInfo || '/' || base64url(AKI) || '.' || base64url(Serial)
]]>
</sourcecode>
<t>For example, to request renewal information for the end-entity certificate given in Appendix A, the client would make the request as follows:</t>

<ol spacing="compact">
<li>The <tt>keyIdentifier</tt> field of the certificate's AKI extension has the hexadecimal bytes <tt>69:88:5B:6B:87:46:40:41:E1:B3:7B:84:7B:A0:AE:2C:DE:01:C8:D4</tt> as its ASN.1 Octet String value. The base64url encoding of those bytes is <tt>aYhba4dGQEHhs3uEe6CuLN4ByNQ=</tt>.</li>
<li>The certificate's Serial Number field has the hexadecimal bytes <tt>00:87:65:43:21</tt> as its DER encoding (note the leading zero byte to ensure the serial number remains positive despite the leading 1 bit in <tt>0x87</tt>). The base64url encoding of those bytes is <tt>AIdlQyE=</tt>.</li>
<li>Stripping the trailing padding characters and concatenating with the separator, the unique identifier is therefore <tt>aYhba4dGQEHhs3uEe6CuLN4ByNQ.AIdlQyE</tt>, and the client makes the request (split onto multiple lines for readability):</li>
</ol>

<sourcecode type="text"><![CDATA[GET https://example.com/acme/renewal-info/
      aYhba4dGQEHhs3uEe6CuLN4ByNQ.AIdlQyE
]]>
</sourcecode>
</section>

<section anchor="renewalinfo-objects"><name>RenewalInfo Objects</name>
<t>The structure of an ACME <tt>renewalInfo</tt> resource is as follows:</t>
<t><tt>suggestedWindow</tt> (object, required): A JSON object with two keys, "<tt>start</tt>" and "<tt>end</tt>", whose values are timestamps, encoded in the format specified in <xref target="RFC3339"/>, which bound the window of time in which the CA recommends renewing the certificate.</t>
<t><tt>explanationURL</tt> (string, optional): A URL pointing to a page which may explain why the suggested renewal window is what it is. For example, it may be a page explaining the CA's dynamic load-balancing strategy, or a page documenting which certificates are affected by a mass revocation event. Conforming clients <bcp14>SHOULD</bcp14> provide this URL to their operator, if present.</t>

<sourcecode type="json"><![CDATA[HTTP/1.1 200 OK
Content-Type: application/json
Retry-After: 21600

{
  "suggestedWindow": {
    "start": "2021-01-03T00:00:00Z",
    "end": "2021-01-07T00:00:00Z"
  },
  "explanationURL": "https://example.com/docs/ari"
}
]]>
</sourcecode>
<t>The server <bcp14>SHOULD</bcp14> include a <tt>Retry-After</tt> header indicating the polling interval that the ACME server recommends. Conforming clients <bcp14>SHOULD</bcp14> query the <tt>renewalInfo</tt> URL again after the <tt>Retry-After</tt> period has passed, as the server may provide a different <tt>suggestedWindow</tt>.</t>
<t>Conforming clients <bcp14>MUST</bcp14> attempt renewal at a time of their choosing based on the suggested renewal window. The following algorithm is <bcp14>RECOMMENDED</bcp14> for choosing a renewal time:</t>

<ol spacing="compact">
<li>Query the <tt>renewalInfo</tt> resource to get a suggested renewal window.</li>
<li>Select a uniform random time within the suggested window.</li>
<li>If the selected time is in the past, attempt renewal immediately.</li>
<li>Otherwise, if the client can schedule itself to attempt renewal at exactly the selected time, do so.</li>
<li>Otherwise, if the selected time is before the next time that the client would wake up normally, attempt renewal immediately.</li>
<li>Otherwise, sleep until the <tt>Retry-After</tt> period has passed, or until the next normal wake time, and return to Step 1.</li>
</ol>
<t>In all cases, renewal attempts are subject to the client's existing error backoff and retry intervals.</t>
<t>In particular, cron-based clients may find they need to increase their run frequency to check ARI more frequently. Those clients will need to store information about failures so that increasing their run frequency doesn't lead to retrying failures without proper backoff. Typical information stored should include: number of failures for a given order (defined by the set of names on the order), and time of the most recent failure.</t>
<t>If the client receives no response or a malformed response (e.g. an <tt>end</tt> timestamp which is equal to or precedes the <tt>start</tt> timestamp), it <bcp14>SHOULD</bcp14> make its own determination of when to renew the certificate, and <bcp14>MAY</bcp14> retry the <tt>renewalInfo</tt> request with appropriate exponential backoff behavior.</t>
</section>
</section>

<section anchor="extensions-to-the-order-object"><name>Extensions to the Order Object</name>
<t>In order to convey information regarding which certificate requests represent renewals of previous certificates, a new field is added to the Order object:</t>
<t><tt>replaces</tt> (string, optional): A string uniquely identifying a previously-issued certificate which this order is intended to replace. This unique identifier is constructed in the same way as the path component for GET requests described above.</t>
<t>Clients <bcp14>SHOULD</bcp14> include this field in New Order requests if there is a clear predecessor certificate, as is the case for most certificate renewals.</t>

<sourcecode type="text"><![CDATA[POST /acme/new-order HTTP/1.1
Host: example.com
Content-Type: application/jose+json

{
  "protected": base64url({
    "alg": "ES256",
    "kid": "https://example.com/acme/acct/evOfKhNU60wg",
    "nonce": "5XJ1L3lEkMG7tR6pA00clA",
    "url": "https://example.com/acme/new-order"
  }),
  "payload": base64url({
    "identifiers": [
      { "type": "dns", "value": "example.com" }
    ],
    "replaces": "aYhba4dGQEHhs3uEe6CuLN4ByNQ.AIdlQyE"
  }),
  "signature": "H6ZXtGjTZyUnPeKn...wEA4TklBdh3e454g"
}
]]>
</sourcecode>
<t>Servers <bcp14>SHOULD</bcp14> check that the identified certificate and the New Order request correspond to the same ACME Account, that they share at least one identifier, and that the identified certificate has not already been marked as replaced by a different Order that is not "invalid". Correspondence checks beyond this (such as requiring exact identifier matching) are left up to Server policy. If any of these checks fail, the Server <bcp14>SHOULD</bcp14> reject the new-order request.</t>
<t>If the Server accepts a new-order request with a "replaces" field, it <bcp14>MUST</bcp14> reflect that field in the response and in subsequent requests for the corresponding Order object.</t>
<t>This replacement information may serve many purposes, including but not limited to:</t>

<ul spacing="compact">
<li>granting New Order requests which arrive during the suggested renewal window of their identified predecessor certificate higher priority or allow them to bypass rate limits, if the Server's policy uses such;</li>
<li>tracking the replacement of certificates which have been affected by a compliance incident, so that they can be revoked immediately after they are replaced; and</li>
<li>tying together certificates issued under the same contract with an entity identified by External Account Binding.</li>
</ul>
</section>

<section anchor="security-considerations"><name>Security Considerations</name>
<t>The extensions to the ACME protocol described in this document build upon the Security Considerations and threat model defined in <xref target="RFC8555"/>, Section 10.1.</t>
<t>This document specifies that <tt>renewalInfo</tt> resources <bcp14>MUST</bcp14> be exposed and accessed via unauthenticated GET requests, a departure from RFC8555's requirement that clients must send POST-as-GET requests to fetch resources from the server. This is because the information contained in <tt>renewalInfo</tt> resources is not considered confidential, and because allowing <tt>renewalInfo</tt> to be easily cached is advantageous to shed load from clients which do not respect the Retry-After header.</t>
</section>

<section anchor="iana-considerations"><name>IANA Considerations</name>

<section anchor="acme-resource-type"><name>ACME Resource Type</name>
<t>IANA will add the following entry to the "ACME Resource Types" registry within the "Automated Certificate Management Environment (ACME) Protocol" registry group at <eref target="https://www.iana.org/assignments/acme">https://www.iana.org/assignments/acme</eref>:</t>
<table>
<thead>
<tr>
<th>Field Name</th>
<th>Resource Type</th>
<th>Reference</th>
</tr>
</thead>

<tbody>
<tr>
<td>renewalInfo</td>
<td>Renewal Info object</td>
<td>This document</td>
</tr>
</tbody>
</table></section>

<section anchor="acme-renewal-info-object-fields"><name>ACME Renewal Info Object Fields</name>
<t>IANA will add the following new registry to the "Automated Certificate Management Environment (ACME) Protocol" registry group at <eref target="https://www.iana.org/assignments/acme">https://www.iana.org/assignments/acme</eref>:</t>
<t>Registry Name: ACME Renewal Info Object Fields</t>
<t>Registration Procedure: Specification Required</t>
<t>Template:</t>

<ul spacing="compact">
<li>Field name: The string to be used as a field name in the JSON object</li>
<li>Field type: The type of value to be provided, e.g., string, boolean, array of string</li>
<li>Reference: Where this field is defined</li>
</ul>
<t>Initial contents:</t>
<table>
<thead>
<tr>
<th>Field Name</th>
<th>Field type</th>
<th>Reference</th>
</tr>
</thead>

<tbody>
<tr>
<td>suggestedWindow</td>
<td>object</td>
<td>This document</td>
</tr>

<tr>
<td>explanationURL</td>
<td>string</td>
<td>This document</td>
</tr>
</tbody>
</table></section>

<section anchor="acme-order-object-fields"><name>ACME Order Object Fields</name>
<t>IANA will add the following entry to the "ACME Order Object Fields" registry within the "Automated Certificate Management Environment (ACME) Protocol" registry group at <eref target="https://www.iana.org/assignments/acme">https://www.iana.org/assignments/acme</eref>:</t>
<table>
<thead>
<tr>
<th>Field Name</th>
<th>Field Type</th>
<th>Configurable</th>
<th>Reference</th>
</tr>
</thead>

<tbody>
<tr>
<td>replaces</td>
<td>string</td>
<td>true</td>
<td>This document</td>
</tr>
</tbody>
</table></section>
</section>

</middle>

<back>
<references><name>References</name>
<references><name>Normative References</name>
<xi:include href="https://bib.ietf.org/public/rfc/bibxml/reference.RFC.2119.xml"/>
<xi:include href="https://bib.ietf.org/public/rfc/bibxml/reference.RFC.3339.xml"/>
<xi:include href="https://bib.ietf.org/public/rfc/bibxml/reference.RFC.4648.xml"/>
<xi:include href="https://bib.ietf.org/public/rfc/bibxml/reference.RFC.5280.xml"/>
<xi:include href="https://bib.ietf.org/public/rfc/bibxml/reference.RFC.8174.xml"/>
<xi:include href="https://bib.ietf.org/public/rfc/bibxml/reference.RFC.8555.xml"/>
</references>
<references><name>Informative References</name>
<xi:include href="https://bib.ietf.org/public/rfc/bibxml/reference.RFC.3647.xml"/>
</references>
</references>

<section anchor="appendix-a-example-certificate" numbered="false"><name>Appendix A. Example Certificate</name>

<sourcecode type="text"><![CDATA[-----BEGIN CERTIFICATE-----
MIIBQzCB66ADAgECAgUAh2VDITAKBggqhkjOPQQDAjAVMRMwEQYDVQQDEwpFeGFt
cGxlIENBMCIYDzAwMDEwMTAxMDAwMDAwWhgPMDAwMTAxMDEwMDAwMDBaMBYxFDAS
BgNVBAMTC2V4YW1wbGUuY29tMFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEeBZu
7cbpAYNXZLbbh8rNIzuOoqOOtmxA1v7cRm//AwyMwWxyHz4zfwmBhcSrf47NUAFf
qzLQ2PPQxdTXREYEnKMjMCEwHwYDVR0jBBgwFoAUaYhba4dGQEHhs3uEe6CuLN4B
yNQwCgYIKoZIzj0EAwIDRwAwRAIge09+S5TZAlw5tgtiVvuERV6cT4mfutXIlwTb
+FYN/8oCIClDsqBklhB9KAelFiYt9+6FDj3z4KGVelYM5MdsO3pK
-----END CERTIFICATE-----
]]>
</sourcecode>
</section>

<section anchor="acknowledgments" numbered="false"><name>Acknowledgments</name>
<t>My thanks to Roland Shoemaker and Jacob Hoffman-Andrews for coming up with the initial idea of ARI and for helping me learn the IETF process. Thanks also to Samantha Frank, Phil Porada, Matt Holt, Ilari Liusvaara, and Wouter Tinus for contributing client implementations, and to Freddy Zhang for contributing an independent server implementation. Finally, thanks to Rob Stradling, Andrew Ayer, and J.C. Jones for providing meaningful feedback and suggestions which significantly improved this specification.</t>
</section>

</back>

</rfc>
