Managing SSH Keys

Published
Length
3 min read

Luis Felipe Dias

All posts

Managing ssh keys starts with replacing static key files with signed OpenSSH certificates. Teams sign user keys with a central authority key and set short expiration windows. Many teams begin by copying public keys onto every server across their fleet. Those static keys never expire on their own and accumulate over time. When engineers leave or change roles, old keys often stay on production hosts. Broad server permissions let any holder of an active key run unchecked commands. How managing ss

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.

Managing ssh keys starts with replacing static key files with signed OpenSSH certificates. Teams sign user keys with a central authority key and set short expiration windows. Many teams begin by copying public keys onto every server across their fleet. Those static keys never expire on their own and accumulate over time. When engineers leave or change roles, old keys often stay on production hosts. Broad server permissions let any holder of an active key run unchecked commands.

How managing ssh keys works with OpenSSH certificates

OpenSSH added native certificate support for users and hosts to solve static key sprawl. The key generator tool signs a user public key with a central authority key. This signing step produces a simple certificate instead of a complex TLS style file. Each certificate holds the public key, an identity string, and allowed principal names. Principals define which user accounts or host names the certificate holder can use. It also stores options and a validity window signed by the authority key.

Servers only need to trust the central authority public key to verify logins. You do not need to push user public keys to individual target hosts anymore. When an engineer logs in, the server checks the authority signature and validity window. You must set an explicit validity window when signing, or the certificate stays valid forever. You can also sign host certificates so user machines trust servers without manual fingerprint prompts. Central signing turns key distribution into a repeatable verification workflow.

Rotating keys and revoking trust across hosts

Static public keys require teams to touch every host during a key rotation. If a laptop is lost, someone must scrub that key from every server file. OpenSSH certificates reduce this work when teams set short validity windows during signing. A certificate that expires after a few hours stops working on its own. Admins can also maintain a revocation list on hosts to block active certificates early. Yet pushing updated revocation lists to every host still takes careful automation and time.

What native key setups solve and what they miss

Native OpenSSH certificates solve the problem of distributing and expiring static public keys. They prove who the user is at the moment the SSH session starts. Still, key and certificate checks only govern the initial login handshake on the host. Once the shell opens, the certificate does not inspect or approve individual commands in flight. A valid principal with root or admin rights can run destructive commands right away.

SSH Access Management + Customer-Managed Encryption Keys: architecture patterns and best practices

Continue reading? Get the full guide.

Free. No spam. Unsubscribe anytime.

Native key setups also leave gaps in audit logs and data protection. Standard server logs record which key or certificate logged in, not full interactive output. If an engineer inspects a file with customer emails or card numbers, raw text appears. Native SSH certificates cannot rewrite matched sensitive fields like phone numbers or national IDs. Teams that need command approvals or output masking must look beyond key files alone.

Inspect one-shot SSH commands and file tasks

SSH certificates and host rules decide who is allowed on a machine. Setup alone does not check single commands or block sftp reads on sensitive paths. By design, hoop.dev runs an inline open-source SSH listener on the host where engineers and AI agents keep their normal ssh, sftp, and scp tools. On every production command or file operation, hoop.dev decides whether to pass, mask, block, or hold it for approval.

First, hoop.dev guardrails check one-shot commands and file paths before they run, and hoop.dev data masking masks matched values in file downloads. The audit trail logs the certificate principal, requested action, and verdict without storing session content. Interactive shells carry no guardrails and can be turned off when every action must be checked. Explore the code on GitHub.

Frequently asked questions

How do OpenSSH certificates differ from static SSH keys?

Static SSH keys are raw key pairs that stay valid until someone deletes them. OpenSSH certificates wrap a public key with an identity, principals, options, and an expiration window. A central authority key signs the certificate so hosts can verify it without local key lists.

Do OpenSSH certificates expire on their own?

They only expire if you set a validity window when signing the key. By default, a newly signed OpenSSH certificate stays valid forever unless you specify a time limit. Teams should always set a short validity window during the signing step.

Can SSH keys restrict what happens inside an active shell session?

Key options can lock a key to a single forced command at login time. Still, if a key grants an interactive shell, it cannot inspect later commands in flight. It also cannot ask a teammate for real-time approval before running a risky command.

The query runs. The emails stay hidden.