Skip to content

Releases

v0.3.0

Choose a tag to compare

@github-actions github-actions released this 10 Nov 13:22
Immutable release. Only release title and notes can be modified.
1510e9f

Setup commands that write every file the hand steps of TARGET-SETUP and deploy/README.md write, and a security fix for targets set up with 0.1.0's or 0.2.0's TARGET-SETUP that run the privileged helper: on those, the new gate refuses the read-only and operator keys until they move to a second service account (Upgrading, step 2). Protocol version 2, the tool catalogue, both policy schemas and the helper's units are unchanged from 0.2.0, so a 0.2.0 server works with a 0.3.0 gate and the reverse. The design record behind each change is docs/ARCHIVE.md §14, sessions S8-scope to S8-4 and PRs #77 to #94.

Security

  • The gate refuses a key without privileged forwarding on the helper's socket-group account (#90). A GitHub security advisory accompanies this release.
    • Who is affected: a target set up by 0.1.0's or 0.2.0's TARGET-SETUP with the privileged helper installed, where a key whose gate policy has no privileged.enabled: true (a read-only or operator key) is on the same service account as the admin key. Those documents put every key on one account (svc-shell) and added it to the helper's socket group. A target without the helper, or whose only keys on that account forward to the helper, is not affected.
    • What could happen: below Landlock ABI 9 (every kernel this project is tested on; the CI runners have ABI 8) the gate's sandbox does not govern a connect to a pathname Unix socket. The socket's permissions (root:svc-shell-priv 0660) and the helper's peer-UID check (client_uid) were all that stood between such a key's commands and the helper, and both passed. Human approval is enforced by the server, not the helper (PRIVILEGED §3). So a compromised server holding the read-only key, with any declared read command able to open a Unix socket, could ask the helper for root actions without any approval, up to what the privileged policy allows. Shown in containers before the fix: a read-only policy's command, inside the gate's own sandbox, got an answer from the helper.
    • What changes: when a policy has no privileged forwarding and the gate's process belongs to the group that owns /run/shell-mcp/privd.sock or /run/shell-mcp/privd-broad.sock (read from the socket files; the gate never reads the privileged policy), the gate refuses every request with install_insecure, before the sandbox and before any byte of the request, hello included: "this account is in the privileged helper's socket group and this policy has no privileged forwarding: serve the keys without forwarding from a second service account outside that group …". It also refuses when /run/shell-mcp cannot be inspected. check-policy as the account prints FAIL install: gate process belongs to group "svc-shell-priv" …, and shell-mcp doctor and shell-mcp check show the refusal for the target. The admin key keeps working; the helper, its policy, its units and its socket group are unchanged.
    • What to do: Upgrading, step 2. SECURITY §2 ("Shared service account") and §5 item 8 state the rule: one account per privilege level.

Upgrading from 0.2.0

