The idea: prove you control the name, then ask for the certificate
A certificate authority (CA) must not give a certificate for example.com to just anyone. ACME (Automatic Certificate Management Environment, RFC 8555) is the protocol Let's Encrypt uses to check this without a human. A program on your server, the ACME client (here certbot), talks to the CA's ACME server over HTTPS. The CA gives it a random token. The client puts an answer built from that token where only the owner of the name can put it: a file on the web server, or a DNS record. The CA looks from the outside. If it finds the answer, it signs a certificate.
The account key and signed requests
First the client makes an account key pair and sends newAccount. Every ACME request is a JWS: a JSON body signed with the account key. The first one carries the public key itself (jwk). The CA answers 201 Created with the account URL in Location. Later requests name that URL (kid) instead of the key.
Each request also carries a Replay-Nonce the server handed out in its previous answer (or from newNonce). A recorded request can't be sent again. Even reads are signed POSTs with an empty body, called POST-as-GET.
Orders, authorizations and challenges
newOrder lists the names (identifiers) wanted in the certificate. The CA makes an order and, for each name, an authorization. Each authorization offers challenges, which are ways to prove control: http-01, dns-01 and tls-alpn-01. One passed challenge makes the authorization valid. The chips on the right of the canvas show these statuses:
| object | statuses on the page | moves on when |
|---|---|---|
| account | valid | newAccount answered 201 |
| order | pending → ready → processing → valid, or invalid | all authorizations valid → ready; finalize → processing → valid |
| authorization | pending → valid, or invalid | one of its challenges passes or fails |
| challenge | pending → processing → valid, or invalid | the client POSTs {} to it; the CA's check ends |
HTTP-01 and DNS-01
Both challenges use the key authorization: the token, a dot, and the thumbprint of the account key (a SHA-256 hash of the public key, RFC 7638). That ties the proof to this account. Someone who copies the token can't use it with their own account.
- HTTP-01: serve the key authorization at
http://example.com/.well-known/acme-challenge/<token>, on port 80. certbot's webroot mode writes it as a file that nginx serves. Demo: HTTP-01, first certificate. - DNS-01: publish
base64url(SHA-256(key authorization))in a TXT record at_acme-challenge.example.com. It needs access to the DNS zone, but works without a web server, and it is the only challenge Let's Encrypt accepts for wildcard names like*.example.com. Demo: DNS-01 (TXT record).
Checking from several places
An attacker who can redirect traffic to example.com in one part of the Internet (a hijacked route, a poisoned DNS cache) could answer a challenge they don't own. So the CA checks from several network perspectives at once: a primary one and remote ones in other networks and regions. This is multi-perspective issuance corroboration, required by the CA/Browser Forum rules. The page draws one primary and three remote perspectives with the rule for 2 to 5 remote ones: the primary must see the right answer, and at most one remote may disagree.
The same rule also catches honest mistakes. In Demo: TXT not on every nameserver yet, the new record is on ns1 but ns2 has not loaded it. The two validators whose queries reach ns2 see no record. That makes two remote failures, one more than allowed, so the challenge fails.
Finalize and download
When the order is ready, the client makes a new domain key and a CSR (certificate signing request) for the names in the order, signed by that domain key. It POSTs the CSR to the order's finalize URL. The CA checks that the CSR asks only for proven names, signs the certificate (here with the intermediate R11) and sets the order to valid with a certificate URL. The client downloads the chain as application/pem-certificate-chain: the leaf, then the intermediate. The account key is never in the certificate, and no private key leaves the server. To see how a browser checks this chain, see TLS certificate chain.
Renewal at day 60 of 90
Let's Encrypt certificates last 90 days. A systemd timer or cron job runs certbot renew twice a day. certbot renews a certificate when 30 days or less are left (renew_before_expiry = 30 days), so at day 60. Renewal is just a new order: a new token, a new challenge, a new domain key. The old certificate keeps working until the new one is installed, and if renewal fails, there are still 30 days to notice. Demo: renew at day 60 of 90.
When a challenge fails
If the check fails, the challenge, its authorization and the whole order become invalid. An invalid order can't be retried. The client fixes the cause and starts a new order with a new token. The authorization carries an error object with a type from RFC 8555 and a message.
| cause | what the validators see | error type |
|---|---|---|
| file in the wrong webroot (Demo: failed challenge (404)) | HTTP 404 Not Found | urn:ietf:params:acme:error:unauthorized |
| TXT record not on every nameserver yet | some see no TXT record | urn:ietf:params:acme:error:unauthorized |
| port 80 closed by a firewall | timeout | urn:ietf:params:acme:error:connection |
| name has no A/AAAA record | DNS lookup fails | urn:ietf:params:acme:error:dns |
Let's Encrypt also limits failed validations per account and name per hour, so a broken setup should be tested against its staging server first.
See also how an HTTPS connection is made, where the certificate from this page is sent in the TLS handshake, and digital signatures, which sign both the ACME requests and the certificate.
What the page leaves out
The newNonce and /directory requests, the JWS fields (protected, payload, signature, url) and the Retry-After polling loop are folded into the drawn messages. The page skips tls-alpn-01, external account binding, key rollover, account deactivation and revocation, reuse of recent valid authorizations, ACME Renewal Information (RFC 9773), which lets the CA suggest a renewal time, and CAA records, which say which CAs may issue for a name. Let's Encrypt now uses more remote perspectives than the three drawn, and is moving to shorter certificate lifetimes than 90 days. The tokens, hashes and serial numbers are shortened toy values.