Repository navigation
Description
Existing issue check
- I searched open and closed issues for unit hardening. None found.
Problem or outcome
The systemd unit that install/install.sh writes is less hardened than the hand-made unit the preview ran before #124. On remi (systemd 257), 2026-10-15, systemd-analyze security scored the two:
| Unit | Exposure |
|---|---|
consolebook.service written by the 0.2.0 installer |
6.8 MEDIUM |
the old hand-made consolebook-preview.service |
4.0 OK |
These settings were present in the old unit and are missing from the installer's:
CapabilityBoundingSet=(empty). The installer leaves the full bounding set.ProtectClock=yes,ProtectHostname=yes,ProtectKernelLogs=yes.RestrictAddressFamilies=. The installer's unit allows netlink, packet, and other unusual socket families.UMask=0077. The installer uses0027, so files are group-readable. Check whether that is deliberate (backups that restorers can read) before changing it.
The service runs as an unprivileged consolebook user with NoNewPrivileges=true, so most capabilities are unusable anyway. This is defense in depth that every agency's installation would get, and it costs nothing at runtime. Evidence (unit files and full systemd-analyze security output) is kept on the maintainer machine. sha256: installer unit 622e3dc6…, analysis 430aa4e1…; old unit 34b46379…, analysis b5ba33b5….
Scope
Harden the unit install.sh writes. Measure each setting against the service's actual needs: SQLite in WAL mode, the loopback listener, the backup copy directory through the existing paths.conf drop-in, and the journal. Consider SystemCallFilter=@system-service, RestrictNamespaces, MemoryDenyWriteExecute, and PrivateUsers.
Acceptance criteria
-
systemd-analyze security consolebook.servicescores at or below the old unit's 4.0, recorded in the PR. - The release workflow's systemd install job still passes: service start, backup and copy,
doctor. - The installer test (
tests/install_command.rs) asserts the hardening lines, with a negative control.
Related
#124 (preview reinstall, where this was found), ADR 0023, ADR 0024.
Activity