When you have to touch a host that lives behind several bastions, forwarding the agent is the quickest way to keep your private key off every hop. The catch? A compromised bastion can steal that key if you’re not careful. Below is a hands‑on walk‑through that shows how to tighten forwarding, what to watch out for, and how to double‑check that the key never ends up where it shouldn’t.
1. Understand the Threat Model
| Threat | Why it matters |
|---|---|
| Key exposure | A breached bastion can use the forwarded key to reach downstream hosts. |
| MITM | An attacker could trick your local SSH client into forwarding the key to an arbitrary host. |
| Untrusted hosts | Some internal services (monitoring agents, etc.) might run an SSH server that could request the key. |
The aim is to confine the key to the exact hosts you trust and to stop accidental leaks.
[Read More]