SSH Automation
You set up ssh automation by using scripts, key pairs, or signed OpenSSH certificates. These tools run remote commands across servers without a human typing a password. Most engineering teams start by copying static public keys onto target Linux hosts. They also route automated jobs through a central jump host or bastion server. When these shared keys hold broad root privileges, any compromised runner can change every server. How native ssh automation works with keys and certificates In a bas
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 ssh automation by using scripts, key pairs, or signed OpenSSH certificates. These tools run remote commands across servers without a human typing a password. Most engineering teams start by copying static public keys onto target Linux hosts. They also route automated jobs through a central jump host or bastion server. When these shared keys hold broad root privileges, any compromised runner can change every server.
How native ssh automation works with keys and certificates
In a basic setup, a build server or script holds a private key. Each remote host stores the matching public key inside an authorized file. When the script starts a session, the host checks that key pair. This lets the script log in and run tasks right away.
Managing static keys across hundreds of hosts gets hard very fast. Teams must add and delete keys on every single machine when jobs change. To fix this, OpenSSH 5.4 added certificate support for users and hosts. Instead of trusting individual public keys, servers trust one central Certification Authority key.
The native key tool signs a user public key with that authority key. The resulting OpenSSH certificate uses a much simpler format than standard web TLS certificates. It holds the public key, an identity string, and zero or more principal names. It also holds a set of options signed by the authority key.
You can sign a certificate for a user or for a host. By default, the key tool creates a user certificate unless you ask for a host one. You also set an identity string and list the valid user or host principals. A validity window controls when the certificate works, though the default window lasts forever.
Why host login rules leave an operational gap
OpenSSH certificates solve the headache of copying static keys to every new machine. You can issue short-lived certificates for automated jobs and set clear principal names. You can also embed certificate options that limit what the session can request. This setup works well for deciding which runner or engineer can log in.
Still, host login checks only happen when the session first starts. Once the daemon accepts the key or certificate, the user gets a shell. If an automated job needs admin rights for one task, it gets full root access. Native host login rules cannot inspect individual commands in flight during that session.
SSH Access Management: architecture patterns and best practices
Continue reading? Get the full guide.
Free. No spam. Unsubscribe anytime.
A script with a valid certificate can still run destructive commands by mistake. It can also read sensitive files that contain customer emails, phone numbers, or card numbers. Standard system logs only show that the key logged in as a specific principal. They do not give teams fine-grained approval steps for risky actions or mask sensitive output.
Designing safer automated server workflows
To reduce risk, teams should stop using long-lived static keys on build servers. Issue OpenSSH certificates with tight validity windows so credentials expire right after a job ends. Map each automated workflow to a dedicated principal name with minimal host permissions. Set clear certificate identity strings so server logs show which job opened the session.
Even with strict certificates, you must still watch what happens after login. Separate routine read tasks from high-risk changes that alter system state or read private data. When scripts or humans run commands on production hosts, control needs to reach the command level.
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 open-source SSH listener on the host where people and agents keep their normal ssh, sftp, and scp tools.
First, hoop.dev guardrails check one-shot commands and file paths before they run. Next, 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
What is the difference between an OpenSSH certificate and a static key?
A static key is just a raw pair of public and private files. An OpenSSH certificate adds an identity, principal names, options, and a signature from an authority key.
Do OpenSSH certificates expire on their own by default?
No, the default validity window for a signed OpenSSH certificate lasts forever. You must set a specific start and end time when you sign the key.
Can OpenSSH certificates sign both user and host keys?
Yes, the native key tool signs user certificates by default during the signing step. You can tell the tool to make a host certificate instead when signing server keys.
Related guides
In this post