The problem
Troubleshooting through an assistant was slow. It suggested a command, I ran it and pasted the output, and we repeated that a dozen times. One outage was diagnosed that way when the assistant could have read the logs itself in seconds.
The obvious fix, giving it a login, carries an obvious risk. An AI assistant can misread a situation, and a prompt telling it not to make changes is a request, not a control.
Enforcement must be technical, not instructional. The mechanism is that the credential the assistant holds has no way to write.
The design
1. Use a native read-only role wherever one exists
The hypervisor and the backup server both offer audit roles in their APIs. Those roles have no write operations at all, which is stronger than any filter I could write, so they are the first choice.
2. Everywhere else, SSH that can run only what is on a list
Each host has a dedicated account with its own key. The key is tied to a forced command, so every request lands in a small wrapper program and never in a shell.
- Nothing interprets the input. The wrapper splits the request into words, checks them and runs the program directly. Semicolons, pipes and command substitution do nothing, because there is no shell to act on them.
- The list names commands and their arguments. Many read-only tools hide a write behind a flag. The disk-health tool can start a self-test and the log viewer can delete logs. Only the specific safe forms are allowed.
- Anything that needs root is a fixed script with no arguments. There is nothing to inject into.
- Tools that can execute or write by design are left out entirely, including scripting languages, editors and download tools.
3. File reads go through one gate
A single helper resolves the real path first, which defeats shortcuts and .. tricks. It then requires an approved location and applies a deny list for secrets. When the two lists disagree, deny wins. Configuration files are readable. The files that hold their passwords are not.
4. Docker through a filtered API, never the socket
Membership of the Docker group is equivalent to root, so the account isn't in it. Container state is read through a proxy that answers read requests and refuses every write. Start, stop, remove and exec all fail at the proxy. Environment variables are stripped from container details before they leave the host, because that is where applications keep secrets.
5. Credentials never pass through the assistant
API tokens are read from locked-down files by small local programs. The assistant asks for “the list of guests” and gets the answer. It never sees the token, so the token never lands in a transcript.
6. Every request is logged
Each host records what was allowed and what was refused. One key per host means the log shows which credential was used, and any one of them can be revoked without touching the others.
A misconception this corrected
Mounting the Docker socket read-only does not make Docker read-only. It only stops a container from changing the socket file. The API behind it still accepts every command. Turning off write requests at a proxy is what does the work.
The result
- Requests outside the list are refused, not silently ignored, and the refusal is logged.
- The assistant now gathers its own evidence. The host-freeze and swap investigations both ran on evidence collected through this access.
- A drift check uses the same access to compare the live systems with the documentation and report where they no longer agree.
- Anything that changes state is still a command I run myself.
The trade-offs I accepted
- No pipes. The wrapper returns full output and filtering happens on my side. The enforcement doesn't bend for convenience.
- The list grows slowly. Each new command or location is a deliberate, recorded change.
- Some data stays out of reach on purpose. Photo originals and personal documents are excluded, even though reading them would sometimes help.