Certificate-based SSH Authentication
You set up certificate based ssh authentication by signing user keys with a central authority. Then you tell each server to trust that authority instead of storing individual public keys. Teams use this method to stop copying public keys to every host across their fleet. Still, teams often issue broad principal names or skip expiration windows during the initial setup. When roles are too broad, one signed key grants wide root login across many machines. How certificate based ssh authentication
Your coding agents run with your access.
Claude Code reaches prod with a developer's credentials, and approval prompts get clicked through. hoop.dev checks every query, masks sensitive data, and holds risky changes for a human.
You set up certificate based ssh authentication by signing user keys with a central authority. Then you tell each server to trust that authority instead of storing individual public keys. Teams use this method to stop copying public keys to every host across their fleet. Still, teams often issue broad principal names or skip expiration windows during the initial setup. When roles are too broad, one signed key grants wide root login across many machines.
How certificate based ssh authentication works in OpenSSH
OpenSSH added support for user and host certificates in version 5.4. These certificates use a much simpler format than standard X.509 certificates used in web traffic. Each OpenSSH certificate holds a public key, an identity string, and a list of principals. It also holds a set of options and a signature from a Certification Authority key. You generate and sign these files with the standard OpenSSH key tool.
To issue a user certificate, the authority signs a user public key with its private key. During signing, the admin sets a key identity string to track the owner in logs. The admin also defines one or more principals, which are the allowed user or host names. You can also set a time window so the signed key expires after a short period. Without an explicit time window, the certificate stays valid forever by default.
On the server side, you do not need to list every user key anymore. Instead, you configure the SSH daemon to trust the public key of the Certification Authority. When an engineer tries to log in, they present their signed certificate to the host. The server checks the signature against the trusted authority key and checks the validity dates. If the requested login account matches a principal on the certificate, the server grants login.
How host certificates stop trust prompts
You can also use the same authority system to sign host keys for your servers. When you sign a key as a host certificate, you list the server hostnames as principals. Users then add the authority public key to their local known hosts file on their laptops. When a user connects to a new server, their client checks the host certificate signature. This stops false trust warnings and prevents attackers from spoofing servers on the network.
Certificate-Based Authentication + Browser-Based SSH/RDP: architecture patterns and best practices
Continue reading? Get the full guide.
Free. No spam. Unsubscribe anytime.
What OpenSSH certificates solve and what they leave open
Certificates solve the hard problem of distributing and rotating static keys across hundreds of servers. You no longer need to run scripts to clean up old keys when someone leaves. Short validity windows help limit how long a stolen key works on your machines. You can also embed options inside a certificate to restrict port forwarding or force one command.
Still, certificate checks only happen at the start of an SSH session during login. Once the server accepts the principal and opens a shell, its job is done. The certificate does not inspect or filter the individual commands an engineer runs inside that shell. If a developer logs in as a shared admin user, they can run destructive system commands. They can also read raw database files containing emails, phone numbers, card numbers, or national IDs. Native certificates decide who enters the host, not what happens inside the active session.
Add command and file guardrails to SSH access
Host firewalls and certificate principals control who opens an SSH session. Yet an allowed user or agent can still run a bad one-shot command or pull sensitive files over sftp. In practice, hoop.dev provides an open-source SSH server with guardrails on the host that uses OpenSSH certificates.
Using hoop.dev SSH controls, guardrails check one-shot commands, env variable names, and sftp or scp paths before they run. Port forwards default to deny unless the target is listed. Because interactive shells have no statement boundary and carry no guardrails, teams can turn them off so every command is checked and logged. Check out the MIT-licensed project on GitHub.
Frequently asked questions
How are OpenSSH certificates different from X.509 certificates?
OpenSSH uses its own light certificate format introduced in version 5.4. It avoids the complex parsing rules of X.509 while still binding keys to identities and principals.
What is a principal in an OpenSSH certificate?
A principal is a username or hostname listed inside the signed certificate. For user certificates, the login account on the server must match one of these listed names.
Do OpenSSH user certificates expire on their own?
No, OpenSSH certificates remain valid forever unless the admin sets a validity window during signing. Teams should always set a start and end time when signing a user public key.
Related guides
In this post