How to Configure Haystack SSH Sandbox

Published
Length
3 min read

Luis Felipe Dias

All posts

You set up a haystack ssh sandbox by connecting your agent pipeline to a restricted remote host. This setup uses OpenSSH keys or signed certificates to isolate shell commands from your main app. Teams often build this sandbox so language models can run code or check system state safely. Still, many setups start with shared keys and broad host roles. When an agent holds broad shell rights, one bad prompt can wipe files or expose secrets. How a haystack ssh sandbox works A Haystack pipeline use

SSH Access Management + AI Sandbox Environments: the complete guide

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

Free white paper. No spam. Unsubscribe anytime.

You set up a haystack ssh sandbox by connecting your agent pipeline to a restricted remote host. This setup uses OpenSSH keys or signed certificates to isolate shell commands from your main app. Teams often build this sandbox so language models can run code or check system state safely. Still, many setups start with shared keys and broad host roles. When an agent holds broad shell rights, one bad prompt can wipe files or expose secrets.

How a haystack ssh sandbox works

A Haystack pipeline uses custom tools or components to run tasks outside the main app. When the model needs to run a script, the component opens an SSH session to a remote host. That remote host acts as the sandbox where untrusted commands can run inside an isolated box.

To lock down the login step, teams can use OpenSSH certificates instead of static keys. A Certification Authority key signs a user public key to create an OpenSSH certificate. Each certificate holds a public key, identity data, principal names, and a set of signed options. OpenSSH uses a much simpler certificate format than the X.509 format used in TLS. When you sign a key, you set a key identity and list allowed user principals. You can also set a time window so the signed certificate expires on schedule.

Setting up host rules for agent sessions

Good sandbox design separates the machine running the Haystack app from the target host. You create a low-privilege user account on the sandbox host just for the agent pipeline. Next, you configure the remote SSH daemon to trust your Certification Authority key. When the Haystack component logs in, the host checks the principal name on the certificate.

You can also add options to the certificate when signing it with your authority key. These options can restrict port forwarding or force the session to run one specific script. If the agent tries to log in as a different user, the host rejects the session. This setup stops the pipeline from reaching other servers that do not trust that principal.

SSH Access Management + AI Sandbox Environments: architecture patterns and best practices

Continue reading? Get the full guide.

Free. No spam. Unsubscribe anytime.

Where native SSH sandbox controls fall short

Native OpenSSH rules do a great job of checking who can log into the sandbox host. They verify the key identity and match the principal name before opening a shell. Still, host login checks only happen at the start of the session.

Once the shell opens, the SSH daemon does not read or judge individual commands in flight. An agent with an open shell can still run a bad command inside its allowed folder. It can also query local files that hold emails, phone numbers, card numbers, or national IDs. Standard SSH logs show that a session happened, but they do not capture every command output. Native certificates also cannot pause a single risky command to ask a human for approval. Plus, the Haystack host still has to store the private key file on its own disk.

Inspect one-shot SSH commands and file tasks

SSH certificates and host rules decide who is allowed on a machine. Setup alone does not check single commands or block sftp reads on sensitive paths. By design, hoop.dev runs an open-source SSH listener on the host where people and agents keep their normal ssh, sftp, and scp tools.

First, hoop.dev guardrails check one-shot commands and file paths before they run. Next, hoop.dev data masking masks matched values in file downloads. The audit trail logs the certificate principal, requested action, and verdict without storing session content. Interactive shells carry no guardrails and can be turned off when every action must be checked. Explore the code on GitHub.

Frequently asked questions

Why do Haystack agents need an SSH sandbox?

Language models can generate faulty or unsafe shell commands during a run. Running those commands on a separate SSH host keeps the main app server safe from harm.

How do OpenSSH certificates help with sandbox logins?

An OpenSSH certificate binds a public key to specific user principals and a set time window. The sandbox host trusts the signing key instead of managing long lists of static public keys.

What risks remain after setting up restricted SSH keys?

SSH keys only check identity when the session starts. They do not block risky commands inside an open shell or rewrite sensitive data in outputs.

Save the open-source gateway.

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.