Harden SSH Bastion
To harden ssh bastion hosts, replace static keys with signed OpenSSH certificates and restrict forwarding. You must also lock down network ports and remove local shell accounts on the jump host. Most teams start by placing a single jump host at the network edge. They copy public keys to servers and let engineers hop to internal machines. When permissions stay too broad, one stolen key opens every server on your private network. How to harden ssh bastion setups with OpenSSH certificates Static
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.
To harden ssh bastion hosts, replace static keys with signed OpenSSH certificates and restrict forwarding. You must also lock down network ports and remove local shell accounts on the jump host. Most teams start by placing a single jump host at the network edge. They copy public keys to servers and let engineers hop to internal machines. When permissions stay too broad, one stolen key opens every server on your private network.
How to harden ssh bastion setups with OpenSSH certificates
Static keys do not expire on their own, so old keys pile up on servers. A better way to harden ssh bastion setups uses an OpenSSH certificate authority. The key tool signs a public key with a private authority key to make a certificate. Each certificate holds a public key, an identity string, principal names, and signed options. OpenSSH certificates use a much simpler format than standard web certificates.
You can sign user certificates for engineers and host certificates for your servers. When signing a key, you set a key identity and list the allowed principal names. You also set a time window so the certificate expires after a few hours. Without a time window, an OpenSSH certificate stays valid forever by default. Your servers trust the authority key and check the principal names before allowing a login.
Your jump host should only pass traffic through to target servers. Engineers should never open a local shell or store private keys on the bastion itself. Certificate options can turn off agent forwarding, port forwarding, and shell allocation on the jump host. This stops attackers from stealing forwarded keys if they break into the bastion host. You should also block password logins and root logins in your server settings.
Network rules and host checks on your jump host
Network rules add another strong layer to your jump host setup. Only allow incoming traffic to the SSH port from known office or VPN addresses. Outgoing traffic from the bastion should only reach the SSH ports on target internal servers. Drop all other outgoing network packets so the bastion cannot download bad tools from the web.
Host certificates protect engineers from fake servers during a login. When the authority signs each server host key, client machines trust the authority by default. Engineers no longer see unknown host warnings when they log into a fresh server. Keep the operating system small by removing compilers, extra network tools, and unneeded packages. Send all login logs to a remote log server right away so no one can erase them.
SSH Bastion Hosts / Jump Servers: architecture patterns and best practices
Continue reading? Get the full guide.
Free. No spam. Unsubscribe anytime.
What native bastion hardening solves and what it misses
Hardening your jump host and using OpenSSH certificates solves the login problem well. You know which user logged in and when their certificate expires. You also stop key sprawl across your fleet of Linux servers. The bastion checks the signed certificate and opens an encrypted tunnel to the target host.
Still, native SSH setup only decides who can open a connection to a server. Once the encrypted tunnel starts, the bastion only sees raw network bytes passing through. It cannot see individual shell commands or database queries running inside that session. If two engineers share the same Linux user account, local logs mix their actions together. You also cannot pause a risky command in flight or rewrite sensitive fields like emails or card numbers.
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
Why are OpenSSH certificates safer than static SSH keys?
Static SSH keys stay on servers until someone removes them by hand. OpenSSH certificates include an identity string, allowed principals, and a set expiration time. Servers trust one authority key instead of tracking hundreds of individual user keys.
Should engineers store their private keys on the SSH bastion?
No, engineers should never store private keys or run local shells on the jump host. They should keep keys on their own machines and jump through the bastion to target hosts. If a private key sits on the bastion, any breach there exposes your whole fleet.
Does a hardened SSH bastion log every command run on target servers?
No, a standard SSH bastion only forwards encrypted traffic from the client to the server. It logs when a tunnel opens and closes, not the commands typed inside the session. To see exact commands, you need tools that inspect the session at the command level.
Related guides
In this post