Fix root symlink follow in postinst auth
Found by Task 11239's security review (PR #7333). That task fixed the same flaw in /var/lib/jaahd only.
`packaging/postinst` runs as root. `$JAAH_HOME` and `$JAAH_HOME/auth` are 2775 jaah:jaah, so both `jaahd` and the runner user `jaah` can plant symlinks there and then request an upgrade, which runs postinst.
- On every configure, the per-account `chown jaah:jaah` / `chmod` of the account dirs and of `.credentials.json` follow a planted link, for example to `/etc/shadow`.
- The marker-gated `find "$auth_dir" -exec chown jaah:jaah {} +` passes each link to `chown`, which follows it. `jaahd` can re-arm this by deleting `.auth-uid-converged`.
- The `find ... -type d -exec chmod g+s` passes race against a directory being swapped for a link.
- The `install -d -o jaah` of `$jaah_home` follows a link once its parent is group-writable.
Ask: root never follows a link under `$JAAH_HOME`. Run these steps as `jaah` with `runuser -u jaah --`, or skip links (`! -type l`, `chown -h`, `[ ! -L ]` guards).
Out of scope: `/var/lib/jaahd` (done in #7333) and the daemon's runtime writes.
Done means:
- A stub-PATH test (like `tools/tests/test_postinst_daemon_gitconfig.py`) plants links in `auth/` that point outside, runs the block, and shows the targets unchanged and not chowned.
- `./dc check quick` is green.
Outcome
postinst: root never follows a link under $JAAH_HOME (cd-in + inode check, chown -h via -execdir, chmods as jaah). Stub-PATH test incl. swap race; quick green; security lane pass; merged #7340 (4585faeb), deploy superseded. Filed draft #11272. Memory: none applied.
Artifacts
Activity
- Created
- Run
- Runner started
- Runner ended (done)