Skip to content

Internal ACME certificate authority with step-ca

Run a private ACME certificate authority with step-ca: create an offline root, sign an online intermediate, enable the ACME provisioner, and point certbot and Caddy at it so internal services renew TLS certificates on their own.

Internal services are where TLS discipline usually collapses: a self-signed certificate generated in a hurry, a browser exception clicked once and forgotten, an expiry that takes out a staging environment at 2 a.m. because nobody owned the renewal. step-ca fixes that by giving you the same machinery public certificate authorities use — an ACME endpoint — for names that only exist on your network. Your services then renew themselves with certbot, Caddy, Traefik, or anything else that speaks ACME, and every client on the network needs to trust exactly one file. This guide builds that setup end to end: an offline root, an intermediate that lives on the CA host, an ACME provisioner, and two working clients.

What you’ll accomplish

  • Create a root CA whose private key never touches a networked machine, and an intermediate signed by it that does the day-to-day issuing.
  • Run step-ca as a hardened systemd service listening on an internal name, with an ACME provisioner exposed at a directory URL.
  • Set a certificate lifetime that matches how often your clients actually renew, instead of taking the 24-hour default by accident.
  • Issue and renew a certificate with certbot on one host and with Caddy on another, using unmodified client configuration.
  • Distribute one root certificate to your trust stores and verify the whole chain from an ordinary curl.

Prerequisites

  • step (the CLI) and step-ca (the server) at 0.25 or newer. Both ship as .deb and .rpm packages, Homebrew formulas, and static binaries from the smallstep releases. Older releases work but some provisioner flags used here landed in the 0.2x series.
  • A small Linux host for the CA — one or two vCPUs is plenty — with a stable internal DNS name. This guide uses ca.internal.example.com and port 8443.
  • A second machine you can use as an offline root: a laptop booted from removable media, a VM with no NIC attached, anything that is genuinely not routable. “A different SSH session on the same box” is not an offline root.
  • Internal DNS that resolves the names you plan to certify. ACME validates names, not IPs, and step-ca will not issue for a bare address.
  • root or sudo on the CA host and on each client.

One version caveat worth knowing: the flag names on step ca provisioner changed shape between early 0.1x releases and current ones. If a flag below is rejected, run step ca provisioner add --help on your actual binary rather than guessing.

How it works

An ACME server does one thing: it proves you control a name, then signs a certificate for it. Public CAs prove control by reaching your host from the internet. step-ca does the identical dance inside your perimeter — it fetches an HTTP-01 token from port 80 on the requesting host, or checks a DNS TXT record, and if the check passes it signs the CSR the client submitted.

Topology showing an offline root CA signing an intermediate on the step-ca host, which issues certificates over ACME to internal services while every client trusts only the root certificate

The split between root and intermediate is what makes this defensible. The root key signs exactly once — to create the intermediate — and then goes back in a drawer. If the CA host is compromised, you revoke and replace the intermediate; the root, and therefore every trust store you have already updated, survives. If the root key were on the CA host, a compromise would mean re-touching every client on the network.

The order flow itself is plain RFC 8555, which is the reason this is worth doing at all: your clients do not need a step-specific integration.

Sequence diagram of an ACME order between the client and step-ca — new-order, challenge, token validation, CSR finalize, certificate issuance, and automatic renewal

Step-by-step

1. Confirm both binaries are present. The CLI and the server are separate packages; installing only step-cli is a common first stumble.

step version && step-ca version
Smallstep CLI/0.28.7 (linux/amd64)
Smallstep CA/0.28.7 (linux/amd64)

2. Create the root CA on the offline machine. Ten years is a reasonable root lifetime; shorter means you repeat the trust-store rollout sooner than you want to.

step certificate create "Example Internal Root CA" \
  root_ca.crt root_ca.key \
  --profile root-ca \
  --kty EC --curve P-256 \
  --not-after 87600h
Please enter the password to encrypt the private key:
Your certificate has been saved in root_ca.crt.
Your private key has been saved in root_ca.key.

Record the fingerprint now — clients use it to pin the root when they bootstrap, and reading it off a screen later is how people end up trusting the wrong file.

step certificate fingerprint root_ca.crt
0d7d3834cf187726cf331c40a31aa7ef6b29ba4df601416c9788f6ee01058cfb

3. Initialise the CA using that root. Copy root_ca.crt and root_ca.key to the CA host over a channel you control, then run step ca init. Passing --root and --key tells step to generate a fresh intermediate and sign it with your root rather than inventing a root of its own.

sudo mkdir -p /etc/step-ca
export STEPPATH=/etc/step-ca
step ca init \
  --deployment-type=standalone \
  --name="Example Internal CA" \
  --dns=ca.internal.example.com \
  --address=":8443" \
  --provisioner=ops@example.com \
  --root=root_ca.crt \
  --key=root_ca.key

