Skip to content

vm: shelter the app on the VM tier and prove its confinement - #91

Merged
TusanHomichi merged 4 commits into
mainfrom
claude/project-thread-pzmnbf
Oct 14, 2026
Merged

TusanHomichi merged 4 commits into
mainfrom
claude/project-thread-pzmnbf

Conversation

@TusanHomichi

Copy link
Copy Markdown
Member

What this adds

Route: none new. This is a VM-tier harness change, for routes/el/centos7-to-alma10.toml on box el/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 replay knew 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):

  1. Build. vm.py runs shelter.build and shelter.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.
  2. Drop hop. stop-native and start run in the guest as hop steps.
  3. Probe. After that hop's reboot and every later one, shelter.vm_probe must pass:
    • the table unit, the shelter unit and the timers are enabled and active, and the native unit and cron line are off;
    • there's one wend-<app> range, identical in subuid and subgid;
    • the container runs the image tagged with the lock's digest;
    • the program's host uid and gid are the range's start plus the app's own ids;
    • no capabilities beyond the plan's, no_new_privs set, and the container_t domain;
    • the root and the code tree are read-only, and a data file it writes is owned on the host by the app's user (idmap);
    • each port answers on its own address only;
    • a TCP listener the guest itself reaches (the mirror shim) is refused from inside;
    • the egress table and the ports come back after systemctl reload nftables and after a restart.
  4. Enforcing window. VM boxes install permissive, so SELinux goes to enforcing for a window. A guard sets permissive again after 15 minutes whatever happens. During the window the shelter restarts, the box's checks run again, and the probe runs again. Any AVC denial touching the shelter fails the hop.

The run's shelters record tier = "vm" and confinement_proved.

Also in this PR:

  • shelter.start's unit now has ReloadPropagatedFrom= its table unit and ExecReload=podman network reload. Without that, nftables' reload (flush ruleset) silently kills netavark's port forwarding.
  • el/centos7-pyapp gets a [vm] table with live db, app, cron and daemons checks. 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 check reports 66 fixes, 4 routes, 10 boxes, 76 runs: ok. Every tools/test_*.py passes with 0 WRONG. The new cases check that vm_probe (two plans), vm_enforce_on and VM_ENFORCE_OFF parse under bash -n, that vm_probe refuses a destination the plan opted in to, and that vm_denials keeps only the shelter's denials.
  • A local chroot replay of routes/el/centos7-to-alma10.toml on el/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.
  • The VM tier itself can only run on remi. That run is the evidence for everything in "After".

Self-review (AGENTS.md step 5)

  • No fixes, so no preconditions to narrow.
  • No fixes.
  • One change: the VM tier's shelter proof, plus the box and unit changes it needs.
  • This is a maintainer harness, SPEC and fixture change (as in tools: shelter an app, chroot tier (build, prove, stop-native, start) #82). The box's roles are unchanged; only [vm] and billing's ids are new.
  • Commits are signed off (git commit -s).

🤖 Generated with Claude Code

https://claude.ai/code/session_016XrCggTfrYZFPiDyPrhqLF


Generated by Claude Code

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]>
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 14, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-14T08:34:24.194831Z 487c905 New commits
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

Comment thread tools/vm.py Resolved

