SSH reference
The ssh_exec tool, its permission target, its limits, and where its keys and hosts are kept.
ssh_exec
| Argument | Required | Meaning |
|---|---|---|
host | yes | a host name or IPv4 address, with :port when not 22; IPv6 is not accepted |
command | yes | the command line, run without a shell |
as | yes | the alias of an SSH key secret, such as vault/web-admin; its hosts must include host |
timeout | no | seconds; default 60, at most 600 |
It returns the exit code, stdout and stderr. Each output is cut at the limit, with a line saying how much was not shown. A command past its timeout is killed.
The command
- The words are run exactly as written, each quoted for the server's login shell.
- Refused unquoted:
;|&><$`*?~. A backslash is always refused. - A pipeline or a glob is an explicit
sh -c '…'. - The words are scanned for stored secrets before they leave; a match refuses the command.
Checks, in order
| Step | Checked | Kind | Chat default |
|---|---|---|---|
| 1 | the command, as <user>@<host>[:port] <command>; the user is the key's login | ssh | ask |
| 2 | the host key: trusted, new or changed | ssh.hostkey | ask, once; a changed key is refused |
| 3 | using the key there, as <alias>@<host> on secret/<alias> | secret | ask |
Voice never has ssh_exec. An agent and a paired device have it off until you allow it; accepting an agent's request sets ask.
Patterns
[user@]host[:port] command, where the host follows the host rules (*.home.example covers the domain and its subdomains) and a * word in the command is any one word, or any number at the end. * alone is every command on every host. Wider suggestions on an approval: the command's first words plus * (never for sh -c, python3, sudo and other runners), or the same command on the parent domain.
Settings
| Variable | Default | Meaning |
|---|---|---|
NOCTURN_SSH_TIMEOUT | 1m | a command's timeout when the call names none |
NOCTURN_SSH_MAX_TIMEOUT | 10m | the longest timeout a call may name; not below NOCTURN_SSH_TIMEOUT |
NOCTURN_SSH_MAX_OUTPUT | 65536 (64 KiB) | bytes of stdout, and of stderr, per command |
A login handshake and a host-key probe each have 30 seconds.
Files and commands
| What | Where |
|---|---|
| keys | vault/<name> in the workspace's vault.enc, or SSH key items of a Vaultwarden collection |
| trusted host keys | nocturn-data/workspaces/<name>/ssh-hosts.json |
| add a key | Extensions › SSH › Add an SSH key, or nocturn secret set vault/<name> --ssh-user <user> --host <host>... < key |
| list hosts | nocturn ssh hosts (ls) |
| forget a host | nocturn ssh forget <host> (rm), or Remove on its row |
A key with a passphrase is refused; store a copy without one (ssh-keygen -p -N '' -f <copy>).