Standalone NATS + install fixes, unified triggers, richer inventory & docs #11

Merged
gsadmin merged 13 commits from dev into main 2026-08-10 12:53:28 +00:00
Owner

Rolls up this iteration of standalone-server, install, and UX work.

Standalone / NATS

  • NATS bind address configurable (default 127.0.0.1) in MSI/docker; data grouped under data/nats/{jetstream,resolver,secrets}.
  • NATS WebSocket TLS reuses the managed self-signed leaf; https Urls when self-signed TLS is on.

Install / networking

  • Windows install uses WebClient and forces TLS 1.2 (fixes the Run-box failure); auto-elevation on the script itself.
  • nginx sample no longer drops the forwarded Host header at location scope.

Triggers & scheduling

  • Schedules unified into triggers: Script > Triggers > Targets, per-trigger target + inline cadence, friendly cadence picker. Standalone Schedules page/objects removed.

Inventory & device UX

  • OS caption split into base name + Edition + Product type + Release version (own field); make/model, System UUID, motherboard added.
  • Remote shell on by default; device-detail polish (Client ID label, split Tags/Groups, public-IP reveal fix, disks by number).
  • Dashboard drill-ins + activity feed; script output search/copy.

Docs and screenshots refreshed to match.

Rolls up this iteration of standalone-server, install, and UX work. **Standalone / NATS** - NATS bind address configurable (default 127.0.0.1) in MSI/docker; data grouped under data/nats/{jetstream,resolver,secrets}. - NATS WebSocket TLS reuses the managed self-signed leaf; https Urls when self-signed TLS is on. **Install / networking** - Windows install uses WebClient and forces TLS 1.2 (fixes the Run-box failure); auto-elevation on the script itself. - nginx sample no longer drops the forwarded Host header at location scope. **Triggers & scheduling** - Schedules unified into triggers: Script > Triggers > Targets, per-trigger target + inline cadence, friendly cadence picker. Standalone Schedules page/objects removed. **Inventory & device UX** - OS caption split into base name + Edition + Product type + Release version (own field); make/model, System UUID, motherboard added. - Remote shell on by default; device-detail polish (Client ID label, split Tags/Groups, public-IP reveal fix, disks by number). - Dashboard drill-ins + activity feed; script output search/copy. Docs and screenshots refreshed to match.
gsadmin added 13 commits 2026-08-10 12:53:05 +00:00
- The server MSI Network page now has a NATS "Bind" field (NATSBIND, default
  127.0.0.1) alongside the ports; it flows through `setup --nb` into nats.conf.
  Set it to 0.0.0.0 only when an edge proxy on another host must reach NATS
  directly. (The backend still connects over loopback, so appsettings NATS_URL
  is unchanged.)
- All NATS-related directories are grouped under data/nats: jetstream
  (store_dir ../data/nats, nats-server appends "jetstream"), resolver
  (../data/nats/resolver), and the auth secrets (../data/nats/secrets). db,
  keys and tls stay at the top of data/.
- appsettings Urls is written as https when self-signed TLS is on, matching
  the actual listener (the backend already force-upgrades http->https at
  startup; the file just said http before).

