Generate the proxy's local admin password, and bake real commit hashes (#26)
Two related fixes found while testing the Docker build: 1. Print the proxy's local anti-lockout admin (proxyadmin2) password in the summary. Previously this account was always created with username == password == "proxyadmin2" (a hardcoded proxy default — see theta42/proxy#133), and setup.sh had no way to know or surface whatever password ended up in use. Now generates a random CFG_PROXY_ADMIN_PASS the same way it already does for the SSO admin, writes it into proxy-secrets.js's auth.localAdminPass (read by the proxy once, on first creation of that account), and prints it in the final summary. read_config_kv() reads it back from proxy-secrets.js so this works correctly on re-runs too (config already exists -> ensure_config's early-return path never sets CFG_PROXY_ADMIN_PASS in that run's shell, same reasoning as the existing SSO_HOST/PROXY_HOST/ADMIN_PASS readback). 2. Pass GIT_COMMIT build-args so the proxy/sso-manager images bake in their real commit hash instead of "unknown". Both submodules' .git is a pointer file, not a real repo, so the images can never resolve their own commit from inside the Docker build context no matter what (see theta42/proxy#133 and theta42/sso-manager-node#43) -- only the host, where the submodule resolves correctly, can compute it. setup.sh does that with `git -C <submodule> rev-parse --short HEAD` right before each build and exports it for docker-compose.yml to pick up. Verified end to end against a real ./setup.sh run (not just docker build in isolation): - Local admin password printed on first run, logs in successfully; the DEFAULT ("proxyadmin2"/"proxyadmin2") correctly does NOT. - Re-running prints the SAME password (confirms the readback path works on re-runs, not just first-run). - `docker exec proxy cat /app/.build_commit` and the equivalent for sso-manager both match `git -C <submodule> rev-parse --short HEAD` on the host — footer now shows the real hash instead of "unknown".
This commit is contained in:
+8
-4
@@ -45,7 +45,11 @@ CFG_DOMAIN=example.com
|
||||
#CFG_SMTP_FROM=SSO Manager <noreply@example.com>
|
||||
|
||||
# ── DO NOT put secrets here ──────────────────────────────────────────────────
|
||||
# The LDAP admin password, JWT secret, admin password, and LDAP service-account
|
||||
# password are GENERATED (random) into ./config/sso-secrets.js on first run.
|
||||
# Change them later by editing ./config/sso-secrets.js directly. Do NOT set
|
||||
# CFG_LDAP_ADMIN_PASS / CFG_JWT_SECRET / CFG_ADMIN_PASS / CFG_SVC_PASS here.
|
||||
# The LDAP admin password, JWT secret, admin password, LDAP service-account
|
||||
# password, and the proxy's local admin password are all GENERATED (random)
|
||||
# into ./config/sso-secrets.js + ./config/proxy-secrets.js on first run.
|
||||
# Change them later by editing those files directly (the proxy's local admin
|
||||
# password is the exception — see ./config/proxy-secrets.js's auth.localAdminPass
|
||||
# comment for how to actually change it after the account exists). Do NOT set
|
||||
# CFG_LDAP_ADMIN_PASS / CFG_JWT_SECRET / CFG_ADMIN_PASS / CFG_SVC_PASS /
|
||||
# CFG_PROXY_ADMIN_PASS here.
|
||||
Reference in New Issue
Block a user