SSH Agent-Forwarding & Jump-Host Risk Review Prompt
Audit SSH client and server config for risky agent forwarding, unrestricted ProxyJump chains, and key-exposure paths on shared bastions, then replace them with safer ProxyJump/certificate patterns.
- Target user
- security-minded DevOps engineers hardening bastion and jump-host access
- Difficulty
- Intermediate
- Tools
- Claude, ChatGPT
The prompt
You are a senior DevSecOps engineer (defensive/blue-team) who knows that `ssh -A` agent forwarding through a multi-tenant bastion lets anyone with root on that hop hijack your keys to every downstream host. You harden the access path to remove that risk. I will provide: - Client config (`~/.ssh/config`, any `ForwardAgent`/`AddKeysToAgent` usage) and how engineers reach internal hosts - Bastion `sshd_config` (AllowAgentForwarding, AllowTcpForwarding, PermitTunnel, ForceCommand) and who shares it - Whether SSH certificates, hardware keys, or plain key files are in use Your job: 1. **Map the access path** — diagram how engineers hop from laptop to target hosts, and flag every place where a forwarded agent socket is exposed to a host the user does not fully trust. 2. **Assess agent-forwarding exposure** — identify hosts where `ForwardAgent yes` lets a compromised intermediary sign with the user's keys, and quantify blast radius. 3. **Audit the bastion sshd** — review AllowAgentForwarding/TcpForwarding/PermitTunnel, ForceCommand, and whether the bastion can be misused as a pivot. 4. **Recommend safer patterns** — replace agent forwarding with `ProxyJump`/`ssh -J` (or `ProxyCommand`), keeping private keys on the endpoint and never landing them on shared hops. 5. **Strengthen key custody** — move toward short-lived SSH certificates and hardware-backed keys with confirmation (`-c`), and scope `AddKeysToAgent`/lifetimes. 6. **Produce a remediation plan** — corrected client and bastion configs, a migration path off agent forwarding, and verification that legitimate workflows still work. Output as: (a) access-path diagram with risk callouts, (b) hardened `ssh/config` and `sshd_config` snippets, (c) ProxyJump/certificate migration steps, (d) verification checklist. Default to caution: prefer ProxyJump and short-lived certificates over agent forwarding; never enable agent forwarding to a host you do not fully control just to make a hop convenient.
Run this prompt with AI
Test it, get an AI-improved version, or compare models — live in the Prompt Workspace. No copy-paste.
Related prompts
-
Bastion / Jump-Host Hardening Review Prompt
Review a bastion/jump host for excess exposure and weak controls, then harden it into a minimal, heavily logged, single-purpose gateway with session recording and tight forwarding rules.
-
SSH known_hosts Host-Key Pinning Audit Prompt
Audit SSH client host-key trust: stale known_hosts entries, disabled StrictHostKeyChecking, weak key algorithms, and missing host-key pinning across a fleet
-
fail2ban Brute-Force Protection Tuning Prompt
Review and tune fail2ban jails to stop credential-stuffing and brute-force attempts without locking out legitimate users, with sane bantimes, allowlists, and persistent banning.
-
SSH Certificate Authority Access Design Prompt
Design an SSH CA-based access model that replaces sprawling authorized_keys with short-lived signed certificates, principals-based authorization, and clean revocation.
More DevOps Security & Hardening prompts & error guides
Browse every DevOps Security & Hardening prompt and troubleshooting guide in one place.
Reading prompts? Get all 500 in one free PDF
500 battle-tested, copy-paste AI prompts engineered by a senior systems engineer — every one with fill-in placeholders and safety/back-out notes. Drop your email and it's yours.
- 500 prompts: Linux · Kubernetes · Terraform · OpenStack · GitLab · Docker · Monitoring · Incident Response
- Instant PDF download — yours free, forever
- Plus one practical AI-workflow email a week (no spam)
Single opt-in · unsubscribe anytime · no spam.