How to Configure Codex SSH Audit Log

Published
Length
3 min read

Luis Felipe Dias

All posts

To set up a codex ssh audit log, sign user keys with an OpenSSH CA. Then configure the target SSH server to write key identity strings into system logs. Teams often let AI coding agents use shared SSH keys to reach remote hosts. When permissions are too broad, an agent can run bad commands without clear blame. A shared key makes it impossible to tell which person or agent broke a host. Adding clear identity data to each key fixes the login trail right away. How a native codex ssh audit log wor

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.

To set up a codex ssh audit log, sign user keys with an OpenSSH CA. Then configure the target SSH server to write key identity strings into system logs. Teams often let AI coding agents use shared SSH keys to reach remote hosts. When permissions are too broad, an agent can run bad commands without clear blame. A shared key makes it impossible to tell which person or agent broke a host. Adding clear identity data to each key fixes the login trail right away.

How a native codex ssh audit log works

AI coding agents like OpenAI Codex run shell tools to reach remote Linux servers. When the agent opens an SSH session, the target server checks the client key. OpenSSH added certificate support for users and hosts in version 5.4. This format is much simpler than the X.509 format used in web traffic.

A certificate holds a public key, an identity string, and a list of user names. It also holds options that a Certificate Authority key signs and locks in place. When your team signs a key for an agent, you set a clear key identity. You also list the exact server principals that the agent may use to log in.

When the agent logs into the host, the SSH daemon reads that signed certificate. The server writes the key identity and the principal name into the host log file. Your team can then ship those host log files to a central log store. This setup creates a basic record of when the agent started a remote session.

Why host logs and certificates are not enough

Signed certificates solve the problem of static public keys scattered across many remote servers. You do not need to copy keys to every host by hand anymore. You can also set a time window so the signed certificate expires after a shift. If you skip the time window, the certificate stays valid forever by default.

Host logs also prove which key opened the connection and when the login happened. Still, this native setup only checks who logs in at the start of the session. It does not check or control what individual shell commands do while in flight.

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

Continue reading? Get the full guide.

Free. No spam. Unsubscribe anytime.

Once the SSH daemon lets the agent in, the agent gets a full shell. A basic login log will not stop a bad script from deleting live files. It also will not rewrite sensitive fields like emails or phone numbers in command output. If an agent reads a file with card numbers, that raw text goes back out. Relying only on server login logs leaves your hosts open to fast, automated mistakes.

How to tighten agent SSH rules

To reduce risk with native tools, teams must narrow what the signed key allows. OpenSSH certificates let you bake options right into the signed key file. You can lock the certificate to a single command so the agent cannot roam free. You can also turn off port forwarding so the agent cannot tunnel into other hosts.

Teams should also separate human keys from AI agent keys at the signing step. Give every agent task its own unique identity string before it runs a remote job. Make sure the validity window is short so old agent keys cannot work tomorrow. Even with these steps, native SSH rules remain an all-or-nothing check at login time. Teams that need command approvals or data masking must look beyond basic daemon logs.

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 inline open-source SSH listener on the host where engineers and AI agents keep their normal ssh, sftp, and scp tools. On every production command or file operation, hoop.dev decides whether to pass, mask, block, or hold it for approval.

First, hoop.dev guardrails check one-shot commands and file paths before they run, and 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

What does an OpenSSH certificate put in the server log?

The SSH server logs the key identity string and the matching principal name at login. It also records the fingerprint of the CA key that signed the user certificate.

Do OpenSSH certificates expire on their own by default?

No, an OpenSSH certificate stays valid forever unless you set a validity window when signing. Always set a clear start and end time when you sign keys for agents.

Can SSH login logs show every command an AI agent runs?

Standard SSH daemon logs record the login event and the key identity, not full shell output. Tracking or blocking live commands requires extra host auditing tools or a runtime control layer.

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.