Copy link
Copy Markdown
Member Author

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 git diff d0d54da 3544e4d. python3 wend check reports ok, every tools/test_*.py passes, and the new vm_probe, vm_enforce_on and VM_ENFORCE_OFF fragments parse under bash -n. I couldn't run QEMU here.

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

  1. boxes/el/centos7-pyapp/box.toml:150 ([vm]): the guest's root is ext3, and ext3 can't be idmapped. The [vm] table has no root_fs, so tools/vm.py:312 installs it as ext3. On EL9 and EL10 the ext4 driver mounts ext3, but it registers ext3_fs_type with FS_REQUIRES_DEV only. FS_ALLOW_IDMAP is on ext4_fs_type alone (fs/ext4/super.c; I checked v6.12). Every shelter volume is :idmap (tools/shelter.py:491: /opt/billing:ro,idmap and /var/lib/billing:Z,idmap), so the mount fails with EINVAL and podman can't create the container. The probe, live:app and live:cron all fail. SPEC "How it runs on the host" says preflight refuses a data directory whose filesystem can't be idmapped, but the VM tier never runs that preflight.
    Fix: add root_fs = "xfs" to [vm]. That's CentOS 7.3+'s default and is already in releases.centos7.install.root_fs. It would also help if shelter.start or vm_probe checked findmnt -no FSTYPE -T <dir> for the code and data dirs and failed with a clear message.

  2. tools/shelter.py:491-493 with box.toml:71/128: 127.0.0.1:8080 is published to a listener that can't be reached. app.py binds ("127.0.0.1", 8080). Inside the shelter, that is the container's own loopback (SPEC itself says so under "Host services"). Rootful netavark's -p 127.0.0.1:8080:8080 DNATs to the container's bridge address 10.90.K.2:8080, and nothing listens there, so every connection is refused. The chroot proof can't see this because podman_standin.sh ignores -p and runs the program in the host's netns. On the VM, after the drop hop's reboot:

    • live:app is lost,
    • the probe's published on 127.0.0.1:8080 and both up checks (after the reload and after the restart) fail,
    • the hop fails and the walk stops at alma9.

    This sits in code that predates this PR, but this run is what will hit it.
    Fix (pick one before running):

    • (a) Serve a loopback listener the way sockets are already served. Add a host ListenStream=127.0.0.1:8080 socket unit, plus a service that execs systemd-socket-proxyd 127.0.0.1:8080 inside the container's netns, for example nsenter --net="$(podman inspect -f '{{.NetworkSettings.SandboxKey}}' wend-<app>)". The fd passed by socket activation survives the exec. Keep -p only for non-loopback addresses.
    • (b) Have the plan and preflight refuse a loopback-bound listener, and give the box an app that binds 0.0.0.0 inside, published on 127.0.0.1.

    Either way, SPEC "Ports the program listens on are published on the same host address" needs a sentence about loopback binds.

