diff --git a/.github/workflows/e2e.yml b/.github/workflows/e2e.yml index c491cd4fc..dec13743b 100644 --- a/.github/workflows/e2e.yml +++ b/.github/workflows/e2e.yml @@ -727,8 +727,10 @@ jobs: # Create home dir via tmpfiles.d so it exists at runtime regardless # of whether bootc initialises the stateroot var from the image's /var. sudo mkdir -p "${DEP}/etc/tmpfiles.d/" - printf 'Z /var/home/bluefin-test 0700 %d %d -\nd /var/home/bluefin-test 0700 %d %d -\nd /var/home/bluefin-test/.ssh 0700 %d %d -\n' \ - "${BFT_UID}" "${BFT_UID}" \ + # Non-recursive `d` only: a recursive `Z` on the home would walk + # the runner container's Podman storage on every later boot and + # trip systemd-tmpfiles SELinux denials (#1205, run 43535082068). + printf 'd /var/home/bluefin-test 0700 %d %d -\nd /var/home/bluefin-test/.ssh 0700 %d %d -\n' \ "${BFT_UID}" "${BFT_UID}" \ "${BFT_UID}" "${BFT_UID}" | \ sudo tee "${DEP}/etc/tmpfiles.d/ci-user.conf" diff --git a/docs/skills/ci-ops/e2e-workflow/references/selinux-enforcing.md b/docs/skills/ci-ops/e2e-workflow/references/selinux-enforcing.md index 33d8af4ea..211e57b6e 100644 --- a/docs/skills/ci-ops/e2e-workflow/references/selinux-enforcing.md +++ b/docs/skills/ci-ops/e2e-workflow/references/selinux-enforcing.md @@ -65,6 +65,15 @@ read only by `ostree`/`bootc`, which run unconfined. Never fix a denial by relabeling the whole tree, `-F` over candidate files, `chcon` to a broad type, `setenforce 0`, or a permissive domain. +The harness's injected `/etc/tmpfiles.d/ci-user.conf` creates the test home +and its `.ssh` with non-recursive `d` entries, which also set their mode, +owner and label on later boots. Don't add a recursive `Z` rule for the home. +Once the runner container is loaded, the home holds Podman storage, and `Z` +makes `systemd-tmpfiles` walk its hardlinks on every later boot. That produced +`systemd_tmpfiles_t` → `proc_security_t` denials (reading +`/proc/sys/fs/protected_hardlinks`) on every boot after the first. Found by +#1205; run 43535082068 has none of them once the rule is gone. + ## AVC collection and canary `selinux_collect_avc.sh` runs in the guest as root and prints AVC/USER_AVC diff --git a/tests/unit/test_e2e_workflow.py b/tests/unit/test_e2e_workflow.py index d7542e790..6ea35a27d 100644 --- a/tests/unit/test_e2e_workflow.py +++ b/tests/unit/test_e2e_workflow.py @@ -37,3 +37,14 @@ def test_manual_runs_checkout_the_selected_fork_ref_without_changing_callers(): assert 'default: "projectbluefin/testsuite"' in reusable assert "repository: ${{ inputs.test_repository }}" in reusable assert "test_repository: ${{ github.repository }}" in manual + + +def test_e2e_ci_user_tmpfiles_has_no_recursive_home_relabel(): + # A recursive `Z` on the test home walks the runner's Podman storage on + # every later boot and trips systemd-tmpfiles SELinux denials (#1205). + workflow = _workflow("e2e.yml") + start = workflow.index('"${DEP}/etc/tmpfiles.d/"') + block = workflow[start:workflow.index("ci-user.conf", start)] + assert "'Z " not in block and "\\nZ " not in block + assert "d /var/home/bluefin-test 0700" in block + assert "d /var/home/bluefin-test/.ssh 0700" in block