A bastion — or jump host — is the only machine in your environment that exposes SSH to the internet. Every other instance has SSH closed and is reachable only through the bastion. Done right, it is the smallest piece of infrastructure you operate. Done wrong, it ends up a snowflake VM with developer tools on it, SSH keys belonging to people who have left, and no documented rebuild path.
What’s happening
Common bastion mistakes we see on audits:
- Treated as a server. People install
tmux,aws-cli,kubectl, a database client, and run long jobs on it. It now has state, secrets, and rebuilding it is scary. - A single instance. When it reboots for kernel patching, on-call cannot reach anything until it returns.
- SSH access by shared key, or by individual keys never rotated. The list of who has access drifts from any source of truth.
- Reachable from
0.0.0.0/0on port 22, a magnet for credential-stuffing botnets and noise that hides real probing in the logs.
The bastion does one thing: forward SSH to instances on the private network. Anything else belongs elsewhere.
How to verify
What is actually exposed:
ss -ltnp
nmap -Pn -p 22,2222 <bastion-public-ip>
What is happening on the SSH port over the last day:
journalctl -u ssh --since "24 hours ago" | grep -E 'Failed|Invalid|Accepted' | wc -l
sudo lastb -F | head -50
A bastion exposed to the world will show thousands of failed attempts. That is acceptable as long as the configuration does not allow them to succeed.
Who actually has access:
sudo getent passwd | grep -E '/bin/(ba)?sh' | cut -d: -f1
cat /etc/ssh/sshd_config.d/*.conf /etc/ssh/sshd_config | grep -iE 'allowusers|allowgroups|passwordauth|permitroot'
If PasswordAuthentication yes is set or PermitRootLogin yes is set, the configuration is wrong regardless of how strong the passwords are.
The fix
- Disable password and root login. In
/etc/ssh/sshd_config.d/00-stackharbor.conf:PasswordAuthentication no,PermitRootLogin no,KbdInteractiveAuthentication no. Restartsshd. - Restrict SSH source IPs at the firewall. The Cloud Compute firewall rule should allow port 22 only from the team’s known egress ranges or a VPN concentrator, not
0.0.0.0/0. - Provision with cloud-init or configuration management. Authorized keys come from a source of truth (LDAP, an identity provider via
AuthorizedKeysCommand, or a versioned config repo). Rebuilding should produce an identical bastion in under 10 minutes. - Run two bastions behind a floating IP or DNS round-robin. Either can be rebuilt without losing access. Patch them on alternating windows.
- Use SSH
ProxyJump, not interactive sessions. Developers should neverssh bastionand thenssh next-hostfrom within it. They should runssh -J bastion next-hostso no shell on the bastion is needed.
Once the bastion is small, replaceable, and locked down, the operational risk it represents collapses. It becomes infrastructure, not a server.
If you want a bastion topology designed and operated as part of your environment, Cloud Compute includes it in the standard build — start a conversation.