Contents
- The certificate does not replace the private key.
- When is a classic authorized key a good choice?
- User and host certificates protect opposite directions
- Principals and validity are specific authorization data
- A small example of issuing a user certificate
- The client test must actually use the certificate
- Access Removal, KRL, and Compromised CA
- Decision-making and operational control
- Frequently asked questions
The certificate does not replace the private key.
In a typical key-based login, the server trusts a specific public key specified in the authorization source, often in authorized_keys. The SSH certificate adds a signed claim about the public key: who signed it, for what identities, and for how long it should be valid. The client still needs the corresponding private key to prove possession of it when logging in.
A server trusting a CA does not need to have a separate line for each short-term key, but it must correctly verify the signature, certificate type, validity, and allowed identities. This centralizes issuing decisions. An improperly protected CA can spread the impact of an incident because its signature is accepted by many servers.
OpenSSH certificates are not X.509 certificates used for regular HTTPS. Neither a public web CA nor browser trust automatically make them accepted SSH identities. The following examples describe the OpenSSH mechanism; support for a specific graphical application, hardware storage, or alternative SSH server must be verified independently.
When is a classic authorized key a good choice?
For a few administrators and a small number of servers, direct authorization may be the most straightforward. Each administrator has their own key, and the inventory shows exactly where it is allowed. Restrictions can be attached to a specific row and changes can be made through configuration management. There is no general obligation to switch to certificates just because they are available.
The challenge increases with the number of accounts, machines, and short-term accesses. When an administrator leaves, you need to find all the original authorizations; when temporary access is needed, you want to ensure that it ends. Certificates can simplify the distribution of decisions, but they require an issuance process, authority protection, recordkeeping, and a leak procedure. Moving the manual work to a signing script without identity verification is not a solution to access management.
- Direct key: simple local trust, but requires records of all authorization points.
- Certificate: trust in the CA signature and its issuance rules, with the possibility of short validity.
- Both variants: require private key protection, a secure client, and account authorization checks.
User and host certificates protect opposite directions
A user certificate helps the server decide who is allowed to log in. A host certificate helps the client verify which server it is connecting to. The two suffixes are not interchangeable. The signature must be issued for the correct purpose and the recipient must trust the correct authority. It is advisable to organizationally separate the authorities for both directions according to their role.
For host certificates, a client can trust a CA for a limited set of server names. This eliminates the need to manually approve each new host key. However, the name range must be consistent with infrastructure management. A trust rule that is too broad would accept authority signatures for hosts that you do not want to trust.
When migrating, do not confuse accepting the host CA with turning off host checking. Properly configured certificate trust still verifies identity. The StrictHostKeyChecking=no option does not replace this suggestion. Similarly, copying a user certificate to known_hosts does not make sense for account authorization.
Principals and validity are specific authorization data
A principal is an identity specified in a certificate, such as a specific administrative role or login name. In simple mode, a user CA is evaluated against the account the client is logging into. The mapping can be further controlled using an AuthorizedPrincipalsFile or other established mechanism. The design must be explicit: the CA signature itself should not automatically imply the right to log in as any user.
The validity period limits when a certificate can be used for new authentication. Short certificates reduce the useful life of a stolen certificate, but are not a substitute for key protection and incident response. Consider the difference in clocks between the client, the signing system, and the server. A small tolerance for the start of validity can help with operations, but should not mask a malfunctioning time synchronization.
# Zobrazení obsahu veřejného SSH certifikátu:
ssh-keygen -L -f ~/.ssh/id_ed25519-cert.pubCheck the type, signing authority, identifier, serial number, principals, time limits, and restrictions. The Key ID is an audit trail, not a secret password or an automatic guarantee of a person's identity. Its meaning depends on a trusted issuance process. A certificate does not create a person's identity simply by having someone write their name on it.
A small example of issuing a user certificate
The following demonstration is for an isolated test environment. Do not create the authority's private key on a regular managed server or store it with public web files. For a real CA, design key protection, access control, backup, and issuance audit trails. The signing engine must verify the applicant and authorized principals before signing.
# Na důvěryhodném podpisovém stroji, jednorázově pro testovací CA:
ssh-keygen -t ed25519 -f ./ca_spravci -C "testovaci-ssh-ca"
# Na stejném stroji podepište pouze ověřený veřejný klíč uživatele:
ssh-keygen -s ./ca_spravci -I "spravce-notebook" -z 2026112901 \
-n spravce -V -5m:+8h ./id_ed25519.pub
ssh-keygen -L -f ./id_ed25519-cert.pubThe -n option in the example restricts the principal to administrators and the -V specifies a time window. Serial numbers should be managed meaningfully in the record; the value here is just an example. The user's private key is not sent to the CA for signing. The public part is signed and the client receives a public certificate. Verify that the certificate actually corresponds to the intended key.
Only pass the CA public key, owned by the administrator and protected from unauthorized writing, to the server. If your chosen trust method is TrustedUserCAKeys, set its path in the effective configuration. Do not remove the existing authorizations until the new method is verified and ready to roll back.
# Příklad deklarace na testovacím serveru:
TrustedUserCAKeys /etc/ssh/user_ca.pub
# Kontrola serverové konfigurace před reloadem správné služby:
sudo /usr/sbin/sshd -tThe client test must actually use the certificate
The OpenSSH client can find the certificate next to the private key if the name is appropriate, but for diagnostics it is clearer to specify it explicitly. Use a test account corresponding to the principal and watch in the detailed log what the server accepts. If the same plain public key is also allowed in authorized_keys, a successful login alone does not prove acceptance of the certificate.
ssh -vvv -o IdentitiesOnly=yes \
-i ~/.ssh/id_ed25519 \
-o CertificateFile=~/.ssh/id_ed25519-cert.pub \
spravce@server.exampleIn an isolated test, design a resolution of both paths so that you can prove the certificate without compromising production access. Check the server record, signing CA, accepted principal, and correct account. If you are using CH-J Tools or another client, verify certificate support for the specific release; this command describes OpenSSH and does not automatically promise an identical interface for another application.
Test for rejections: different principal, expired, or untrusted test CA should result in the intended failure. Don't do mass production attempts that can trigger a block. Without negative tests, you can easily miss another authorization that bypasses the certificate policy.
Access Removal, KRL, and Compromised CA
A short validity period is useful, but you can't always wait for it to expire if you want to revoke access immediately. OpenSSH supports revocation lists, including KRLs and the RevokedKeys server directive. Effectiveness depends on the list being properly distributed and available on all relevant servers. Verify the behavior for a specific key or certificate, not just the existence of the file on disk.
Revocation and expiration are handled by new authentication. An already running session may not automatically be terminated. In the event of an incident, you must assess active access and changes that the user or attacker has managed to make. In the case of a CA private key compromise, the scope is broader: it is necessary to change the trust of servers or clients, map issued certificates, and safely restart the issuance process.
The central signing service also needs to address unavailability. Short certificates can limit access in the event of an issuance failure or incorrect time. Provide a controlled escape route with its own records and minimal privileges. A permanent, unlimited shared rescue key without audit would negate the value of a carefully designed short-term authorization.
Decision-making and operational control
Certificates are especially helpful where there are many servers, permissions change frequently, and the capacity to operate trusted issuance exists. For a small environment, carefully managed individual keys may be simpler. Base your decision on the number of changes and management costs, not on the assumption that a certificate is automatically a more secure file.
- Trust is limited to the correct CA, purpose, and set of accounts or hosts.
- Issuance verifies the actual authority of the applicant and records serial numbers as well as principals.
- Hours and validity are controlled, and short-term access has renewal available.
- The revocation is distributed and is actually tested.
- Clients support the required format and the transition maintains a safe return path.
The certificate itself is not a second factor and is not automatically post-quantum. The properties depend on the key used, the signature algorithm, and the entire verification policy. When documenting the deployment, name exactly what the new layer improves and what responsibilities it adds. This way, its benefits can be properly assessed even if the client or server changes in the future.
Frequently asked questions
Is an SSH certificate the same as an HTTPS certificate?
No. OpenSSH uses its own format and its own trust method. A public web CA is not automatically trusted by SSH.
Do I need a private key for the certificate?
Yes. The certificate signs the public identity, but login still requires proof of possession of the corresponding private key.
Will certificate expiration close the existing session?
No. Validity is assessed during authentication; running sessions require their own policy and incident response, if applicable.
Is the certificate automatically multi-factor authentication?
No. Multi-factor requires an appropriate login policy. The certificate file itself does not constitute a second factor.
Detailed documentation
OpenSSH: certificates and signatures ssh-keygen →
OpenSSH: trusted CAs and principals →
IETF: SSH certificate specification draft →