Manage CAP's own TLS certificate
CertAutoPilot ships with a self-signed certificate so the web UI is reachable over HTTPS on first boot (browsers will warn — that is expected). Once the platform is running you can have CertAutoPilot manage its own TLS: issue a real certificate for the controller's hostname, distribute it to the node(s) that serve the UI, and let the normal renewal machinery keep it fresh. No extra software and no product feature to enable — this is the ordinary SSH distribution flow pointed at CertAutoPilot's own hosts.
This works identically on a single host and a multi-node cluster — you simply list every node as a target.
Where the served certificate lives
On a standalone install, nginx terminates TLS and reads its certificate and key from:
/etc/certautopilot/tls/server.crt (root:root, mode 0644) — leaf + chain (fullchain)
/etc/certautopilot/tls/server.key (root:root, mode 0600) — private key
The backend itself listens as plain HTTP on 127.0.0.1; nginx is the only TLS terminator. Replacing these two files and reloading nginx swaps the served certificate without restarting the backend.
- Kubernetes / Helm: the served certificate is not on disk — it is the
<release>-tlsKubernetes Secret (typekubernetes.io/tls), consumed by both the backend and the frontend pods. Usecert-manager(the idiomatic K8s option) or the Kubernetes distribution module to write that Secret instead of the SSH recipe below. - Docker Compose: the shipped compose runs plain HTTP (dev only) — there is no TLS to manage.
- CertAutoPilot OS (the appliance): the same two files, but written through the appliance's own import helper — see CertAutoPilot OS.
Recipe (SSH distribution)
Prerequisites:
- A certificate whose SAN covers the controller's public hostname (e.g.
cap.example.com), issued from any CA you have configured, with auto-renew ON. - Root SSH access to every node (or a user with password-less
sudo). Writing to/etc/certautopilot/tls, settingroot:rootownership, and runningsystemctl reload nginxall require privilege. Key-based SSH asrootis the simplest. - For the first certificate you need a working ACME challenge path — HTTP-01 (port 80 reachable to the controller) or DNS-01. Until that first certificate is issued and distributed, the self-signed one stays in place.
Steps (all in Settings → Distribution):
-
Targets — add one SSH target per node (the two cluster IPs, e.g.
cap-aandcap-b), or add both to a target group. A node distributing to itself over SSH is fine — no special handling needed. -
Path set — map the certificate artifacts to the exact paths nginx reads. This is a PathSet; the important columns are source, path, owner, and mode:
fullchain /etc/certautopilot/tls/server.crt root:root 0644private_key /etc/certautopilot/tls/server.key root:root 0600Use
fullchain(leaf + intermediates) forserver.crtso clients get the full chain, andprivate_keyforserver.keyat mode0600. These match exactly what the installer's self-signed generator produced, so nginx needs no config change. -
Action set — reload nginx after the files are written. This is an ActionSet:
sudo nginx -tsudo systemctl reload nginxnginx -tfails fast on a bad config before the reload. By default the action runs only when a written file actually changed, so a no-op redistribute won't reload. -
Module config + link — create an SSH module config referencing the target(s)/group, then link a distribution on the certificate to it.
That is all. On every renewal CertAutoPilot re-distributes automatically (the finalize step marks the distribution pending and enqueues it), so each node receives the new certificate and reloads nginx with zero manual steps.
Cluster notes
- The distribution job is picked up by whichever node's worker is free and it SSHes out to every listed target, so all nodes get the certificate regardless of which node ran the job — including the node CertAutoPilot itself runs on.
- Because the source of truth is the issued certificate (stored once in the shared database) and each node is an explicit SSH target, adding a third node is just adding a third target — nothing else changes.
- Prefer a target group over individual targets so a new node joins by group membership and inherits the same path set / action set automatically.
CertAutoPilot OS (the appliance)
The appliance serves the UI from the same two files, but the recipe above does not fit it:
- SSH accepts only the
adminaccount (norootlogin), andadmincan neither write/etc/certautopilot/tlsnor reload nginx. - The cluster agent keeps a certificate there only when it was imported through the appliance; otherwise it re-issues its self-signed one when the node's names change and 30 days before it ends.
A distribution therefore goes through the appliance's import helper, the one behind the console's import tls-cert. CertAutoPilot writes the certificate and key into admin's home over SSH and runs the helper with sudo; admin may run it without a password. The helper:
- checks that the key matches the certificate and that the certificate is valid now;
- installs both for nginx (
root, 0644 / 0600), keeps the previous pair beside them, and marks the pair as imported, so the agent keeps it across reboots, VIP changes and re-renders; - reloads nginx after
nginx -t; when nginx refuses the pair, puts the previous one back and fails the action.
Steps:
-
SSH key. Make a key pair without a passphrase for CertAutoPilot, for example
ssh-keygen -t ed25519 -N '' -f cap-dist. On the console of every node:set ssh-key <the line in cap-dist.pub>. Ifset ssh allowlimits SSH, its list must include the nodes' own addresses: the distribution runs on whichever node's worker picks it up. -
Credential — type SSH private key, the contents of
cap-dist. -
Path set (Linux) — leave owner empty: the files must stay
admin's for the helper to take them.fullchain /home/admin/cap-tls/server.crt 0644private_key /home/admin/cap-tls/server.key 0600 -
Action set — one command:
sudo /usr/lib/cap/cap-import tls-cert /home/admin/cap-tls/server.crt /home/admin/cap-tls/server.keyadminmay run the helper only on files under/home/admin(or/tmp), so keep the files there. -
Targets — one SSH target per node: the node's management address, user
admin, the credential, the path set and the action set above, host-key verification on (the key is pinned on the first run). Put them in a target group. -
Module config + link — an SSH module config on the group, linked to the certificate.
The certificate must name what browsers open: the VIP (its address or DNS name) and, when users reach nodes directly, the nodes' names or addresses. For ACME over HTTP-01 the appliance must answer on port 80, which it keeps closed: firewall http-01 enable on every node opens it for challenges only. DNS-01 needs nothing on the appliance. Until the first certificate is distributed, the self-signed one stays in place.
Afterwards show health on each node lists web UI certificate (imported) valid until <date>, and every renewal runs the distribution again. A node that joins later needs set ssh-key on its console and a target in the group.
- The credential logs in as
admin, the console's account. Over a non-interactive SSH session that account gets a shell (file transfer and commands need one), so whoever may use the credential in CertAutoPilot can run commands asadminon every node. Give it to the people who administer the appliance only (resource grants). - A copy of the private key stays in
/home/admin/cap-tls(mode 0600, owned byadmin). - Without a licence CertAutoPilot holds one target at a time (target limit): enough for one node, not for a cluster.
Verifying
After the first distribution:
# On each node
openssl x509 -in /etc/certautopilot/tls/server.crt -noout -subject -enddate
# From a client
echo | openssl s_client -connect cap.example.com:443 -servername cap.example.com 2>/dev/null \
| openssl x509 -noout -issuer -enddate
The distribution's status in the UI shows per-target success; a failed reload marks that target failed (and, if auto-rollback is enabled, a rollback re-deploys the previous retained certificate version through the same paths).
See also
- SSH distribution module — path sets, action sets, rollback
- Standalone install — the initial TLS options
- CertAutoPilot OS — the appliance's own certificate, by hand or by CertAutoPilot
- Multi-VM cluster — load-balancer and per-host TLS models