#530 Run the log receivers as their own user, openchronology-logs (#501)
–
- github
- github/openchronology/timeline-app
- github/openchronology/timeline-app#530
- pull request
- state:merged
Closes #501. **Stacked on #527** (`security/deploy-hardening`); retarget to `main` once #527 merges. The syslog receiver and the journald follower now run as their own system user, `openchronology-logs`. They can no longer read the server's `openchronology.env` (database password, auth encryption key), and the web server can't read their API keys. **Every package** (Debian/Ubuntu, RPM, Arch, FreeBSD): - creates the user on install and upgrade; - runs the new `openchronology-log-files` script, which moves `syslog.env`, `journald.env` and the files they name to the new account. It is careful about what it moves: - it only moves regular, singly linked files reached through root-owned folders, with no symlinks; - it never touches `openchronology.env`, and keeps each file's mode; - creates new `syslog.env` and `journald.env` files as `root:openchronology-logs` 0640; - sets `/etc/openchronology` to 0751. **Keeping the two services apart:** the follower runs with group `systemd-journal`, so a compromised receiver can't ptrace it and take that group. Both units get `ProtectProc=invisible`. **NixOS:** - The log services run as the new user, without the server's environment. - **Breaking:** they need the new `syslog.environmentFile` / `journald.environmentFile` options. The module warns while either is unset. - The follower gets a `StateDirectory` for its cursor. - The VM test checks the receiver can't read `generated.env` or reach the database. **Tests:** `test/server-upgrade-services.mjs` now upgrades from an old-style layout, symlinked file included. It checks owners, groups and modes afterwards, and that `openchronology.env` is unchanged. **Not yet run locally:** the package builds, the upgrade tests and the NixOS VM test. This PR's CI is their first run. The script itself was exercised as root in a Debian container. 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_011fFY8eruEi1xAkkMBni13B https://github.com/openchronology/timeline-app/pull/530
Related
Open #530 Run the log receivers as their own user, openchronology-logs (#501) in the timeline