Non-blocking (worth fixing while you're in there)

  • tools/shelter.py:703 + tools/vm.py:708: nothing checks that the enforcing pass actually ran enforcing. If the window runs past the 900 s guard (a slow failure path: up() can take 120 s twice, plus the 180 s initial wait and the checks), the guard switches to permissive part-way through. The "enforcing" probe can still pass, and denials after that point are only logged as permissive=1. Suggest requiring fact selinux=Enforcing in the enforcing probe output, and checking getenforce again as its last line.
  • tools/shelter.py:723: "{c} isn't running ..." is in a plain string, so the FAIL line prints a literal {c}.
  • tools/shelter.py:585: podman network reload takes container names, not network names. wend-<app> works only because the container and the network share that name. Say so in the comment, or it will break when someone renames one of them.
  • tools/shelter.py:510 (ExecStartPre import on the first boot): the first start does tar | podman import of the whole root inside the default 90 s TimeoutStartSec. A slow disk could time out and leave the unit in a Restart=on-failure loop. Consider TimeoutStartSec= of several minutes, or importing during the hop.
  • tools/shelter.py start(): dnf install podman nftables runs in the drop hop's post phase on the live box, which is still on EL7's PID 1 and kernel, and outside the private namespace the adapter built for exactly this (wend#79). Scriptlets will reach PID 1 (systemd's filetrigger daemon-reload, nftables' %systemd_post preset), and container-selinux runs load_policy against the 3.10 kernel. I expect it to work, since systemctl against EL7 PID 1 already works for the sshd restart, but nothing has exercised it yet. If it hangs, the hop sits until the 4 h run_hop limit.
  • tools/vm.py:206-212 push_tree: tar's stderr goes to a PIPE that is only read after ssh finishes. More than 64 KiB of warnings would deadlock until the 1800 s timeout. Unlikely for this root, but a temp file or stderr=DEVNULL plus the return code would be safer.
  • tools/vm.py:779: if shelter_build raises anything other than Refused (for example an HTTPError while fetching), rw is never assigned. The chroot copy under $WEND_WORK/runs then leaks, at a few GB each time.
  • tools/vm.py:913: confinement_proved can be true on a --from run that started after the drop hop. SPEC says "every hop from the drop hop on", so also require drop in todo (or not resume).
  • tools/vm.py:465-469 vs SPEC 1370: SPEC says the guest's passwd, group and carried files are checked before the copy. The code copies first, then checks, and fails the hop either way. That's harmless, but the wording doesn't match.
  • Likely real findings, not harness problems (so expect them):
    • Under enforcing, container_t connectto on the socket that systemd holds for the mysql proxy.
    • systemd-socket-proxyd's own domain connecting to mysqld's socket. That denial won't match vm_denials' pattern, but it will show up as a lost live:app.
    • Before the window, it would be cheap to record any permissive-mode AVCs for sshd_t or init_t since boot. The upgrade never relabels, so those predict whether setenforce 1 cuts ssh off.

Things I checked and found fine:

  • walk_vm gets every name it uses, and none of its parameters is unused (checked with an AST scan).
  • The refused-build and copy-failure paths each stop the guest and record the hop.
  • rw.close() runs in finally.
  • shelter_copy_check quoting: grep output's trailing newline matches sha(line + "\n").
  • .ImageName gives the localhost/...:<digest> name exactly as passed to podman run.
  • Uid/Gid of S+600 with idmap, so data is written as host 600:600.
  • CapEff/CapPrm/CapBnd come out 0 with --cap-drop=all and a non-root user.
  • ReloadPropagatedFrom cascades (systemd adds the propagated reload jobs recursively).
  • systemctl start nftables is harmless: the kickstart has firewall --disabled and no firewalld, and EL's default nftables.conf loads nothing.
  • The setsid guard survives the ssh session, and the [vm].live checks are bash 4.2/EL7-safe.

Generated by Claude Code

@github-actions github-actions Bot added the needs-claude-review Waiting on the Claude review layer label Oct 14, 2026
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]>

Copy link
Copy Markdown
Member Author

This answers the changes requested on 3544e4d. Both blockers and most of the notes are fixed in 659a56a.

Blockers

  1. The guest filesystem can't be idmapped. The box's [vm] now has root_fs = "xfs". shelter_copy_check also refuses code or data on anything but ext4, XFS or btrfs, naming the directory and its filesystem, so this fails in seconds instead of at container start.
  2. The loopback port reaches nothing. A port on 127.0.0.1 is no longer published. It's now a wend socket unit, wend-shelter-port-<app>-<n>.socket, on the host's 127.0.0.1. Its service runs sh -c 'exec nsenter --net=/proc/$(podman inspect -f "{{.State.Pid}}" wend-<app>)/ns/net -S 65534 -G 65534 systemd-socket-proxyd 127.0.0.1:<port>'.
    • It joins only the running shelter's network namespace, as nobody. exec keeps the PID, so LISTEN_PID still holds.
    • It has BindsTo= and After= on the shelter unit, so a restarted container gets a fresh proxy on the next connection.
    • The $$ in the unit is checked: the heredoc writes $$, which systemd hands sh as $.
    • 0.0.0.0 is still published with -p, and the checker now refuses any other address. Test cases cover both.
    • The name is outside wend-shelter-<app>-*, so the chroot tier's checks don't try to start it. There, the program runs in the host's namespace anyway.
    • SPEC's Network bullet and the ports row say all this.

Notes

  • Fixed:
    • The enforcing probe now has to print fact selinux=Enforcing, so a probe that outlasted the guard fails.
    • The literal {c} is fixed.
    • The shelter and cron services get TimeoutStartSec=15min for the first import.
    • push_tree's tar stderr goes to a temporary file.
    • The chroot copy is closed on any exception.
    • confinement_proved needs the drop hop in this run.
    • SPEC's order now matches the code.
  • Not changed:
    • podman network reload takes a container name. It's the container's name here, by design, and the comment says what it puts back.
    • Running dnf install podman on the live EL7 box is how the drop hop's post steps already install packages on the VM tier. remi's run is the test.
    • The two expected SELinux findings are what the run is for.

Re-ran python3 wend check and every tools/test_*.py: 0 WRONG. A local chroot replay of the box with the uid pin (before this push) printed PASS ... 2 hops, 11 fixes fired. One on 659a56a is running.


Generated by Claude Code

Copy link
Copy Markdown
Member Author

Changes requested on 659a56a

I re-reviewed git diff 3544e4d 659a56a. At 659a56a, python3 wend check passes ("66 fixes, 4 routes, 10 boxes, 76 runs: ok"), every tools/test_*.py exits 0 with no WRONG lines, and pyflakes is clean on vm.py, shelter.py and check.py.

What's fixed, and checked:

  • root_fs = "xfs", plus the filesystem check before the copy. findmnt -T exists on EL7's util-linux, and an XFS v5 root idmaps on 5.14+.
  • The checker rule for port addresses. Only 127.0.0.1 or 0.0.0.0 are accepted, with tests both ways.
  • The proxy unit's quoting, heredoc → unit → sh. I ran the generated heredoc through bash. The unit gets ExecStart=/bin/sh -c 'exec /usr/bin/nsenter --net=/proc/$$(/usr/bin/podman inspect -f "{{.State.Pid}}" wend-billing)/ns/net -S 65534 -G 65534 /usr/lib/systemd/systemd-socket-proxyd 127.0.0.1:8080'. systemd turns $$ into $, so sh does the command substitution. The " inside '…' stays literal for systemd, and there's no % specifier. Correct.
  • Socket activation with nsenter. I read util-linux v2.37.4 (EL9) and v2.40.2 (EL10) nsenter.c.
    • -S/-G call setgroups(0), setgid and setuid without -U.
    • With only --net, do_fork stays off, so sh → nsenter → systemd-socket-proxyd all keep one PID. LISTEN_PID therefore still matches and fd 3 is inherited.
    • podman inspect runs as root, before the uid drop.
    • Under enforcing, the proxy stays in unconfined_service_t (sh is bin_t from init), so setns and the connect are fine.
  • The chroot tier. The wend-shelter-port-* names sit outside the $S-*.socket glob in the box's app role.
  • The rest:
    • TimeoutStartSec=15min.
    • push_tree now sends tar's stderr to a temp file.
    • shelter_build cleans up on BaseException.
    • confinement_proved now needs the drop hop in this run.
    • The enforcing probe must see fact selinux=Enforcing.
    • The literal {c} is fixed.
    • SPEC matches the code.

Blocker

  1. tools/shelter.py start_units, the wend-shelter-port-<app>-<n>.service unit: a connection that arrives before the container has a PID kills the port socket for good. After=/Requires= on the shelter unit only waits until wend-shelter-<app>.service is active. It's Type=simple, so that's as soon as podman run is spawned, and it happens before the container exists.

    • How long that window lasts: on the first boot (alma9) and after every restart (the probe's systemctl restart nftables, and vm_enforce_on's restart of the table unit), podman still has to create the container. With a custom --uidmap over an imported image, that includes the chowned/idmapped layer, so it can take several seconds.
    • What fails: podman inspect returns nothing (or 0) in that window, so nsenter fails on /proc//ns/net and the service fails.
    • Why it never recovers: the client's connection is still queued on the listening fd, so systemd triggers the service again at once. Within about a second it hits the service's default start limit (5 in 10 s), and the socket goes failed with service-start-limit-hit. It stops listening until something restarts it.
    • Who triggers it: live:app curls every 2 s right after the reboot, and the probe's up() probes every 2 s right after each restart. Both are almost certain to connect inside that window, so live:app and the port checks would fail for a harness reason, not a confinement one.

    Suggested fix:

    • In the proxy service's [Unit], add StartLimitIntervalSec=0.
    • In ExecStart, wait for the PID before exec'ing, e.g. /bin/sh -c 'i=0; while P=$$(/usr/bin/podman inspect -f "{{.State.Pid}}" wend-billing 2>/dev/null); [ "$${P:-0}" -le 0 ]; do i=$$((i+1)); [ $$i -lt 120 ] || exit 1; sleep 1; done; exec /usr/bin/nsenter --net=/proc/$$P/ns/net -S 65534 -G 65534 /usr/lib/systemd/systemd-socket-proxyd 127.0.0.1:8080'. In the Python f-string inside the unquoted heredoc, write every $ as \\$, so $$ becomes \\$\\$.
    • The app not listening yet inside the shelter is fine: proxyd keeps running and only that one client gets refused.

Non-blocking

  • The probe doesn't check the port socket. vm_probe's "enabled and active" loop should include wend-shelter-port-<app>-<n>.socket. Then a failed socket shows up by name, not only as "nothing answers".
  • The enforcing check only looks at the start of the probe. It reads fact selinux at the beginning. A getenforce at the end would also catch the guard firing partway through. That's unlikely on the success path, which takes well under 15 minutes.

Generated by Claude Code

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

Comment thread tools/shelter.py Resolved
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]>

