← Back to section · Digital Security
The SSH Certificate System in Depth: Certificate Structure, CA Governance, and Revocation
Treating OpenSSH certificates as a complete identity system: what a certificate actually contains, how principals define the authorisation boundary, the division of labour between critical options and extensions, how KRL revocation lists work, and why CA private-key governance decides the fate of the whole system.
What Is Actually in a Certificate
An OpenSSH certificate is not the deeply nested structure of X.509; its format, defined by PROTOCOL.certkeys, is essentially “a public key plus a set of identity fields signed by the CA.” Understand those fields and you understand every governance handle the system offers:
- Serial: the CA’s issuance sequence number — the index for audit and revocation;
- Type: user certificate or host certificate; the fields are similar but the direction of trust is opposite;
- Key ID: a free-text identity label that lands in logs, meant for humans;
- Principals: the list of identities this certificate may represent — account names for a user certificate, hostnames for a host certificate;
- Validity period (valid after / valid before): two timestamps; on expiry the certificate fails automatically, with nobody having to reclaim anything;
- Critical options: constraints the server must enforce, and must reject the whole certificate if it does not recognise them — typically
force-commandandsource-address(source IP restriction); - Extensions: ignorable permission switches such as
permit-pty,permit-port-forwarding,permit-agent-forwarding— all off by default, opened one by one.
Issuance is the CA private key signing all of the above. Once the server has a single TrustedUserCAKeys line pointing at the CA public key, authentication logic changes from “is this public key in authorized_keys” to “verify the signature and read the fields”: is the signature valid, is it expired, is the target account among the principals, can the critical options be enforced. The public key file is no longer the carrier of permission — the certificate is.
Principals: Where the Authorisation Boundary Is Written
The most common misunderstanding of the certificate system is equating “has a certificate” with “has permission.” In the actual authorisation decision, the private key only proves “I am the certificate’s holder”; which machines and accounts you may enter is decided jointly by the principals and server configuration — the server can further restrict which principals an account accepts via AuthorizedPrincipalsFile.
This means the issuance step is the authorisation step. Issuing an operator principals: deploy versus principals: root are worlds apart, though the commands differ by one word. Mature issuance processes therefore turn principal values into templates: predefined per role (deployment, read-only inspection, database maintenance), issuers may only pick a template rather than type freely, and template changes go through review. A short validity period (hours) adds a time lock to that authorisation: even if the permissions were written wrong, the damage window is a few hours, not a line in some machine’s authorized_keys lying undiscovered for years.
Critical options refine “may enter” into “may only do this once inside”: a certificate issued to a backup system carries force-command restricting it to the backup command and source-address restricting it to originate from the backup server — even if that private key leaks, what the attacker gets is a key locked in a cage.
Revocation: The Division of Labour Between KRL and Short Validity
To void a certificate before it expires, you use a KRL (Key Revocation List): generated with ssh-keygen -k, it can enumerate certificates to revoke by serial range, by key ID, or directly by public key; it is distributed to every server and pointed to by RevokedKeys in sshd_config. After verifying the signature, the server checks the KRL as well and refuses on a match.
The KRL’s soft spot is distribution latency: an updated list only counts once it has been pushed to every machine, so there is always a window. The design consensus is therefore that revocation and short validity are mutually redundant: with validity measured in hours, most “void this” needs are satisfied by simply waiting for expiry, and the KRL handles only events that cannot wait, such as a confirmed private-key compromise. Conversely, validity measured in months turns the KRL into a daily dependency and makes distribution delay a standing risk. Judging whether an SSH certificate deployment is healthy: look at its validity lengths before you look at whether it has a revocation mechanism at all.
CA Governance: Where the System Is Won or Lost
All trust ultimately converges on the CA private key: whoever holds it can issue any identity. The protection level of the CA private key is therefore the ceiling of the whole system, and common practice escalates in strength: keep the private key offline, present only on the issuing machine; log every issuance action for audit (serial, principals, applicant, validity); in high-value environments, place the CA private key in a hardware security module or use the PKCS#11 / security-key residency OpenSSH supports, so signatures can only be performed by hardware and the key cannot be exported.
CA rotation must also be prepared: generate the new CA public key in advance, have servers trust old and new simultaneously, and retire the old CA once existing certificates have naturally expired — because certificates are short-lived, the rotation cycle can be compressed to days, a structural advantage over “replace authorized_keys machine by machine.”
Assemble these parts and an SSH certificate is no longer “another way to hand out keys” but a complete identity system: issuance is authorisation, fields are policy, expiry is reclamation, revocation is damage control, and the CA is the root of trust. The problem it solves was never cryptography — it is scale.
The Issuance Pipeline: How a Certificate Reaches Your Hands
The final piece of the system is the user experience of issuance. An hours-long validity period means issuance must be a low-friction daily action — if every certificate requires finding an administrator to run an ssh-keygen command by hand, short validity will be quietly changed back to a year by the second week, “for convenience.” Mature deployments make issuance a self-service pipeline: the user first proves who they are through the organisation’s unified authentication (such as single sign-on plus multi-factor), the issuance service determines which principal templates they may request, sends their public key and the template parameters to the CA for signing, and within tens of seconds the certificate lands directly in their ssh-agent — without the user ever needing to know which machine the CA private key lives on.
Two design points matter in this pipeline. First, the issuance service exposes exactly one action: signing. It verifies the applicant’s identity and template, then calls the CA to complete the signature; the CA private key itself never traverses the network and never appears in any ticketing system. Second, the issuance log is the access ledger: who obtained a certificate for which account, and when, is all recorded on the issuance side; combined with server login logs, “request — issuance — use” forms a complete chain, which under the authorized_keys model would require stitching logs from across the whole fleet to approximate.
The pipeline also needs an exception path: what happens when the issuance service itself is down? Common practice keeps a very small number of emergency accounts on traditional public keys (placed on the bastion host, with the strictest source restrictions and alerting), unused in normal times and alarmed the moment they are touched — an emergency path is not distrust of the system; it is the acknowledgement that every system needs a recovery route that does not depend on itself.
References
- OpenSSH certificate format specification, PROTOCOL.certkeys — https://www.openssh.com/specs.html
- ssh-keygen manual page (-s signing, -k KRL generation, -O options) — https://man.openbsd.org/ssh-keygen
- sshd_config manual page (TrustedUserCAKeys, AuthorizedPrincipalsFile, RevokedKeys) — https://man.openbsd.org/sshd_config
Tags: SSHCertificatesCAIdentity Governance