Scaling (IaC/queue groups), self-signed CA auto-trust + public-IP SANs, clean uninstall #9

Merged
gsadmin merged 4 commits from dev into main 2026-08-09 21:50:14 +00:00
Owner

Scaling, self-signed trust, clean uninstall, and IaC.

Self-signed TLS / agent trust

  • The server publishes its public CA chain at GET /api/enrollment/ca.
  • Agents for a self-signed server now install the CA into the OS trust store (ServerCaAutoInstall) and keep it current across renewals — ordinary system validation then trusts a direct/local connection. It is not pinned or forced: add a reverse proxy with a real certificate later and that validates normally, the self-signed CA just goes unused. configure --install-server-ca, agent MSI CAINSTALL, ADMX toggle, install scripts. Accept-any (TlsSkipVerify) remains an escape hatch.
  • Server certificate SANs now cover the hostname, hostname.<dns-suffix> for every adapter suffix + the global domain, every non-link-local IP on every adapter, the discovered public IP (cloud metadata → echo, time-bounded, self-signed only), PUBLIC_SERVER_URL host, and localhost/loopback.

Clean uninstall

  • ExecuteR-Server.exe purge and the server MSI's "Also remove all data, keys and self-signed certificates" checkbox / PURGEDATA=1 forget the managed chain from the Windows stores and delete generated data/logs/secrets. A plain uninstall still keeps everything for a resume.

Scaling

  • Backend ingest (presence, inventory, agent events, job output/progress) uses a NATS queue group, so replicas share the load instead of duplicating writes.
  • IaC/ holds compose (moved from root, deploy.sh + docs updated), swarm (replicated stack, bind mounts on shared storage, 3-node JetStream cluster, API replicas + single scheduler worker), and k8s (StatefulSets, Deployments + HPA, single worker, ingress). Wiki gains a Scaling and HA page with an HA topology diagram and the stateless/stateful breakdown (NATS cluster/supercluster, Tailscale/NetBird overlay, MicroCeph shared storage, service discovery).

Verified locally: solution builds, Backend 100 / Agent 60 / Shared tests pass, svelte-check clean, agent + server MSIs build, self-signed boot emits the broadened SANs incl. the public IP. Dev commits used [skip ci]; this PR is where CI runs.

🤖 Generated with Claude Code

