Skip to content

v0.74.0 Bastion: Admin → Security rewritten — posture score, unknown never OK, audited host changes - #185

Merged
agit8or1 merged 2 commits into
mainfrom
server-security-074
Nov 20, 2026
Merged

agit8or1 merged 2 commits into
mainfrom
server-security-074

Conversation

@agit8or1

Copy link
Copy Markdown
Owner

Admin → Security, rewritten (0.74.0 · Bastion)

The page at /admin/security reported failures as healthy. This rewrites it around one rule: a check whose source cannot be read is Unknown, never OK. Every change it makes to the host is now Platform Admin only, may ask the person to confirm it is them, and is audited with its outcome.

Bugs fixed (symptom → cause → fix)

  • Code Audit said "no issues" → ESLint ran on dist/ outside its base path, ignored every file, and nobody checked the empty result. semgrep is a snap that the service's PATH and ProtectHome cannot reach. The checkout path was hard-coded. → Both removed (CI does source scanning). A Dependencies tab now runs npm audit --omit=dev, and when it cannot run it says Unknown and gives the reason.
  • "Fix" ran npm audit fix in production's node_modules → this bypassed the generated manifest → removed.
  • "Renew TLS" did nothing → it re-posted Caddy's unchanged config, which Caddy ignores → removed. The TLS tab now explains renewal. Certificates are read with tls.connect over loopback using SNI.
  • fail2ban showed Stopped or "no jails" while loading or after an error, apt showed up to date after an error, an empty certificate list showed a green dot, and the Overview was green while loading → none of these had loading or error states → every panel now has loading, error and Unknown states.
  • fail2ban changes and the install had no audit row and no step-up, and a failed install reported success → each step's exit code is now checked, a failure returns 502 with the command's message, and every change is recorded as HOST_SECURITY_CHANGED with its outcome. Banning your own address is refused.
  • GeoIP and IP allow/block lists could be saved but were never enforced → they can no longer be set. Values already stored are flagged and can be cleared. The lockout policy, which is enforced, is now audited, and weakening it needs a step-up.