You are prompted once for the root key password, then for a password to encrypt the new intermediate key. The run ends with a manifest:

✔ Root certificate: /etc/step-ca/certs/root_ca.crt
✔ Root private key: /etc/step-ca/secrets/root_ca_key
✔ Intermediate certificate: /etc/step-ca/certs/intermediate_ca.crt
✔ Intermediate private key: /etc/step-ca/secrets/intermediate_ca_key
✔ Database folder: /etc/step-ca/db
✔ Certificate Authority configuration: /etc/step-ca/config/ca.json

4. Remove the root key from the CA host. Read that manifest again: step ca init copied the root key into secrets/. The running CA never reads it, and leaving it there quietly discards the entire reason you built an offline root.

sudo shred -u /etc/step-ca/secrets/root_ca_key
ls /etc/step-ca/secrets/
intermediate_ca_key

Wipe the working copies of root_ca.key you shuttled over as well, and keep the offline original plus its password somewhere you can actually find in two years.

5. Run the CA as a service. Put the intermediate key password in a root-owned file, create a dedicated user, and let systemd own the process. Distribution packages ship a unit already; if you installed from a tarball, this is the minimum.

printf '%s' 'the-intermediate-password' | sudo tee /etc/step-ca/password.txt >/dev/null
sudo chmod 600 /etc/step-ca/password.txt
sudo useradd --system --home /etc/step-ca --shell /usr/sbin/nologin step
sudo chown -R step:step /etc/step-ca
[Unit]
Description=step-ca internal certificate authority
After=network-online.target
Wants=network-online.target

[Service]
Type=simple
User=step
Group=step
Environment=STEPPATH=/etc/step-ca
ExecStart=/usr/bin/step-ca /etc/step-ca/config/ca.json --password-file=/etc/step-ca/password.txt
Restart=on-failure
RestartSec=5
ProtectSystem=full
PrivateTmp=true
NoNewPrivileges=true

[Install]
WantedBy=multi-user.target
sudo systemctl daemon-reload && sudo systemctl enable --now step-ca
sudo journalctl -u step-ca -n 5 --no-pager
Starting Smallstep CA/0.28.7 (linux/amd64)
Config file: /etc/step-ca/config/ca.json
The primary server URL is https://ca.internal.example.com:8443
Root certificates are available at https://ca.internal.example.com:8443/roots.pem
Serving HTTPS on :8443 ...

6. Add the ACME provisioner. A provisioner is an authentication method; the default one created by step ca init is a JWK provisioner for the step CLI. ACME is a second, separate one.

sudo -u step STEPPATH=/etc/step-ca step ca provisioner add acme --type ACME
Success! Your `step-ca` config has been updated. To pick up the new configuration SIGHUP (kill -1 <pid>) or restart the step-ca process.

7. Set a lifetime your clients can live with. This is the step most people skip and then debug for an afternoon. step-ca defaults to 24-hour certificates, which is excellent if your renewal loop runs hourly and quietly fatal if it runs daily. Thirty days is a sane starting point for certbot and Caddy.

sudo -u step STEPPATH=/etc/step-ca step ca provisioner update acme \
  --x509-default-dur=720h \
  --x509-max-dur=720h
sudo systemctl restart step-ca

Confirm the directory is live before touching any client:

curl -sS --cacert /etc/step-ca/certs/root_ca.crt \
  https://ca.internal.example.com:8443/acme/acme/directory
{"newNonce":"https://ca.internal.example.com:8443/acme/acme/new-nonce","newAccount":"https://ca.internal.example.com:8443/acme/acme/new-account","newOrder":"https://ca.internal.example.com:8443/acme/acme/new-order","revokeCert":"https://ca.internal.example.com:8443/acme/acme/revoke-cert","keyChange":"https://ca.internal.example.com:8443/acme/acme/key-change"}

The acme in the middle of that path is the provisioner name. Add a second ACME provisioner with a different name and you get a second directory URL with its own lifetime policy.

8. Distribute the root to clients. step ca bootstrap fetches the root, checks it against the fingerprint from step 2, and with --install writes it into the system trust store.

sudo step ca bootstrap \
  --ca-url https://ca.internal.example.com:8443 \
  --fingerprint 0d7d3834cf187726cf331c40a31aa7ef6b29ba4df601416c9788f6ee01058cfb \
  --install
The root certificate has been saved in /root/.step/certs/root_ca.crt.
The authority configuration has been saved in /root/.step/config/defaults.json.
Installing the root certificate in the system truststore... done.

9. Issue a certificate with certbot. certbot is a Python program using requests, which reads its own CA bundle and ignores the system trust store on most distributions. Point it at the root explicitly.

sudo REQUESTS_CA_BUNDLE=/root/.step/certs/root_ca.crt certbot certonly \
  --standalone \
  --server https://ca.internal.example.com:8443/acme/acme/directory \
  --email ops@example.com --agree-tos --non-interactive \
  -d app.internal.example.com
