feat(setup): VERVAIN_SETUP_SCHEME/HOST/PORT/BIND_IP listener overrides #42
Loading…
Reference in a new issue
No description provided.
Delete branch "feat/setup-listener-env"
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
/setupwas unreachable on a fresh deployment behind an http-upstream reverse proxy: setup mode requires config.json to be ABSENT, but without a config.json there is nosettings.tlsto switch the listener to plain HTTP, so the proxy's http upstream hit the TLS listener and surfaced a 500 (the TLS-alert-as-HTTP-response failure).Four env vars now shape the listener while setup mode is active. They are honored ONLY while setup mode is active (
VERVAIN_SETUP_ENABLE=trueand no config.json) and ignored with an info log otherwise; once a config.json exists, config plus the long-term overrides (VERVAIN_TLS_MODEetc.) own the listener.VERVAIN_SETUP_SCHEME:https(default) orhttp. Withhttpthe setup listener serves plain HTTP and the setup auto-login cookie drops theSecureflag, so onboarding works both through an https-terminating proxy and over a direct plain-HTTP browse.VERVAIN_SETUP_HOST: hostname the operator browses to; replaces--cert-fqdn(defaultlocalhost) for the generated cert chain,server_name, and the WebAuthn origin.VERVAIN_SETUP_PORT: listener port (default 15443).VERVAIN_SETUP_BIND_IP: listener address (default 0.0.0.0).Decisions baked in: an explicit
--bindCLI flag still wins overPORT/BIND_IP(the more deliberate knob); malformed values fail the boot with a named-var error; the http setup listener skips the HTTP->HTTPS redirect listener like dev/offload modes do.Typical Traefik onboarding:
VERVAIN_SETUP_ENABLE=true+VERVAIN_SETUP_SCHEME=http, proxy upstream athttp://<host>:15443, register the admin, write a config.json withsettings.tls.mode = "offload", restart.Verification
SCHEME=http PORT=18099 BIND_IP=127.0.0.1 HOST=setup.test:GET /api/setup200, register 200 with non-Securemc_sessioncookie + token, cert chain generated forsetup.test, probe 404s once the first user exists, overrides logged at boot.cargo fmt --check,cargo clippy --all-targets -- -D warnings,cargo build --all-targets,cargo test --lib, andcargo test -p meshcentral --binsall pass.