Skip to content

v0.72.0 Helm: MSA agent enforcement, managed test session, cutover and rollback, behind MSA_GRANTS (off) - #181

Merged
agit8or1 merged 4 commits into
mainfrom
msa-step4-helm
Nov 20, 2026
Merged

agit8or1 merged 4 commits into
mainfrom
msa-step4-helm

Conversation

@agit8or1

Copy link
Copy Markdown
Owner

Managed Secure Access build step 4: agent enforcement, managed test session, cutover and rollback. Everything is behind MSA_GRANTS, which is off.

This is a new signed agent build. Once it is published, the fleet's signed agents update to 0.72 the usual way. On a Legacy computer, which means every computer until a Platform Admin moves one, the agent behaves exactly as 0.71 does. The heartbeat never says msaPoll, the poller never starts, and no RustDesk setting or password is touched. With MSA_GRANTS off, every new route answers 404 MSA_NOT_ENABLED.

Do not merge or deploy without the owner's approval.

Decisions

  • Where the poller lives. It is a new subcommand of the signed agent, rem0te-agent.exe msa-poller. The signed heartbeat script (SYSTEM) starts it, but only when the portal answers msaPoll: true. The portal does that only for an authenticated signed heartbeat that may act (§64), after the not-may-act and pooled returns, with the switch on and an MsaManagedComputer row.
    • Only one instance runs at a time (msa\poller.lock).
    • It exits after an idle hour, and immediately when the portal says Legacy / 404 / 403.
    • The logic is in the portable internal/msa/enforce, tested with fakes. The Windows wiring is msa_poller_windows.go.
  • How grant keys reach agents. Through signed release metadata only. A new root-run rem0te-signed-grant-key add|list|retire records public keys on the release host. rem0te-signed-publish signs them in as the target msa/grant-keys.json.
    • The agent reads keys only through the verified TUF chain (agent.MsaTrust). The portal never sends one.
    • The console shows a Platform Admin the exact two commands. They are constants in grant-key-commands.ts, which §56 allowlists exactly.
    • Cutover is refused until the published release lists the active key.
  • Ceiling. View only, with nothing beyond it: no keyboard, clipboard, files, audio, tunnel or restart. It is compiled into the agent (enforce.Ceiling), and the portal also refuses a managed grant above it (MSA_ABOVE_CEILING).
  • One computer at a time. Cutover needs a Platform Admin plus msa.cutover. It is refused unless readiness is Compatible, the agent is ≥0.72, the computer is not pooled, there is no remote pause and the key is published. It is audited before the row is written. There is no group or business route.
  • Pending keeps Legacy working. After each test session the agent restores the settings it saved and the portal stages a legacy rotation. A staged rotation waits while a grant is in flight (bounded by the grant's window, or 9 h).
  • Verified needs a test session since cutover that read back and connected, then the admin's confirmation. After that the agent sets a permanent password nobody is told, and legacy Reveal, Connect, Rotate and Set password are refused (MSA_MANAGED).
  • Rollback is Platform Admin only and never asks for a fresh confirmation. It is audited and cancels issued grants.
    • It stages a sealed rotation through the existing path. The agent ends the session, restores the settings and reads them back.
    • force is only for a computer already rolling back whose agent is gone.
  • Fail closed. Each of these refuses, reports the reason and substitutes nothing weaker: no keys, a grant that does not verify, the pause, a replay, a failed save, a readback mismatch, or no Done from --password. Ending a session means a random password, then stop-service Y, then N, then reading back N.
  • Exec sites. §80's "only the preflight names --option" is replaced with an exact list: the preflight's two files plus enforce/args.go. Only args.go names --password. The only exec site is enforceRunner.Run:
    • it runs only what enforce.Valid accepts, and only the installed rustdesk.exe that the service runs;
    • it passes an argument array, uses no shell, and never logs the arguments.
  • The managed test session. A view-only test grant, then Reveal one-time password. The reveal requires msa.reveal, is audited with ids only before a conditional claim, and works once. The agent reports connected (--cm) and ended.

Scoped out (step 5)

These are not built:

  • Connect issuing grants for technicians.
  • control mode, or any permission above view-only.
  • Cutover by group or by business.
  • Revocation and the session-evidence timeline.
  • A console switch for MSA_GRANTS.

So a verified computer is reachable only through Platform Admin test grants until step 5 ships; roll it back to connect normally. Turning the switch off while a computer is verified stops its poller but still refuses its legacy password (fail closed). Roll back first.

Tests (all run locally on a scratch DB, ports 3961/3962)

Suite Result
e2e-msa-managed.mjs (new, in run-e2e.sh) 106 / 0
e2e-msa-grants.mjs 69 / 0
e2e-msa-readiness.mjs 52 / 0
e2e-confirm-policy.mjs 46 / 0
e2e-signed-release.mjs (new grant-key section, all pass) 83 / 1 — the 1 is environmental: the scratch DB's oldest tenant has no relay host (NO_PORTAL_ADDRESS)
unit-msa-managed.mjs (new, in CI) 42 / 0
unit-msa-readiness.mjs 102 / 0
unit-msa-grants.mjs 83 / 0
unit-signed-release.mjs 23 / 0
unit-confirm-policy.mjs 47 / 0
Go internal/msa/enforce 20 tests pass
Go go test ./... 12 packages ok
go vet (linux, GOOS=windows, -tags labwindows) clean
check-security-invariants.mjs (new §82; §56/§62/§80/§81 amended) all hold
check-versions.mjs ok
api + web tsc and eslint on changed files clean
docs/API-REFERENCE.md regenerated --check against the runtime route table: 623/623

Windows lab: TestLabRustdeskEnforce was added to every RustDesk job (1.4.1–1.5.3). It runs save → apply → readback → password → end session → restore, as the administrator and as SYSTEM via a scheduled task. merge-evidence.mjs requires its evidence, and the WSUS 127.0.0.1:8530 trick is unchanged.

Not run or verified

  • The Windows lab job runs only on GitHub, so TestLabRustdeskEnforce has not run yet. The lab does not cover the portal, the long-poll or a real remote connection.
  • Nothing has run on a Windows 10/11 desktop or on the fleet. The agent's Windows HTTP/poll wiring (msaPortal) has been vetted but not executed.
  • CLAUDE.md was not edited. Its §80 paragraph still says "only the preflight names --option", and a §82 paragraph is worth adding there.
  • The in-app /help copy is unchanged.

Deploy notes (only with approval)

  1. Apply migration 0089 and regenerate the Prisma client at the target.
  2. Leave MSA_GRANTS unset.
  3. Publish the signed agent as usual.

🤖 Generated with Claude Code

agit8or1 and others added 4 commits November 20, 2026 02:56
…d rollback, behind MSA_GRANTS (off)

Managed Secure Access build step 4. A new signed agent build: on a Legacy
computer (every computer until a Platform Admin moves one) it behaves exactly
as 0.71. With MSA_GRANTS off nothing new happens anywhere.

- Grant public keys published as the signed target msa/grant-keys.json
  (rem0te-signed-grant-key add|list|retire, rem0te-signed-publish); the agent
  trusts keys only from the verified TUF chain.
- MsaManagedComputer (0089): per-computer cutover (Platform Admin, msa.cutover),
  confirm after a managed test session, rollback (never asks), reveal-once
  one-time password (msa.reveal).
- Heartbeat msaPoll only for an authenticated signed may-act heartbeat of a
  managed computer; rem0te-agent.exe msa-poller verifies, applies, reads back
  and ends sessions through one closed exec site; ceiling view-only.
- §82 added; §56, §62, §80, §81 amended. Lab: TestLabRustdeskEnforce.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…nest

The device page asked GET /msa/managed/:id on every view and got
404 MSA_NOT_ENABLED with MSA_GRANTS off (the UI suite's failed-request
check on a dozen pages). The readiness answers now carry
managedControls (msaGrantsEnabled()), and the card mounts the managed
controls only when it is true, so with the switch off the console makes
no request to a gated route. e2e-ui runs its API with MSA_GRANTS=off and
asserts no /msa/managed or /msa/grants request is made.

The fleet page showed seven count tiles (three empty managed ones) with a
note saying nothing can be managed. With the switch off it shows the four
readiness tiles, plus a managed tile only for a state some computer is
really in; with it on, all seven and a testing note. The page renders the
API's note.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@agit8or1
agit8or1 merged commit 5471f08 into main Nov 20, 2026
18 checks passed
@agit8or1
agit8or1 deleted the msa-step4-helm branch November 20, 2026 14:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant