secrets: factor shared values into common.yaml; stop the renderer failing open #75
No reviewers
Labels
No labels
Compat/Breaking
Kind/Bug
Kind/Documentation
Kind/Enhancement
Kind/Feature
Kind/Security
Kind/Testing
Priority
Critical
Priority
High
Priority
Low
Priority
Medium
Reviewed
Confirmed
Reviewed
Duplicate
Reviewed
Invalid
Reviewed
Won't Fix
Status
Abandoned
Status
Blocked
Status
Need More Info
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: Jinemi/thermograph#75
Loading…
Reference in a new issue
No description provided.
Delete branch "fix/key-gaps-digit-regex"
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?
Two changes to how credentials are stored and distributed.
1.
common.yamlnow existsThe renderer has always concatenated
common.yamlthen<env>.yaml(host winning), and the vault README has always listedcommon.yamlwith a ✅. The file was never created. So every value shared by prod and beta was duplicated in both vaults, free to drift apart with nothing to detect it.common.yaml: VAPID keypair, metrics token, IndexNow key,REGISTRY_TOKEN, the S3 endpoint/bucket and both S3 keypairs, plus shared config.APP_CPUS,DB_CPUS,DB_MEMORY,WORKERS,THERMOGRAPH_BASE_URL.Three held back deliberately
POSTGRES_PASSWORD,THERMOGRAPH_AUTH_SECRETandTHERMOGRAPH_DATABASE_URLare identical today, so by the mechanical rule they belong incommon.yaml. They are kept per-host anyway.These are the credentials that let one environment act as another: with them, a foothold on beta is a foothold on prod's database and prod's session signing — and beta is the more exposed box, serving public Forgejo and Grafana. They match only because beta was seeded from prod, not because the two are meant to be one system.
Keeping them per-host costs one line each and preserves the ability to diverge, so that rotating prod's database password stops implying "and beta's too". Putting them in
common.yamlwould encode that equivalence as intentional and make breaking it a migration rather than an edit. The reasoning is in the vault README, because otherwise a future reader will helpfully "fix" it.How this was done safely
No plaintext left prod. Ciphertext was shipped up, decrypted against the host's age key, recombined, re-encrypted, shipped back. The consolidation refuses to write unless it has proved
merged(common + env) == the original env vault— same keys, same values — and then re-verifies from the written files. Both checks passed for prod and beta.An earlier attempt failed at the encrypt step because SOPS's creation rule is
path_regex: ^deploy/secrets/.*\.yaml$, which doesn't match a scratch directory. It failed before writing anything and left no plaintext behind.2.
render_thermograph_secretsno longer fails openOne
return 0covered two different situations:/etc/thermograph.envalready held — including after a rotation.The likely cause is passing the wrong root. The function wants the directory containing
deploy/secrets, which on the hosts is/opt/thermograph/infra, not/opt/thermograph. That mistake looked exactly like "not configured here", which is why it went unnoticed. It now exits 1 and names the probable cause.Verified across all three paths: unconfigured →
rc=0, configured-but-missing →rc=1with a diagnostic, configured-and-present → proceeds.