Certificate automation lab: ACME, short-lived TLS certificates and automatic renewal with a private CA

This lab gives each student a small world of TLS certificates of their own: a private certificate authority (CA) that speaks ACME, the protocol programs use to get certificates with nobody typing, a web server that gets and renews its own certificate from it, the step command line to ask for one by hand, and Python with OpenSSL to read them. Public certificates last at most 200 days from March 2026 and will last 47 days from March 2029, so renewal has to be automatic, and this is where students see how.

It is not an attack lab. Every copy has no route to the internet and none to any other student, and nothing in it is trusted by any browser: the CA makes its own keys the first time the lab starts. It has no web page, so everything is typed in the terminal beside it, and the CA signs certificates that last 24 hours, so renewal is a daily event rather than a yearly one.

What students learn

How to read a certificate with openssl x509 (its names in the subject alternative name, its issuer, its dates and the chain up to a root, checked with openssl verify), how an ACME order goes from account to downloaded certificate (the CA’s directory, an order, a challenge, finalize), how the http-01 challenge passes for a name you control and fails for one you do not, when to renew (two thirds of the lifetime, step certificate needs-renewal, jitter and ACME Renewal Information), why revocation helps only clients that check while a short lifetime limits a stolen key for everyone, and how renewal is run at scale: probing the live certificate, an inventory and alerts. It suits a network security, systems administration or DevOps course, and the module Short-lived certificates and ACME automation is worked in it.

Run it in your browser

The lab starts four services, ca, shop, client and python, and waits until each is healthy. By then the web server has already asked the CA for its certificate. The terminal reaches each service with docker exec followed by its name.

  1. Open the Container page. Open Build on the bar and choose Run a container. Anybody may open it, and the Git lab and the SQL lab start with no account. Every other lab needs a free account: create one, sign in, then press Start.
  2. Find the lab. The Sample labs card lists every sample. Find Certificates: ACME and automatic renewal.
  3. Press Start. Start runs it as it is, in one press. Edit the file first opens the compose file so you can change it before you start.
  4. Open it. On the lab’s page, press Open terminal. There is no link under In your browser because the lab has no web page. Type docker exec client curl -sS --cacert /ca/certs/root_ca.crt https://shop and the shop answers over HTTPS with a certificate from the lab’s own CA. Then docker exec python python3 steps/read_shop.py prints the names it is valid for, its issuer and its lifetime of 24 hours.

What is real and what is a model

Real: the CA (step-ca) and its ACME directory, accounts and orders, the web server (Caddy) getting and renewing its certificate over http-01, a certificate asked for by hand with the step client, http-01 failing for a name nothing answers and for a name another server holds, the chain read and verified with OpenSSL, renewal checks, and a revocation followed by the renewal the CA refuses. Models in Python, saying so on the page: dns-01, because the lab has no DNS server a student can add a TXT record to, and ACME Renewal Information (RFC 9773), because the lab’s CA does not offer it yet. Both follow the protocol’s own rules over made-up values. Serial numbers and dates differ every time a certificate is issued, so the scripts print lifetimes and rules rather than dates.

What to ask students to hand in

A short report: the shop’s certificate read with openssl (subject, names, issuer, lifetime and chain), a certificate they asked for themselves, a renewal check that says yes and one that says no, a revocation followed by the renewal the CA refused, and one sentence on why short-lived certificates do the job revocation was meant to do. A good sentence says that most clients do not check revocation, so only the end date stops a stolen key for everyone.

A basic lesson on this lab

Certificate Automation Basics is a small lesson worked in this lab. In it a student reads the CA’s ACME directory, fetches the shop over HTTPS and reads its certificate, asks for a certificate by hand, sees a name they do not control refused, and checks whether a certificate needs renewing.

Free personal accounts have it in the Basics module, which is on Home, every college can copy it from the Library’s Basics folder, and a new college opens with it in a module called DevOps Labs (Sample). It is deliberately small: it shows a teacher what a lesson worked in a lab is, and the lab does the rest. Copy it into a module of your own to change it.

The code on GitHub

The compose file has no Dockerfile: it runs stock public images pinned to versions, step-ca for the CA and the client (Apache-2.0), Caddy for the web server (Apache-2.0) and the official Python image, which carries OpenSSL, with 384 MB of memory in all. None of them is distributed by us. The CA keeps its keys in a named volume, so certificates issued before a stop still verify after a start, and the other services read only its root. The scripts in steps/ are written by the compose file itself from fixed text. The lab has no way out to the internet and holds no key or password: the CA makes its own, at random, when it first starts.

Set it as work

Say in the task what to hand in.

  1. Make the lab. In your module add a task and choose the Container lab card, then In a GitHub repository. Give https://github.com/mitsurutech/lab-acme-lab with the branch main. The compose file is the default, compose.yaml. Fork the repository first if you want to change it.
  2. Publish and try it. Publish pins the commit you were shown, so a later change in the repository does not alter a lab you have already set. Start your own copy first.
  3. Hand it out. Assign it like any task, with a due date if you want one, and say in the task what to do and what to hand in.
  4. Mark what is handed in. Open a student’s copy and the work they handed in, mark it, and send it back with a reason if it needs more.

Try this lab, and what it costs

A free personal account can work through the basic lessons in this lab, with enough free credit each month to follow most lessons and no card. For a class, a school or college has its first 365 days free for up to 50 students, then pays per student a year, with every lab included and staff free.

Questions people ask

Why do certificates in this lab last only 24 hours?
That is the lab CA’s own default, and it makes renewal something students see in a single session rather than once a year. Public certificates are heading the same way: 200 days from March 2026, 100 from March 2027 and 47 from March 2029.
Will a browser trust the shop’s certificate?
No, and it should not. The root belongs to this copy of the lab alone, made when it first started. Inside the lab, curl and OpenSSL are told to trust it with --cacert and -CAfile, which is exactly what a company does with its own private CA.
Why are dns-01 and ARI models rather than the real thing?
dns-01 needs a DNS server the student can add a TXT record to, and the lab has none. ACME Renewal Information needs a CA that offers it, and the lab’s CA does not yet. Both are worked in Python with the protocol’s own rules, so the values are what a real client would compute.
Why does a revoked certificate still verify?
step certificate verify, like most clients, checks the signatures and the dates and does not ask the CA whether the certificate was revoked. The CA itself remembers, which is why it then refuses to renew it. That gap is the lesson’s point: only the end date stops a stolen key for every client.