EnvMap GitHub

Runbooks beside the terminal: SOPs that type but never run

The runbook is in a wiki, the shell is in another window, and the command gets copied with a stray newline or a placeholder nobody replaced. EnvMap puts the SOP beside the shell instead, and makes the paste the safe part.

EnvMap is an open-source, self-hosted control plane with a privileged access manager (PAM) in it. People open SSH sessions from the browser, never see the password or key, and every session is recorded.

Most of what happens in those sessions is routine: renew a certificate, clear a disk, restart a service, check a load balancer. Routine work is where a written procedure helps most and is used least, because it lives somewhere else. So EnvMap keeps standard operating procedures, SOPs, in the PAM itself, and shows them in a panel beside every SSH terminal.

The Terminal with a live SSH session on web-lb-01, and the SOP panel open on a runbook with its commands
A live session, with the runbook beside the shell

The code is in the repository, in app/sops.py and the terminal's _sop.html.

Writing one is ordinary Markdown#

An SOP is a title, a one-line summary, some tags and a body. In the body, a # or ## heading starts a numbered step, and a code fence is a command. An upper-case name in double braces is a value the operator fills in once:

text
Read-only checks first; the reload is the only step that changes anything.

## Is the configuration valid
```
nginx -t
```

## What it serves for {{SITE}}
```
nginx -T 2>/dev/null | grep -n -A3 "server_name {{SITE}}"
```

## Reload without dropping connections
Only after the test above passes.
```
nginx -s reload
```

Steps are numbered for you, so a leading 1. or Step 2: in a heading is dropped: a body renumbered by hand always drifts. A fence marked nginx, yaml or output is a block to copy, not a command to paste. Lower-case braces, such as a Go template in a kubectl command, are left alone.

The Edit SOP page: title, summary, tags and the steps in Markdown on the left, and the live preview on the right
What you write on the left, what the terminal will show on the right

Paste types, it never presses Enter#

In the session, the operator picks the SOP, types each value once, and presses Paste into shell on a step. The command appears at the prompt of the focused tab, and the button says Pasted — press Enter. Nothing runs until they read it and press Enter themselves.

Three details make that safe:

The paste is recorded like typing: it is in the session's replay, its command transcript and the audit log.

An SOP cannot hide what it runs#

An SOP is text that people paste into production shells because they trust it. That makes it an attack surface of its own, in two ways.

Invisible characters. A right-to-left override, a soft hyphen or a Unicode tag character can make a command read differently from what it runs. This is the "Trojan Source" problem, and code review has the same blind spot. A control character is worse: ESC [ 201 ~ ends a bracketed paste early, and a carriage return after it presses Enter on the operator's behalf. EnvMap removes every control character except tab and newline, and every Unicode format character, by category rather than by a list, so none is missed. It does it twice: when the SOP is saved, and again in the browser just before a paste.

Secrets in placeholders. A value filled into a placeholder is typed into the command line, so the shell echoes it and the recording keeps it. EnvMap refuses to save an SOP with a placeholder named like a secret: {{DB_PASSWORD}}, {{API_KEY}}, {{TOKEN}}, {{OTP}} and the like, matched as whole parts of the name, so {{KEY_PATH}} is still allowed. The SOP should let the command ask instead, with mysql -p or read -s. The words are the same ones the session recorder treats as a password prompt.

Writing an SOP is its own permission#

Reading SOPs comes with access to the PAM. Writing them is a separate grant, Privileged Access: write SOPs, and deleting one also needs Privileged Access: delete. Changing an SOP changes what other people will run, on targets the writer may not be able to reach themselves, so it is not something every operator should be able to do.

Every save goes into the audit log with a fingerprint of the body, the first 16 hex digits of its SHA-256. When someone asks "which version of the runbook did the on-call person follow at 03:00?", the audit log and the session recording answer it together.

What it does not do#

Try it#

A new installation ships one example SOP, Renew a TLS certificate on an NGINX load balancer, with 11 steps and four values, to adapt to your hosts. The quickest look is the demo, with nothing to install. To run EnvMap as a PAM and nothing else, on one machine:

bash
curl -fsSLO \
  https://raw.githubusercontent.com/ammar-hassoun/envmap/main/deploy/compose/compose.yaml
ENVMAP_MODE=pam docker compose up -d

More: Runbooks (SOPs) in the manual, live sessions, and how a session recording is built.

EnvMap home · Docs · GitHub