SSH Key Lifecycle
You manage the ssh key lifecycle by creating, rotating, and revoking server keys on schedule. You can also use OpenSSH certificates to expire user keys on a timer. Many teams start by copying static public keys onto each Linux host. Over time, old keys stay on servers after staff leave or change roles. When permissions are too broad, a single leaked key lets an attacker onto every machine. How the native ssh key lifecycle works A standard ssh key lifecycle has four main stages for every user
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 manage the ssh key lifecycle by creating, rotating, and revoking server keys on schedule. You can also use OpenSSH certificates to expire user keys on a timer. Many teams start by copying static public keys onto each Linux host. Over time, old keys stay on servers after staff leave or change roles. When permissions are too broad, a single leaked key lets an attacker onto every machine.
How the native ssh key lifecycle works
A standard ssh key lifecycle has four main stages for every user key. First, an engineer creates a public and private key pair on a local machine. Second, an admin places that public key onto the target server. Third, the engineer uses the key to log in and run commands. Fourth, the team must rotate or delete the key when the role ends.
Managing static files across hundreds of hosts breaks down fast for growing teams. You must track which public key sits on which host at all times. If an engineer loses a laptop, you must remove that key from every server. Missing even one server leaves an open door into your system.
OpenSSH offers a better way to handle this workflow with signed certificates. The OpenSSH key tool can sign a public key with a Certification Authority key. This signed certificate holds the public key, identity info, principal names, and options. OpenSSH certificates use a much simpler format than standard TLS certificates.
Using OpenSSH certificates to control key lifetime
Instead of copying user keys to every host, you set up one Certification Authority. Each host trusts the Certification Authority public key to check user logins. When an engineer needs to log in, the authority signs their public key. The signing step adds a key identity and one or more principal names. A principal name matches the user or host account allowed for the session.
By default, a newly signed OpenSSH certificate stays valid forever. You must set a clear validity window when you sign the user key. When you set a short window, the certificate stops working after the timer ends. You no longer need to scrub old public keys off individual servers. The ssh key lifecycle becomes much easier because expired keys simply fail to log in.
SSH Key Rotation + Identity Lifecycle Management: architecture patterns and best practices
Continue reading? Get the full guide.
Free. No spam. Unsubscribe anytime.
What native key management solves and what it misses
Certificates and key rotation solve the problem of who can log into a host. They stop old keys from working forever and shrink the window of stolen credentials. A central authority also saves admins from editing key files on every Linux machine.
Still, key management only checks identity at the start of a session. Once a user logs in as a shared Linux account, the key step ends. The native key setup does not watch or control individual commands in flight. Two engineers using the same principal name get the exact same host rights. If a script or user runs a bad command, a valid certificate will not stop it. You still lack clear logs of what each person typed inside that shared shell. Native keys also do not mask sensitive outputs like emails or card numbers in terminal results.
Check SSH commands and file transfers on the host
OpenSSH keys and certificates decide who can log into a Linux host. They do not check what a one-shot command or file transfer does once the session starts. With hoop.dev, you run an open-source SSH server with guardrails inline on the host. On every one-shot command or file transfer an AI agent or engineer runs against production, hoop.dev decides to pass, mask, block, or hold it for human review.
When a caller runs a one-shot command or moves a file, hoop.dev guardrails check the command or path before it runs, and hoop.dev data masking masks matched sensitive patterns in downloads and output. Interactive shells carry no guardrails because keystrokes have no statement boundary. Teams can turn interactive shells off and allow only commands and file tasks. The audit trail logs who connected and what was allowed or refused, without storing keystrokes or file bytes. See the source on GitHub.
Frequently asked questions
What are the main stages of the ssh key lifecycle?
The four main stages are key creation, placement on hosts, regular rotation, and removal. Each stage requires clear rules so old keys do not stay active on servers.
How do OpenSSH certificates improve the ssh key lifecycle?
A Certification Authority signs a user key with an identity, principal names, and an expiration time. Once the time runs out, the certificate expires without admins editing host files.
Does key rotation control what commands an engineer can run?
No, key rotation only controls who can start a login session on a server. Once the session starts, Linux user permissions decide which commands the engineer can run.
Related guides
In this post