ACME gets a certificate with nobody typing
ACME, the Automatic Certificate Management Environment, is the protocol a program uses to get a certificate from a CA with no person involved. It is defined in RFC 8555.
Without it, a 47-day certificate means a person renewing every few weeks, for every name. With it, renewal is a job that runs by itself.
By the end of this lesson
Note
I can describe the steps of an ACME order from account to downloaded certificate.
Key words
| Word | What it means |
|---|---|
| Directory | the CA's list of ACME addresses |
| Account | a key pair the CA knows the client by |
| Order | a request for one certificate and its names |
| Authorisation | the CA's record of proving one name |
| Finalize | sending the signing request once every name is proven |
| CSR | a certificate signing request holding the public key |
The cells students fill in are left blank in this preview.
Everything starts at the directory
A client is given one address, the directory. It reads it and finds every other address there. They say where to get a nonce, make an account, place an order, revoke and change keys.
A nonce is a number used once. Every request carries a fresh one, so an old request cannot be sent again by somebody else.
Read the lab CA's directory
docker exec client curl -s https://ca:9000/acme/acme/directory --cacert /ca/certs/root_ca.crtShown here, not run. Press Start lab to type it into your own lab’s terminal.
What the directory lists
| Name in the reply | What the client uses it for |
|---|---|
| newNonce | Get a fresh nonce before a request |
| newAccount | Register the account key |
| newOrder | Ask for a certificate for some names |
| revokeCert | Say a certificate must not be trusted any more |
| keyChange | Swap the account key for a new one |
The cells students fill in are left blank in this preview.
An order moves through five states
Every request is signed with the account key. The client places an order for some names. Each name gets an authorisation, which offers challenges.
The order is pending until every name is proven, then ready. The client finalizes with a CSR, and the order is processing, then valid. A failed proof makes it invalid.
Print one recorded order step by step
docker exec python python3 steps/order.pyShown here, not run. Press Start lab to type it into your own lab’s terminal.
What the recorded order shows
| Step | State | What happened |
|---|---|---|
| 1 new-account | account valid | The client's key is now an account |
| 2 new-order | order pending | Asks for a certificate for shop |
| 3 and 4 authorization, challenge | pending, then processing | The client says: come and look |
| 5 authorization | valid | The CA fetched the proof and it matched |
| 6 to 8 order, finalize, order | ready, processing, valid | The CSR is signed |
| 9 certificate | issued | The client downloads the chain |
The cells students fill in are left blank in this preview.
A common mistake
Warning
Many people think the CA makes the server's key and sends it. The client makes its own key pair and sends only the public half, inside the CSR. The private key never leaves the server.
Now place a real order
The client container has the step command, told where the CA is and which root to trust. The next Run makes an account, orders a certificate for the name client, proves it with http-01 and finalizes.
It prints done! for the challenge, the wait for ready and the finalize step, then names client.crt and client.key.
Order a certificate for client
docker exec client step ca certificate client client.crt client.key --provisioner acme --standalone --forceShown here, not run. Press Start lab to type it into your own lab’s terminal.
Look at what you were given
docker exec client step certificate inspect client.crt --shortShown here, not run. Press Start lab to type it into your own lab’s terminal.
Your certificate, in short
The short view names Subject: client, Issuer: Lab Private CA Intermediate CA and Provisioner: acme, with your own serial and dates a day apart.
The shop did the same by itself when it started. Run docker logs shop in the terminal to see its account, order, challenge and finalize lines. Its times and ids are its own.