The full steps, with what each command does on a host set up by hand, are README's "Upgrading from 0.2.0" and TARGET-SETUP §4, §7, §8 and §12.

  1. Install the new shell-mcp-gate and shell-mcp-privd on every target, then the new server image. The protocol is unchanged (version 2), so the order is free and nothing is refused for a version mismatch; both start per request, so nothing on the target restarts. The server restart drops pending approvals, as on every upgrade.
  2. Targets with the helper: move every key without privileged forwarding to a second service account (required; the security fix). Do it in the same window as step 1: the new gate refuses those keys on the shared account.
    1. Create the account with install, with the first key you move: that key's own flags (policy, principal, from= list, .pub file) and --user svc-shell-std --uid 60125 --gid 60125 (your own unused ids; never the socket group). Run it with --dry-run first. It appends the account's Match block to the sshd drop-in, writes its keys file with the key's line byte for byte as the old one, its slice drop-in and, with services.control, its polkit rule (60-shell-mcp-svc-shell-std.rules), checks the policy as the new account and reloads sshd. The key then logs in as either account. An account's keys must agree on the journal: keys whose policy has a journal section and keys whose policy has none go to different accounts.
    2. Give the moved policies' write roots and repositories to the new account (chown -R svc-shell-std: <root>).
    3. On the server, set the target user of each moved key's instance to the new account (SHELL_MCP_TARGET_USER=svc-shell-std, or user: in the targets file), then docker compose up -d. The host-key pin, the key and from= are unchanged.
    4. shell-mcp-gate move-key --principal <label> --from-user svc-shell --to-user svc-shell-std, one run per key. For a key install already put on the new account it finishes the move; any other key's line moves byte for byte with its polkit rule. It refuses the admin key, which stays on svc-shell with everything about the helper.
    5. If svc-shell was in systemd-journal only for keys that moved, remove the membership: usermod -r -G systemd-journal svc-shell (install for the admin key refuses it otherwise).
    6. install for each key of either account, and move-key again, then report every item unchanged.
  3. Optional: adopt the setup commands. On a host set up by hand as TARGET-SETUP says, shell-mcp-gate install with the flags that describe it, and shell-mcp-privd install --accept <sha256> over units units generated from the same policy, report every item unchanged and write nothing; any difference is refused with a diff, never overwritten. policy new never overwrites a hand-written policy, and is optional: from the example answers files it writes 0.2.0's example policies with their comments rearranged, and with one value changed in admin and the privileged policy, both of which now carry the union of the two examples' deny lists (README, "Upgrading from 0.2.0", step 6). On the server, init refuses 0.2.0's by-hand secrets directory until it belongs to the image's user: chown -R 65532:65532 secrets, after which it keeps every file. init compose prints the reference compose with your values; diff it against your file before using it.
  4. Check: shell-mcp doctor in the server's container (docker compose exec shell-mcp /shell-mcp doctor), check-policy as each service account, and journalctl -t shell-mcp-gate for the install commands' audit lines.