Features added

  • Overview posture score: counts only the checks that could be read, and shows coverage, severity, evidence, when each check was read, a fix and a link for each finding.
    • SSH settings, parsed with includes; settings an unreadable include could change show as Unknown.
    • ufw, listening ports compared with the expected set, pending and security updates, package-list age, unattended-upgrades, reboot required and the packages that need it.
    • fail2ban, including whether the sshd jail watches the unit that actually runs.
    • TLS expiry thresholds, HSTS/CSP/framing/nosniff/referrer/permissions headers, server disclosure, HTTP→HTTPS redirect.
    • MFA coverage (names only for admins), Platform Admins and break-glass accounts, API key expiry and age, audit-chain verification (reuses the existing verifier) and export.
    • Lockout, signed releases, approval signer, MSA_GRANTS, NODE_ENV, and every *_SWEEP/*_SEALER off switch.
  • Release root keys always show Unknown, because §56 keeps the portal away from them. The page shows sudo rem0te-signed-status instead.
  • The OS updates tab adds list age, kernel, unattended-upgrades and pending reboot. Upgrades are audited at start and finish.
  • New catalog keys: server.security and login.lockout, both defaulting to off like every key.
  • New docs page docs/server-security.md (in the bundle ORDER), plus /help, the README index, CLAUDE.md §84 and a regenerated API-REFERENCE (636 routes, checked against the runtime table).

Owner action needed (found read-only on the production host as reboot)

  • PermitRootLogin yes is set in sshd_config, and 50-cloud-init.conf is unreadable, so the effective value is unknown. Check it with sudo sshd -T | grep -i permitrootlogin.
  • The fail2ban sshd jail watches _SYSTEMD_UNIT=sshd.service, but Ubuntu 24.04 runs ssh.service, so the jail has seen 0 failures. Fix: in jail.local, set journalmatch = _SYSTEMD_UNIT=ssh.service + _COMM=sshd, then restart fail2ban.
  • Public UDP port 33344 is listening, and no Rem0te component should be using it.
  • A reboot is pending: the running kernel is 6.8.0-147, and newer kernels plus libc6 are installed.
  • Port 80 sends Server: Caddy, and there is no Permissions-Policy header.
  • Deploy needs the schema steps. Run migration 0091_server_security_audit, then prisma generate at the target. Sudoers is unchanged.

Tests

  • unit-host-security.mjs: 80 passed (added to CI).
  • e2e-host-security.mjs: 104 passed on a scratch DB, using ports 3991–3993 and a fixture host (added to run-e2e.sh).
  • e2e-ui.mjs: new serverSecurity step covering every tab, no console errors, and nothing Unknown labelled OK.
  • check-security-invariants.mjs: new §84 section, all hold.
  • check-versions.mjs: passes. pnpm lint: 0 errors. next build and nest build are clean.

Not merged or deployed.

🤖 Generated with Claude Code

agit8or1 added a commit that referenced this pull request Nov 20, 2026
Audits the Full RMM Functionality Expansion directive against 0.73.0 source,
migrations, tests and flags: docs/rmm-expansion-audit.md (in /docs) with a
status and strongest-evidence matrix (136 rows), related work (MSA steps 2-5
behind MSA_GRANTS off; #183 and #185 in progress), thirteen conflicts with
existing invariants, the P0 sequence as eight PR-sized releases
(0.75.0-0.82.0), P1/P2, and a needs-real-device list.

Corrects stale statements in implementation-status.md, capabilities.md and
rmm-gap-analysis.md. No code, migration, agent or signer change.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
agit8or1 added a commit that referenced this pull request Nov 20, 2026
Audits the Full RMM Functionality Expansion directive against 0.73.0 source,
migrations, tests and flags: docs/rmm-expansion-audit.md (in /docs) with a
status and strongest-evidence matrix (136 rows), related work (MSA steps 2-5
behind MSA_GRANTS off; #183 and #185 in progress), thirteen conflicts with
existing invariants, the P0 sequence as eight PR-sized releases
(0.75.0-0.82.0), P1/P2, and a needs-real-device list.

Corrects stale statements in implementation-status.md, capabilities.md and
rmm-gap-analysis.md. No code, migration, agent or signer change.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
agit8or1 added a commit that referenced this pull request Nov 20, 2026
Audits the Full RMM Functionality Expansion directive against 0.73.0 source,
migrations, tests and flags: docs/rmm-expansion-audit.md (in /docs) with a
status and strongest-evidence matrix (136 rows), related work (MSA steps 2-5
behind MSA_GRANTS off; #183 and #185 in progress), thirteen conflicts with
existing invariants, the P0 sequence as eight PR-sized releases
(0.75.0-0.82.0), P1/P2, and a needs-real-device list.

Corrects stale statements in implementation-status.md, capabilities.md and
rmm-gap-analysis.md. No code, migration, agent or signer change.

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
agit8or1 and others added 2 commits November 20, 2026 21:12
…never OK, audited and confirmed host changes

The page reported failures as healthy: ESLint linted nothing on dist and
semgrep never started, both shown as "no issues"; "Fix" ran npm audit fix in
production's node_modules; "Renew" re-posted Caddy's unchanged config; a
failed fail2ban or apt read showed Stopped / up to date; fail2ban changes were
unaudited, unconfirmed, and a failed install reported success; GeoIP and IP
lists were stored and never enforced.

Now: one exec site with a closed argv list matching the installer's sudoers
(sudo -n, no sudoers change), every change Platform Admin + assertFresh
(server.security / login.lockout) + HOST_SECURITY_CHANGED or
LOGIN_POLICY_CHANGED with its outcome (migration 0091), and an Overview
posture over SSH, firewall, ports, updates, restart, fail2ban, certificates,
headers, MFA coverage, API keys, audit chain, signer and the API's off
switches, scored only over what could be read.

Tests: unit-host-security (80, in CI), e2e-host-security (104, ports
3991-3993, fixture host), e2e-ui tabs, invariant §84.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@agit8or1
agit8or1 force-pushed the server-security-074 branch from a7dfcf1 to b3fdd66 Compare November 20, 2026 21:12
@agit8or1
agit8or1 merged commit d43a862 into main Nov 20, 2026
21 checks passed
@agit8or1
agit8or1 deleted the server-security-074 branch November 20, 2026 21:55
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