Title: Make the RabbitMQ restore drill's scratch tree as the rabbitmq user (#544) by shipmill-romamo[bot] · Pull Request #545 · cloudfall-dev/cloudfall · GitHub
Open Graph Title: Make the RabbitMQ restore drill's scratch tree as the rabbitmq user (#544) by shipmill-romamo[bot] · Pull Request #545 · cloudfall-dev/cloudfall
X Title: Make the RabbitMQ restore drill's scratch tree as the rabbitmq user (#544) by shipmill-romamo[bot] · Pull Request #545 · cloudfall-dev/cloudfall
Description: Plan Serves: quality bar Files: engine/ansible/roles/cloudfall_rabbitmq/templates/restore-check.sh.j2, engine/tests/test_s023_rabbitmq_backup.py, changelog.d/544-restore-check-scratch-race.md Order: the failing test first (a stand-in runuser that acts as the rabbitmq user and a stand-in head that swaps the fresh scratch tree for a link), then the script makes, writes, reads and removes the scratch tree as the rabbitmq user Proof: test_root_writes_nothing_through_a_scratch_directory_swapped_for_a_link fails on the old script (the drill ran and root's writes landed through the link) and passes now; the rest of test_s023_rabbitmq_backup.py and test_s023_rabbitmq_role.py pass Summary cloudfall-rabbitmq-restore-check runs as root and builds its scratch directory under /var/lib/rabbitmq, which the rabbitmq user owns. Root made the directory, then wrote the cookie, the export (password hashes) and the configuration into it by path before a chown -R, so that user could rename the fresh directory and put a link in its place, and root's writes followed the link. Now root writes nothing below /var/lib/rabbitmq by path: the tree is made with runuser -u rabbitmq -- mkdir -m 0700 each file is streamed in through runuser -u rabbitmq -- tee, then given its mode as that user (the export, the configuration and the other files 0600, the cookie 0400); root only opens the export in its own backup directory the pid file is read as that user too teardown and the removal of a leftover tree run rm -rf as that user, and a link at the scratch path (a dangling one too) is removed, not followed; a leftover tree that user can't remove fails the drill with a message naming it the mktemp -d work directory for restored.json and console.log stays root's A link the rabbitmq user puts there now leads only its own writes. The decided path, node name, ports and watermark are unchanged. Test notes New: test_root_writes_nothing_through_a_scratch_directory_swapped_for_a_link. The stand-in runuser now refuses writes in a directory listed as protected (one only root could write), the way the kernel would for the real user. A stand-in head, the first tool the script runs after it makes the tree, renames the tree and links its name to that directory. The test asserts the drill fails with Permission denied, nothing new appears in the protected directory, the link is gone (not its target), no scratch node was started, and no secret is printed. On the old script the drill went on and root wrote the cookie, export and configuration into the protected directory New: test_a_dangling_link_left_at_the_scratch_path_is_removed_first uv run pytest engine/tests/test_s023_rabbitmq_backup.py engine/tests/test_s023_rabbitmq_role.py: 49 passed uv run ruff check ., uv run mypy and ansible-lint engine/ansible: clean The full suite is left to CI Unverified on a live host: runuser with a real rabbitmq user. GNU tee, chmod, mkdir and rm run as that user, which owns /var/lib/rabbitmq, so it can make and remove the tree Fixes #544 🤖 Generated with Claude Code
Open Graph Description: Plan Serves: quality bar Files: engine/ansible/roles/cloudfall_rabbitmq/templates/restore-check.sh.j2, engine/tests/test_s023_rabbitmq_backup.py, changelog.d/544-restore-check-scratch-race.md Orde...
X Description: Plan Serves: quality bar Files: engine/ansible/roles/cloudfall_rabbitmq/templates/restore-check.sh.j2, engine/tests/test_s023_rabbitmq_backup.py, changelog.d/544-restore-check-scratch-race.md Orde...
Opengraph URL: https://github.com/cloudfall-dev/cloudfall/pull/545
X: @github
Domain: github.com
IPv4 address: 140.82.113.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:fe5d0f1d-025a-7c70-2fd7-6c694c79fc94 |
| current-catalog-service-hash | ae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b |
| request-id | DFEE:33B184:1DCF2AF:283AB4A:6B055A0F |
| html-safe-nonce | afc8d47dd353ef761697442614b82a820a8bf14ee705a21063e1c42ebdd9700f |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJERkVFOjMzQjE4NDoxRENGMkFGOjI4M0FCNEE6NkIwNTVBMEYiLCJ2aXNpdG9yX2lkIjoiNDgwMTc2MDAyNTU0MDY0NzQzOSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | dc4d25719315ae805f043b64e2eb7726d043a4199829c251da19834548acb91a |
| hovercard-subject-tag | pull_request:5377435801 |
| 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/545/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 | Plan Serves: quality bar Files: engine/ansible/roles/cloudfall_rabbitmq/templates/restore-check.sh.j2, engine/tests/test_s023_rabbitmq_backup.py, changelog.d/544-restore-check-scratch-race.md Orde... |
| 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