How to Configure Haystack SSH Data Masking
You set up haystack ssh data masking by adding output filters to remote command tools. This setup rewrites matched emails, phone numbers, card numbers, and national IDs in results. Teams often build Haystack pipelines that run shell commands on remote Linux servers over OpenSSH. They use a bastion or jump host to route traffic from the AI app. Then they give the agent a static key or an OpenSSH certificate to log in. When the server user role has broad permissions, every command output goes str
Data Masking (Static) + SSH Access Management: the complete guide
Architecture patterns, implementation strategies, and security best practices. Delivered to your inbox.
You set up haystack ssh data masking by adding output filters to remote command tools. This setup rewrites matched emails, phone numbers, card numbers, and national IDs in results.
Teams often build Haystack pipelines that run shell commands on remote Linux servers over OpenSSH. They use a bastion or jump host to route traffic from the AI app. Then they give the agent a static key or an OpenSSH certificate to log in. When the server user role has broad permissions, every command output goes straight into prompts. If a remote log file holds customer card numbers, the model reads that raw text. This creates a data leak risk in your model logs and prompt history.
How haystack ssh data masking works in pipelines
A Haystack pipeline connects language models to external tools and data sources through custom components. To run remote checks, engineers build a tool component that opens an OpenSSH session. OpenSSH supports certificate login, which arrived in OpenSSH 5.4 as a simple format. A Certification Authority key signs a user public key to make this certificate. The certificate holds a public key, identity text, principal names, and a set of options. This is much simpler than the X.509 format used in web traffic.
Once the Haystack component logs in, it runs a shell command on the remote host. The remote server runs the command and sends the text output back over the tunnel. Native OpenSSH does not inspect or mask the text inside that return stream. To apply haystack ssh data masking by hand, developers must write custom code inside Haystack. They add pattern filters that scan the text stream before the model reads it. When the filter finds emails or phone numbers, it rewrites those matched fields in results.
What native OpenSSH controls solve and what they miss
Native OpenSSH tools are great at deciding who can log into a remote server. Using a Certification Authority key lets teams sign user keys with an identity and principals. You can also set a time window so the signed user certificate expires on schedule. You can even lock a key or certificate down to one specific command. Using a jump host also gives the team one network choke point for server logins.
Still, OpenSSH controls stop working the moment the remote shell session starts running commands. OpenSSH only checks the key, the principal name, and the login rule at the door. It cannot read the command output stream to spot national IDs or card numbers. Also, keeping custom masking code inside every Haystack app is hard to maintain at scale. If a developer forgets to add the filter component, raw customer emails enter the prompt. Also, basic server logs only show that a login happened, not what each command returned.
Data Masking (Static) + SSH Access Management: architecture patterns and best practices
Continue reading? Get the full guide.
Free. No spam. Unsubscribe anytime.
Why host-level command rules fall short for AI agents
Some teams try to fix this gap by putting strict rules on the remote host. They write shell wrappers on the target server that pipe command output through text scripts. This host-level approach breaks down fast when an AI pipeline needs to check fifty servers. Updating text rules across dozens of hosts takes hours of manual work for the team. A single typo in a script can break the tool or let phone numbers slip.
Worse, if the AI agent has shell write permissions, it might bypass the wrapper script. Centralizing the masking rule outside the agent code and outside the target host works better. The pipeline stays simple while the security rule stays consistent across every remote server call.
Check SSH commands and file transfers on the host
OpenSSH keys and certificates decide who can log into a Linux host. They do not check what a one-shot command or file transfer does once the session starts. With hoop.dev, you run an open-source SSH server with guardrails on the host. It checks callers with OpenSSH certificates and works with ssh, sftp, scp, and rsync clients.
When a caller runs a one-shot command or moves a file, hoop.dev guardrails check the command or path before it runs. Then hoop.dev data masking masks matched sensitive patterns in downloads and output. Interactive shells carry no guardrails because keystrokes have no statement boundary. Teams can turn interactive shells off and allow only commands and file tasks. The audit trail logs who connected and what was allowed or refused, without storing keystrokes or file bytes. See the source on GitHub.
Frequently asked questions
Does OpenSSH have built-in data masking for command output?
No, OpenSSH only handles encrypted transport, host checks, and user login with keys or certificates. It does not inspect, filter, or mask text streams inside an active shell session.
What data fields should we mask in Haystack SSH tool outputs?
Teams should set up rules that rewrite emails, phone numbers, card numbers, and national IDs. Rewriting these matched fields in results keeps sensitive records out of model prompts.
Why are OpenSSH certificates not enough for AI agent security?
OpenSSH certificates verify the user identity and principals at login, which stops unauthorized server entry. They do not inspect what commands run during the session or what data returns.
Related guides
In this post