Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions .github/workflows/e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
11 changes: 11 additions & 0 deletions tests/unit/test_e2e_workflow.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Loading