All posts

How to Apply PAM to Nested Agents

When pam is correctly applied to nested agents, privileged actions can be gated by identity verification, just‑in‑time approval, and an immutable audit trail, while the agents themselves never see raw credentials. In many organizations, a nested agent is a service account that runs inside a bastion host or a CI runner and then launches further connections to databases, Kubernetes clusters, or SSH endpoints. Those agents usually inherit a long‑lived secret from the host, and that secret is reuse

Free White Paper

End-to-End Encryption + CyberArk PAM: The Complete Guide

Architecture patterns, implementation strategies, and security best practices. Delivered to your inbox.

Free. No spam. Unsubscribe anytime.

When pam is correctly applied to nested agents, privileged actions can be gated by identity verification, just‑in‑time approval, and an immutable audit trail, while the agents themselves never see raw credentials.

In many organizations, a nested agent is a service account that runs inside a bastion host or a CI runner and then launches further connections to databases, Kubernetes clusters, or SSH endpoints. Those agents usually inherit a long‑lived secret from the host, and that secret is reused across dozens of downstream sessions. The result is a cascade of standing access: if the initial credential is compromised, an attacker can pivot through every downstream system without triggering any alert. Auditors see a wall of successful logins but no evidence of who actually initiated each command.

Why pam matters for nested agents

Privileged Access Management (pam) is about enforcing the principle of least privilege at the moment of use. For nested agents, pam must answer three questions:

  • Who is the original requestor?
  • Is the requested operation approved for that identity?
  • Can we prove, after the fact, exactly what was done?

Without a control point that inspects each request, the answers remain hidden in logs that only record successful connections. The downstream target sees a valid credential, not the human or system that caused the request, and therefore cannot enforce pam policies.

The missing enforcement layer

Identity providers such as Okta or Azure AD can issue tokens that prove who a user is, and role‑based policies can limit which resources a token may reach. Those pieces belong to the setup layer: they decide who may start a session, but they do not inspect the traffic that flows after the session begins. The enforcement point must sit in the data path, between the nested agent and the target service, so that every command can be evaluated against pam rules before it is executed.

How hoop.dev creates a pam‑aware data path

Setup: identity and least‑privilege grants

First, configure an OIDC or SAML identity provider that issues short‑lived tokens to engineers and automation. Assign each token to a role that only allows the minimal set of downstream resources required for the job. Deploy the hoop.dev gateway in the same network segment as the bastion host so that the nested agents must route their connections through it.

The data path: an identity‑aware proxy

hoop.dev sits on the wire at layer 7, intercepting the protocol stream from the nested agent to the target database, Kubernetes API, or SSH daemon. Because the gateway terminates the connection, it can read the user’s identity from the presented token, match it against the pam policy, and decide whether to allow, mask, or block the request. No other component in the architecture can see or modify the traffic without breaking the flow, making the gateway the sole enforcement point.

Enforcement outcomes provided by hoop.dev

  • hoop.dev records each session, preserving a replayable log that shows exactly which commands were issued and what responses were returned.
  • hoop.dev masks sensitive fields, such as passwords or personal data, in real time, so downstream services never expose them to the agent.
  • hoop.dev blocks disallowed commands before they reach the target, preventing destructive actions that fall outside the pam policy.
  • hoop.dev routes high‑risk operations to a human approver, enforcing just‑in‑time approval based on the original requester’s identity.
  • hoop.dev ensures that the nested agent never receives the raw credential; the gateway holds the secret and presents short‑lived, scoped tokens to the target.

All of these outcomes exist only because hoop.dev occupies the data path. If the gateway were removed, the nested agent would connect directly to the target, and none of the pam controls would be applied.

Practical steps to adopt pam for nested agents

1. Define pam policies that describe which identities may perform which actions on each downstream service. Include rules for masking, command allow‑lists, and approval thresholds.

Continue reading? Get the full guide.

End-to-End Encryption + CyberArk PAM: Architecture Patterns & Best Practices

Free. No spam. Unsubscribe anytime.

2. Configure your identity provider to issue short‑lived tokens that embed the user’s groups or roles. Ensure that the token contains enough context for the gateway to make a decision.

3. Deploy the hoop.dev gateway near the bastion host or CI runner. The getting started guide walks you through a Docker‑Compose deployment that includes OIDC verification and agent installation.

4. Register each downstream resource in hoop.dev, attaching the appropriate credentials or IAM role. The gateway will use these credentials on behalf of the nested agent, keeping them hidden from the agent process.

5. Enable the built‑in approval workflow and inline masking features. The learn page provides detailed explanations of how approvals are triggered and how masking rules are expressed.

6. Test the end‑to‑end flow: an engineer triggers a CI job, the nested agent attempts a database query, hoop.dev evaluates the pam policy, records the session, masks any sensitive columns, and either allows the query or routes it for approval.

7. Monitor the audit logs generated by hoop.dev. They give you the evidence needed to demonstrate compliance with internal security standards and external audits.

FAQ

Does hoop.dev replace my existing identity provider?

No. hoop.dev consumes the identity token issued by your provider and uses it to enforce pam rules. The provider still handles authentication and token issuance.

Can I use hoop.dev with existing service accounts?

Yes. Service accounts can be granted scoped roles in your identity system, and hoop.dev will enforce pam policies on any connection that originates from those accounts.

What happens if an agent tries to bypass the gateway?

Because hoop.dev terminates the network connection, any attempt to connect directly to the target will be blocked by network policies that allow traffic only from the gateway’s IP range.

By placing pam enforcement in the data path, you gain real‑time control, immutable audit, and protection against credential leakage for every nested agent.

Explore the source code and contribute on GitHub.

Open source

Save the open-source gateway for agent data access

Hoop is MIT-licensed infrastructure for controlling how AI agents reach production data. Star hoophq/hoop so you can inspect it, deploy it, or share it when your team starts governing agent access.

Star and save the repo →More posts