feat(web): tighten setup-mode gating and add settings.tls connection config #40
Loading…
Reference in a new issue
No description provided.
Delete branch "feat/setup-gate-and-tls-config"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
What
Reworks onboarding gating and moves connection configuration into config.json.
Setup mode (tightened)
/api/setupand/api/setup/registerare active only when ALL of these hold: (1)VERVAIN_SETUP_ENABLE=true, (2)config.jsondoes not exist, (3) no user account exists yet. Any failed condition returns 404 (the old existing-user 403 and theneeds_first_user: falseprobe response are both 404 now), so the registration surface closes itself the moment the first admin is created, a config.json is written, or the env var is cleared.Connection configuration (
settings.tls)New config.json section, with env overrides so a fresh deployment without a config.json (i.e. during setup mode) behind a reverse proxy still works; env wins over config:
mode(VERVAIN_TLS_MODE):terminate(default; the server terminates TLS itself) oroffload(a reverse proxy terminates TLS and the listener serves plain HTTP). Unlike dev mode, offload keepsSecurecookies and the strict agent handshake because clients still reach the server over https. The HTTP->HTTPS redirect listener is skipped in offload mode. Traefik can point its upstream athttp://<host>:15443with no serversTransport/skip-verify.certUrl: config home for whatVERVAIN_CERT_URL(VS-27) does; the env var still overrides.insecureSkipHashCheck: agent handshake accepts any agent-reported server cert hash. Narrower than the dev-mode short-circuit:AuthVerifysignature verification stays real, only the cert-pinning check is skipped. Debugging aid; keepfalsein production.Naming is ours by design (not MeshCentral's
tlsOffload/ignoreAgentHashCheck), per best-practice explicit enum + insecure- prefix.Tests
meshcentral-config:settings.tlsparsing (defaults, full section incl. key lower-casing, unknown mode, type errors, case-insensitive mode values).agent_handshake: unknown hash accepted withskip_hash_checkwhile a bad signature is still rejected.tls_smoke: new offload listener test (plain HTTP serves, setup auto-login cookie keepsSecure).setup: updated 404 contract (existing-user GET and register both 404; post-registration probe 404s).All suites for
meshcentral-config,meshcentral-web, andmeshcentralpass; clippy clean; fmt clean (the two pre-existingboot.rsfmt diffs on main are untouched).