Added

  • shell-mcp-gate install (S8-1, #79; several accounts per host since #94): the service account (locked with usermod -L, never the setuid passwd), its memory slice, its polkit rule, its Match block in the sshd drop-in and the key line, last; check-policy as the account, sshd -t and sshd -T -C for every account and for a name that is not one, the reload, and the host-key pin, read locally. It refuses a from= wider than /24 or /64 (no override), a key with options, a private key or a host key, ids below 1000 or in use, any file on the host owned by a new id (the owner scan), any supplementary group but systemd-journal (journal section) and the socket group (privileged forwarding), and every file with other content, with a diff. One Match block per account in the one drop-in; polkit rules 60-shell-mcp.rules for the first account and 60-shell-mcp-<user>.rules for others. Idempotent, with --dry-run, rollback of every file on a later failure, temp files that a failed run removes, and one audit line per change or refusal (TARGET-SETUP §12.1, §12.4).
  • shell-mcp-gate move-key (#94): moves one key line between two accounts install made, byte for byte, with its polkit rule, in one transaction with rollback and a read-back of both files. It refuses a key with privileged forwarding and a destination whose groups the moved policy does not allow; it finishes a move install began, and a second run reports unchanged (TARGET-SETUP §12.1, "Moving a key between accounts").
  • shell-mcp-gate host-key (#79): the pin lines from the host's own .pub files, as any user, never from the network.
  • shell-mcp-privd install (#79): the full check-policy, then the review (every REVIEW line and the policy's SHA-256), and nothing written without --accept <that sha256>, on every run; the backup store, the units exactly as units generates them, systemd-analyze verify with rollback, the sockets enabled, a socket restarted only when its own file changed, an unused broad pair disabled and removed, and the exposure score (TARGET-SETUP §12.3).
  • policy new in both binaries (S8-3, #83): the gate policy and the privileged policy from one answers file and a preset (read-only, operator, admin), rendered from examples/ with their comments and loaded strictly by each binary's own loader before anything is written. The answers file is strict (unknown keys, duplicates, wrong types refused), and its comments are untrusted: each line gets its own # prefix, control characters and the Unicode line and paragraph separators are refused, and a comment is bounded. examples/policies/*.answers.yaml reproduce the examples byte for byte (POLICY §9).
  • shell-mcp init and init compose (S8-2, #82). init writes the bearer token, the SSH key pair and, with --approver, the approvers file, owned by the image's user, in the image with no network and no capabilities; it never prints the token or the key, keeps every existing file, and refuses wrong owners, modes and keys rather than repair them. The approver's seed is shown on a terminal only: without one, --approver is refused before anything is written. init compose prints the reference comp...
Read more

v0.2.0

Choose a tag to compare

@github-actions github-actions released this 30 Oct 10:49
Immutable release. Only release title and notes can be modified.
b47e94b

The open items after 0.1.0, closed or decided: a memory limit for every process the gate and the helper start, commands that read the file the gate checked, privileged #! scripts reviewed by name, private keys kept out of every output and replaceable under approval, recovery of an interrupted dpkg through the tools, and protocol version 2. The server, the gate and the helper must be upgraded together (below). The design record behind each change is docs/ARCHIVE.md §14, sessions S6-1 to S7-7 (PRs #61 to #73).

Upgrading from 0.1.0

  1. Upgrade shell-mcp, shell-mcp-gate and shell-mcp-privd together. This release speaks protocol version 2 and 0.1.0 speaks version 1. Any mismatch between the server and a gate, or between a gate and its helper, fails with protocol_mismatch, naming both versions and which side to upgrade, and nothing runs; it is never reported as outcome_unknown. Install the new gate and helper on every target first (both start per request, so nothing restarts), then the new server image. Requests fail closed in between. The server restart drops pending approvals, as on every upgrade.

  2. Add an acknowledge to every privileged command whose program is a #! script. The helper now refuses to load a privileged policy that declares a script without one, so it serves nothing until the policy is fixed. A symlink to a script or a renamed copy counts: the file is judged by its content. Review each script and add a one-line acknowledge. /usr/local/libexec/shell-mcp-privd check-policy --policy /etc/shell-mcp/privileged.yaml fails on each such command until it has one, and then prints it as REVIEW script. An interpreter on the never list is still refused, acknowledged or not.

  3. Add reads_private_keys: true to any command whose {path:read} legitimately takes a private-key file (for example openssl pkey -pubout or ssh-keygen -y), in the gate policy or the privileged policy. Without it, a command whose {path:read} or {path:read:fd} names a file that holds a private key is now refused with path_denied, at the preview too. Set it only for a program that never prints part of its input; check-policy warns when it is set on a range or filter program (tail, head, sed, cut, grep and the others in POLICY §4).

  4. Review limits.max_memory_mb and packages.allow_recover.

    • limits.max_memory_mb (gate policy and privileged policy; default 1024, from 128 to 16384) bounds the data memory of every command, git, systemctl, journalctl and apt-get process. 0.1.0 had no such bound. Raise it for a command that needs more than 1024 MiB (for example jq on very large files). The helper's units take their MemoryMax= from it (step 5).
    • packages.allow_recover (privileged policy; default false) enables shell_priv_recover_packages. Leave it off unless you want dpkg recovery through the tools.
  5. Regenerate and reinstall the helper's units, after the policy edits above (the units are pinned to the policy's hash):

    /usr/local/libexec/shell-mcp-privd units --policy /etc/shell-mcp/privileged.yaml --out /etc/systemd/system
    systemctl daemon-reload

    The new units set MemoryMax= to limits.max_memory_mb plus 256M, with MemorySwapMax=0 and OOMPolicy=continue, and the core unit gets ProtectHome=yes unless a root, command, interpreter or the policy file lies under /home, /root or /run/user, contains one of them (a read root of / or /run), or cannot be resolved; then it stays read-only, as before, and check-policy names the path responsible. If the policy did not change, a new helper still starts with the 0.1.0 units, but without these directives: the old units' fixed MemoryMax= (256M core, 1G broad, without OOMPolicy=continue) is below the new limits, so a command using more than about 256 MiB in the core unit ends the whole instance instead of failing its own allocation. Regenerate in every case.

  6. Check. As the service account, shell-mcp-gate check-policy --policy <each gate policy>; as root, /usr/local/libexec/shell-mcp-privd check-policy --policy /etc/shell-mcp/privileged.yaml; then shell-mcp check from the server, which shows each target's gate version and protocol. Diff the tool catalogue (shell-mcp tools) against 0.1.0's: two new tools, shell_priv_recover_packages and shell_priv_reinstall_packages; new descriptions for shell_write_file and shell_priv_write_file; new output schemas for shell_get_policy, shell_run_read_command, shell_run_command, shell_priv_run_command and shell_priv_preview_packages (whose input also changed: the reinstall operation).

A 0.1.0 gate or helper refuses a policy that uses any new key or placeholder (limits.max_memory_mb, {path:read:fd}, reads_private_keys, packages.allow_recover; strict parsing), so add those only once the new binaries are installed.

Added

  • A memory limit for every child of the gate and the helper (N-30, S6-1, #61): limits.max_memory_mb, as above, applied as RLIMIT_DATA, soft and hard, before the child's first instruction. A command that reaches it fails its allocation, and that is its result, never outcome_unknown. git's thread counts are pinned (pack.threads=4, index.threads=1, checkout.workers=1 and the others in gitx), so a git operation's memory need does not follow the host's CPU count. check-policy reports the limit and the units' MemoryMax=, and warns when the kernel's ignore_rlimit_data is set. A large file planted in a submodule's git files (N-25) now ends a git operation within about a second, naming the limit. TARGET-SETUP §4 recommends MemoryMax= on the service account's slice as the outer bound.
  • {path:read:fd} (N-22, S6-2, #62): an opt-in placeholder for gate commands that passes the file as the gate's open descriptor (/dev/fd/4 and up) instead of a path, so the command reads the file the gate checked, whatever happens to its name afterwards. It closes the owner-matched {path:read} redirect for such commands. Regular files only, at most 8 per template; the privileged policy refuses it. exec_preview, exec, shell_run_read_command and shell_run_command report the descriptors (fds), and an approved command is bound to each file's identity. check-policy checks /dev/fd and warns about programs measured to give wrong results with a descriptor: stat, du, file, ls and find without following links, cp -a/-P/-r, tar adding a member, findmnt, nginx and docker compose (POLICY §4).
  • Replacing a private-key file under approval, with hashes only (N-5, S6-4 #64 and S7-3 #68). Two read-tier ops return a file's size, SHA-256, line count and whether it holds a private key, never its content: priv_hash_file in the helper and hash_file in the gate (under read_file's path rules, refused above 256 MiB). The previews of shell_priv_write_file, shell_priv_copy_path and shell_priv_move_path, and of shell_write_file, shell_copy_path and shell_move_path when they are gated, hash an existing destination with them, so a key file, or a certificate bundle with its key, can be replaced under an approval that binds the old and new hashes without showing either. The previews gain private_key (and a write's new.private_key). shell_read_file and shell_priv_read_file still refuse the key. A privileged replace backs the old key up, root-only, like any other file; PRIVILEGED §6 says how to remove those backups after a rotation for compromise. TOOLS.md shows how to generate a key on the host with a gate command and move it into place, which keeps the key away from the client and its model provider.
  • Recovering an interrupted dpkg through the tools (N-14, S7-4, #69): shell_priv_recover_packages (operator, always approval-gated; needs packages.allow_recover: true) runs dpkg --force-confold --configure --pending as root in the broad unit, under the package operations' protections. The approval binds the unfinished packages, read from dpkg's status with its journal folded in, by hash; any change before the run is refused. At a hang-up or the deadline it answers early and lets dpkg finish: dpkg gets no SIGINT (it has no graceful stop) and is killed only at limits.max_timeout_s. The result comes from dpkg's state. With nothing unfinished it answers at once, with no approval and nothing run.
  • Removing and reinstalling what the recovery leaves (N-36, S7-7, #73):
    • shell_priv_remove_packages accepts an unfinished database when dpkg's journal is empty and the request names exactly the unfinished packages that do not need a reinstall (for example one whose dependency nothing provides). Its preview lists every unfinished package with its version and state (unfinished), and its hash binds that state.
    • A new tool, shell_priv_reinstall_packages (operator, always approval-gated), and reinstall as an operation of shell_priv_preview_packages, reinstall exactly the half-installed or reinstreq packages, each pinned to the version dpkg names, through the install's lock rule, record and stop points, with the result from dpkg's state.
    • Both use the existing allow-lists (packages.remove, packages.install); no new key.
  • reads_private_keys (N-35, S7-6, #72): an optional command key in the gate policy and the privileged policy (default false), shown in check-policy and in both policy summaries (shell_get_policy, priv_policy). It lets the command's {path:read} files hold a private key (Upgrading, step 3), and its output then also gets the PEM-width masking described under Fixed.
  • An offline exposure check of the helper's units (N-28, S6-5, #65): scripts/exposure/run.sh, in scripts/ci-local.sh and a new exposure CI job, generates the core unit of the example and end-to-end privileged policies and rates it with systemd-analyze security --offline on systemd 255 (Ubuntu 24.04), 257 (De...
Read more

v0.1.0

Choose a tag to compare

@github-actions github-actions released this 25 Oct 12:43
Immutable release. Only release title and notes can be modified.
5797225

The first release: an MCP server that gives AI clients bounded, audited read and write access to Linux hosts over SSH, without a shell.

What it contains

  • Three binaries, static, for linux/amd64 and linux/arm64: shell-mcp (the MCP server, also shipped as a distroless, non-root container image), shell-mcp-gate (the SSH forced command on each target) and shell-mcp-privd (the optional privileged helper for root actions).
  • The server. Streamable HTTP with a bearer token (MCP 2026-07-28 and 2025-11-25), or stdio. Host and Origin allow-lists, per-client rate limits and an auth-failure lockout, trusted proxies by address. Pinned SSH host keys only, Ed25519 client keys, no agent, forwarding or PTY. Three profiles: read-only (19 tools, the default), operator (27) and admin (50). shell-mcp check verifies every target; shell-mcp tools prints the catalogue with schema hashes.
  • The gate. One request per SSH session, checked against a root-owned policy on the target: read and write roots, a built-in deny list and protected set, exact unit and verb lists, pinned git repositories, and declared commands as exact argv templates with typed placeholders. Before it reads a request it sets no_new_privs and a Landlock sandbox computed from the policy, inherited by everything it runs. Shells, interpreters, wrappers, pagers, editors and privilege changers are refused under any name, including through hard links, renamed copies, multi-call binaries and #! interpreters. Writes are atomic and read back; deletes and git discards remove exactly what their preview listed, or stop. Service control is authorized by a generated polkit rule. check-policy reports what the gate would refuse before it is asked.
  • The privileged helper. Root actions without sudo, setuid or a root shell: a socket-activated process per request that authenticates the gate's account by kernel peer credentials, applies its own root-owned policy, and runs in a systemd sandbox generated from that policy and pinned to its hash. File operations as root with backups and restore, chown and chmod, declared root commands, apt package operations bound to an approved transaction of exact versions, and a delayed, cancellable reboot or power-off through logind.
  • Human approval. Destructive operations and every privileged change need a person's approval on the server's own approval page, with a TOTP code from an enrolled approver's authenticator, bound to the exact operation, its preview and both policies, single-use and short-lived. The model cannot approve. Approvals are off by default (gated tools refuse), and a logged confirm-argument opt-out exists for those who accept the model approving.
  • Supply chain. Every file in a signed SHA256SUMS; cosign keyless signatures, SLSA build provenance and CycloneDX SBOM attestations for the binaries and the image, all bound to the release workflow at the release tag. Every dependency, image and tool at its newest stable release, enforced in CI.
  • Documentation. docs/TARGET-SETUP.md (target hosts), docs/CLIENTS.md (clients, profiles, approvals), the normative design documents, example policies and a hardened reference deployment.

Known limitations

  • Targets must be Linux with systemd and a kernel with Landlock ABI 4 or newer (Linux 6.7+); tested on Debian 13, Ubuntu 24.04 and Ubuntu 26.04. The helper's sandbox is exercised end to end on Ubuntu 26.04 only.
  • Package operations use apt only. Git LFS repositories, repositories on case-folding filesystems, and git repositories that an account other than root or the service account owns or can write are not supported by the git tools; submodules are never entered.
  • Deletes and moves are refused on filesystems without RENAME_NOREPLACE (for example NFS), and verified replaces on those without RENAME_EXCHANGE.
  • UDP is not restricted by the gate's sandbox (the target kernels cannot govern it).
  • Approvals live in memory and are lost when the server restarts. MCP elicitation is not used for approval; clients relay the approval page's URL instead.
  • OAuth is not supported: keep the server on a LAN or VPN, behind a TLS-terminating proxy, never on the public internet.
  • One profile per server instance; run several instances for several ceilings.

Open items after this release

  • N-5: an approved copy or move over an existing file cannot be approved when that file is larger than 256 MiB or starts with a private key, because the preview hashes it through the read operation. Workaround: delete the destination first (its own approval), then copy or move without overwriting.
  • N-22: a declared command's {path:read} is passed as a path, not as the descriptor the gate checked, so an application account that owns a directory on that path can redirect what the command reads to another file the service account can read. Planned as an opt-in per template.
  • N-25: an account that can write a git submodule's directory in a listed repository can make git status, diff, pull and discard wait until their timeout (a FIFO in the submodule's git files). Nothing runs; the request times out.
  • N-26: a declared command that is a #! script is judged by its interpreter; what the script itself runs is not inspected. Review every script you declare, above all in the privileged policy.

Verify

Image: ghcr.io/tyler-rich/shell-mcp:0.1.0@sha256:9c19075aadb69950eb71d69d840e64ba021fcabf22c7df32a76a229d3c387dd4 (linux/amd64, linux/arm64). Pin the digest.

Every file is listed in SHA256SUMS. The binaries, the examples archive and SHA256SUMS are signed with Sigstore keyless signing (<file>.sigstore.json), and every file and the image carry SLSA build provenance; the binaries and the images also carry CycloneDX SBOM attestations. Only the identity below is a release of this version; anything signed by another ref is not.

cosign verify-blob --bundle shell-mcp-gate_0.1.0_linux_amd64.sigstore.json \
  --certificate-identity https://github.com/tyler-rich/shell-mcp/.github/workflows/release-build.yml@refs/tags/v0.1.0 \
  --certificate-oidc-issuer https://token.actions.githubusercontent.com \
  shell-mcp-gate_0.1.0_linux_amd64
sha256sum --ignore-missing -c SHA256SUMS
gh attestation verify shell-mcp-gate_0.1.0_linux_amd64 --repo tyler-rich/shell-mcp \
  --signer-workflow tyler-rich/shell-mcp/.github/workflows/release-build.yml --source-ref refs/tags/v0.1.0
cosign verify ghcr.io/tyler-rich/shell-mcp@sha256:9c19075aadb69950eb71d69d840e64ba021fcabf22c7df32a76a229d3c387dd4 \
  --certificate-identity https://github.com/tyler-rich/shell-mcp/.github/workflows/release-build.yml@refs/tags/v0.1.0 \
  --certificate-oidc-issuer https://token.actions.githubusercontent.com
gh attestation verify oci://ghcr.io/tyler-rich/shell-mcp@sha256:9c19075aadb69950eb71d69d840e64ba021fcabf22c7df32a76a229d3c387dd4 --repo tyler-rich/shell-mcp \
  --signer-workflow tyler-rich/shell-mcp/.github/workflows/release-build.yml --source-ref refs/tags/v0.1.0