Copy link
Copy Markdown
Member Author

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.

  • The proxy service now runs /bin/sh /etc/wend/shelter/<app>.port-proxy <addr:port>.
  • That script loops for up to 120 s until podman inspect gives a PID above 0, then execs nsenter --net=/proc/$P/ns/net -S 65534 -G 65534 systemd-socket-proxyd "$1".
  • start_units writes it with a quoted heredoc, so nothing expands when it's written, and there's no $$ escaping in the unit anymore. I rendered it with bash and it passes sh -n.
  • The service has StartLimitIntervalSec=0.

Notes, both taken:

  • vm_probe checks the port sockets for "enabled and active" along with the other units.
  • The probe prints fact selinux_end= last. The enforcing pass needs Enforcing at both the start and the end.

python3 wend check and every tools/test_*.py pass, with 0 WRONG. On 659a56a's tools, the local chroot replay built and proved the shelter, with start_units running the new port units in the proof's copy; the rest of that replay is still going.


Generated by Claude Code

Copy link
Copy Markdown
Member Author

Sign-off: approve 487c905

I re-reviewed git diff 659a56a 487c905. At 487c905, python3 wend check passes ("66 fixes, 4 routes, 10 boxes, 76 runs: ok"), every tools/test_*.py exits 0 with no WRONG lines, and pyflakes is clean.

