Condition builder, built-in vault, script parameters from code, BYO TLS and a simpler server installer #22

Merged
gsadmin merged 29 commits from dev into main 2026-11-05 11:43:14 +00:00

29 Commits

Author SHA256 Message Date
Alphaeus Mote 32306bf191 Merge branch 'feature/remote-screen': remote screen contracts (not yet used)
CI / build-test (push) Successful in 31m30s
CI / images (push) Successful in 3m41s
CI / build-test (pull_request) Successful in 11m0s
CI / images (pull_request) Has been skipped
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-04 22:58:31 -05:00
Alphaeus Mote 4a332c5c1e feat(screen): contracts for the browser remote screen
Subjects, message types, payloads, the binary ERSF frame format, API DTOs,
the server-side session policy and protocol timeouts.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-04 22:11:06 -05:00
Alphaeus Mote 7e2c0bdbbc Merge branch 'feature/server-installer-admin': bind a store certificate and follow its renewals
CI / build-test (push) Successful in 27m3s
CI / images (push) Successful in 4m29s
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-04 22:07:03 -05:00
Alphaeus Mote 7fb02f05d1 feat(console): Settings › Server Certificate
The certificate in use (source, subject, names, issuer, expiry, thumbprint,
chain, public or private, distribution folder, whether agents get the chain
pinned), Following Renewals with the last switch, a New Root notice for agents
enrolled before, and on Windows the LocalMachine\My certificates with Bind,
unusable ones disabled with the reason on hover. Use Self-Signed and Use
Configured switch back.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-04 22:06:07 -05:00
Alphaeus Mote 32024037f4 test(tls): take back the intermediates certificate contexts import
On Windows a TLS certificate context imports its intermediates into the
Intermediate CAs store (LocalMachine's when elevated) so SChannel can send
them. Test runs left hundreds there, until chain building slowed and failed.
Tests now remove what they caused, and the classes that change stores or build
the managed chain run in one serial collection.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-04 22:06:06 -05:00
Alphaeus Mote 94a0e255aa feat(tls): bind a store certificate by identity and follow its renewals
Settings › Server Certificate stores a binding in the database
(tls.serverCertificate): the certificate's subject, issuer, DNS names and
template plus the thumbprint bound, never just a thumbprint. Every minute each
replica picks what to serve from its own LocalMachine\My: Windows' renewal
link first, otherwise the newest usable certificate with the same template
(else issuer) and the same subject or DNS name set; the swap needs no restart
and each replica records what it serves and when it last switched. The managed
self-signed chain can be bound too; clearing the binding serves the configured
source again. A certificate setting in the process environment wins over the
binding; appsettings.json (what setup writes) is the default it replaces. A
new private root after a switch is recorded (tls.rootChange) for the console.
GET/POST/DELETE /api/settings/server-certificate*, settings.manage, audited.
Context creation now fails soft when Windows' chain engine errors.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-04 22:06:06 -05:00
Alphaeus Mote aac32e16a9 Merge branch 'feature/script-parameters': parameters always follow the code
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-04 21:22:54 -05:00
Alphaeus Mote 5da8b648a3 feat(scripts): PowerShell parameters always follow the code
The editor adopts the param() block's parameters when a script opens,
without marking it unsaved, and keeps updating them as the code changes;
the Differs From Code state and the Sync From Code button are gone. Saving
applies the same merge on the server, so the stored parameters of a
PowerShell or Windows PowerShell script always match its code whatever the
client sent, keeping Literal and descriptions the code has no help for (from
the request, else from what was stored). Code that does not parse keeps the
editor's last read; Bash is unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-04 21:22:34 -05:00
Alphaeus Mote c471a968d2 chore: copyright and licence are Endexa Solutions
LICENSE, the assembly copyright, the README licence line and the image
licence labels (LicenseRef-EndexaSolutions-Proprietary).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-04 21:13:56 -05:00
Alphaeus Mote 84bed9a1b6 Merge branch 'feature/script-parameters' (with the shared code editor)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-04 20:58:28 -05:00
Alphaeus Mote 5195fd168a feat(scripts): parameters follow the code, values follow the defaults
PowerShell scripts take their parameters from the param() block as the code
is edited (debounced, through the server's parser), with a Sync From Code
action, a Matches Code / Differs From Code / Code Has Errors status, and the
unsaved additions, removals and changes listed above the table. Fields the
code owns are read-only with a hover reason; Literal and descriptions the
code has no help for stay editable. Bash keeps hand-defined parameters and
gains editable defaults.

Runs and schedules start from the defaults. Only values changed there are
sent and stored, so a schedule keeps following the script's defaults for
everything it did not set; each value shows Default or a reset. Run and
Save stay disabled, with the reason on hover, until required values are
given. Arrays are lists with add, remove and reorder, typed by element
type, ValidateSet values are pick lists, and schedules that no longer fit
their script are flagged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-04 20:54:28 -05:00
Alphaeus Mote 1ef7d348d8 feat(scripts): read PowerShell param() blocks and check values on every start
The server reads a PowerShell script's param() block with PowerShell's own
parser (System.Management.Automation, parse only) through
POST /api/scripts/parameters/parse (scripts.view) and merges it into the
editor's parameters: the code owns name, type, required, default and
ValidateSet; Expansion and hand-written descriptions without help are kept;
parameters gone from the code are dropped. Only constant primitive defaults
and lists of them are imported; computed ones stay in the code. `using
assembly` is masked before parsing, since the parser would load it.

Manual runs, trigger saves and every firing share one check: a required
parameter needs a value or a default, and given values must fit. Schedules
store only the values set on them, so untouched ones follow the script's
defaults; a firing that no longer fits records why and does not run. Empty
values count as not given on the server and the agent alike.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-04 20:46:00 -05:00
Alphaeus Mote dcaf07a4ab Merge branch 'feature/server-installer-admin'
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-04 20:43:37 -05:00
Alphaeus Mote 198df09d41 feat(installer): StifleR-style server wizard without admin fields
Welcome, Server Address, Certificate (Self-Signed, Certificate Store, File,
None), Ready; upgrades skip straight to Ready. Labels are short with detail in
tooltips, stock strings come from ServerUI.wxl. The admin account page is gone:
Finish says where the one-time password is; ADMINUSERNAME/ADMINPASSWORD are
still honoured from the command line. Secrets are hidden from the log and the
setup carrying one runs through WixSilentExec. Publisher is Endexa Solutions.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-04 20:42:39 -05:00
Alphaeus Mote 5a0bd1a7ea feat(agent): validate every channel first, then the CA pinned at enrollment
First contact keeps only the root matching the token's fingerprint and the
CAs that chain to it, so an extra root in the response can no longer reach
the trust store. The verified chain is kept as the agent's anchors and backs
the HTTPS API, downloads, upgrades, the CA refresh and the NATS WebSocket when
OS validation fails on an untrusted chain.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-04 20:42:39 -05:00
Alphaeus Mote bae67a9ffc feat(tls): serve a certificate from the Windows store or a file
TLS_CERT_SOURCE=store (TLS_CERT_THUMBPRINT, LocalMachine\My, renewals with the
same subject and issuer followed) or file (TLS_CERT_FILE PFX/PEM,
TLS_CERT_KEY_FILE, TLS_CERT_PASSWORD), hot-reloaded within a minute; the
managed self-signed chain stays the default. Each handshake carries the
intermediates. A chain that is not publicly trusted is handed to agents like
the managed one (GET /api/enrollment/ca without the leaf, its root's
fingerprint in tokens); TLS_DISTRIBUTE_CA overrides. Root and intermediate go
to <data>/ca-certificates as .cer/.pem for Group Policy. setup takes
--tls-source/--tls-thumbprint/--tls-cert-file/--tls-key-file/--tls-password,
checks the certificate, writes values JSON-escaped and restricts
appsettings.json. The install scripts validate first and pin the CA to the
token only on a trust failure.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-04 20:42:38 -05:00
Alphaeus Mote 39441eced9 feat(auth): record a generated first-start admin password and add reset-admin
An empty INITIAL_ADMIN_PASSWORD now means generate and record: the one-time
password goes to <data>/initial-admin-password.txt (Administrators, SYSTEM and
the server's own account only; mode 600 elsewhere) and the log only says where.
The file is removed once the password is changed or reset. reset-admin (alias
auth-reset) reads the standalone appsettings.json, so it reaches the same
database with the service running or stopped, takes --user/--password, turns
the account back on and is audited. The compose scripts stop generating the
password into .env.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-04 20:42:38 -05:00
Alphaeus Mote 52eb8c178c Merge branch 'feature/builtin-vault'
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-04 20:24:06 -05:00
Alphaeus Mote 86dd6fa405 docs(secrets): the built-in vault
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-04 20:23:07 -05:00
Alphaeus Mote 47238a5613 feat(secrets): manage the built-in vault from the console
A Vault page (Automation) browses the built-in vault folder by folder:
new folders and secrets, edit, rename and move (a secret through its
folder and name, a folder with everything in it), and delete. Values
stay masked; the eye button reveals one through its own audited call
and hides it again after 30 seconds or when the folder is left, with a
copy button while shown. Writes are gated on Manage Secrets and reveal
on Reveal Secrets, each explaining itself on hover when missing.

Settings, Secrets Providers lists the built-in vault as a row that opens
the vault instead of an editor, keeps it out of the kinds a provider
can be added as, and gates its actions on Manage Secrets, as the API
already did.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-04 20:23:07 -05:00
Alphaeus Mote bede763ea1 feat(secrets): a built-in vault every server has
A secrets provider kind "builtin" that is always listed, under a fixed
id and with nothing to configure, so script bindings, the picker's
folder and name listings and dispatch-time resolution work without an
external vault. Secrets live in the application database (VaultSecrets,
VaultFolders): folder and name in clear for listing, the value
encrypted with the server's Data Protection key ring, which replicas
already share. Uniqueness is case-insensitive on every provider through
upper-cased key columns; the version doubles as the concurrency token,
so concurrent saves from two replicas conflict instead of one winning.

The console API browses folders, creates, edits, renames and moves
secrets and folders, and deletes them; values only leave through a
separate reveal call that takes the new secrets.reveal permission.
Every change and reveal is audited under "secrets", never with a value.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-04 20:13:45 -05:00
Alphaeus Mote 2136649edb Merge branch 'feature/condition-builder'
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-04 20:10:12 -05:00
Alphaeus Mote a2c96407b8 feat(groups): condition builder with Add Condition and Add Group
The rule editor follows StifleR's builder: the rule and every group pick
All of or Any of with a Not, and hold conditions and nested groups, with
Add Condition and Add Group inside each (Add Group stops at eight levels,
with the reason on hover). Add Block is gone.

Fields are picked from a searchable list headed by category; operators
fit the field's type; values are suggested from what the caller's
devices report (fetched while the list is open, as typing pauses), fixed
choices are a select, lists are chips, and patterns get their own input.

Problems show on their row: missing values and unreadable numbers from
the console, patterns (.NET semantics) and CIDR ranges from the server
through the live preview. The preview's count opens a table of every
match. A rule saved as one block opens flat, matching the same devices;
the Groups page describes nested rules.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-04 20:09:39 -05:00
Alphaeus Mote 7a1dede5e9 refactor(console): one code workspace for the script and function editors
The Scripts code tab and the Functions editor now share CodeWorkspace
(toolbar with language, IntelliSense and Pop Out/Restore, full-window mode
with its own Save, and the Monaco editor with its status line), plus the
editing session pieces: SaveButton (Ctrl+S hint, Saving...), UnsavedChip,
useSaveShortcut and useUnsavedChangesGuard (in-console navigation and
tab close/reload).

Functions gain Ctrl+S, Pop Out, the IntelliSense switch, change bars on
new modules, and a guard on leaving the page, browser back/forward and
module switches (the page's own switch dialog is gone). IntelliSense is
now an editor preference shared by both, carrying over the old setting.
The device file dialog reuses the shared Ctrl+S hook.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-04 20:07:58 -05:00
Alphaeus Mote 87f56a2eea feat(s3): reveal the built-in store's keys
The built-in store generates its keys on first start and keeps them
encrypted in the settings; until now nothing could show them. Settings ›
Storage gains Reveal Keys (endpoint, bucket, access and secret key, each
copyable), from an admin-only, audited endpoint
GET /api/settings/s3/built-in/credentials. A shared store's keys stay
with the deployment that sets them.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-04 20:05:12 -05:00
Alphaeus Mote 95e6bd4b02 chore: publisher is Endexa Solutions
Assembly Company and the agent installer's Manufacturer (what Programs
and Features shows as the publisher). Copyright and LICENSE unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-04 20:00:59 -05:00
Alphaeus Mote 624f768478 feat(devices): removed devices leave at once; right-click a device
- A removed device leaves the Devices list immediately; the Removals
  filter keeps the history. ShowInDeviceList and the 7-day window are gone.
- An agent too old to take the remove command, or one that can't
  uninstall itself (foreground, container), no longer keeps its removal
  open: it is removed from the system straight away, its commands
  cleared, the agent left on the device ("Agent Left on Device"). Its
  later reports don't reopen it; enrolling again still needs a new token.
- Right-click a device row for its actions menu; on a chosen row it acts
  on every chosen device.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-04 19:58:55 -05:00
Alphaeus Mote bf55c6fc84 fix(install): install scripts hand out the newest agent
The package route served the first Agent.msi it found, AGENT_PACKAGE_PATH
before the build baked into the image, and offload reused whatever S3 key
was saved once. An old package left in a volume or uploaded once was
installed forever, and every new device was upgraded straight after.

It now serves the catalog's newest build for the platform (presigned when
offloaded), unless this node holds a newer one. Local lookup picks the
newest copy by VERSION marker, and the catalog imports every copy it finds.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-04 19:58:54 -05:00
Alphaeus Mote b711b71f92 feat(groups): nested rule groups, rule validation and field value suggestions
The rule set is now the outermost group: it holds conditions of its own
beside nested groups, with its own All/Any and Not, and groups nest to
eight levels. Rule sets stored in the older two-level shape (blocks of
conditions) read, save and evaluate exactly as before; rules stay JSON in
RulesJson, so no migration.

Saving or previewing a rule checks it by row path: nesting depth, a
200-condition cap, a field on every row, patterns compiled with .NET
regex semantics and CIDR ranges that parse. The field catalogue gains a
type, fixed choices and a short description for the console's picker.

GET /api/groups/fields/values?field=&prefix=&limit= returns a field's
distinct values with device counts (groups.manage, limited to the
caller's device scope, 25 by default and 100 at most). The preview and
members endpoints now also stay inside the caller's device scope.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-04 19:57:19 -05:00