Projection: create the staged file with its final mode, drop the post-rename chmod
CultCache stages a temp file and renames it over the store; the temp file is created under Idunn's UMask=027, so the visible projection was 0640 until publish_projection_mode chmodded it after the rename and the directory fsync. A reader running as another user (Odin) failed with EACCES in that window. The store write now runs on a helper thread that unshares CLONE_FS and sets umask 022, so the staged file and the .lock are created 0644 and never visible in another mode; other threads keep 027. publish_projection_mode is deleted. CultCache has no mode parameter, so this lives in Idunn. The ACL note in migration.md now says the ACL is no longer required. Test: a reader polls the directory across 300 publishes and records the mode of every store and lock inode it sees; all must be 0644. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
012853529c
commit
40a6682e11
2 changed files with 100 additions and 39 deletions
|
|
@ -520,7 +520,7 @@ started, ran, and then died on a file it could not open:
|
|||
| `runtime_root` and every directory above it | traversable by the workload: `o+x`, or group-owned by the state group with `g+x` | the workload is a `DynamicUser` and owns nothing, and `ReadOnlyPaths=` binds the bundle's leaf into the namespace without granting traversal above it. Idunn now checks the whole chain and names the closed directory |
|
||||
| `runtime_root` | setgid, group-owned by the state group (`2750 root:<state_group>`) | `harden_root_authority_file` requires the write-lease record's group to equal its parent's, and only setgid makes a newly created record inherit it. Without it the record lands `root:root` and the workload cannot read its own lease |
|
||||
| the write-lease record | `root:<state_group>`, mode `0640` | follows from the setgid parent; the workload reads it through the state group. Idunn writes it, so fixing an existing wrong-group record means deleting it, and that is safe only when no transaction is live |
|
||||
| `/var/lib/gamecult/idunn-projection` | default ACL `u::rw-,g::r--,o::r--` | Idunn runs with `UMask=027`, so each publish creates the store and its `.lock` at `0640`. The code re-opens them after every write, but that leaves a window; a default ACL sets the mode at creation and closes it |
|
||||
| `/var/lib/gamecult/idunn-projection` | default ACL `u::rw-,g::r--,o::r--` (no longer required) | Idunn runs with `UMask=027`, but writes the projection on a thread with umask `022`, so the staged file and its `.lock` are created `0644` and are never visible in another mode. The ACL is redundant defense in depth; a rebuilt host works without it |
|
||||
| `/etc/nginx/idunn-stream-routes` | `root:root`, not group-writable | "route authority parent is not canonical root-owned and nonwritable". It was `root:idunn 0775` from the generation where Idunn ran unprivileged and needed to write it as a group member |
|
||||
|
||||
Two shapes are worth stating plainly because they are easy to get backwards.
|
||||
|
|
|
|||
Loading…
Reference in a new issue