TEST-06-SELINUX: Add knob to allow checking for AVCs (#35921)

When running the integration tests downstream, it's useful to be able to
test that a new systemd version doesn't introduce any AVC denials, so
let's add a knob to make that possible.
This commit is contained in:
Daan De Meyer
2025-01-09 11:59:58 +01:00
committed by GitHub
3 changed files with 24 additions and 0 deletions
+10
View File
@@ -151,6 +151,16 @@ that make use of `run_testcases`.
`TEST_SKIP_TESTCASE=testcase`: takes a space separated list of testcases to skip.
### SELinux AVCs
To have `TEST-06-SELINUX` check for SELinux denials, write the following to
mkosi.local.conf:
```conf
[Runtime]
KernelCommandLineExtra=systemd.setenv=TEST_SELINUX_CHECK_AVCS=1
```
## Ubuntu CI
New PRs submitted to the project are run through regression tests, and one set
+10
View File
@@ -69,8 +69,18 @@ ToolsTreeDistribution=$ID
ToolsTreeRelease=${VERSION_ID:-rawhide}
EOF
if [[ -n "${TEST_SELINUX_CHECK_AVCS:-}" ]]; then
tee --append mkosi.local.conf <<EOF
[Runtime]
KernelCommandLineExtra=systemd.setenv=TEST_SELINUX_CHECK_AVCS=$TEST_SELINUX_CHECK_AVCS
EOF
fi
if [[ -n "${TESTING_FARM_REQUEST_ID:-}" ]]; then
tee --append mkosi.local.conf <<EOF
[Content]
SELinuxRelabel=yes
[Build]
ToolsTreeSandboxTrees=
/etc/yum.repos.d/:/etc/yum.repos.d/
+4
View File
@@ -46,4 +46,8 @@ NSPAWN_ARGS=(systemd-nspawn -q --volatile=yes --directory=/ --bind-ro=/etc --ina
[[ "$("${NSPAWN_ARGS[@]}" --selinux-apifs-context="$CONTEXT" stat --printf %C /run)" == "$CONTEXT" ]]
[[ "$("${NSPAWN_ARGS[@]}" --selinux-apifs-context="$CONTEXT" --tmpfs=/tmp stat --printf %C /tmp)" == "$CONTEXT" ]]
if [[ -n "${TEST_SELINUX_CHECK_AVCS:-}" ]] && ((TEST_SELINUX_CHECK_AVCS)); then
(! journalctl -t audit -g AVC -o cat)
fi
touch /testok