refpolicy: Allow booting without denied actions
cover refpolicy: Allow booting without denied actions
Following the refpolicy support recently added, this series adds support for booting basic systems using SELinux with a first batch of fixes, allowing a clean boot without denied actions.
Some remaining issues are left to be fixed in order to boot in Enforcing mode.
Most of the series adds the missing rules in the refpolicy for Buildroot to be supported. An ongoing effort is currently being made to upstream as much of these rules in the refpolicy itself, and some of these fixes are already there, waiting for the next release.
Some other fixes are still being discussed, and finally some are waiting to be better analysed in order to find the correct solution for upstreaming in the refpolicy.
Still, this series adds patches that apply onto the refpolicy to fix ongoing issues, along with a buildroot SELinux module to fix some rules that needs to be analysed and upstreamed, being specific to embedded systems.
Finally, the last patch adds a check for the number of denied actions in the bootlog for the 2 testcases currently existing for SELinux, while still using the Permissive mode.
These patches and the module are due to evolve, hopefully being thinner and thinner until we can use the vanilla refpolicy.
Thanks to Antoine Tenart <[email protected]> for initiating this work and doing the heavy lifting.
Thanks,
Maxime
Maxime Chevallier (3):
package/refpolicy: Add patches pending the next release package/refpolicy: Add a buildroot module support/testing: improve SELinux test
.../refpolicy/0001-pending-next-release.patch | 673 ++++++++++++++++++ ...-private-type-for-run-systemd-userdb.patch | 130 ++++ .../0003-authlogin-connect-to-userdb.patch | 92 +++ ...0004-systemd-logind-utilize-nsswitch.patch | 33 + ...0005-getty-utilize-auth_use_nsswitch.patch | 40 ++ ...d-tmpfiles-utilize-auth_use_nsswitch.patch | 32 + .../refpolicy/0007-first-udevadm-patch.patch | 130 ++++ ...ing-Fixes-for-Buildroot-to-boot-in-e.patch | 190 +++++ .../refpolicy/selinux-modules/buildroot.fc | 0 .../refpolicy/selinux-modules/buildroot.if | 1 + .../refpolicy/selinux-modules/buildroot.te | 121 ++++ .../tests/init/test_systemd_selinux.py | 6 + 12 files changed, 1448 insertions(+) create mode 100644 package/refpolicy/0001-pending-next-release.patch create mode 100644 package/refpolicy/0002-systemd-private-type-for-run-systemd-userdb.patch create mode 100644 package/refpolicy/0003-authlogin-connect-to-userdb.patch create mode 100644 package/refpolicy/0004-systemd-logind-utilize-nsswitch.patch create mode 100644 package/refpolicy/0005-getty-utilize-auth_use_nsswitch.patch create mode 100644 package/refpolicy/0006-systemd-tmpfiles-utilize-auth_use_nsswitch.patch create mode 100644 package/refpolicy/0007-first-udevadm-patch.patch create mode 100644 package/refpolicy/0008-pending-upstreaming-Fixes-for-Buildroot-to-boot-in-e.patch create mode 100644 package/refpolicy/selinux-modules/buildroot.fc create mode 100644 package/refpolicy/selinux-modules/buildroot.if create mode 100644 package/refpolicy/selinux-modules/buildroot.te
Signature · 1 line
2.25.4
PATCH 1/3 package/refpolicy: Add patches pending the next release
In order to be able to run a basic system in enforcing mode, we need to apply a few patches on top of RELEASE_2_20200818.
This allows us to fix a few pending issues, most notably with systemd v246.
Patch 0001 is a squash of a few patches written by Antoine Tenart that are already in the refpolicy master branch.
Patches 2, 3 and 4 are also in the master branch, and are needed by subsequen patches so that systemd-tmpfiles and agetty can make use of nsswitch.
Patches 5 and 6 are part of a pull-request that haven't been merged yet, that addresses the issues with agetty and systemd-tmpfiles :
https://github.com/SELinuxProject/refpolicy/pull/330
Patch 7 fixes the current issue with systemd v246 that is related to sytemd-udevd now being a symlink to udevadm.
The fix for that has been submitted on the refpolicy mailing-list, with
the review process ongoing :
https://lore.kernel.org/selinux-refpolicy/2b5b0f1e-2576-23f4-4ab4-26f8fcfb2c30 at ieee.org/T/#t
Finally, Patch 8 addresses issues for which there's no clear strategy yet for upstreaming in the refpolicy.
Hopefully, most of these patches should be dropped once the next refpolicy version is published.
--- .../refpolicy/0001-pending-next-release.patch | 673 ++++++++++++++++++ ...-private-type-for-run-systemd-userdb.patch | 130 ++++ .../0003-authlogin-connect-to-userdb.patch | 92 +++ ...0004-systemd-logind-utilize-nsswitch.patch | 33 + ...0005-getty-utilize-auth_use_nsswitch.patch | 40 ++ ...d-tmpfiles-utilize-auth_use_nsswitch.patch | 32 + .../refpolicy/0007-first-udevadm-patch.patch | 130 ++++ ...ing-Fixes-for-Buildroot-to-boot-in-e.patch | 190 +++++ 8 files changed, 1320 insertions(+) create mode 100644 package/refpolicy/0001-pending-next-release.patch create mode 100644 package/refpolicy/0002-systemd-private-type-for-run-systemd-userdb.patch create mode 100644 package/refpolicy/0003-authlogin-connect-to-userdb.patch create mode 100644 package/refpolicy/0004-systemd-logind-utilize-nsswitch.patch create mode 100644 package/refpolicy/0005-getty-utilize-auth_use_nsswitch.patch create mode 100644 package/refpolicy/0006-systemd-tmpfiles-utilize-auth_use_nsswitch.patch create mode 100644 package/refpolicy/0007-first-udevadm-patch.patch create mode 100644 package/refpolicy/0008-pending-upstreaming-Fixes-for-Buildroot-to-boot-in-e.patch
package/refpolicy/0001-pending-next-release.patch new file +673 -0
@@ -0,0 +1,673 @@ +From 2566e2dac2c759392e0b9f3d442b8489b726cb10 Mon Sep 17 00:00:00 2001 +From: Antoine Tenart <[email protected]> +Date: Mon, 31 Aug 2020 15:38:13 +0200 +Subject: [PATCH 1/8] [pending next release] + +udev: allow udevadm to retrieve xattrs + +Fixes: + +avc: denied { getattr } for pid=50 comm="udevadm" name="/" dev="vda" +ino=2 scontext=system_u:system_r:udevadm_t +tcontext=system_u:object_r:fs_t tclass=filesystem permissive=0 + +avc: denied { getattr } for pid=52 comm="udevadm" name="/" dev="vda" +ino=2 scontext=system_u:system_r:udevadm_t +tcontext=system_u:object_r:fs_t tclass=filesystem permissive=0 + +Signed-off-by: Antoine Tenart <[email protected]> + +locallogin: allow login to get attributes of procfs + +Fixes: +avc: denied { getattr } for pid=88 comm="login" name="/" dev="proc" +ino=1 scontext=system_u:system_r:local_login_t +tcontext=system_u:object_r:proc_t tclass=filesystem permissive=1 + +Signed-off-by: Antoine Tenart <[email protected]> + +logging: allow systemd-journal to write messages to the audit socket + +Fixes: + +avc: denied { nlmsg_write } for pid=46 comm="systemd-journal" +scontext=system_u:system_r:syslogd_t +tcontext=system_u:system_r:syslogd_t tclass=netlink_audit_socket +permissive=1 + +avc: denied { nlmsg_write } for pid=46 comm="systemd-journal" +scontext=system_u:system_r:syslogd_t +tcontext=system_u:system_r:syslogd_t tclass=netlink_audit_socket +permissive=1 + +Signed-off-by: Antoine Tenart <[email protected]> + +sysnetwork: allow to read network configuration files + +Fixes: + +avc: denied { getattr } for pid=55 comm="systemd-udevd" +path="/etc/systemd/network" dev="vda" ino=128 +scontext=system_u:system_r:udev_t tcontext=system_u:object_r:net_conf_t +tclass=dir permissive=1 + +avc: denied { getattr } for pid=55 comm="systemd-udevd" +path="/etc/systemd/network" dev="vda" ino=128 +scontext=system_u:system_r:udev_t tcontext=system_u:object_r:net_conf_t +tclass=dir permissive=1 + +avc: denied { read } for pid=55 comm="systemd-udevd" name="network" +dev="vda" ino=128 scontext=system_u:system_r:udev_t +tcontext=system_u:object_r:net_conf_t tclass=dir permissive=1 + +avc: denied { read } for pid=55 comm="systemd-udevd" name="network" +dev="vda" ino=128 scontext=system_u:system_r:udev_t +tcontext=system_u:object_r:net_conf_t tclass=dir permissive=1 + +avc: denied { open } for pid=55 comm="systemd-udevd" +path="/etc/systemd/network" dev="vda" ino=128 +scontext=system_u:system_r:udev_t tcontext=system_u:object_r:net_conf_t +tclass=dir permissive=1 + +avc: denied { open } for pid=55 comm="systemd-udevd" +path="/etc/systemd/network" dev="vda" ino=128 +scontext=system_u:system_r:udev_t tcontext=system_u:object_r:net_conf_t +tclass=dir permissive=1 + +avc: denied { getattr } for pid=59 comm="systemd-network" +path="/etc/systemd/network" dev="vda" ino=128 +scontext=system_u:system_r:systemd_networkd_t +tcontext=system_u:object_r:net_conf_t tclass=dir permissive=1 + +avc: denied { read } for pid=59 comm="systemd-network" name="network" +dev="vda" ino=128 scontext=system_u:system_r:systemd_networkd_t +tcontext=system_u:object_r:net_conf_t tclass=dir permissive=1 + +avc: denied { open } for pid=59 comm="systemd-network" +path="/etc/systemd/network" dev="vda" ino=128 +scontext=system_u:system_r:systemd_networkd_t +tcontext=system_u:object_r:net_conf_t tclass=dir permissive=1 + +avc: denied { search } for pid=59 comm="systemd-network" +name="network" dev="vda" ino=128 +scontext=system_u:system_r:systemd_networkd_t +tcontext=system_u:object_r:net_conf_t tclass=dir permissive=1 + +avc: denied { getattr } for pid=55 comm="systemd-udevd" +path="/etc/systemd/network" dev="vda" ino=128 +scontext=system_u:system_r:udev_t tcontext=system_u:object_r:net_conf_t +tclass=dir permissive=1 + +Signed-off-by: Antoine Tenart <[email protected]> + +dbus: add two interfaces to allow reading from directories and named sockets + +Signed-off-by: Antoine Tenart <[email protected]> + +dbus: allow clients to list runtime dirs and named sockets + +Fixes: + +avc: denied { read } for pid=77 comm="systemd-resolve" name="dbus" +dev="tmpfs" ino=2748 scontext=system_u:system_r:systemd_resolved_t +tcontext=system_u:object_r:system_dbusd_runtime_t tclass=dir +permissive=1 + +avc: denied { read } for pid=77 comm="systemd-resolve" +name="system_bus_socket" dev="tmpfs" ino=2765 +scontext=system_u:system_r:systemd_resolved_t +tcontext=system_u:object_r:system_dbusd_runtime_t tclass=sock_file +permissive=1 + +avc: denied { read } for pid=59 comm="systemd-network" name="dbus" +dev="tmpfs" ino=2777 scontext=system_u:system_r:systemd_networkd_t +tcontext=system_u:object_r:system_dbusd_runtime_t tclass=dir +permissive=1 + +avc: denied { read } for pid=59 comm="systemd-network" +name="system_bus_socket" dev="tmpfs" ino=2791 +scontext=system_u:system_r:systemd_networkd_t +tcontext=system_u:object_r:system_dbusd_runtime_t tclass=sock_file +permissive=1 + +Signed-off-by: Antoine Tenart <[email protected]> + +systemd: add extra systemd_generator_t rules + +Fixes: + +avc: denied { setfscreate } for pid=41 comm="systemd-getty-g" +scontext=system_u:system_r:systemd_generator_t +tcontext=system_u:system_r:systemd_generator_t tclass=process +permissive=1 + +avc: denied { dac_override } for pid=40 comm="systemd-fstab-g" +capability=1 scontext=system_u:system_r:systemd_generator_t +tcontext=system_u:system_r:systemd_generator_t tclass=capability +permissive=1 + +Signed-off-by: Antoine Tenart <[email protected]> + +systemd: allow systemd-hwdb to search init runtime directories + +Fixes: + +avc: denied { search } for pid=54 comm="systemd-hwdb" name="systemd" +dev="tmpfs" ino=664 scontext=system_u:system_r:systemd_hw_t +tcontext=system_u:object_r:init_runtime_t tclass=dir permissive=1 + +avc: denied { search } for pid=54 comm="systemd-hwdb" name="systemd" +dev="tmpfs" ino=664 scontext=system_u:system_r:systemd_hw_t +tcontext=system_u:object_r:init_runtime_t tclass=dir permissive=1 + +Signed-off-by: Antoine Tenart <[email protected]> + +systemd: allow systemd-network to get attributes of fs + +Fixes: + +avc: denied { getattr } for pid=57 comm="systemd-network" name="/" +dev="vda" ino=2 scontext=system_u:system_r:systemd_networkd_t +tcontext=system_u:object_r:fs_t tclass=filesystem permissive=0 + +Signed-off-by: Antoine Tenart <[email protected]> + +systemd: allow systemd-resolve to read in tmpfs + +Fixes: +avc: denied { read } for pid=76 comm="systemd-resolve" name="/" +dev="tmpfs" ino=651 scontext=system_u:system_r:systemd_resolved_t +tcontext=system_u:object_r:var_run_t tclass=dir permissive=1 + +Signed-off-by: Antoine Tenart <[email protected]> + +corecommands: add entry for Busybox shell + +Fixes: + +vc: denied { execute } for pid=87 comm="login" name="sh" dev="vda" +ino=408 scontext=system_u:system_r:local_login_t +tcontext=system_u:object_r:bin_t tclass=file permissive=1 + +Signed-off-by: Antoine Tenart <[email protected]> + +systemd: allow systemd-getty-generator to read and write unallocated ttys + +Fixes: + +avc: denied { read write } for pid=40 comm="systemd-getty-g" +name="ttyS0" dev="devtmpfs" ino=612 +scontext=system_u:system_r:systemd_generator_t +tcontext=system_u:object_r:tty_device_t tclass=chr_file permissive=1 + +avc: denied { open } for pid=40 comm="systemd-getty-g" +path="/dev/ttyS0" dev="devtmpfs" ino=612 +scontext=system_u:system_r:systemd_generator_t +tcontext=system_u:object_r:tty_device_t tclass=chr_file permissive=1 + +avc: denied { ioctl } for pid=40 comm="systemd-getty-g" +path="/dev/ttyS0" dev="devtmpfs" ino=612 ioctlcmd=0x5401 +scontext=system_u:system_r:systemd_generator_t +tcontext=system_u:object_r:tty_device_t tclass=chr_file permissive=1 + +Signed-off-by: Antoine Tenart <[email protected]> + +systemd: allow systemd-network to list the runtime directory + +Fixes: + +avc: denied { read } for pid=58 comm="systemd-network" name="/" +dev="tmpfs" ino=652 scontext=system_u:system_r:systemd_networkd_t +tcontext=system_u:object_r:var_run_t tclass=dir permissive=1 + +avc: denied { read } for pid=58 comm="systemd-network" name="/" +dev="tmpfs" ino=652 scontext=system_u:system_r:systemd_networkd_t +tcontext=system_u:object_r:var_run_t tclass=dir permissive=1 + +Signed-off-by: Antoine Tenart <[email protected]> + +ntp: allow systemd-timesyn to watch dbus objects + +Fixes: + +avc: denied { watch } for pid=68 comm="systemd-timesyn" +path="/run/dbus" dev="tmpfs" ino=2707 scontext=system_u:system_r:ntpd_t +tcontext=system_u:object_r:system_dbusd_runtime_t tclass=dir +permissive=1 + +avc: denied { watch } for pid=68 comm="systemd-timesyn" +path="/run/dbus/system_bus_socket" dev="tmpfs" ino=2716 +scontext=system_u:system_r:ntpd_t +tcontext=system_u:object_r:system_dbusd_runtime_t tclass=sock_file +permissive=1 + +Signed-off-by: Antoine Tenart <[email protected]> + +ntp: allow systemd-timesyn to setfscreate + +Fixes: + +avc: denied { setfscreate } for pid=68 comm="systemd-timesyn" +scontext=system_u:system_r:ntpd_t tcontext=system_u:system_r:ntpd_t +tclass=process permissive=1 + +Signed-off-by: Antoine Tenart <[email protected]> + +logging: add an interface to relabel auditd log directories + +Signed-off-by: Antoine Tenart <[email protected]> + +systemd: allow systemd-tmpfile to manage the audit log + +Fixes: + +avc: denied { create } for pid=57 comm="systemd-tmpfile" name="audit" +scontext=system_u:system_r:systemd_tmpfiles_t +tcontext=system_u:object_r:auditd_log_t tclass=dir permissive=1 + +avc: denied { create } for pid=57 comm="systemd-tmpfile" name="audit" +scontext=system_u:system_r:systemd_tmpfiles_t +tcontext=system_u:object_r:auditd_log_t tclass=dir permissive=1 + +avc: denied { read } for pid=57 comm="systemd-tmpfile" name="audit" +dev="vda" ino=1942 scontext=system_u:system_r:systemd_tmpfiles_t +tcontext=system_u:object_r:auditd_log_t tclass=dir permissive=1 + +avc: denied { open } for pid=57 comm="systemd-tmpfile" +path="/var/log/audit" dev="vda" ino=1942 +scontext=system_u:system_r:systemd_tmpfiles_t +tcontext=system_u:object_r:auditd_log_t tclass=dir permissive=1 + +avc: denied { read } for pid=57 comm="systemd-tmpfile" name="audit" +dev="vda" ino=1942 scontext=system_u:system_r:systemd_tmpfiles_t +tcontext=system_u:object_r:auditd_log_t tclass=dir permissive=1 + +avc: denied { open } for pid=57 comm="systemd-tmpfile" +path="/var/log/audit" dev="vda" ino=1942 +scontext=system_u:system_r:systemd_tmpfiles_t +tcontext=system_u:object_r:auditd_log_t tclass=dir permissive=1 + +avc: denied { getattr } for pid=57 comm="systemd-tmpfile" +path="/var/log/audit" dev="vda" ino=1942 +scontext=system_u:system_r:systemd_tmpfiles_t +tcontext=system_u:object_r:auditd_log_t tclass=dir permissive=1 + +avc: denied { getattr } for pid=57 comm="systemd-tmpfile" +path="/var/log/audit" dev="vda" ino=1942 +scontext=system_u:system_r:systemd_tmpfiles_t +tcontext=system_u:object_r:auditd_log_t tclass=dir permissive=1 + +Signed-off-by: Antoine Tenart <[email protected]> + +systemd: allow systemd-tmpfile to relabel auditd log directories + +Fixes: + +avc: denied { relabelfrom } for pid=57 comm="systemd-tmpfile" +name="audit" dev="vda" ino=1942 +scontext=system_u:system_r:systemd_tmpfiles_t +tcontext=system_u:object_r:auditd_log_t tclass=dir permissive=1 + +avc: denied { relabelto } for pid=57 comm="systemd-tmpfile" +name="audit" dev="vda" ino=1942 +scontext=system_u:system_r:systemd_tmpfiles_t +tcontext=system_u:object_r:auditd_log_t tclass=dir permissive=1 + +Signed-off-by: Antoine Tenart <[email protected]> + +locallogin: allow login to create /run/utmp with the right attributes + +This allows systems based on Busybox to have 'login' create and use +/run/utmp correctly. + +Fixes: + +avc: denied { write } for pid=82 comm="login" name="/" dev="tmpfs" +ino=652 scontext=system_u:system_r:local_login_t +tcontext=system_u:object_r:var_run_t tclass=dir permissive=1 + +avc: denied { add_name } for pid=82 comm="login" name="utmp" +scontext=system_u:system_r:local_login_t +tcontext=system_u:object_r:var_run_t tclass=dir permissive=1 + +avc: denied { create } for pid=82 comm="login" name="utmp" +scontext=system_u:system_r:local_login_t +tcontext=system_u:object_r:var_run_t tclass=file permissive=1 + +avc: denied { write open } for pid=82 comm="login" path="/run/utmp" +dev="tmpfs" ino=4199 scontext=system_u:system_r:local_login_t +tcontext=system_u:object_r:var_run_t tclass=file permissive=1 + +avc: denied { read } for pid=82 comm="login" name="utmp" dev="tmpfs" +ino=4199 scontext=system_u:system_r:local_login_t +tcontext=system_u:object_r:var_run_t tclass=file permissive=1 + +avc: denied { lock } for pid=82 comm="login" path="/run/utmp" +dev="tmpfs" ino=4199 scontext=system_u:system_r:local_login_t +tcontext=system_u:object_r:var_run_t tclass=file permissive=1 + +Signed-off-by: Antoine Tenart <[email protected]> + +getty: allow agetty to read /proc/sys/kernel/random/boot_id + +Fixes: + +avc: denied { search } for pid=78 comm="agetty" name="sys" dev="proc" +ino=4026531854 scontext=system_u:system_r:getty_t +tcontext=system_u:object_r:sysctl_t tclass=dir permissive=1 + +avc: denied { search } for pid=78 comm="agetty" name="kernel" +dev="proc" ino=638 scontext=system_u:system_r:getty_t +tcontext=system_u:object_r:sysctl_kernel_t tclass=dir permissive=1 + +avc: denied { read } for pid=78 comm="agetty" name="boot_id" +dev="proc" ino=1087 scontext=system_u:system_r:getty_t +tcontext=system_u:object_r:sysctl_kernel_t tclass=file permissive=1 + +avc: denied { open } for pid=78 comm="agetty" +path="/proc/sys/kernel/random/boot_id" dev="proc" ino=1087 +scontext=system_u:system_r:getty_t +tcontext=system_u:object_r:sysctl_kernel_t tclass=file permissive=1 + +Signed-off-by: Antoine Tenart <[email protected]> + +getty: allow agetty to watch its reload file + +Fixes: + +avc: denied { watch } for pid=78 comm="agetty" +path="/run/agetty.reload" dev="tmpfs" ino=3497 +scontext=system_u:system_r:getty_t +tcontext=system_u:object_r:getty_runtime_t tclass=file permissive=1 + +Signed-off-by: Antoine Tenart <[email protected]> + +logging: allow systemd-journal to use audit_control on itself + +Fixes: + +avc: denied { audit_control } for pid=46 comm="systemd-journal" +capability=30 scontext=system_u:system_r:syslogd_t +tcontext=system_u:system_r:syslogd_t tclass=capability permissive=1 + +avc: denied { audit_control } for pid=46 comm="systemd-journal" +capability=30 scontext=system_u:system_r:syslogd_t +tcontext=system_u:system_r:syslogd_t tclass=capability permissive=1 + +Signed-off-by: Antoine Tenart <[email protected]> +--- + policy/modules/kernel/corecommands.fc | 1 + + policy/modules/services/dbus.if | 38 +++++++++++++++++++++++++++ + policy/modules/services/ntp.te | 4 +++ + policy/modules/system/getty.te | 2 ++ + policy/modules/system/locallogin.te | 4 +++ + policy/modules/system/logging.if | 19 ++++++++++++++ + policy/modules/system/logging.te | 4 +-- + policy/modules/system/sysnetwork.if | 2 ++ + policy/modules/system/systemd.te | 10 +++++++ + policy/modules/system/udev.te | 2 ++ + 10 files changed, 84 insertions(+), 2 deletions(-) + +diff --git a/policy/modules/kernel/corecommands.fc b/policy/modules/kernel/corecommands.fc +index b473850d4..4c18154ce 100644 +--- a/policy/modules/kernel/corecommands.fc ++++ b/policy/modules/kernel/corecommands.fc +@@ -155,6 +155,7 @@ ifdef(`distro_gentoo',` + /usr/bin/sesh -- gen_context(system_u:object_r:shell_exec_t,s0) + /usr/bin/scponly -- gen_context(system_u:object_r:shell_exec_t,s0) + /usr/bin/scponlyc -- gen_context(system_u:object_r:shell_exec_t,s0) ++/usr/bin/sh -- gen_context(system_u:object_r:shell_exec_t,s0) + /usr/bin/smrsh -- gen_context(system_u:object_r:shell_exec_t,s0) + /usr/bin/tcsh -- gen_context(system_u:object_r:shell_exec_t,s0) + /usr/bin/yash -- gen_context(system_u:object_r:shell_exec_t,s0) +diff --git a/policy/modules/services/dbus.if b/policy/modules/services/dbus.if +index 146262d88..501d70fda 100644 +--- a/policy/modules/services/dbus.if ++++ b/policy/modules/services/dbus.if +@@ -143,6 +143,8 @@ interface(`dbus_system_bus_client',` + stream_connect_pattern($1, system_dbusd_runtime_t, system_dbusd_runtime_t, system_dbusd_t) + + dbus_read_config($1) ++ dbus_list_system_bus_runtime($1) ++ dbus_read_system_bus_runtime_named_sockets($1) + ') + + ####################################### +@@ -594,6 +596,24 @@ interface(`dbus_watch_system_bus_runtime_dirs',` + allow $1 system_dbusd_runtime_t:dir watch; + ') + ++######################################## ++## <summary> ++## List system bus runtime directories. ++## </summary> ++## <param name="domain"> ++## <summary> ++## Domain allowed access. ++## </summary> ++## </param> ++# ++interface(`dbus_list_system_bus_runtime',` ++ gen_require(` ++ type system_dbusd_runtime_t; ++ ') ++ ++ allow $1 system_dbusd_runtime_t:dir list_dir_perms; ++') ++ + ######################################## + ## <summary> + ## Watch system bus runtime named sockets. +@@ -612,6 +632,24 @@ interface(`dbus_watch_system_bus_runtime_named_sockets',` + allow $1 system_dbusd_runtime_t:sock_file watch; + ') + ++######################################## ++## <summary> ++## Read system bus runtime named sockets. ++## </summary> ++## <param name="domain"> ++## <summary> ++## Domain allowed access. ++## </summary> ++## </param> ++# ++interface(`dbus_read_system_bus_runtime_named_sockets',` ++ gen_require(` ++ type system_dbusd_runtime_t; ++ ') ++ ++ allow $1 system_dbusd_runtime_t:sock_file read; ++') ++ + ######################################## + ## <summary> + ## Unconfined access to DBUS. +diff --git a/policy/modules/services/ntp.te b/policy/modules/services/ntp.te +index b178d915b..6d18bb894 100644 +--- a/policy/modules/services/ntp.te ++++ b/policy/modules/services/ntp.te +@@ -139,10 +139,14 @@ userdom_dontaudit_use_unpriv_user_fds(ntpd_t) + userdom_list_user_home_dirs(ntpd_t) + + ifdef(`init_systemd',` ++ allow ntpd_t self:process setfscreate; ++ + allow ntpd_t ntpd_unit_t:file read_file_perms; + + dbus_system_bus_client(ntpd_t) + dbus_connect_system_bus(ntpd_t) ++ dbus_watch_system_bus_runtime_dirs(ntpd_t) ++ dbus_watch_system_bus_runtime_named_sockets(ntpd_t) + init_dbus_chat(ntpd_t) + init_get_system_status(ntpd_t) + init_list_unit_dirs(ntpd_t) +diff --git a/policy/modules/system/getty.te b/policy/modules/system/getty.te +index ce9e4dedb..26459a413 100644 +--- a/policy/modules/system/getty.te ++++ b/policy/modules/system/getty.te +@@ -47,6 +47,7 @@ allow getty_t getty_log_t:file { append_file_perms create_file_perms setattr_fil + logging_log_filetrans(getty_t, getty_log_t, file) + + allow getty_t getty_runtime_t:dir watch; ++allow getty_t getty_runtime_t:file watch; + manage_files_pattern(getty_t, getty_runtime_t, getty_runtime_t) + files_runtime_filetrans(getty_t, getty_runtime_t, file) + +@@ -55,6 +56,7 @@ allow getty_t getty_tmp_t:dir manage_dir_perms; + files_tmp_filetrans(getty_t, getty_tmp_t, { file dir }) + + kernel_read_system_state(getty_t) ++kernel_read_kernel_sysctls(getty_t) + + # these two needed for receiving faxes + corecmd_exec_bin(getty_t) +diff --git a/policy/modules/system/locallogin.te b/policy/modules/system/locallogin.te +index c4b9bd7bb..59e812e1a 100644 +--- a/policy/modules/system/locallogin.te ++++ b/policy/modules/system/locallogin.te +@@ -59,6 +59,7 @@ kernel_read_system_state(local_login_t) + kernel_read_kernel_sysctls(local_login_t) + kernel_search_key(local_login_t) + kernel_link_key(local_login_t) ++kernel_getattr_proc(local_login_t) + + corecmd_list_bin(local_login_t) + # cjp: these are probably not needed: +@@ -103,6 +104,9 @@ files_read_world_readable_sockets(local_login_t) + # for when /var/mail is a symlink + files_read_var_symlinks(local_login_t) + ++init_runtime_filetrans_utmp(local_login_t) ++init_manage_utmp(local_login_t) ++ + fs_search_auto_mountpoints(local_login_t) + + storage_dontaudit_getattr_fixed_disk_dev(local_login_t) +diff --git a/policy/modules/system/logging.if b/policy/modules/system/logging.if +index 693acf7d9..ff9494b11 100644 +--- a/policy/modules/system/logging.if ++++ b/policy/modules/system/logging.if +@@ -367,6 +367,25 @@ interface(`logging_manage_audit_log',` + dontaudit $1 auditd_log_t:file map; + ') + ++######################################## ++## <summary> ++## Relabel from and to audit log directory type. ++## </summary> ++## <param name="domain"> ++## <summary> ++## Domain allowed access. ++## </summary> ++## </param> ++## <rolecap/> ++# ++interface(`logging_relabel_audit_log_dirs',` ++ gen_require(` ++ type auditd_log_t; ++ ') ++ ++ allow $1 auditd_log_t:dir relabel_dir_perms; ++') ++ + ######################################## + ## <summary> + ## Execute klogd in the klog domain. +diff --git a/policy/modules/system/logging.te b/policy/modules/system/logging.te +index 849494db5..53ee4240a 100644 +--- a/policy/modules/system/logging.te ++++ b/policy/modules/system/logging.te +@@ -523,8 +523,8 @@ ifdef(`init_systemd',` + # for systemd-journal + allow syslogd_t self:netlink_audit_socket connected_socket_perms; + allow syslogd_t self:capability2 audit_read; +- allow syslogd_t self:capability { chown setgid setuid sys_ptrace }; +- allow syslogd_t self:netlink_audit_socket { getattr getopt read setopt write }; ++ allow syslogd_t self:capability { audit_control chown setgid setuid sys_ptrace }; ++ allow syslogd_t self:netlink_audit_socket { getattr getopt read setopt write nlmsg_write }; + + # remove /run/log/journal when switching to permanent storage + allow syslogd_t var_log_t:dir rmdir; +diff --git a/policy/modules/system/sysnetwork.if b/policy/modules/system/sysnetwork.if +index 2d58238af..f646ac647 100644 +--- a/policy/modules/system/sysnetwork.if ++++ b/policy/modules/system/sysnetwork.if +@@ -346,6 +346,8 @@ interface(`sysnet_read_config',` + ') + + files_search_etc($1) ++ files_search_runtime($1) ++ allow $1 net_conf_t:dir list_dir_perms; + allow $1 net_conf_t:file read_file_perms; + + ifdef(`distro_debian',` +diff --git a/policy/modules/system/systemd.te b/policy/modules/system/systemd.te +index 54c2a2139..c20bd6f35 100644 +--- a/policy/modules/system/systemd.te ++++ b/policy/modules/system/systemd.te +@@ -362,6 +362,8 @@ seutil_search_default_contexts(systemd_coredump_t) + # + + allow systemd_generator_t self:fifo_file rw_fifo_file_perms; ++allow systemd_generator_t self:capability dac_override; ++allow systemd_generator_t self:process setfscreate; + + corecmd_getattr_bin_files(systemd_generator_t) + +@@ -400,6 +402,8 @@ storage_raw_read_fixed_disk(systemd_generator_t) + + systemd_log_parse_environment(systemd_generator_t) + ++term_use_unallocated_ttys(systemd_generator_t) ++ + optional_policy(` + fstools_exec(systemd_generator_t) + ') +@@ -456,6 +460,7 @@ files_search_runtime(systemd_hw_t) + selinux_get_fs_mount(systemd_hw_t) + + init_read_state(systemd_hw_t) ++init_search_runtime(systemd_hw_t) + + seutil_read_config(systemd_hw_t) + seutil_read_file_contexts(systemd_hw_t) +@@ -777,6 +782,8 @@ dev_write_kmsg(systemd_networkd_t) + files_read_etc_files(systemd_networkd_t) + files_watch_runtime_dirs(systemd_networkd_t) + files_watch_root_dirs(systemd_networkd_t) ++files_list_runtime(systemd_networkd_t) ++fs_getattr_xattr_fs(systemd_networkd_t) + + auth_use_nsswitch(systemd_networkd_t) + +@@ -1084,6 +1091,7 @@ auth_use_nsswitch(systemd_resolved_t) + + files_watch_root_dirs(systemd_resolved_t) + files_watch_runtime_dirs(systemd_resolved_t) ++files_list_runtime(systemd_resolved_t) + + init_dgram_send(systemd_resolved_t) + +@@ -1228,6 +1236,8 @@ logging_relabel_syslogd_tmp_files(systemd_tmpfiles_t) + logging_relabel_syslogd_tmp_dirs(systemd_tmpfiles_t) + logging_setattr_syslogd_tmp_files(systemd_tmpfiles_t) + logging_setattr_syslogd_tmp_dirs(systemd_tmpfiles_t) ++logging_manage_audit_log(systemd_tmpfiles_t) ++logging_relabel_audit_log_dirs(systemd_tmpfiles_t) + + miscfiles_manage_man_pages(systemd_tmpfiles_t) + miscfiles_relabel_man_cache(systemd_tmpfiles_t) +diff --git a/policy/modules/system/udev.te b/policy/modules/system/udev.te +index f5cf89197..a0b0b1cfc 100644 +--- a/policy/modules/system/udev.te ++++ b/policy/modules/system/udev.te +@@ -421,3 +421,5 @@ kernel_read_kernel_sysctls(udevadm_t) + kernel_read_system_state(udevadm_t) + + seutil_read_file_contexts(udevadm_t) ++ ++fs_getattr_xattr_fs(udevadm_t) +-- +2.25.4 +
package/refpolicy/0002-systemd-private-type-for-run-systemd-userdb.patch new file +130 -0
130 lines not on this page · raw message
package/refpolicy/0003-authlogin-connect-to-userdb.patch new file +92 -0
92 lines not on this page · raw message
package/refpolicy/0004-systemd-logind-utilize-nsswitch.patch new file +33 -0
@@ -0,0 +1,33 @@ +From ba33ef18434eadbaa4598cbc33babca4c2feb1bb Mon Sep 17 00:00:00 2001 +From: bauen1 <[email protected]> +Date: Thu, 4 Jun 2020 18:41:21 +0200 +Subject: [PATCH 4/8] systemd-logind: utilize nsswitch + +Signed-off-by: bauen1 <[email protected]> +--- + policy/modules/system/systemd.te | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/policy/modules/system/systemd.te b/policy/modules/system/systemd.te +index 4e0a993bc..d427c2323 100644 +--- a/policy/modules/system/systemd.te ++++ b/policy/modules/system/systemd.te +@@ -555,7 +555,6 @@ dev_setattr_video_dev(systemd_logind_t) + + domain_obj_id_change_exemption(systemd_logind_t) + +-files_read_etc_files(systemd_logind_t) + files_search_runtime(systemd_logind_t) + + fs_getattr_cgroup(systemd_logind_t) +@@ -579,6 +578,7 @@ term_setattr_unallocated_ttys(systemd_logind_t) + term_use_unallocated_ttys(systemd_logind_t) + + auth_manage_faillog(systemd_logind_t) ++auth_use_nsswitch(systemd_logind_t) + + init_dbus_send_script(systemd_logind_t) + init_get_all_units_status(systemd_logind_t) +-- +2.25.4 +
package/refpolicy/0005-getty-utilize-auth_use_nsswitch.patch new file +40 -0
@@ -0,0 +1,40 @@ +From f557951567cde1a1b108bedba1b960e222450b5c Mon Sep 17 00:00:00 2001 +From: Maxime Chevallier <[email protected]> +Date: Tue, 5 Jan 2021 16:32:06 +0100 +Subject: [PATCH 5/8] getty: utilize auth_use_nsswitch + +Fixes : + +denied { read } for pid=80 comm="agetty" name="userdb" dev="tmpfs" ino=809 scontext=system_u:system_r:getty_t tcontext=system_u:object_r:systemd_userdb_runtime_t tclass=dir permissive=1 + +denied { open } for pid=80 comm="agetty" path="/run/systemd/userdb" dev="tmpfs" ino=809 scontext=system_u:system_r:getty_t tcontext=system_u:object_r:systemd_userdb_runtime_t tclass=dir permissive=1 + +denied { getattr } for pid=80 comm="agetty" path="/run/systemd/userdb" dev="tmpfs" ino=809 scontext=system_u:system_r:getty_t tcontext=system_u:object_r:systemd_userdb_runtime_t tclass=dir permissive=1 + +denied { search } for pid=80 comm="agetty" name="userdb" dev="tmpfs" ino=809 scontext=system_u:system_r:getty_t tcontext=system_u:object_r:systemd_userdb_runtime_t tclass=dir permissive=1 + +denied { write } for pid=80 comm="agetty" name="io.systemd.DynamicUser" dev="tmpfs" ino=811 scontext=system_u:system_r:getty_t tcontext=system_u:object_r:systemd_userdb_runtime_t tclass=sock_file permissive=1 + +denied { connectto } for pid=80 comm="agetty" path="/run/systemd/userdb/io.systemd.DynamicUser" scontext=system_u:system_r:getty_t tcontext=system_u:system_r:init_t tclass=unix_stream_socket permissive=1 + +Suggested-by: Antoine Tenart <[email protected]> +Signed-off-by: Maxime Chevallier <[email protected]> +--- + policy/modules/system/getty.te | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/policy/modules/system/getty.te b/policy/modules/system/getty.te +index 26459a413..a96c726f8 100644 +--- a/policy/modules/system/getty.te ++++ b/policy/modules/system/getty.te +@@ -85,6 +85,7 @@ term_setattr_unallocated_ttys(getty_t) + term_setattr_console(getty_t) + + auth_rw_login_records(getty_t) ++auth_use_nsswitch(getty_t) + + init_rw_utmp(getty_t) + +-- +2.25.4 +
package/refpolicy/0006-systemd-tmpfiles-utilize-auth_use_nsswitch.patch new file +32 -0
@@ -0,0 +1,32 @@ +From a579743ba62b28c4b41b84b975b4fd3c17ca8865 Mon Sep 17 00:00:00 2001 +From: Maxime Chevallier <[email protected]> +Date: Tue, 5 Jan 2021 16:37:37 +0100 +Subject: [PATCH 6/8] systemd-tmpfiles: utilize auth_use_nsswitch + +Fixes : + +denied { write } for pid=49 comm="systemd-tmpfile" name="io.systemd.DynamicUser" dev="tmpfs" ino=811 scontext=system_u:system_r:systemd_tmpfiles_t tcontext=system_u:object_r:systemd_userdb_runtime_t tclass=sock_file permissive=1 + +denied { connectto } for pid=49 comm="systemd-tmpfile" path="/run/systemd/userdb/io.systemd.DynamicUser" scontext=system_u:system_r:systemd_tmpfiles_t tcontext=system_u:system_r:init_t tclass=unix_stream_socket permissive=1 + +Suggested-by: Antoine Tenart <[email protected]> +Signed-off-by: Maxime Chevallier <[email protected]> +--- + policy/modules/system/systemd.te | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/policy/modules/system/systemd.te b/policy/modules/system/systemd.te +index d427c2323..b6369a048 100644 +--- a/policy/modules/system/systemd.te ++++ b/policy/modules/system/systemd.te +@@ -1223,6 +1223,7 @@ auth_manage_var_auth(systemd_tmpfiles_t) + auth_relabel_lastlog(systemd_tmpfiles_t) + auth_relabel_login_records(systemd_tmpfiles_t) + auth_setattr_login_records(systemd_tmpfiles_t) ++auth_use_nsswitch(systemd_tmpfiles_t) + + init_manage_utmp(systemd_tmpfiles_t) + init_manage_var_lib_files(systemd_tmpfiles_t) +-- +2.25.4 +
package/refpolicy/0007-first-udevadm-patch.patch new file +130 -0
130 lines not on this page · raw message
package/refpolicy/0008-pending-upstreaming-Fixes-for-Buildroot-to-boot-in-e.patch new file +190 -0
190 lines not on this page · raw message
Signature · 1 line
2.25.4
PATCH 1/3 package/refpolicy: Add patches pending the next release
Hello,
package/refpolicy/0001-pending-next-release.patch line 4
Quoted 10 lines · On Thu, 7 Jan 2021 14:53:05 +0100 Maxime Chevallier…
package/refpolicy/0001-pending-next-release.patch new file +4
-0@@ -0,0 +1,673 @@ +From 2566e2dac2c759392e0b9f3d442b8489b726cb10 Mon Sep 17 00:00:00 2001 +From: Antoine Tenart <[email protected]> +Date: Mon, 31 Aug 2020 15:38:13 +0200 +Subject: [PATCH 1/8] [pending next release]
Could you generate patches for packages with git format-patch -N to avoid the numbering PATCH X/Y ? This is normally caught by "make check-package".
Also, this particular patch is apparently a huge aggregation of several individual upstream commits. We do want to have each individual commit as a separate patch in Buildroot, with a reference to the upstream commit, a bit like this:
Signed-off-by: Antoine T?nart ...
Upstream: link to upstream commit, or at least commit hash
Signed-off-by: You
Thanks!
Thomas
Signature · 3 lines
Thomas Petazzoni, CTO, Bootlin Embedded Linux and Kernel engineering https://bootlin.com
PATCH 1/3 package/refpolicy: Add patches pending the next release
Hi Thomas,
Quoted 5 lines · On Thu, 7 Jan 2021 17:55:43 +0100 Thomas Petazzoni…
Hello,
On Thu, 7 Jan 2021 14:53:05 +0100
Maxime Chevallier <[email protected]> wrote:
Quoted 14 lines
package/refpolicy/0001-pending-next-release.patch line 4
Quoted 10 lines
package/refpolicy/0001-pending-next-release.patch new file +4
-0@@ -0,0 +1,673 @@ +From 2566e2dac2c759392e0b9f3d442b8489b726cb10 Mon Sep 17 00:00:00 2001 +From: Antoine Tenart <[email protected]> +Date: Mon, 31 Aug 2020 15:38:13 +0200 +Subject: [PATCH 1/8] [pending next release]Could you generate patches for packages with git format-patch -N to avoid the numbering PATCH X/Y ? This is normally caught by "make check-package".
OK I'll do that.
Quoted 8 lines
Also, this particular patch is apparently a huge aggregation of several individual upstream commits. We do want to have each individual commit as a separate patch in Buildroot, with a reference to the upstream commit, a bit like this:
Signed-off-by: Antoine T?nart ...
Upstream: link to upstream commit, or at least commit hash
Signed-off-by: You
OK I'll resubmit with individual patches. I wanted to ease the task by grouping patches that could be removed all at once in the next release.
I hope that having a large number of patches bundled with the refpolicy package will be acceptable.
Thanks,
Maxime
Quoted 3 lines
Thanks!
Thomas
Signature · 3 lines
Maxime Chevallier, Bootlin Embedded Linux and kernel engineering https://bootlin.com
PATCH 1/3 package/refpolicy: Add patches pending the next release
Not sure if this patch is abandoned or not. Just wanted to say that with the bump to 20210203,
the only patches that apply are:
- 0005-getty-utilize-auth_use_nsswitch.patch
- 0006-systemd-tmpfiles-utilize-auth_use_nsswitch.patch
- 0008-pending-upstreaming-Fixes-for-Buildroot-to-boot-in-e.patch
It might be worth making another patch series with just those three patches and the buildroot module.
Adam
Quoted 61 lines · Maxime Chevallier
Hi Thomas,
Quoted 5 lines · On Thu, 7 Jan 2021 17:55:43 +0100 Thomas Petazzoni…
Hello,
On Thu, 7 Jan 2021 14:53:05 +0100
Maxime Chevallier <[email protected]> wrote:Quoted 14 lines
package/refpolicy/0001-pending-next-release.patch line 4
Quoted 10 lines
package/refpolicy/0001-pending-next-release.patch new file +4
-0@@ -0,0 +1,673 @@ +From 2566e2dac2c759392e0b9f3d442b8489b726cb10 Mon Sep 17 00:00:00 2001 +From: Antoine Tenart <[email protected]> +Date: Mon, 31 Aug 2020 15:38:13 +0200 +Subject: [PATCH 1/8] [pending next release]Could you generate patches for packages with git format-patch -N to avoid the numbering PATCH X/Y ? This is normally caught by "make check-package".
OK I'll do that.
Quoted 8 lines
Also, this particular patch is apparently a huge aggregation of several individual upstream commits. We do want to have each individual commit as a separate patch in Buildroot, with a reference to the upstream commit, a bit like this:
Signed-off-by: Antoine T?nart ...
Upstream: link to upstream commit, or at least commit hash
Signed-off-by: YouOK I'll resubmit with individual patches. I wanted to ease the task by grouping patches that could be removed all at once in the next release.
I hope that having a large number of patches bundled with the refpolicy package will be acceptable.
Thanks,
Maxime
Quoted 3 lines
Thanks!
Thomas
--
Maxime Chevallier, Bootlin
Embedded Linux and kernel engineering
https://bootlin.com
_______________________________________________
buildroot mailing list
buildroot at busybox.net
http://lists.busybox.net/mailman/listinfo/buildroot
Re: [Buildroot] [PATCH 1/3] package/refpolicy: Add patches pending the next release
In reply to Maxime ChevallierHello Maxime,
Quoted 19 lines · On Thu, 7 Jan 2021 14:53:05 +0100 Maxime Chevallier…
In order to be able to run a basic system in enforcing mode, we need to apply a few patches on top of
RELEASE_2_20200818.This allows us to fix a few pending issues, most notably with systemd v246.
Patch 0001 is a squash of a few patches written by Antoine Tenart that are already in the refpolicy master branch.
Patches 2, 3 and 4 are also in the master branch, and are needed by subsequen patches so that systemd-tmpfiles and agetty can make use of nsswitch.
Patches 5 and 6 are part of a pull-request that haven't been merged yet, that addresses the issues with agetty and systemd-tmpfiles :
https://github.com/SELinuxProject/refpolicy/pull/330Patch 7 fixes the current issue with systemd v246 that is related to sytemd-udevd now being a symlink to udevadm.
Quoted 6 lines
The fix for that has been submitted on the refpolicy mailing-list, with the review process ongoing :
https://lore.kernel.org/selinux-refpolicy/[email protected]/T/#tFinally, Patch 8 addresses issues for which there's no clear strategy yet for upstreaming in the refpolicy.
So now, all of the patches except patch 8 are in upstream refpolicy, which is good.
However, this patch 8 is really not good, it doesn't document anything about why those fixes are needed. I think it would be acceptable to have out of tree refpolicy patches, but they should be just a mixed bag of fixes all in a single patch that just says "Buildroot fixes".
We need that patch 8 to be split up into multiple patches, each with a proper explanation of what it is fixing. Perhaps this would also help with the upstreaming.
So I'm afraid we can't merge this patch series as it is, just because patch 8 isn't properly explained/detailed.
Maxime: do you have that patch 8 broken down into smaller pieces with reasonable explanation about each piece?
I really would like to see this being finalized.
Best regards,
Thomas
Signature · 7 lines
Thomas Petazzoni, co-owner and CEO, Bootlin Embedded Linux and Kernel engineering and training https://bootlin.com _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
Re: [Buildroot] [PATCH 1/3] package/refpolicy: Add patches pending the next release
Quoted 2 lines · Thomas Petazzoni
Maxime: do you have that patch 8 broken down into smaller pieces with reasonable explanation about each piece?
Just to be clear: "reasonable explanation" means:
- indicate what the problem is;
- why this is different for Buildroot than for others (i.e. why it is a problem to begin with);
- possible solutions;
- why this specific solution was chosen (which can very well be: the others are too complicated).
Regards,
Arnout
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
PATCH 2/3 package/refpolicy: Add a buildroot module
In reply to Maxime ChevallierBooting a system on an embedded platform is quite different to what the refpolicy was originally designed to support, which is general purpose distributions.
This means that we have to enable specific rules for our embedded sytem to work. For now, we implement that as a buildroot-specific module, but this could in the future be upstreamed as part of the refpolicy.
--- .../refpolicy/selinux-modules/buildroot.fc | 0 .../refpolicy/selinux-modules/buildroot.if | 1 + .../refpolicy/selinux-modules/buildroot.te | 121 ++++++++++++++++++ 3 files changed, 122 insertions(+) create mode 100644 package/refpolicy/selinux-modules/buildroot.fc create mode 100644 package/refpolicy/selinux-modules/buildroot.if create mode 100644 package/refpolicy/selinux-modules/buildroot.te
package/refpolicy/selinux-modules/buildroot.fc new file +0 -0
package/refpolicy/selinux-modules/buildroot.if new file +1 -0
@@ -0,0 +1 @@ +## <summary>Buildroot rules</summary>
package/refpolicy/selinux-modules/buildroot.te new file +121 -0
121 lines not on this page · raw message
Signature · 1 line
2.25.4
PATCH 3/3 support/testing: improve SELinux test
In reply to Maxime ChevallierNow that we have support for the refpolicy in buildroot with the latest pending patches and the buildroot module, we are able to boot a system without any denied actions.
Make the test check for the number of denied actions, making sure it's 0.
For ow, we don't switch to "Enforcing" mode yet due to some issues still being present, although not reported as denied actions, possibly because of "dontaudit" rules.
--- support/testing/tests/init/test_systemd_selinux.py | 6 ++++++ 1 file changed, 6 insertions(+)
support/testing/tests/init/test_systemd_selinux.py +6 -0
@@ -17,6 +17,8 @@ class TestSELinuxSystemd(infra.basetest.BRTest): BR2_LINUX_KERNEL_CUSTOM_CONFIG_FILE="board/qemu/x86_64/linux.config" BR2_PACKAGE_LIBSELINUX=y BR2_PACKAGE_REFPOLICY=y + BR2_REFPOLICY_EXTRA_MODULES_DIRS="package/refpolicy/selinux-modules" + BR2_REFPOLICY_EXTRA_MODULES="buildroot" """ def wait_boot(self):
@@ -50,6 +52,10 @@ class TestSELinuxSystemd(infra.basetest.BRTest): self.assertEqual(ret, 0) self.assertEqual(out[0], "system_u:system_r:init_t\0") + # Check no action was denied by the policy while booting. + out, ret = self.emulator.run("journalctl -e | grep audit | grep denied | wc -l") + self.assertEqual(ret, 0) + self.assertEqual(out[0], "0") class TestSELinuxSystemdExt4(TestSELinuxSystemd): config = TestSELinuxSystemd.config + \
Signature · 1 line
2.25.4