Verified: setup produces the data/nats layout and https Urls; boot creates
data/nats/{jetstream,resolver,secrets} with nothing in C:\data; server MSI
builds clean (setup CA 251 chars, under the ICE03 limit) with the NATSBIND
field/property present. Backend 103 tests pass.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
When the NATS WebSocket bind is opened for a remote edge proxy (NATSBIND
non-loopback) and self-signed TLS is on, the sidecar's WebSocket listener now
serves TLS using the server's own managed leaf (data/tls/server.crt + .key) —
no separate NATS certs to generate or rotate. The loopback default is
unchanged (plaintext WS; the backend relays /messaging/* over loopback).

- ServerCli nats.conf: core + monitor are backend-only and always loopback;
  only the WebSocket honours NATSBIND. Its block is `tls { cert_file; key_file }`
  from data/tls when exposed+self-signed, else `no_tls`.
- appsettings NATS_WS_PROXY becomes wss when the WS runs TLS; NATS_TLS_CERT
  carries the cert path for the sidecar.
- MessagingWsProxy trusts the loopback cert when relaying to a wss target
  (loopback can't be intercepted, so no CA distribution to the process).
- NatsSidecar watches the cert and bounces nats-server on rotation (it reads
  certs only at start; the supervisor respawns it with the fresh chain).
- MSI Network page: the bind field is labelled "WS bind" and its note makes
  clear core/monitor stay local.

Verified: loopback stays no_tls/ws; exposed boot logs "Listening for websocket
clients on wss://0.0.0.0:9222", monitor healthz 200, backend serves
https://0.0.0.0:9080, NATS core connects over loopback, layout is data/nats/*.
Backend 103 tests pass; server MSI builds clean.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
An operator behind nginx got install commands pointing at the upstream name
(https://executer_api/...). Root cause: nginx does not merge proxy_set_header
across levels, so each /api/* location that set `Connection ""` for keepalive
silently dropped the server-level Host and X-Forwarded-* headers. With a named
proxy_pass upstream, nginx then sent Host: executer_api, and the backend
derives its public URL from Host/X-Forwarded-Host.

Fix in the sample: the $connection_upgrade map now yields empty (not "close")
for non-WebSocket requests, so Connection can be set once at server{} level
and still keep upstream keepalive. The per-location proxy_set_header/http
overrides are removed, so every location inherits Host + X-Forwarded-*. Added
a prominent warning comment against re-introducing location-level headers.

Definitive operator override documented in Troubleshooting: set
PUBLIC_SERVER_URL to pin the public URL regardless of proxy headers.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Two Windows-specific fixes:
- The served script downloads the agent package with System.Net.WebClient
  instead of Invoke-WebRequest — far faster for the tens-of-MB package on
  Windows PowerShell 5.1.
- Force TLS 1.2 before any HTTPS fetch. The Win+R Run box launches PS 5.1 with
  -NoProfile, which defaults to TLS 1.0/1.1 and fails the handshake to a modern
  ACME/nginx edge (works in an already-open shell that negotiated 1.2). The
  Add Device / Settings one-liners now prepend
  [Net.ServicePointManager]::SecurityProtocol='Tls12', and the served script
  sets it (and, for a direct self-signed fetch, the accept-any callback that
  WebClient honors in both PS 5.1 and 7).

Also restored the automatic self-signed-direct handling in the Add Device and
Settings commands (server-informed via serverInfo.selfSignedDirect — no
checkbox): the outer fetch accepts the cert / curl uses -k only when this
origin is the self-signed listener reached directly.

Verified: generated scripts use WebClient + Tls12, no Invoke-WebRequest, parse
clean; Backend install-script tests pass (19); svelte-check clean.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
- The served Linux/macOS install script is normalized to LF. A CRLF bash
  script piped to bash fails with ": invalid option namepefail"
  (set -euo pipefail\r). BuildUnixScript now ReplaceLineEndings("\n").
- The reported build version drops the -<shortcommit> suffix: enrollment,
  presence, /health and the agent CLI now report 2026.08.10.0056, not
  2026.08.10.0056-c87a8bf. The binary keeps its full informational version.
- The device page labels the identifier "Client ID:" next to the value.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
- Remote shell no longer hangs forever on "Opening shell…": if the agent has
  not opened the session in 15s it reports that the agent is offline or remote
  shell is disabled (AllowRemoteShell is off by default). Root cause of the
  original hang: the agent only subscribes to shell commands when
  AllowRemoteShell is enabled.
- Added a default "Windows" dynamic group (all Windows devices), matching the
  existing "Linux" and "macOS" all-platform groups.
- The groups page now shows a dynamic group's current members as soon as it is
  selected (Members — N), separate from the unsaved-rules Preview. No need to
  hit Preview to see membership.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
- Device page: storage disks are ordered by physical disk number (Disk 0, 1,
  ...) instead of report order.
- Dashboard: the Jobs, Success rate and Failed tiles are now drill-ins
  (Failed -> /jobs?state=failed), and a live Activity feed panel shows
  enrollments, runs and presence changes as they happen, each drilling into
  the job or device.
- Jobs page honors a ?state= filter with a clear-filter chip.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The Output panel gains a search box (filter to matching lines) and a Copy
button (copies the full output). Output already focuses per target (click a
target under Run). Renamed the script page's "Execution" section to "Targets".

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
- Remote shell is on by default now (opt out with AllowRemoteShell=0). Updated
  the shell timeout message, key doc, and Troubleshooting; test updated.
- Device detail: Tags and Groups are separate cards; the public-IP Reveal/Hide
  button no longer collapses vertical; info cards are a touch wider so values
  don't wrap.
- OS version shows version(.UBR) on Windows and drops the redundant
  "(build N)". Inventory now collects the system firmware UUID and motherboard
  make/product (Win32_BaseBoard + Win32_ComputerSystemProduct / DMI on unix),
  surfaced under Identity (Make/model, System UUID) and Firmware & board.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Triggers are now the single automation object. Each trigger carries its own
timing AND its own target, so one script can run at different times on
different targets (e.g. on registration for a Linux group, hourly for a
Windows group).

Model:
- ScriptTriggerType gains Scheduled (cron or one-shot) alongside
  OnRegistration/OnAgentReady.
- ScriptTriggerEntity gains a device target (ClientId), schedule fields
  (CronExpression/RunOnceUtc/TimeZoneId/NextRunUtc/LastRunUtc), captured
  ArgumentsJson and LastResult. Target = device, group, or all (both null).
- EF migration UnifyTriggers (SQLite/Postgres/SQLServer) adds the columns +
  a NextRunUtc index. Additive; no table drops.

Behavior:
- ScheduleWorker now fires due Scheduled triggers (cron advances, one-shot
  disables) against the trigger's target with its arguments.
- ScriptTriggerService fires event triggers and honors device/group/all
  targets.
- The separate Schedule API/UI is retired: Schedules nav item, /schedules
  page and SchedulesCard removed; the cron-preview endpoint stays.

UI:
- One Triggers card on the script page: pick When (registration / agent ready
  / scheduled cron) and Targets (all / group / a device); no more
  once-per-device checkbox (implicit for event types). Shows next run and last
  result per trigger.

Tests rewritten for the unified worker; full suite passes (Shared 89 /
Agent 60 / Backend 103), svelte-check clean.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Removed the now-dead schedule layer: ScheduleEntity/ScriptScheduleEntity,
ScheduleEndpoints, schedule DTOs + API routes, the api-client methods and
TypeScript types, and the DefaultSeeder schedule seeding. Migration
RemoveSchedules drops the Schedules/ScriptSchedules tables
(SQLite/Postgres/SQLServer). ScheduleCron stays (used by scheduled triggers).

Scheduled triggers now use a friendly cadence picker (the reclaimed
ScheduleCadenceEditor): Every N minutes/hours, Daily/Weekly/Monthly at a
time, Once at a datetime, or Advanced cron — with a plain-English summary via
describeCron. The backend still validates the cron on save. No raw-cron typing
required.

Full suite passes (Shared 89 / Agent 60 / Backend 103); svelte-check clean.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The agent now reports a clean OS name and richer fields:
- Caption is the base OS ("Windows 11", "Windows Server 2022") — "Microsoft "
  stripped and the edition split off (regex on the Win32 caption).
- Edition is its own field ("Pro", "Enterprise", "Standard", ...).
- ProductType added (Workstation / Server / Domain Controller) from
  Win32_OperatingSystem.ProductType; unix maps its Server/Workstation role.
- ReleaseVersion added for Windows (DisplayVersion, e.g. "23H2") from the
  registry.

The device OS caption is updated from the inventory report, so the device
list and platform derivation show the base name too; the "Server" group rules
still match. Device detail shows OS (release), Edition, Product type, Version.
Dev seed data updated to exercise the new fields. Tests pass; svelte-check clean.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
- Device detail: the Windows release (DisplayVersion, e.g. 23H2) is now its
  own "Release" row instead of being appended to the OS caption in parens —
  OS reads "Windows 11", Release reads "23H2".
- README: rewrite the triggers/schedules section for the unified model — a
  single "scheduled" trigger type carries its cadence and target inline; the
  standalone Schedules page and reusable cadence objects are gone.
- Screenshots: refresh the pages that changed this session (device detail with
  the new Identity/OS/board fields and split Tags/Groups, hardware motherboard,
  public-IP reveal, devices list base captions, dashboard drill-ins, add-device
  and settings install commands, group-target execution, scheduled-trigger
  builder). Drop the now-defunct schedules.png and script-schedules-card.png.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
gsadmin merged commit f3dbbef080 into main 2026-08-10 12:53:28 +00:00
Sign in to join this conversation.