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

4 Commits

Author SHA256 Message Date
gsadmin 2a663df3c2 Self-signed cert SANs include the public IP (cloud metadata + echo) [skip ci]
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>
2026-08-09 17:47:18 -04:00
gsadmin 1d4e770a8f Self-signed CA: install into OS trust (not pinned); richer cert SANs; bind mounts [skip ci]
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>
2026-08-09 17:42:18 -04:00
gsadmin bbe5702692 Scaling: agent CA auto-trust, queue-group ingest, IaC (compose/swarm/k8s) [skip ci]
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>
2026-08-09 16:39:53 -04:00
gsadmin 6998411e11 Clean server uninstall: purge data, keys and self-signed certs [skip ci]
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>
2026-08-09 15:57:13 -04:00