The SSH Key Problem: Why Agentless Configuration Management Creates More Security Risks Than It Solves
Published · Updated
The SSH key on your Ansible server can open every host it manages. Here's why "agentless simplicity" often hides a long-lived credential risk.
"Agentless" became a selling point in configuration management because agents were seen as overhead: something else to install, maintain and debug. Ansible, Salt in SSH mode and similar tools promoted the simplicity. No agent to manage. Just SSH, which you already have. It sounds elegant.
But agentless isn't simpler. It's a trade-off that exchanges agent overhead for a persistent security exposure: SSH key management at scale. In larger environments, and especially in disconnected or air-gapped ones, it's a risk many teams don't recognize until something goes wrong.
Key rotation that never happens, audit findings on credential management, breaches that start with a copied private key: these are common stories. The "agentless is better" assumption deserves a closer look.
How agentless configuration management works
Strip away the marketing and here's the technical reality.
Ansible, Salt SSH and similar tools connect to managed nodes to run commands, using SSH as the transport. That typically means:
- an SSH private key stored on the management server (for example
/home/ansible/.ssh/id_rsa) - the matching public key in
~/.ssh/authorized_keyson every managed node - often the same key pair across hundreds of machines
- passwordless
sudofor that SSH user on every managed node
Each time configuration is applied or checked, the management server opens SSH connections, authenticates with the private key, runs commands with sudo, and disconnects.
The appeal of agentless
- No agent software to install or maintain on endpoints
- No agent process using resources on managed nodes
- No agent version compatibility to manage
- "Just SSH, which you already have and understand"
The implication: SSH, and the keys that authenticate it, become the crown jewels of your infrastructure. Whoever holds that private key controls everything it can reach.
Issue 1: SSH must be reachable, always
For Ansible to reach a node, the node's SSH port must be reachable from the management server. That's an architectural requirement security teams often dislike but can't remove.
The network exposure reality
- SSH must listen on every managed node and be reachable from the management server
- In many deployments, that means SSH open across internal networks or network segments
- Nodes in other VLANs, subnets or isolated segments need SSH paths through jump hosts
- Firewall rules multiply: every node must allow SSH from management infrastructure
- Segmentation gets harder ("we need SSH open from the management VLAN to production")
SSH becomes a permanent, required service that can't be disabled or tightly restricted. Every listening SSH daemon is a potential target. Non-standard ports and IP allowlists help, but the exposure remains.
Picture a network where SSH is reachable from segments that include contractor workstations, legacy systems and IoT devices, all because automation needs a path to production. The network team wants SSH locked down. The infrastructure team needs it open. Automation usually wins that argument, and permissive SSH access is exactly what attackers look for.
Issue 2: One key to open everything
Here the security implications get serious. Agentless tools typically use one SSH private key for all managed nodes, or at best a few keys grouped by environment.
The key management reality
- One private key grants access to many nodes
- The key lives on the management server, often without a passphrase so automation can run
- The key's user has passwordless
sudoon managed nodes - Plain SSH keys don't expire (there's no built-in expiry unless you use SSH certificates)
- Rotation is rare because it risks breaking automation
Why this happens
- Per-node keys are operationally complex
- Rotation workflows have to be built and maintained by the team
- Teams prioritize "working" over "secure"
- Once deployed, inertia keeps the same key for years
- Nobody wants to be the one who broke production
If that private key is compromised:
- The attacker has persistent access to every node that trusts it
- They don't need to stay on the management server; they can connect from anywhere that reaches the nodes
- With
sudo, full root compromise is trivial - The exposure isn't time-limited: the key works until it's removed across the fleet
- There's no way to know the key was copied unless you catch it being used
Scenario: the silent compromise. Your Ansible server is compromised through an unrelated weakness: an unpatched CI server, a phished admin. The attacker doesn't need to keep access to that server. They copy /home/ansible/.ssh/id_rsa and leave. They can now connect to any managed node, whenever they choose. They can wait weeks before using it, or sell it. They keep access even after you rebuild the compromised server from scratch.
Issue 3: The key works any time, until removed
This is what makes SSH key compromise different from most credential theft.
Time-limited credentials
- API tokens often expire
- Kerberos tickets expire after hours
- Session tokens time out
- OAuth access tokens need refreshing
- Even passwords can be forced to change
Plain SSH keys
- No built-in expiry
- Work until manually removed
- Can be used from any location that can reach the nodes
- No central session to detect or terminate
- Authentication looks the same as legitimate use
An attacker with the key doesn't need live access to the management server. They can use it from their own infrastructure, at their own pace, and pick their moment: during an incident (when you're distracted), during a maintenance window (when activity looks normal), or off-hours (when monitoring is thinner).
Network logs show ordinary-looking SSH connections: same key, same protocol, same behavior. SIEM rules struggle to tell legitimate automation from malicious use of the same key. Source IP may be the only signal, and if the attacker pivots through internal systems, even that's gone.
Consider a plausible sequence. An organization recovers from a breach by rebuilding its Ansible server from scratch. The new server is clean, so nobody rotates the SSH keys. But the old key was copied during the original breach. Months later, someone is still connecting every few weeks, collecting data and disconnecting, and it looks like routine automation traffic.
The air-gap illusion
Here's an uncomfortable irony: disconnected environments (air-gapped networks, classified systems, OT/ICS networks) are meant to be more secure, yet they often rely on agentless tools for the same reasons: simplicity, and no internet-based agent updates.
SSH key management is even harder there:
- Jump hosts and bastion servers become single points of failure and high-value targets
- SSH keys get copied to several jump hosts for redundancy
- Key rotation is harder still, with no central repository to push from
- Audit trails are fragmented across disconnected segments
- If a key is compromised, working out which systems are affected is very hard
- Keys stay unchanged for years because rotation is an operational burden
The management server and nodes may not reach the internet, but the management server still needs SSH. So keys end up on jump hosts, intermediate management servers and sometimes engineers' laptops for emergency access. The attacker doesn't need internet access. They need one of those keys.
How agent-based architecture changes the model
Here's how LEA Platform's agent architecture differs from the agentless approach, and why it matters for security.
The basic difference
- LEA agents run on managed hosts (Linux, macOS, Windows)
- Agents open outbound HTTPS connections to the LEA server (pull, not push)
- No SSH keys are needed for normal operation
- No inbound port needs to be open on managed hosts for LEA
- Each agent authenticates with its own client certificate (mTLS)
No shared SSH key
There is no SSH private key that opens every node, and no single stolen file that hands over the whole fleet. Compromising the LEA server doesn't give an attacker SSH access to nodes. Each agent has its own certificate, obtained at enrollment with a deployment token, not a shared key.
Outbound-only connections
Agents connect to the server; the server doesn't connect to agents. Nodes don't need to accept inbound connections for management, so firewall rules can block inbound SSH while LEA keeps working. Hosts in restrictive segments only need to reach the LEA server over HTTPS.
The server can't be impersonated easily either
Agents check the server's identity too: server responses are signed (Ed25519), and the agent pins the key and checks a timestamp window. A machine that merely intercepts traffic can't hand agents its own instructions.
No sudo key material
There are no passwordless-sudo SSH keys sitting in authorized_keys. The agent runs with the privileges you give it, and LEA's rules document the minimal privilege each one needs. Rules are read-only checks by default; remedies (commands that change settings) are opt-in per rule.
Per-node identity
Each agent has its own certificate. Compromising one host doesn't give access to others. An admin can invalidate a single agent's certificate from the console without touching the rest of the fleet, and enrollment and re-enrollment events are written to the audit log.
The architectural comparison
In an agentless environment, if someone steals /home/ansible/.ssh/id_rsa, they can reach your infrastructure until that key is removed everywhere.
In an agent-based environment, an attacker who compromises the LEA server can influence what agents run, but only through the server, only when agents check in, and only while they hold the server. That is still serious, which is why the server needs the same protection as any other management system. But there's no portable credential to take away and use at leisure, and no direct SSH path to the nodes.
The operational trade-offs
To be fair about what agents require:
Agent overhead
- Agents must be installed on every managed node
- Agent binaries need updates (LEA agents can update themselves, with hash checks)
- Agent processes use some CPU, memory and disk
- You need to watch agent health and connectivity
- Initial rollout takes more effort than "just use SSH"
Compare that to SSH key management
- How do you rotate SSH keys across a large fleet?
- How do you audit which keys can reach which systems?
- How do you revoke a key you suspect is compromised?
- How do you know whether a key has been copied?
- How do you prove compliance with credential policies?
Agentless front-loads simplicity and defers security complexity. Agents front-load the effort and pay it back over time. You pay either way; the question is when, and what you get for it.
Agent-based isn't perfect
Agents don't solve everything.
Agents can be compromised. An attacker with root on a host can tamper with the agent on that host. That's true of any endpoint software (EDR, log forwarders, monitoring agents). LEA limits what a tampered agent can do: it sends raw output, and the server decides pass or fail, so the agent never sees the expected values.
Agents need maintenance. Updates need rolling out. Agents can stop running. You need monitoring to catch offline agents. There's operational overhead, even when most of it is automated.
Agents don't remove all SSH. You may still use SSH for emergency access or initial bootstrapping. The difference is that SSH is no longer the main management path, so it can be restricted and monitored much more tightly as the exception rather than the rule.
Agent-based isn't a silver bullet. But it changes the threat model: instead of one key that grants open-ended access to everything, you have per-host identities with a limited blast radius. That's a real improvement.
Hybrid approaches and escape hatches
Real environments are messy, and pure approaches rarely survive contact with operations.
LEA with SSH for emergencies. Agents handle day-to-day compliance checks and remediation. SSH stays available but tightly restricted: IP allowlists, MFA, session recording, time-limited access. SSH becomes break-glass access, not the default management path.
Ansible for bootstrap, LEA for ongoing checks. Use Ansible to provision new hosts and install the LEA agent with a deployment token. Once the agent is enrolled, the bootstrap SSH keys can be removed or tightly restricted.
Where agents aren't possible. LEA also offers an Ansible/AWX path: a gateway playbook fetches rules and posts results over SSH for hosts that can't run an agent. That path inherits the SSH key concerns in this article, so keep it to the hosts that need it. LEA's legacy and gateway endpoints can be limited to gateway certificates or turned off.
Disconnected environments. Agents check in when they can reach the LEA server, which you run inside the segment. No persistent SSH access across the gap is needed for routine checks. Jump hosts are still useful for initial agent installation, but not for day-to-day operations.
Attack scenarios
Here's how SSH key compromise tends to play out, and why it's so damaging.
Scenario 1: the stolen laptop. A DevOps engineer's laptop is stolen. It holds SSH keys used for automation, with no passphrase, because typing one interrupts automation. Impact: the attacker has access to managed infrastructure, and nobody is sure which keys were on the laptop. With agents: the laptop may hold a login to the LEA console, which can be disabled centrally (local account or your SSO provider). There's no SSH key for the fleet to steal.
Scenario 2: the compromised CI/CD pipeline. A CI server runs Ansible playbooks during deployment. It's compromised through an unpatched plugin, and the attacker finds the SSH keys in its credential store. Impact: access that survives cleanup of the CI server, usable from anywhere. With agents: there's no fleet-wide SSH key in the pipeline to find.
Scenario 3: the insider. An admin copies SSH keys before leaving. Months later, the keys still work, because nobody rotated them. Impact: no detection, since it looks like automation traffic. With agents: the admin's console account is disabled when they leave. There are no fleet SSH keys to copy.
Scenario 4: the supply chain. A service provider holds SSH access to manage your systems. The provider is compromised, and attackers use its keys to reach customer environments. Impact: customers don't know the keys are compromised. With agents: provider access goes through the management console with an audit trail. Removing it is an account change, not a key rotation across every node.
The compliance headache
SSH key management creates audit questions that are hard to answer:
- Which SSH keys can reach which systems?
- When were keys last rotated?
- Can you show a specific key hasn't been copied?
- How do you cut off a departed employee who might have copied keys?
- What's your rotation policy, and can you prove you follow it?
- Who accessed which systems, and when?
PCI DSS, SOC 2, NIST SP 800-53 and ISO 27001 all have requirements on credential management, privileged access, least privilege and audit logging. SSH keys with passwordless sudo to many systems cut against the intent of those requirements, if not the letter.
What an agent-based approach gives you
- Per-host identity, with enrollment events in the audit log
- Central control of access, including invalidating a single agent's certificate
- An audit trail of admin actions: who did what, and when
- Rules that document the privilege they need
- Rotating deployment tokens and automatic certificate renewal
LEA can also check SSH hygiene itself, for example sshd_config settings and legacy SSH algorithms, as part of its rule set.
The real trade-off
Agentless configuration management isn't simpler. It's a security trade-off that looks like operational convenience. The SSH key on your Ansible server can open every host it manages, from anywhere that reaches them, until it's removed. If it's copied, the resulting access is hard to tell apart from legitimate automation.
Agent-based approaches trade upfront effort for long-term security: no shared SSH key, per-host identity, outbound-only connections and a smaller blast radius. The agents aren't just overhead. They're a security control.
Stolen credentials are one of the most common ways attackers get in. Handing out a key that opens every host, in the name of simplicity, is a risk worth reconsidering.
Key takeaways
- SSH keys can be skeleton keys. One copied key can give passwordless
sudoon every node that trusts it, with no time limit and no session to end. - Agentless needs always-on SSH. Every managed node must accept inbound SSH from management infrastructure, which widens exposure and complicates segmentation.
- Plain SSH keys don't expire. A copied key works until removed, and its use looks like normal automation.
- Air gaps don't fix it. Disconnected environments have the same key problem, with harder rotation and fragmented audit trails.
- Agent-based design limits blast radius. Per-host certificates, outbound-only connections and no shared SSH key change the threat model.
- You pay either way. Agentless defers its security cost; agents pay it up front.
LEA Platform produces evidence; certification is granted only by an accredited auditor.
Try LEA Platform on your own servers:
Start a free POC