The blocker from my last review is fixed. I checked it by running start_units' output through bash, with paths, id and the native ExecStart stubbed:

  • The rendered script. /etc/wend/shelter/billing.port-proxy comes out exactly as intended, with '{{.State.Pid}}', $P, $((i + 1)) and { echo …; exit 1; } written literally, because the heredoc is quoted. It parses under bash -n. /etc/wend/shelter is created earlier in the same step.
  • The rendered proxy unit. It has StartLimitIntervalSec=0 in [Unit] and ExecStart=/bin/sh /etc/wend/shelter/billing.port-proxy 127.0.0.1:8080, with no $ or % for systemd to expand.
  • The wait loop. I ran it against a fake podman that prints 0 twice, then a PID. It waits, then reaches exec nsenter --net=/proc/<pid>/ns/net -S 65534 -G 65534 systemd-socket-proxyd 127.0.0.1:8080.
  • Socket activation. The pid systemd handed the socket to survives: sh, then exec nsenter, which doesn't fork with only --net, then exec proxyd. podman inspect runs in a child process.
  • The waiting window. While the script waits, the service is running, so the queued connection doesn't trigger it again. A container that never starts fails the service after about 120 s, and with no start limit the socket stays usable for the next attempt.
  • After a restart. The proxy is bound to the shelter (BindsTo=) and the socket goes down with it (PartOf=), so the next connection waits for the new container's PID.
  • The probe's list of units that must be enabled and active. It now has wend-shelter-port-<app>-<n>.socket, numbered the same way start_units numbers them.
  • The enforcing probe. It now needs both fact selinux=Enforcing and fact selinux_end=Enforcing.

Non-blocking

  • StartLimitIntervalSec=: EL7's systemd 219 is still PID 1 when systemctl enable runs on the drop hop, and it doesn't know this setting (added in v230). It only logs an "unknown lvalue" warning; EL9 and EL10 honour it after the reboot.

Generated by Claude Code

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

Comment thread tools/shelter.py Resolved
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]>

Copy link
Copy Markdown
Member Author

Sign-off: approve b83e7e0

I re-reviewed git diff 487c905 b83e7e0. That's one commit, "vm_probe: probe every data dir, none when the plan has none", on top of the head I approved.

  • The change is sound. data = plan["data"][0] is gone, and the write-and-owner probe is now built once per entry of plan["data"]. I generated the probe three ways:

    • for centos7-pyapp, it emits 1 data probe;
    • with two data dirs, it emits 2;
    • with data: [], it emits 0, so an empty list no longer raises IndexError.

    Nothing else in tools/ indexes ["data"][0].

  • The probe for this box doesn't change. With one data dir it's the same script as before, so the remi run is unaffected.

  • Checks at b83e7e0:

    • python3 wend check prints "66 fixes, 4 routes, 10 boxes, 76 runs: ok".
    • Every tools/test_*.py exits 0 with no WRONG lines.
    • The new "vm_probe, no data parses" case passes.
    • pyflakes is clean.

Non-blocking: with several data dirs, each one prints fact data_owner=…, and shelter_confine puts the facts in a dict, so the run record keeps only the last one. Each dir still gets its own ok/FAIL line, so nothing is lost from the verdict. Naming the fact per dir would keep every owner in the record.


Generated by Claude Code

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs-claude-review Waiting on the Claude review layer

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants