Test that what root runs is root's alone

60-security.sh now also checks, in the smoketest VM, that each file
CoreDesktop installs for root (the pacman guard and hook, the captive
portal script, sshd, ufw and systemd settings, and after configure
security-key and fingerprint, the PAM files, the lid check and the key
list), and every folder above it, is root's and not writable by the
user; that nothing in /etc, /usr, /boot or /opt is the user's to write;
and that nothing root runs names a path in a home folder.

pam_env gives logins ~/.local/bin on PATH, so it checks that root's
PATH under sudo, sudo -i and systemd has only root's folders, also for
a user who types a password: tester's sudo needs none, and then PAM's
auth step, where Arch runs pam_env, never runs. With a security key
registered but not plugged in and fingerprints turned on, the password
still works for sudo and a wrong or missing one doesn't.

It found nothing to fix. Each check was shown to fail on a machine
broken the way it looks for.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-16 17:07:44 -07:00
co-authored by Claude Opus 5.5
parent e991264ddc
commit d5925fa551
2 changed files with 216 additions and 34 deletions
@@ -1,6 +1,6 @@
---
name: coredesktop-security-checks
description: Plan and progress for CoreDesktop's security test suite. The report receiver, report's redaction and the agent sandbox are tested; the checks still to write run in the smoketest VM (network exposure, what root runs, the install path). Use when resuming, continuing, checking the status of, or changing CoreDesktop's security or penetration tests.
description: Plan and progress for CoreDesktop's security test suite. The report receiver, report's redaction, the agent sandbox and what root runs are tested; the checks still to write run in the smoketest VM (network exposure, the install path). Use when resuming, continuing, checking the status of, or changing CoreDesktop's security or penetration tests.
---
# CoreDesktop's security checks
@@ -25,7 +25,7 @@ leak data or give away control, in this order:
2. `report`'s redaction, which decides what leaves a user's computer. **Done.**
3. The agent sandbox: the one place that runs code CoreDesktop doesn't trust. **Done.**
4. Network exposure from outside.
5. Files root runs, and secrets only root may read.
5. Files root runs, and secrets only root may read. **Done.**
6. The install path (federated.sh, the `[federated]` repo).
The pacman guard (`system/pacman-guard`) is
@@ -105,6 +105,30 @@ Lessons for the next scenarios:
- Outside checks can leave state behind (an empty config file broke a later
check once); make them look, not change.
## Done: step 5 (the commit "Test that what root runs is root's alone")
`root_checks` in `60-security.sh`. It found nothing to fix. It checks:
- `ROOT_FILES` and `PAM_FILES` (keep them up to date when CoreDesktop installs
something root runs): each, and every folder above it, is root's and not
writable by the user, following links too (`root_only`)
- nothing in /etc, /usr, /boot or /opt is the user's or writable by them
- no `/home`, `~/`, `$HOME` or `@{HOME}` in what root runs: system units,
pacman hooks, NetworkManager dispatcher, PAM, sudoers, udev and polkit
rules, /usr/local
- root's PATH under sudo, sudo -i and systemd has only root's folders.
`pam_env.conf` gives logins `@{HOME}/.local/bin`; sudo's secure_path keeps
it from root. Checked as `pamtest`, who types a password: `tester`'s sudo
needs none, so PAM's auth step, where Arch runs pam_env, never runs for it.
- the real `use_keys` and `use_fingerprint`, with a key registered but not
plugged in: the password still works, a wrong or empty one doesn't, and the
sudo and polkit-1 stacks only gained their lines
Each check was shown to fail by a throwaway scenario that broke the VM five
ways (a world-writable file, a user-owned folder above the guard, a unit
running from /home, secure_path in /home, `pam_permit.so` atop sudo's stack).
`/etc/coredesktop/smb` isn't checked: only `configure storage` makes it, which
needs an SMB server.
## Running the smoketest
- `coredesktop-dev smoketest run 60-security`, outside Claude Code's sandbox
@@ -118,7 +142,7 @@ Lessons for the next scenarios:
- The user's global git config has no name or email. Commits so far used
`git -c user.name="David Young" -c user.email=...` from the repo's history.
## Next: steps 4 to 6 in the smoketest VM
## Next: steps 4 and 6 in the smoketest VM
Add them to `smoketest/scenarios/60-security.sh` (or a sibling scenario if it
grows too long), with the same `check` style. Where a check needs a second
@@ -141,30 +165,6 @@ VM against itself goes through loopback, which ufw allows. Find out from
`coredesktop-dev` whether the VM can get a bridged or tap network, or a second
VM, before writing this one.
### 5. What root runs, and root-only secrets
Every file root runs must be owned by root and not writable by the user, and
so must every folder above it. Check it with `stat`, walking up to `/`. As of
2026-11-16:
- `/etc/coredesktop/smb` (mode 600, root), sshd's
`10-coredesktop-keys-only.conf`, the ufw rules, and the systemd drop-ins in
`system/defaults.sh`.
- Added with the Omarchy features (commit 9dc5eb1):
- the pacman hook `/etc/pacman.d/hooks/00-coredesktop-guard.hook` and
`/usr/local/lib/coredesktop/pacman-guard`
- `/etc/NetworkManager/dispatcher.d/90-coredesktop-captive-portal`
- after `configure security-key` and `configure fingerprint`:
`/usr/local/lib/coredesktop/lid-closed`, `/etc/pam.d/sudo`,
`/etc/pam.d/polkit-1` and `/etc/u2f_mappings`
Also check that nothing root runs reads a path in a user's home. That's why
the pacman guard and the lid check are copies in /usr/local, not run from
~/.local/share/coredesktop.
For `/etc/pam.d/sudo`: after the fingerprint or security-key item, a wrong
password must still fail, and `sudo -k; sudo true` without the key must still
ask for the password.
### 6. The install path
- `https://federated.sh` sends `wget` (User-Agent not starting with