Repository navigation
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.sockor/run/shell-mcp/privd-broad.sock(read from the socket files; the gate never reads the privileged policy), the gate refuses every request withinstall_insecure, before the sandbox and before any byte of the request,helloincluded: "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-mcpcannot be inspected.check-policyas the account printsFAIL install: gate process belongs to group "svc-shell-priv" …, andshell-mcp doctorandshell-mcp checkshow 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.
- 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
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.
- Install the new
shell-mcp-gateandshell-mcp-privdon 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. - 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.
- Create the account with
install, with the first key you move: that key's own flags (policy, principal,from=list,.pubfile) and--user svc-shell-std --uid 60125 --gid 60125(your own unused ids; never the socket group). Run it with--dry-runfirst. It appends the account'sMatchblock 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, withservices.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. - Give the moved policies' write roots and repositories to the new account (
chown -R svc-shell-std: <root>). - On the server, set the target user of each moved key's instance to the new account (
SHELL_MCP_TARGET_USER=svc-shell-std, oruser:in the targets file), thendocker compose up -d. The host-key pin, the key andfrom=are unchanged. shell-mcp-gate move-key --principal <label> --from-user svc-shell --to-user svc-shell-std, one run per key. For a keyinstallalready 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 onsvc-shellwith everything about the helper.- If
svc-shellwas insystemd-journalonly for keys that moved, remove the membership:usermod -r -G systemd-journal svc-shell(installfor the admin key refuses it otherwise). installfor each key of either account, andmove-keyagain, then report every itemunchanged.
- Create the account with
- Optional: adopt the setup commands. On a host set up by hand as TARGET-SETUP says,
shell-mcp-gate installwith the flags that describe it, andshell-mcp-privd install --accept <sha256>over unitsunitsgenerated from the same policy, report every itemunchangedand write nothing; any difference is refused with a diff, never overwritten.policy newnever 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 inadminand 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,initrefuses 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 composeprints the reference compose with your values; diff it against your file before using it. - Check:
shell-mcp doctorin the server's container (docker compose exec shell-mcp /shell-mcp doctor),check-policyas each service account, andjournalctl -t shell-mcp-gatefor the install commands' audit lines.
Added
shell-mcp-gate install(S8-1, #79; several accounts per host since #94): the service account (locked withusermod -L, never the setuidpasswd), its memory slice, its polkit rule, itsMatchblock in the sshd drop-in and the key line, last;check-policyas the account,sshd -tandsshd -T -Cfor every account and for a name that is not one, the reload, and the host-key pin, read locally. It refuses afrom=wider than/24or/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 butsystemd-journal(journal section) and the socket group (privileged forwarding), and every file with other content, with a diff. OneMatchblock per account in the one drop-in; polkit rules60-shell-mcp.rulesfor the first account and60-shell-mcp-<user>.rulesfor 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 accountsinstallmade, 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 moveinstallbegan, and a second run reportsunchanged(TARGET-SETUP §12.1, "Moving a key between accounts").shell-mcp-gate host-key(#79): the pin lines from the host's own.pubfiles, as any user, never from the network.shell-mcp-privd install(#79): the fullcheck-policy, then the review (everyREVIEWline and the policy's SHA-256), and nothing written without--accept <that sha256>, on every run; the backup store, the units exactly asunitsgenerates them,systemd-analyze verifywith 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 newin both binaries (S8-3, #83): the gate policy and the privileged policy from one answers file and a preset (read-only,operator,admin), rendered fromexamples/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.yamlreproduce the examples byte for byte (POLICY §9).shell-mcp initandinit compose(S8-2, #82).initwrites 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,--approveris refused before anything is written.init composeprints the reference compose with a deployment's values in two forms: composesecrets:fordocker compose, or one read-only bind mount of the directory (--form bind) for stack editors. With--profile operatorand--approve-hostit setsSHELL_MCP_APPROVAL_TIERS: operator,destructive;--profile adminneeds--approve-host.shell-mcp doctor(S8-4, #84): run in the server's container, one row per check with its fix: the configuration asserveloads it, the secret files' modes, each target's pin, gate, protocol and sandbox, the helper's core and broad sockets, each trusted proxy against the container's own routes (a gateway is a FAIL), the approval page and, with--mcp-url, the MCP endpoint without a token. It writes nothing and never sends the token (TARGET-SETUP §12.6).scripts/verify-release.sh(#84), in the repository and the examples archive: every file againstSHA256SUMS, and the signatures (cosign) or provenance (gh) at the release tag; without either tool it refuses unless--sumsnames aSHA256SUMSverified elsewhere. No network fallback, no identity override, and a dry run's files never pass. The release workflow runs it against the files it just signed, and checks that it refuses a changed binary, a changedSHA256SUMS, a missing bundle and another release's identity.deploy/caddy/(#84, #87): an exampleCaddyfileand an examplenginx.conffor the reference compose, and a README of what any proxy needs: a container on the server's network at a fixed address, the address it saw asX-Forwarded-For, that address alone trusted (never the gateway), the approval page for the LAN or VPN only, and a restart after an edit.- The quick start in eleven steps (#84, #87), each naming its command: verify the image (cosign or gh) before running it; the secrets with
init; download and verify the release on a workstation and copy it to the target; the binaries; the gate policy withpolicy new;install; write roots by hand; the privileged policy andprivd installwith the review;init composeand the proxy;up -danddoctor; a client. TARGET-SETUP is its reference part, with every hand step and the command that does it.
Fixed
Other security-relevant fixes found on the way:
- Three required CI checks and the release preflight could not fail (#86). Without an explicit shell, GitHub runs steps as
bash -e, withoutpipefail, so… run.sh | teein the exposure, setup-check and caddy-check jobs, and the release preflight'snotes.sh … | tee, tooktee's exit status. No run had hidden a failure. Every workflow now setsshell: bash(-eo pipefail), andscripts/workflowcheckfails if one loses it. - The execx credential option and its checks (#79). The one caller,
install'scheck-policyas the account, needs a process that starts as root and runs as the account. The option is off by default and honoured only for a root caller; the trampoline runs all its usual checks as root, then switches every thread to exactly the account's groups, gid and uid, reads back the ids, groups and capability sets of every thread, re-arms the parent-death signal and setsno_new_privsbefore the exec. A cgo build, where the switch could not reach every thread, is refused before anything is written. A test keeps every other caller from setting it. - The approval seed reaches a terminal only (#82):
init --approveroff a terminal is refused before anything is generated, a--dry-runincluded. - The proxy and tunnel guidance (#87). The docs now say never to put a tunnel or internet-facing relay in front of either name (a source filter cannot tell: the proxy sees the connector's address), that a proxy on the host itself reaches the server from the gateway and is not supported, and that
.env.example's trusted-proxy value is a single address (its/29held the gateway). caddy-check and nginx-check refuse an example that allowsprivate_ranges,172.16.0.0/12, the compose's subnet or any Docker default network. - The deployer-docs review (#87): the image verified before it first runs; TARGET-SETUP §2's verification loop stops at the first failure; the host-key pin's refusal and the docs name
shell-mcp-gate host-keyand a trusted channel, neverssh-keyscan; the Landlock refusal names a newer kernel first and saysbest-effortweakens the sandbox;--helpexits 0 on every subcommand; removal and rotation steps (TARGET-SETUP §11.1,deploy/README.md).
CI
- e2e-host in four shards (#86) beside a required
e2e-host-coveragejob that checks every e2e test ran in exactly one shard, passed, and that nothing skipped; CI's wall time went from about 25 to about 8 minutes, with the same test counts. pipefailin every workflow and actionlint v1.7.12 (#86), withworkflowcheckholding theciaggregate to every job;goandgo-checkssplit per runner image (#86).- New container checks in CI and
scripts/ci-local.sh:setup-check(the install, init and policy commands on Debian 13, Ubuntu 24.04 and 26.04, against hosts set up by hand; #79 to #94),caddy-checkandnginx-check(#84, #87),proxy-live-check(#88: both example proxies live in front of the server, with negative controls for a pass-throughX-Forwarded-Forand a gateway-sourced proxy), and the quick start's and CLIENTS §3.2's commands checked against each binary's--help(#88).doccheckchecks every relative link andDOC §Nreference (#84). scripts/ci-local.shruns in lanes, prints NOT RUN for what only CI runs, and its--quicksays it is not the full gate (#86).
Other merged changes
- The 0.2.0 image digest pinned in
deploy/, SECURITY §7 and CLIENTS, and the release recorded (#77). The setup tooling scoped (docs/handoff/S8-SETUP-TOOLING.md, #78). go.yaml.in/yaml/v3v3.0.6 (from v3.0.5); Go 1.27.3; the builder image and the test images' bases at their current digests; CodeQL Action v4.39.3 and cosign-installer v4.1.3. No dependency added.
Known limits
- N-37: at its memory limit a Go 1.27.3 command sometimes ends with a
SIGSEGVin the garbage collector instead of Go's out-of-memory error (newSpanSPMCstores an unchecked allocation). The limit holds every time; only the message differs.TestExecMemoryLimitaccepts the fault only with proof of the stop, andTestGCSpanQueueBugInRuntimeis a tripwire that fails on the Go release that fixes it, so the acceptance is removed in that release's PR (POLICY §4a, POST-RELEASE N-37). go.yaml.in/yamlheld on v3 (#91): v4.0.0 accepts inputs v3 refuses at the policy boundary (C1 control characters, empty keys, wider anchor names, some flow-context text). Golden tests pin every parser's YAML layer to v3's behaviour, and deps-current's exception for v4 lasts until 2026-12-08, when a narrow YAML profile in the strict loaders is due, applied on v3 first, then the migration.- Deferred: shellcheck over the scripts and workflows (approved, its own PR); running setup-check's three distributions in parallel (L5);
keys listandrevokebeyondmove-key; uninstall (TARGET-SETUP §11.1 has the hand steps).
Verify
Image: ghcr.io/tyler-rich/shell-mcp:0.3.0@sha256:95fd125d8f18c869b884f336881b24383383270f5d7b63a6efaa145d6a3eb537 (linux/amd64, linux/arm64). Pin the digest.
SHA256SUMS lists every release file except itself and the Sigstore bundles. The binaries, the examples archive and SHA256SUMS are signed with Sigstore keyless signing (<file>.sigstore.json). Every file SHA256SUMS lists, and the image index, carry SLSA build provenance; SHA256SUMS itself has no attestation (gh attestation verify SHA256SUMS finds nothing), and its cosign signature covers it. The binaries and the platform images also carry CycloneDX SBOM attestations. Only the identity below is a release of this version; anything signed by another ref is not.
Run the cosign verify-blob command for each binary you use, the examples archive and SHA256SUMS, and the gh attestation verify command for each file you use that SHA256SUMS lists.
cosign verify-blob --bundle shell-mcp-gate_0.3.0_linux_amd64.sigstore.json \
--certificate-identity https://github.com/tyler-rich/shell-mcp/.github/workflows/release-build.yml@refs/tags/v0.3.0 \
--certificate-oidc-issuer https://token.actions.githubusercontent.com \
shell-mcp-gate_0.3.0_linux_amd64sha256sum --ignore-missing -c SHA256SUMSgh attestation verify shell-mcp-gate_0.3.0_linux_amd64 --repo tyler-rich/shell-mcp \
--signer-workflow tyler-rich/shell-mcp/.github/workflows/release-build.yml --source-ref refs/tags/v0.3.0cosign verify ghcr.io/tyler-rich/shell-mcp@sha256:95fd125d8f18c869b884f336881b24383383270f5d7b63a6efaa145d6a3eb537 \
--certificate-identity https://github.com/tyler-rich/shell-mcp/.github/workflows/release-build.yml@refs/tags/v0.3.0 \
--certificate-oidc-issuer https://token.actions.githubusercontent.comgh attestation verify oci://ghcr.io/tyler-rich/shell-mcp@sha256:95fd125d8f18c869b884f336881b24383383270f5d7b63a6efaa145d6a3eb537 --repo tyler-rich/shell-mcp \
--signer-workflow tyler-rich/shell-mcp/.github/workflows/release-build.yml --source-ref refs/tags/v0.3.0