SSH Security Automation

Published
Length
3 min read

Luis Felipe Dias

All posts

You build ssh security automation by replacing static public keys with signed OpenSSH certificates. An authority key signs user and host keys with an identity and valid principals. Most teams start by copying static public keys to server files across their fleet. When roles stay too broad, old keys let former staff log in to critical hosts. Manual key cleanup takes hours and often misses hidden accounts on older machines. How ssh security automation works with OpenSSH certificates OpenSSH add

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 build ssh security automation by replacing static public keys with signed OpenSSH certificates. An authority key signs user and host keys with an identity and valid principals. Most teams start by copying static public keys to server files across their fleet. When roles stay too broad, old keys let former staff log in to critical hosts. Manual key cleanup takes hours and often misses hidden accounts on older machines.

How ssh security automation works with OpenSSH certificates

OpenSSH added support for user and host certificates in version 5.4. These certificates use a much simpler format than standard TLS certificates. Each certificate holds a public key, an identity string, and a list of principals. It also holds a set of options signed by a Certification Authority key. Instead of pushing user keys to every server, you configure servers to trust the authority.

When an engineer needs to log in, the authority signs their public key. The signing step sets a key identity and attaches one or more principal names. Principals match the user or host accounts allowed for that specific certificate. By default, signing creates a user certificate, though the tool can also sign host keys. You can also set a validity window so the certificate expires on a set schedule. If you skip the validity setting, the certificate stays valid forever. Teams automate this signing step through scripts that check identity status before issuing a certificate. Hosts also use signed certificates so users never have to guess if a server is real.

Why static bastion hosts slow down key management

Many teams place a bastion or jump host in front of private servers. Engineers log in to the jump host first, then hop to the target machine. Without automation, admins must still update key files on both the bastion and target hosts. If an engineer changes teams, someone must find and remove their public key everywhere.

A stray key on one machine gives an attacker a path into the network. Automated certificate signing removes the need to touch key files on individual servers. The server simply checks the authority signature and the principal list at login time. This approach cuts down on manual work when new engineers join or leave the team.

SSH Agent Forwarding Security: architecture patterns and best practices

Continue reading? Get the full guide.

Free. No spam. Unsubscribe anytime.

What native certificate setups solve and what they miss

Certificate automation solves the problem of who can log in to a Linux host. It replaces scattered key files with a central trust model and clear expiration times. You no longer need to run scripts that scrub old keys from hundreds of servers.

Still, native SSH setup only checks identity at the moment the session starts. Once a user logs in as a shared principal, the server grants full shell rights. Standard certificates do not inspect individual commands while the session runs in flight. They cannot pause a risky delete command for peer approval before it executes. They also cannot mask sensitive fields like emails, phone numbers, or card numbers in output. If ten engineers share one Linux principal, standard host logs struggle to tie commands to individuals. Teams still need a way to govern live commands and protect data during active sessions.

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 on the host. It checks callers with OpenSSH certificates and works with ssh, sftp, scp, and rsync clients.

When a caller runs a one-shot command or moves a file, hoop.dev guardrails check the command or path before it runs. Then 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 is the difference between an OpenSSH certificate and a static SSH key?

A static SSH key is just a raw public and private key pair. An OpenSSH certificate wraps that public key with an identity, principals, options, and an authority signature.

Do OpenSSH certificates use the same format as TLS certificates?

No, OpenSSH uses a custom certificate format introduced in version 5.4. It is much simpler than the X.509 format used for web TLS traffic.

What happens if you do not set an expiration time on an OpenSSH certificate?

If you do not specify a validity window during signing, the certificate remains valid forever. Teams should always set a short validity window when automating certificate signing.

The query runs. The emails stay hidden.