Scaling, self-signed trust, clean uninstall, and IaC. **Self-signed TLS / agent trust** - The server publishes its public CA chain at `GET /api/enrollment/ca`. - Agents for a self-signed server now **install the CA into the OS trust store** (`ServerCaAutoInstall`) and keep it current across renewals — ordinary system validation then trusts a direct/local connection. It is **not pinned or forced**: add a reverse proxy with a real certificate later and that validates normally, the self-signed CA just goes unused. `configure --install-server-ca`, agent MSI `CAINSTALL`, ADMX toggle, install scripts. Accept-any (`TlsSkipVerify`) remains an escape hatch. - Server certificate SANs now cover the hostname, `hostname.<dns-suffix>` for every adapter suffix + the global domain, every non-link-local IP on every adapter, the discovered **public IP** (cloud metadata → echo, time-bounded, self-signed only), `PUBLIC_SERVER_URL` host, and localhost/loopback. **Clean uninstall** - `ExecuteR-Server.exe purge` and the server MSI's "Also remove all data, keys and self-signed certificates" checkbox / `PURGEDATA=1` forget the managed chain from the Windows stores and delete generated data/logs/secrets. A plain uninstall still keeps everything for a resume. **Scaling** - Backend ingest (presence, inventory, agent events, job output/progress) uses a NATS **queue group**, so replicas share the load instead of duplicating writes. - **IaC/** holds `compose` (moved from root, deploy.sh + docs updated), `swarm` (replicated stack, bind mounts on shared storage, 3-node JetStream cluster, API replicas + single scheduler worker), and `k8s` (StatefulSets, Deployments + HPA, single worker, ingress). Wiki gains a **Scaling and HA** page with an HA topology diagram and the stateless/stateful breakdown (NATS cluster/supercluster, Tailscale/NetBird overlay, MicroCeph shared storage, service discovery). Verified locally: solution builds, Backend 100 / Agent 60 / Shared tests pass, svelte-check clean, agent + server MSIs build, self-signed boot emits the broadened SANs incl. the public IP. Dev commits used `[skip ci]`; this PR is where CI runs. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
gsadmin added 4 commits 2026-08-09 21:50:01 +00:00
On Windows the managed chain is located in the machine certificate
stores by subject and reused across reinstalls; a plain uninstall left
the certs and the generated data/logs/secrets/appsettings behind. New
`ExecuteR-Server.exe purge [--yes]` forgets the chain (removes
root/intermediate/leaf from the stores) and deletes the generated
runtime state, keeping MSI-owned files. The server MSI adds a PURGEDATA
property, an uninstall-page checkbox ("Also remove all data, keys and
self-signed certificates") spliced into the maintenance flow, and a
deferred CA that runs purge --yes before RemoveFiles when checked. A
plain uninstall still keeps everything for a resume.

Verified: purge deletes data/logs/secrets/appsettings/nats.conf and
keeps nats-server.exe; MSI builds clean with the property, CA and
PurgeDlg present; solution builds, 99 backend tests pass.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Agent trust for self-signed servers is now abstracted from operators.
The server exposes its public CA chain at GET /api/enrollment/ca; a new
pinned trust mode (TlsTrustMode=pinned) makes the agent fetch, pin,
install and validate against that CA for both enrollment HTTPS and the
NATS WebSocket, and a background CaRefreshService re-pins it across
renewals so trust never lapses. Install scripts, the agent MSI
(TRUSTMODE property), the ADMX template and the Add Device modal all
drive pinned trust for self-signed servers; skip-verify/insecure
remains an escape hatch.

Backend ingest subscriptions (presence, inventory, agent events, job
output/progress) now use a NATS queue group, so multiple backend
replicas share the load instead of each writing duplicates.

Deployment manifests move to IaC/: compose (moved from root, paths
rebased; deploy.sh and docs updated), swarm (replicated stack: Postgres,
3-node JetStream cluster, API replicas + single scheduler worker, shared
key-ring volume), and k8s (namespace/config, Postgres + NATS
StatefulSets, API Deployment + HPA, single worker, WebUI, ingress).

Wiki gains a Scaling and HA page with an HA topology diagram covering
stateless vs stateful tiers, NATS cluster/supercluster, overlay
(Tailscale/NetBird), shared storage (MicroCeph) and service discovery.

Verified: solution builds, Backend 100 / Agent 60 tests, svelte-check
clean, agent + server MSIs build.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Agent trust for self-signed servers no longer pins/forces — pinning
breaks if a reverse proxy with a real cert is added later. Instead the
CA is installed into the OS trust store (ServerCaAutoInstall) so
ordinary system validation trusts a direct/local self-signed server,
and a proxy with a real cert later just validates normally with the
self-signed CA sitting unused. Replaces the pinned TlsTrustMode: agent
config ServerCaAutoInstall, ServerTrust.FetchAndInstallCaAsync
(Windows stores / update-ca-certificates / macOS keychain),
CaRefreshService keeps it current across renewals, configure
--install-server-ca, agent MSI CAINSTALL, ADMX toggle, install scripts.

Server certificate SANs now cover the hostname, hostname.<dns-suffix>
for every adapter suffix plus the global domain, every non-link-local
IP on every adapter, and localhost/loopback (verified live).

Swarm stack switches named volumes to STACK_BINDMOUNTROOT bind mounts
(shared storage across nodes), matching the compose conventions.

Verified: solution builds, Backend 100 / Agent 60 tests, svelte-check
clean, agent MSI builds, self-signed boot emits the broadened SANs.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Enumerating adapters only sees a cloud VM's private/NAT IP, so the
public address (Azure/GCP/AWS metadata service, then an api.ipify.org
echo fallback) is discovered and added to the SANs, plus a configured
PUBLIC_SERVER_URL host. Best-effort and time-bounded (3s cap), and gated
on self-signed TLS being enabled so it makes no network calls in tests
or when TLS is off. Verified: the public IP lands in the cert.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
gsadmin merged commit 43776bbf26 into main 2026-08-09 21:50:14 +00:00
Sign in to join this conversation.