Repository navigation
vm: shelter the app on the VM tier and prove its confinement - #91
Conversation
tools/vm.py replay, on a box with a [shelter] plan (as root): shelter.build and shelter.prove exactly as the chroot walk runs them, on a chroot copy of the box at the route's start, then the built shelter is copied into the guest before the drop hop, once the guest's passwd and group lines and carried files match the lock. stop-native and start run in the guest as hop steps. After that hop's reboot and every later one, shelter.vm_probe checks the units, the id range, the image by the lock's digest, the program's host ids, capabilities, no_new_privs and container_t, the read-only root and code, idmapped data, ports, refused egress, and the table and ports through an nftables reload and restart; then an enforcing window reruns the box's checks and the probe and fails on any AVC denial that touches the shelter. The run's shelters say tier "vm" and confinement_proved. shelter.start's unit now reloads with its table unit and runs `podman network reload`, since nftables' reload flushes netavark's forwarding too. el/centos7-pyapp: a [vm] table with live db, app, cron and daemons checks, and billing's uid and gid fixed at 600 so the chroot copy's lines are the VM's. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_016XrCggTfrYZFPiDyPrhqLF Signed-off-by: Claude <[email protected]>
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 3544e4d3a1
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
Changes requested on 3544e4d I reviewed this independently and looked for problems on purpose. I read AGENTS.md, SPEC "Sheltering an app" and "VM tier", and The harness control flow holds up. Two problems in the box and shelter, though, mean the remi run will fail on the drop hop (alma9) before it shows anything new, and then it never reaches alma10. Both can be found by reading the code, so they should be fixed before the expensive run. Blockers
Non-blocking (worth fixing while you're in there)
Things I checked and found fine:
Generated by Claude Code |
A program listening on 127.0.0.1 listens on the shelter's own loopback, which podman's -p never reaches. A port on 127.0.0.1 is now a wend socket unit on the host's 127.0.0.1 whose systemd-socket-proxyd joins only the running shelter's network namespace (nsenter --net, as nobody); 0.0.0.0 is still published, and the checker refuses any other address, which doesn't exist in the shelter. The shelter's units get TimeoutStartSec=15min for the first image import. VM tier: el/centos7-pyapp installs on XFS (ext3 can't be idmapped), and the copy check refuses code or data on a filesystem that can't; the enforcing probe has to see Enforcing; confinement_proved needs the drop hop in the run; the chroot copy is removed on any error; push_tree's tar errors go to a file. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_016XrCggTfrYZFPiDyPrhqLF Signed-off-by: Claude <[email protected]>
|
This answers the changes requested on 3544e4d. Both blockers and most of the notes are fixed in 659a56a. Blockers
Notes
Re-ran Generated by Claude Code |
|
Changes requested on 659a56a I re-reviewed What's fixed, and checked:
Blocker
Non-blocking
Generated by Claude Code |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 659a56a007
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
A connection that arrived while the container was still being created made the proxy's `podman inspect` come back empty, failed the service, and after five quick retries left the socket failed for good. The proxy is now a small script (written with a quoted heredoc, so nothing in it expands) that waits up to two minutes for the shelter's pid before it joins its namespace, and the service has no start limit. vm_probe lists the port sockets with the other units and reads SELinux's mode again at the end, and the enforcing pass needs Enforcing at both ends. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_016XrCggTfrYZFPiDyPrhqLF Signed-off-by: Claude <[email protected]>
|
This answers the changes requested on 659a56a, and 487c905 fixes it. The blocker: the proxy started before the container existed and could fail its socket.
Notes, both taken:
Generated by Claude Code |
|
Sign-off: approve 487c905 I re-reviewed The blocker from my last review is fixed. I checked it by running
Non-blocking
Generated by Claude Code |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 487c9057ea
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
check_shelter accepts data = []; vm_probe indexed data[0] and raised. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_016XrCggTfrYZFPiDyPrhqLF Signed-off-by: Claude <[email protected]>
|
Sign-off: approve b83e7e0 I re-reviewed
Non-blocking: with several data dirs, each one prints Generated by Claude Code |
What this adds
Route: none new. This is a VM-tier harness change, for
routes/el/centos7-to-alma10.tomlon boxel/centos7-pyapp.New fixes: none
Claims issue: none. This is SPEC "Sheltering an app", Proof, VM tier: the confinement proof the chroot tier can't give.
Before:
tools/vm.py replayknew nothing about shelters. On centos7-pyapp it would have walked to alma9 with no shelter, lost the app, and failed. And no test anywhere touched real podman, SELinux, nftables or the id range.After, on a box with a
[shelter]plan (run as root):vm.pyrunsshelter.buildandshelter.prove, the chroot walk's own, on a chroot copy of the box at the route's start. It then copies the built shelter into the guest before the drop hop. Before that it checks that the guest's passwd and group lines, and every carried file, match the lock.stop-nativeandstartrun in the guest as hop steps.shelter.vm_probemust pass:wend-<app>range, identical in subuid and subgid;no_new_privsset, and thecontainer_tdomain;systemctl reload nftablesand after a restart.The run's
sheltersrecordtier = "vm"andconfinement_proved.Also in this PR:
shelter.start's unit now hasReloadPropagatedFrom=its table unit andExecReload=podman network reload. Without that, nftables' reload (flush ruleset) silently kills netavark's port forwarding.el/centos7-pyappgets a[vm]table with livedb,app,cronanddaemonschecks. These reach billing whichever way it runs: its own unit and crontab line, or the shelter's unit and timer. billing's uid and gid are fixed at 600, below useradd's dynamic range, so the chroot copy's passwd and group lines are the installed VM's too.Model
anthropic:claude-opus-5-5, hand-directed.
Evidence
python3 wend checkreports66 fixes, 4 routes, 10 boxes, 76 runs: ok. Everytools/test_*.pypasses with 0 WRONG. The new cases check thatvm_probe(two plans),vm_enforce_onandVM_ENFORCE_OFFparse underbash -n, thatvm_proberefuses a destination the plan opted in to, and thatvm_denialskeeps only the shelter's denials.routes/el/centos7-to-alma10.tomlonel/centos7-pyapp, with the new unit text but before the uid pin, built the shelter (51 packages, 0 carried files) and proved it. It then went 9/9 after alma9 and 9/9 after alma10. A replay with the uid pin is running, and CI replays the box too.Self-review (AGENTS.md step 5)
[vm]and billing's ids are new.git commit -s).🤖 Generated with Claude Code
https://claude.ai/code/session_016XrCggTfrYZFPiDyPrhqLF
Generated by Claude Code