Title: Set a PostgreSQL owner's password only when it changed by shipmill-romamo[bot] · Pull Request #413 · cloudfall-dev/cloudfall · GitHub
Open Graph Title: Set a PostgreSQL owner's password only when it changed by shipmill-romamo[bot] · Pull Request #413 · cloudfall-dev/cloudfall
X Title: Set a PostgreSQL owner's password only when it changed by shipmill-romamo[bot] · Pull Request #413 · cloudfall-dev/cloudfall
Description: Summary A PostgreSQL owner role with a passwordRef reported a change on every services converge: the store task had changed_when: true, and the controller staged a verifier with a fresh random salt each run, so it could never equal the stored one. This implements D-25 (decided on #398, recorded in #412): The role reads the owner's rolcanlogin and stored rolpassword from pg_authid (no_log) A new controller-side filter, cloudfall_scram_verifier (roles/cloudfall_postgresql/filter_plugins/scram.py, stdlib only like the other role plugins), computes the password's SCRAM-SHA-256 verifier with the stored verifier's salt and iteration count, or a fresh 16-byte salt and 4096 iterations when the role has no SCRAM verifier (none, or md5) The verifier is copied to the host and ALTER ROLE runs, reporting a change, only when the role can't log in or the verifiers differ; otherwise nothing runs and nothing changes A stored password of any other shape (a broken SCRAM verifier, cleartext, no role row) stops the run through an assert whose message names the role and the problem, never the value The controller now stages the owner's password itself in its private 0600 temp file (it never leaves the controller) so the filter can compute the verifier mid-play; only a verifier reaches the host, as D-9 requires The converge fixture's postgresql-main gets a second database, ledger, owned by ledger with a passwordRef; the converge job installs sops (pinned by SHA-256) and age, encrypts a random password to a throwaway age key, logs in as ledger over TCP to prove the verifier works, and the second converge must still report changed=0 Plan Serves: quality bar Files: engine/ansible/roles/cloudfall_postgresql/tasks/owner_password.yml, a new engine/ansible/roles/cloudfall_postgresql/filter_plugins/scram.py, sdk/src/cloudfall/secrets.py (stage the owner password in its controller-only 0600 file), engine/tests/test_postgresql_owner_role.py, sdk/tests/test_owned_postgresql_converge.py, the converge fixture (engine/tests/converge/project/services/postgresql-main.yaml, .github/workflows/converge.yml), docs/secrets-guide.md, docs/specs/006-standalone-postgresql.md, a changelog.d fragment Order: first the failing replay test (an unchanged password reports no change, a changed one does), then the filter and the role's read-compare-alter tasks, then the SDK staging, then the fixture's passwordRef and docs Proof: the replay test of the role's tasks at -vvv --diff (unchanged: no ALTER and no change; changed: ALTER and a change; malformed stored verifier: the play fails; neither the password nor either verifier in any output, argv or stdin); the filter's unit tests against the SDK's scram_sha256_verifier; the converge job's second run reporting changed=0 with an owner that has a passwordRef Test plan engine/tests/test_postgresql_owner_role.py replays the owner password tasks on localhost with a stand-in psql at -vvv --diff: an unchanged password reports changed=0 and never runs the ALTER; a rotated password (same stored salt) runs it with the verifier computed from the stored salt; a role that can't log in, has no password, or has an md5 verifier gets a fresh verifier; a broken SCRAM verifier, cleartext, or no role row fails the play; in every case neither the password nor any verifier appears in Ansible's output or any psql argv/stdin. The new tests fail on the old task file The filter's verifier equals cloudfall.secrets.scram_sha256_verifier for ASCII and SASLprep passwords, keeps a stored non-default iteration count, and its problem messages never quote the stored value sdk/tests/test_owned_postgresql_converge.py adapted: the staged controller file holds the password, 0600 in a 0700 dir outside the project, removed after the run; the password is still in no argv, environment, answer, receipt or project file Run locally: uv run ruff check ., uv run mypy (root and demo/), uv run ansible-lint engine/ansible, and the touched test files (88 passed). The full suite and the converge job are left to CI Fixes #398 🤖 Generated with Claude Code
Open Graph Description: Summary A PostgreSQL owner role with a passwordRef reported a change on every services converge: the store task had changed_when: true, and the controller staged a verifier with a fresh random salt...
X Description: Summary A PostgreSQL owner role with a passwordRef reported a change on every services converge: the store task had changed_when: true, and the controller staged a verifier with a fresh random salt...
Opengraph URL: https://github.com/cloudfall-dev/cloudfall/pull/413
X: @github
Domain: github.com
IPv4 address: 140.82.114.3
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /:user_id/:repository/pull/:id/files(.:format) |
| route-controller | pull_requests |
| route-action | files |
| fetch-nonce | v2:cd137d90-8ff3-0b5d-71d9-d2e29e64c3d8 |
| current-catalog-service-hash | ae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b |
| request-id | D748:3B27CE:19AF2EB:21B42D8:6B0556A7 |
| html-safe-nonce | 1b6d1c8ea7ed81cff1bab518a03f2214b847c9d61a7610a653556f386ae5c39d |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJENzQ4OjNCMjdDRToxOUFGMkVCOjIxQjQyRDg6NkIwNTU2QTciLCJ2aXNpdG9yX2lkIjoiNDAwMTkzODY3ODY2OTk4OTU0NCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 931f12a067a3c8a4e72ba969ee8a7dbea2f4e5e21c7536a3def8a033b6ae71eb |
| hovercard-subject-tag | pull_request:5332637834 |
| github-keyboard-shortcuts | repository,pull-request-list,pull-request-conversation,pull-request-files-changed,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/cloudfall-dev/cloudfall/pull/413/files |
| twitter:image | https://avatars.githubusercontent.com/u/5600783?s=400&v=4 |
| twitter:card | summary_large_image |
| og:image | https://avatars.githubusercontent.com/u/5600783?s=400&v=4 |
| og:image:alt | Summary A PostgreSQL owner role with a passwordRef reported a change on every services converge: the store task had changed_when: true, and the controller staged a verifier with a fresh random salt... |
| og:site_name | GitHub |
| og:type | object |
| hostname | github.com |
| expected-hostname | github.com |
| None | a79a02b7e7546ea306864e922ed2103ef4c04fac63168e11c2b2d4d816793080 |
| turbo-cache-control | no-preview |
| diff-view | unified |
| go-import | github.com/cloudfall-dev/cloudfall git https://github.com/cloudfall-dev/cloudfall.git |
| octolytics-dimension-user_id | 339512759 |
| octolytics-dimension-user_login | cloudfall-dev |
| octolytics-dimension-repository_id | 1360999777 |
| octolytics-dimension-repository_nwo | cloudfall-dev/cloudfall |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 1360999777 |
| octolytics-dimension-repository_network_root_nwo | cloudfall-dev/cloudfall |
| turbo-body-classes | logged-out env-production page-responsive full-width |
| disable-turbo | true |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 10dff83edfd4f3617a7792a152d44991587b434c |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
| Server | github.com |
| Content-Type | text/html; charset=utf-8 |
| Cache-Control | no-cache |
Viewport: width=device-width