- Jinja 100%
| Filename | Latest commit message | Latest commit date |
|---|---|---|
| .forgejo/workflows | ||
| defaults | ||
| meta | ||
| tasks | ||
| templates | ||
| vars | ||
| .gitignore | ||
| CHANGELOG.md | ||
| LICENSE | ||
| README.md | ||
step-ca
Ansible role that runs Smallstep step-ca as a Docker Compose service and prepares it for Fleet-managed SCEP enrollment (iPhone, Android, Linux) and EAP-TLS with FreeRADIUS.
It is intentionally a CA-only role. It does not configure Fleet, FreeRADIUS, Omada, or client devices; it provides the CA endpoint, root CA, and SCEP provisioner those systems consume.
What it does
- Runs
smallstep/step-cawith a persistent/home/step. - Initializes the CA once with a generated or supplied CA password.
- Persists the CA password and SCEP challenge on the host (mode
0400). - Adds a SCEP provisioner for Fleet if it does not exist.
- Restarts step-ca after adding the provisioner.
- Exports the root CA certificate for Fleet and FreeRADIUS.
- Supports uninstall; data is kept unless
step_ca_purgeis true.
Requirements
- Docker with the Compose plugin.
- The
community.dockercollection. - A DNS name clients/Fleet use for the CA, e.g.
ca.example.com. - Traefik on the host, with the external
traefik_webnetwork, whenstep_ca_traefikis true (the default). - A real certificate for that name. The recommended path is Traefik with the
Hetzner DNS challenge: set
traefik_hetzner_tokento the new Hetzner DNS API token andtraefik_acme_emailin the Traefik role. Thedefaultcertificate resolver then obtains a Let's Encrypt certificate forstep_ca_domain.
Step-ca serves its CA API over HTTPS internally and exposes a separate HTTP
SCEP listener on step_ca_insecure_address (:8080). Traefik terminates
public TLS and proxies only /scep/ to that HTTP listener. No Traefik
serversTransport or TLS-skip transport is needed. Step-ca has no separate
public server-certificate setting; public TLS belongs to Traefik.
Variables
| Variable | Default | Description |
|---|---|---|
step_ca_instance |
step-ca |
Compose project and container name. |
step_ca_docker_path |
/docker/step-ca |
Compose file, secrets, exported root CA. |
step_ca_data_path |
/data/step-ca |
Persistent /home/step (CA keys, config, database). |
step_ca_version |
0.30.2 |
smallstep/step-ca image tag. |
step_ca_domain |
~ |
Required. CA DNS name, e.g. ca.example.com. |
step_ca_dns_names |
[] |
Extra DNS names for the CA. Defaults to [step_ca_domain]. |
step_ca_ca_name |
Device Access CA |
CA display name. |
step_ca_admin_provisioner |
admin |
JWK admin provisioner name. |
step_ca_password |
~ |
CA/admin password. Generated if unset. |
step_ca_scep_enabled |
true |
Add a SCEP provisioner. |
step_ca_scep_provisioner |
fleet-scep |
SCEP provisioner name / URL path. |
step_ca_scep_challenge |
~ |
SCEP challenge. Generated if unset. |
step_ca_scep_extra_args |
[] |
Extra step ca provisioner add arguments. |
step_ca_traefik |
true |
Attach to Traefik and create router/service labels. |
step_ca_traefik_network |
traefik_web |
External Traefik network. |
step_ca_traefik_certresolver |
default |
Traefik ACME resolver; with a Hetzner token this uses DNS-01. |
step_ca_insecure_address |
:8080 |
HTTP SCEP listener inside the container. |
step_ca_insecure_port |
8080 |
Traefik backend port for the HTTP SCEP listener. |
step_ca_publish_port |
9000 |
Host port when step_ca_traefik: false. |
step_ca_bind_address |
0.0.0.0 |
Host bind address when step_ca_traefik: false. |
step_ca_env |
{} |
Extra container environment. |
step_ca_extra_volumes |
[] |
Extra Compose volume strings, e.g. a SCEP template. |
step_ca_uninstall |
false |
Remove the container and compose.yml; keep secrets, root CA and CA data. |
step_ca_purge |
false |
With uninstall, also remove secrets, root CA and CA data. |
Example
- hosts: ca
roles:
- step-ca
vars:
step_ca_domain: ca.example.com
step_ca_password: "{{ vault_step_ca_password }}"
step_ca_scep_challenge: "{{ vault_step_ca_scep_challenge }}"
With Traefik enabled, the SCEP endpoint is:
https://ca.example.com/scep/fleet-scep
Traefik obtains the public certificate; step-ca is not published on a host port.
Without Traefik (step_ca_traefik: false), the endpoint is
https://ca.example.com:9000/scep/fleet-scep and Fleet must trust the exported
root CA.
Fleet's custom_scep_proxy:
org_settings:
certificate_authorities:
custom_scep_proxy:
- name: CORP_SCEP
url: https://ca.example.com:9000/scep/fleet-scep
challenge: "<step_ca_scep_challenge>"
The challenge is stored at
/docker/step-ca/secrets/scep_challenge. Read it on the host; the role does
not print it.
CA root and FreeRADIUS
The role writes the root CA to:
/docker/step-ca/root_ca.crt
Use it:
- in Apple/Android trust profiles;
- in Fleet's SCEP profile/configuration as the CA;
- as the client CA in FreeRADIUS (
ca_file).
Step-ca's own internal TLS certificate is signed by the CA. With Traefik enabled, Fleet validates the public Traefik certificate, not the step-ca root. FreeRADIUS still trusts this root to validate client certificates. Without Traefik, Fleet must also trust this root for the SCEP endpoint.
First run and CA password
The role initializes the CA with a one-shot step ca init container before
Compose starts. This avoids the official image entrypoint printing the
generated admin password into the container logs. The Compose service still
gets DOCKER_STEPCA_INIT_* as a fallback; once config/ca.json exists the
entrypoint skips initialization.
The role supplies:
- CA name;
- DNS names;
- admin provisioner name;
- CA password from
/run/secrets/ca_password.
If step_ca_password is not set, the role generates one and keeps it at:
/docker/step-ca/secrets/ca_password
Back this up. Without it, admin operations on the CA are not possible.
The CA password is fixed at first initialization; changing
step_ca_password later does not rotate it.
The admin provisioner password is the same as the CA password in the official image's initialization flow.
Provisioner behavior
After the container is healthy, the role runs:
step ca provisioner add <step_ca_scep_provisioner> \
--type=SCEP \
--challenge="$(cat /run/secrets/scep_challenge)" \
--ca-config /home/step/config/ca.json
It checks the existing provisioner list first, so reruns do not add duplicates.
Changing step_ca_scep_challenge later does not update the existing
provisioner automatically; update it explicitly with step ca provisioner update and restart the container.
SCEP requires an RSA intermediate CA. The role first runs the normal
step ca init, then replaces the ECDSA root/intermediate with a 3072-bit RSA
chain before step-ca starts. This is mandatory for SCEP PKCS#7 decryption, even
when clients use ECDSA leaf certificates.
step_ca_scep_extra_args can carry options such as --force-cn or
--x509-template. If you use a template file, mount it into the container
with an additional Compose volume and pass its container path.
Traefik and the Hetzner DNS token
The role assumes the host already runs the traefik role with the
traefik_web network. For a real certificate:
# Traefik role
traefik_acme_email: it@tni.dev
traefik_hetzner_token: "{{ vault_hetzner_dns_api_token }}"
Use the new Hetzner DNS API token (not an old project token). The Traefik role
switches the default ACME resolver to DNS-01 when the token is set; step-ca
only adds router/service labels.
Traefik routes only:
Host(`step_ca_domain`) && PathPrefix(`/scep/`)
to http://step-ca:8080. The HTTPS CA API on 9000 is not published. Public TLS
is terminated by Traefik with the Hetzner DNS-01 certificate. The HTTP SCEP
listener is enabled by insecureAddress in ca.json; it is reachable only on
the internal Compose/Traefik network, not on a host port.
Limitations
- SCEP challenge is static. Fleet's
custom_scep_proxyuses one challenge for the CA. This is not a per-device enrollment challenge. - No EST. step-ca has no EST provisioner. Use ACME for Linux, or an
EST-capable CA for Fleet's
custom_est_proxy. - Passive revocation by default.
step ca revokestops renewal, but the certificate remains valid until it expires. Use short-lived certificates or configure active revocation if FreeRADIUS must enforce immediate revocation. - No HA. This role runs one container. Back up
/home/stepand the secrets. - TLS trust. With Traefik, Fleet validates the public Traefik certificate. Without Traefik, step-ca serves its CA-backed TLS certificate on port 9000 and Fleet must trust the exported root. SCEP still requires the RSA chain.
- Fleet/FreeRADIUS/Omada are out of scope. The role does not push profiles, configure RADIUS, or manage switches.
Uninstall
step_ca_uninstall: true
Removes the container and compose.yml. The CA data at /data/step-ca,
the secrets under /docker/step-ca/secrets, and the exported root CA remain,
so a reinstall keeps the existing CA and admin password. Set
step_ca_purge: true to delete the secrets, root CA export and
/data/step-ca as well.
Notes
- The CA password and SCEP challenge are written with mode
0400and owned by the step-ca container user (UID/GID 1000). Back up the secrets directory. - The container runs as the image's
stepuser. The data directory is owned by UID/GID 1000. If you change the container user, adjuststep-ca-dataownership accordingly. - The image is Alpine-based. That is not a problem for Docker; it is only a
problem for a direct Proxmox OCI-LXC deployment because of UID 1000 and the
/home/stepvolume. This role targets a normal Docker host. - The SCEP URL path is
/scep/<provisioner-name>. Keepstep_ca_scep_provisionerstable; Fleet profiles and renewals are tied to it.