Successfully received certificate.
Certificate is saved at: /etc/letsencrypt/live/app.internal.example.com/fullchain.pem
Key is saved at:         /etc/letsencrypt/live/app.internal.example.com/privkey.pem
This certificate expires on 2026-08-31.

The renewal timer runs in a different environment than your shell, so persist that variable or every unattended renewal fails:

sudo systemctl edit certbot.service
[Service]
Environment=REQUESTS_CA_BUNDLE=/root/.step/certs/root_ca.crt

If you are new to certbot’s renewal model, our certbot operator basics covers the timer, deploy hooks, and where renewal state actually lives.

10. Point Caddy at the same directory. Caddy needs two global options: the directory URL and the root it should trust when talking to that URL.

{
	acme_ca https://ca.internal.example.com:8443/acme/acme/directory
	acme_ca_root /etc/step-ca-root.crt
	email ops@example.com
}

app2.internal.example.com {
	reverse_proxy 127.0.0.1:8080
}
caddy validate --config /etc/caddy/Caddyfile && sudo systemctl reload caddy
Valid configuration

Caddy manages renewal itself with no timer to configure — see Caddy automatic HTTPS for how it decides when to renew.

Validate it works

Inspect what the service is actually serving, which also proves the chain resolves:

step certificate inspect --short https://app.internal.example.com
X.509v3 TLS Certificate (ECDSA P-256) [Serial: 1980...4471]
  Subject:     app.internal.example.com
  Issuer:      Example Internal CA Intermediate CA
  Valid from:  2026-08-01T14:02:11Z
          to:  2026-08-31T14:02:11Z

Then verify from a client that has only the root installed — no -k, no bundle override. A clean exit code here is the real test:

curl -sS https://app.internal.example.com/ -o /dev/null -w '%{http_code}\n'
200

Finally, force a renewal rather than waiting a month to discover it is broken:

sudo certbot renew --force-renewal --cert-name app.internal.example.com
Congratulations, all renewals succeeded:
  /etc/letsencrypt/live/app.internal.example.com/fullchain.pem (success)

Troubleshooting

x509: certificate signed by unknown authority. The client does not trust your root. Distinguish between trust stores before changing anything: curl and Caddy read the OS store, certbot reads REQUESTS_CA_BUNDLE or certifi, Java reads its own keystore, and containers carry a frozen copy of whatever the base image shipped. Installing the root on the host does nothing for a process inside a container — that image needs the root baked in or bind-mounted.

HTTP-01 fails with a connection timeout. The direction surprises people: step-ca connects to the client, not the other way round. The CA host must reach port 80 on the machine requesting the certificate, and --standalone binds that port itself, so anything already listening there causes a bind failure instead. If the CA genuinely cannot reach the host — different VLAN, NAT, a laptop — switch that name to DNS-01 with a provider plugin.

Certificates keep coming back with a 24-hour lifetime. The provisioner update from step 7 did not apply. Provisioner changes are written to ca.json but the running process holds the old config in memory: systemctl restart step-ca or send it a SIGHUP. Confirm with step ca provisioner list that claims.maxTLSCertDuration reads what you expect.

step-ca exits immediately with a permission or password error. Almost always ownership. The step user must be able to read password.txt, the secrets/ directory, and write to db/. sudo chown -R step:step /etc/step-ca after any operation you ran as root — including the provisioner commands, which rewrite ca.json.

Renewals work by hand but fail from the timer. Environment. A sudo shell inherits your variables; certbot.service does not. Check with systemctl show certbot.service -p Environment and add the drop-in from step 9 if it comes back empty.

When this is the wrong approach

For any name that resolves on the public internet, use a public CA. Let’s Encrypt is free, its root is already in every trust store on earth, and running your own CA for public names means every visitor sees a warning. Internal PKI is for names that are deliberately unreachable from outside.

If you have three hosts and one certificate, the arithmetic does not favour this. You are taking on a service to keep running, a database to back up, a root key to store safely, and a trust-store rollout — to avoid renewing one certificate. A long-lived self-signed certificate distributed by configuration management is a smaller and more honest answer at that scale.

If you already run a service mesh, it almost certainly issues workload certificates for you with tighter rotation than any ACME client gives. Adding step-ca beside it means two PKIs to reason about during an incident. The same applies to cloud-native private CA services when your workloads live entirely in one provider.

And step-ca is a poor answer to SSH access. Certificate-based SSH is a genuinely good idea, but it is a different key format and a different trust path — our guide on replacing authorized_keys with an SSH CA covers that properly. step-ca does have SSH support, but do not adopt it as a side effect of wanting TLS.

The authoritative references are the step-ca documentation and the smallstep/certificates repository, which carries the release notes that tell you which provisioner flags exist in your build.

If this is the kind of work you’d rather never own again, it’s the daily job of Managed Cloud Ops — book an infrastructure review.