Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: Check for AVC denials in the journal #38

Merged
merged 3 commits into from
Nov 14, 2024
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
2 changes: 0 additions & 2 deletions test/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,6 @@ if ! [ -n "${reuseinitrd}" ] || ! [ -e "${tmpdir}/vmlinuz" ] || ! [ -e "${tmpdir
rm -f "${tmpdir}/done"
cat >create-initrd <<'EOF'
#!/bin/bash
# Workaround for https://bugzilla.opensuse.org/show_bug.cgi?id=1230912
# combustion: network
set -euxo pipefail
exec &>/dev/ttyS0
trap '[ $? -eq 0 ] || poweroff -f' EXIT
Expand Down
11 changes: 8 additions & 3 deletions test/testscript
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
#!/bin/bash
# Work around for https://bugzilla.opensuse.org/show_bug.cgi?id=1230912
# combustion: network
set -euxo pipefail
exec &>/dev/ttyS0
# Poweroff immediately on any failure to avoid unnecessary waiting.
Expand All @@ -19,13 +17,18 @@ umount /mnt
cat >>/usr/bin/combustion-validate <<'EOF'
#!/bin/bash
set -euxo pipefail
exec &>/dev/ttyS0
trap '[ $? -eq 0 ] || poweroff -f' EXIT
# Print a list of files which have SELinux label mismatches
if restorecon -nvR -e /.snapshots -e /run / | grep -v wtmpdb | grep "Would relabel"; then
echo "Some labels aren't correct?"
exit 1
fi
# Check that there are no SELinux denials.
# Can't use ausearch here, that would miss initial boot events.
if journalctl -b | grep -w avc | grep -w denied; then
echo "SELinux denials found"
exit 1
fi
mount -t 9p -o trans=virtio tmpdir /mnt
touch /mnt/done
umount /mnt
Expand All @@ -35,6 +38,8 @@ chmod a+x /usr/bin/combustion-validate

cat >>/etc/systemd/system/combustion-validate.service <<'EOF'
[Service]
Type=oneshot
StandardOutput=journal+console
ExecStart=/usr/bin/combustion-validate
[Install]
RequiredBy=default.target
Expand Down