How to Configure n8n SSH Audit Log

Published
Length
3 min read

Luis Felipe Dias

All posts

You set up an n8n ssh audit log by combining workflow run history with host logging. The SSH server records who logged in, while n8n tracks the workflow steps that ran. Teams often share one static SSH key across many workflows to make setup fast. When that shared key has broad server rights, one bad workflow step can break production. How the native n8n ssh audit log works In n8n, workflows run remote commands on Linux servers using built-in SSH steps. Teams also build AI workflows where an

Audit Log Integrity + SSH Access Management: 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 an n8n ssh audit log by combining workflow run history with host logging. The SSH server records who logged in, while n8n tracks the workflow steps that ran. Teams often share one static SSH key across many workflows to make setup fast. When that shared key has broad server rights, one bad workflow step can break production.

How the native n8n ssh audit log works

In n8n, workflows run remote commands on Linux servers using built-in SSH steps. Teams also build AI workflows where an AI Agent node connects to a chat model. You must attach at least one tool sub-node to that AI Agent node. The agent decides which tools to call to finish a task. An agent can call another n8n workflow tool that runs SSH commands on a host.

On the server side, OpenSSH handles user logins and records connection events to system logs. Instead of static keys, teams can use OpenSSH certificates added in OpenSSH 5.4. The ssh-keygen tool signs a public key with a CA key to make a certificate. Each certificate holds a public key, identity details, principal names, and signed options. This format is much simpler than the X.509 certificates used in TLS.

When the workflow logs in, the SSH daemon checks the certificate or public key. The server writes the key identity and login time to the host log. Meanwhile, n8n saves the workflow execution result inside its own app log. Auditors then read both logs to see which workflow ran and which key logged in.

Where native SSH and workflow logs fall short

Host logs and workflow logs solve basic login tracking, but they leave big gaps. Native SSH setup decides who logs in, not what individual commands do in flight. Once a key or certificate passes the login check, the session runs with full user rights. If an AI agent or workflow sends a bad shell command, the server runs it right away.

Correlating events across two separate systems also takes a lot of manual work. The Linux host log only sees the shared service account or certificate identity. It does not know which n8n user or webhook triggered that specific workflow run. If five workflows share one SSH key, the server log looks the same for all five.

Audit Log Integrity + SSH Access Management: architecture patterns and best practices

Continue reading? Get the full guide.

Free. No spam. Unsubscribe anytime.

Also, standard host logs do not capture the full terminal output of every command. And if a command outputs sensitive data, that raw text enters the n8n execution log. Sensitive values like emails, phone numbers, card numbers, or national IDs stay in plain text. If an engineer exports the workflow history, those secret values leak into other systems.

Why command-level auditing matters for automation

Automated workflows and AI agents run commands much faster than human engineers. A human typing in a terminal might spot a mistake before pressing enter. An n8n workflow runs the exact string passed to it without pausing to check. When an AI Agent node picks a tool, the exact command can change each run.

To keep servers safe, teams need a clear record of every single command and output. Security teams must see the exact script, who triggered it, and what data came back. They also need a way to pause risky commands before the target host runs them. Adding command-level checks and data masking closes the gap between n8n and your Linux hosts. Masking rewrites matched fields in results so sensitive data does not spill into workflow logs.

Add command and file guardrails to SSH access

Host firewalls and certificate principals control who opens an SSH session. Yet an allowed user or agent can still run a bad one-shot command or pull sensitive files over sftp. In practice, hoop.dev provides an open-source SSH server with guardrails on the host that uses OpenSSH certificates.

Using hoop.dev SSH controls, guardrails check one-shot commands, env variable names, and sftp or scp paths before they run. Port forwards default to deny unless the target is listed. Because interactive shells have no statement boundary and carry no guardrails, teams can turn them off so every command is checked and logged. Check out the MIT-licensed project on GitHub.

Frequently asked questions

Does n8n record SSH command outputs by default?

Yes, n8n saves node outputs in its execution history when you turn on workflow logging. Still, this history lives inside n8n and does not link to your Linux host logs.

How do OpenSSH certificates help with an n8n ssh audit log?

OpenSSH certificates let you embed an identity string and principal names when signing a key. The SSH server writes this identity string to the host log on every login.

Can an n8n AI Agent run SSH commands on its own?

An AI Agent node decides which attached tool sub-nodes to call to complete a task. If you attach a workflow tool that runs SSH steps, the agent can trigger remote commands.

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.