refpolicy: backport patches to fix policy issues for systemd 250
PATCH 1/2 refpolicy: backport patches to fix policy issues for systemd 250
Backport the following patches to fix systemd-resolved and systemd-netowrkd policy issues:
systemd-systemd-resolved-is-linked-to-libselinux.patch sysnetwork-systemd-allow-DNS-resolution-over-io.syst.patch term-init-allow-systemd-to-watch-and-watch-reads-on-.patch systemd-add-file-transition-for-systemd-networkd-run.patch systemd-add-missing-file-context-for-run-systemd-net.patch systemd-add-file-contexts-for-systemd-network-genera.patch systemd-udev-allow-udev-to-read-systemd-networkd-run.patch
--- ...emd-resolved-is-linked-to-libselinux.patch | 33 +++++++ ...md-allow-DNS-resolution-over-io.syst.patch | 63 +++++++++++++ ...systemd-to-watch-and-watch-reads-on-.patch | 94 +++++++++++++++++++ ...-transition-for-systemd-networkd-run.patch | 32 +++++++ ...ing-file-context-for-run-systemd-net.patch | 29 ++++++ ...-contexts-for-systemd-network-genera.patch | 38 ++++++++ ...ow-udev-to-read-systemd-networkd-run.patch | 34 +++++++ .../refpolicy/refpolicy_common.inc | 7 ++ 8 files changed, 330 insertions(+) create mode 100644 recipes-security/refpolicy/refpolicy/0062-systemd-systemd-resolved-is-linked-to-libselinux.patch create mode 100644 recipes-security/refpolicy/refpolicy/0063-sysnetwork-systemd-allow-DNS-resolution-over-io.syst.patch create mode 100644 recipes-security/refpolicy/refpolicy/0064-term-init-allow-systemd-to-watch-and-watch-reads-on-.patch create mode 100644 recipes-security/refpolicy/refpolicy/0065-systemd-add-file-transition-for-systemd-networkd-run.patch create mode 100644 recipes-security/refpolicy/refpolicy/0066-systemd-add-missing-file-context-for-run-systemd-net.patch create mode 100644 recipes-security/refpolicy/refpolicy/0067-systemd-add-file-contexts-for-systemd-network-genera.patch create mode 100644 recipes-security/refpolicy/refpolicy/0068-systemd-udev-allow-udev-to-read-systemd-networkd-run.patch
recipes-security/refpolicy/refpolicy/0062-systemd-systemd-resolved-is-linked-to-libselinux.patch new file +33 -0
@@ -0,0 +1,33 @@ +From 52a4222397f5d3b28ca15a45bb2ace209a4afc3e Mon Sep 17 00:00:00 2001 +From: Kenton Groombridge <[email protected]> +Date: Thu, 31 Mar 2022 13:09:10 -0400 +Subject: [PATCH] systemd: systemd-resolved is linked to libselinux + +systemd-resolved as of systemd 250 fails to start with this error: + +Failed to initialize SELinux labeling handle: No such file or directory + +Upstream-Status: Backport +[https://github.com/SELinuxProject/refpolicy/commit/3a22db2410de479e5baa88f3f668a7a4ac198950] + +Signed-off-by: Kenton Groombridge <[email protected]> +Signed-off-by: Yi Zhao <[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 8cea6baa1..beb301cc6 100644 +--- a/policy/modules/system/systemd.te ++++ b/policy/modules/system/systemd.te +@@ -1261,6 +1261,7 @@ fs_getattr_cgroup(systemd_resolved_t) + + init_dgram_send(systemd_resolved_t) + ++seutil_libselinux_linked(systemd_resolved_t) + seutil_read_file_contexts(systemd_resolved_t) + + systemd_log_parse_environment(systemd_resolved_t) +-- +2.25.1 +
recipes-security/refpolicy/refpolicy/0063-sysnetwork-systemd-allow-DNS-resolution-over-io.syst.patch new file +63 -0
63 lines not on this page · raw message
recipes-security/refpolicy/refpolicy/0064-term-init-allow-systemd-to-watch-and-watch-reads-on-.patch new file +94 -0
94 lines not on this page · raw message
recipes-security/refpolicy/refpolicy/0065-systemd-add-file-transition-for-systemd-networkd-run.patch new file +32 -0
@@ -0,0 +1,32 @@ +From 6f8a8ecd8bafd6e8a3515b53db2a2982a02ff254 Mon Sep 17 00:00:00 2001 +From: Kenton Groombridge <[email protected]> +Date: Thu, 31 Mar 2022 13:22:37 -0400 +Subject: [PATCH] systemd: add file transition for systemd-networkd runtime + +systemd-networkd creates the /run/systemd/network directory which should +be labeled appropriately. + +Upstream-Status: Backport +[https://github.com/SELinuxProject/refpolicy/commit/663b62f27cb12c22f056eba9326cf3f7f78d8a9e] + +Signed-off-by: Kenton Groombridge <[email protected]> +Signed-off-by: Yi Zhao <[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 beb301cc6..654c6a42a 100644 +--- a/policy/modules/system/systemd.te ++++ b/policy/modules/system/systemd.te +@@ -917,6 +917,7 @@ auth_use_nsswitch(systemd_networkd_t) + + init_dgram_send(systemd_networkd_t) + init_read_state(systemd_networkd_t) ++init_runtime_filetrans(systemd_networkd_t, systemd_networkd_runtime_t, dir) + + logging_send_syslog_msg(systemd_networkd_t) + +-- +2.25.1 +
recipes-security/refpolicy/refpolicy/0066-systemd-add-missing-file-context-for-run-systemd-net.patch new file +29 -0
@@ -0,0 +1,29 @@ +From 2e3f371b59bee343c42e4c69495df0f3719b6e24 Mon Sep 17 00:00:00 2001 +From: Kenton Groombridge <[email protected]> +Date: Sat, 2 Apr 2022 15:44:01 -0400 +Subject: [PATCH] systemd: add missing file context for /run/systemd/network + +Upstream-Status: Backport +[https://github.com/SELinuxProject/refpolicy/commit/f2fe1ae15485da7b6269b7d0d7dbed9a834f1876] + +Signed-off-by: Kenton Groombridge <[email protected]> +Signed-off-by: Yi Zhao <[email protected]> +--- + policy/modules/system/systemd.fc | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/policy/modules/system/systemd.fc b/policy/modules/system/systemd.fc +index 34db8c034..d21914227 100644 +--- a/policy/modules/system/systemd.fc ++++ b/policy/modules/system/systemd.fc +@@ -85,6 +85,7 @@ HOME_DIR/\.local/share/systemd(/.*)? gen_context(system_u:object_r:systemd_data + + /run/systemd/ask-password(/.*)? gen_context(system_u:object_r:systemd_passwd_runtime_t,s0) + /run/systemd/ask-password-block(/.*)? gen_context(system_u:object_r:systemd_passwd_runtime_t,s0) ++/run/systemd/network(/.*)? gen_context(system_u:object_r:systemd_networkd_runtime_t,s0) + /run/systemd/resolve(/.*)? gen_context(system_u:object_r:systemd_resolved_runtime_t,s0) + /run/systemd/seats(/.*)? gen_context(system_u:object_r:systemd_sessions_runtime_t,s0) + /run/systemd/sessions(/.*)? gen_context(system_u:object_r:systemd_sessions_runtime_t,s0) +-- +2.25.1 +
recipes-security/refpolicy/refpolicy/0067-systemd-add-file-contexts-for-systemd-network-genera.patch new file +38 -0
@@ -0,0 +1,38 @@ +From 143d339b2e6611c56cd0210279757ebee9632731 Mon Sep 17 00:00:00 2001 +From: Kenton Groombridge <[email protected]> +Date: Thu, 19 May 2022 11:42:51 -0400 +Subject: [PATCH] systemd: add file contexts for systemd-network-generator + +Upstream-Status: Backport +[https://github.com/SELinuxProject/refpolicy/commit/73adba0a39b7409bc4bbfa0e962108c2b1e5f2a5] + +Thanks-To: Zhao Yi +Signed-off-by: Kenton Groombridge <[email protected]> +Signed-off-by: Yi Zhao <[email protected]> +--- + policy/modules/system/systemd.fc | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/policy/modules/system/systemd.fc b/policy/modules/system/systemd.fc +index d21914227..1a35bd65c 100644 +--- a/policy/modules/system/systemd.fc ++++ b/policy/modules/system/systemd.fc +@@ -35,6 +35,7 @@ + /usr/lib/systemd/systemd-machined -- gen_context(system_u:object_r:systemd_machined_exec_t,s0) + /usr/lib/systemd/systemd-modules-load -- gen_context(system_u:object_r:systemd_modules_load_exec_t,s0) + /usr/lib/systemd/systemd-networkd -- gen_context(system_u:object_r:systemd_networkd_exec_t,s0) ++/usr/lib/systemd/systemd-network-generator -- gen_context(system_u:object_r:systemd_networkd_exec_t,s0) + /usr/lib/systemd/systemd-pstore -- gen_context(system_u:object_r:systemd_pstore_exec_t,s0) + /usr/lib/systemd/systemd-resolved -- gen_context(system_u:object_r:systemd_resolved_exec_t,s0) + /usr/lib/systemd/systemd-rfkill -- gen_context(system_u:object_r:systemd_rfkill_exec_t,s0) +@@ -60,6 +61,7 @@ HOME_DIR/\.local/share/systemd(/.*)? gen_context(system_u:object_r:systemd_data + /usr/lib/systemd/system/systemd-backlight.* -- gen_context(system_u:object_r:systemd_backlight_unit_t,s0) + /usr/lib/systemd/system/systemd-binfmt.* -- gen_context(system_u:object_r:systemd_binfmt_unit_t,s0) + /usr/lib/systemd/system/systemd-networkd.* gen_context(system_u:object_r:systemd_networkd_unit_t,s0) ++/usr/lib/systemd/system/systemd-network-generator.* gen_context(system_u:object_r:systemd_networkd_unit_t,s0) + /usr/lib/systemd/system/systemd-rfkill.* -- gen_context(system_u:object_r:systemd_rfkill_unit_t,s0) + /usr/lib/systemd/system/systemd-socket-proxyd\.service -- gen_context(system_u:object_r:systemd_socket_proxyd_unit_file_t,s0) + +-- +2.25.1 +
recipes-security/refpolicy/refpolicy/0068-systemd-udev-allow-udev-to-read-systemd-networkd-run.patch new file +34 -0
@@ -0,0 +1,34 @@ +From 6508bc8a3440525384fcfcd8ad55a4cd5c79b912 Mon Sep 17 00:00:00 2001 +From: Kenton Groombridge <[email protected]> +Date: Thu, 19 May 2022 11:43:44 -0400 +Subject: [PATCH] systemd, udev: allow udev to read systemd-networkd runtime + +udev searches for .link files and applies custom udev rules to devices +as they come up. + +Upstream-Status: Backport +[https://github.com/SELinuxProject/refpolicy/commit/998ef975f38c70d57e7220b88ae5e62c88ebb770] + +Thanks-To: Zhao Yi +Signed-off-by: Kenton Groombridge <[email protected]> +Signed-off-by: Yi Zhao <[email protected]> +--- + policy/modules/system/udev.te | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/policy/modules/system/udev.te b/policy/modules/system/udev.te +index 4c5a690fb..8e243c0f2 100644 +--- a/policy/modules/system/udev.te ++++ b/policy/modules/system/udev.te +@@ -270,6 +270,8 @@ ifdef(`init_systemd',` + systemd_read_hwdb(udev_t) + systemd_read_logind_sessions_files(udev_t) + systemd_read_logind_runtime_files(udev_t) ++ # udev searches for .link files and applies custom udev rules ++ systemd_read_networkd_runtime(udev_t) + + optional_policy(` + init_dbus_chat(udev_t) +-- +2.25.1 +
recipes-security/refpolicy/refpolicy_common.inc +7 -0
@@ -77,6 +77,13 @@ SRC_URI += " \ file://0059-policy-modules-system-setrans-allow-setrans_t-use-fd.patch \ file://0060-policy-modules-system-systemd-make-_systemd_t-MLS-tr.patch \ file://0061-policy-modules-system-logging-make-syslogd_runtime_t.patch \ + file://0062-systemd-systemd-resolved-is-linked-to-libselinux.patch \ + file://0063-sysnetwork-systemd-allow-DNS-resolution-over-io.syst.patch \ + file://0064-term-init-allow-systemd-to-watch-and-watch-reads-on-.patch \ + file://0065-systemd-add-file-transition-for-systemd-networkd-run.patch \ + file://0066-systemd-add-missing-file-context-for-run-systemd-net.patch \ + file://0067-systemd-add-file-contexts-for-systemd-network-genera.patch \ + file://0068-systemd-udev-allow-udev-to-read-systemd-networkd-run.patch \ " S = "${WORKDIR}/refpolicy"
Signature · 1 line
2.25.1
PATCH 2/2 refpolicy: add file context for findfs alternative
Add file context for findfs alternative which is provided by util-linux.
--- ...s-apply-policy-to-findfs-alternative.patch | 29 +++++++++++++++++++ .../refpolicy/refpolicy_common.inc | 1 + 2 files changed, 30 insertions(+) create mode 100644 recipes-security/refpolicy/refpolicy/0069-fc-fstools-apply-policy-to-findfs-alternative.patch
recipes-security/refpolicy/refpolicy/0069-fc-fstools-apply-policy-to-findfs-alternative.patch new file +29 -0
@@ -0,0 +1,29 @@ +From 3e3ec39659ae068d20efbb5f13054d90960c3c3f Mon Sep 17 00:00:00 2001 +From: Yi Zhao <[email protected]> +Date: Thu, 19 May 2022 16:51:49 +0800 +Subject: [PATCH] fc/fstools: apply policy to findfs alternative + +Add file context for findfs alternative which is provided by util-linux. + +Upstream-Status: Inappropriate [embedded specific] + +Signed-off-by: Yi Zhao <[email protected]> +--- + policy/modules/system/fstools.fc | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/policy/modules/system/fstools.fc b/policy/modules/system/fstools.fc +index bef711850..91be0ef3d 100644 +--- a/policy/modules/system/fstools.fc ++++ b/policy/modules/system/fstools.fc +@@ -77,6 +77,7 @@ + /usr/sbin/fdisk -- gen_context(system_u:object_r:fsadm_exec_t,s0) + /usr/sbin/fdisk\.util-linux -- gen_context(system_u:object_r:fsadm_exec_t,s0) + /usr/sbin/findfs -- gen_context(system_u:object_r:fsadm_exec_t,s0) ++/usr/sbin/findfs\.util-linux -- gen_context(system_u:object_r:fsadm_exec_t,s0) + /usr/sbin/fsck.* -- gen_context(system_u:object_r:fsadm_exec_t,s0) + /usr/sbin/gdisk -- gen_context(system_u:object_r:fsadm_exec_t,s0) + /usr/sbin/hdparm -- gen_context(system_u:object_r:fsadm_exec_t,s0) +-- +2.25.1 +
recipes-security/refpolicy/refpolicy_common.inc +1 -0
@@ -84,6 +84,7 @@ SRC_URI += " \ file://0066-systemd-add-missing-file-context-for-run-systemd-net.patch \ file://0067-systemd-add-file-contexts-for-systemd-network-genera.patch \ file://0068-systemd-udev-allow-udev-to-read-systemd-networkd-run.patch \ + file://0069-fc-fstools-apply-policy-to-findfs-alternative.patch \ " S = "${WORKDIR}/refpolicy"
Signature · 1 line
2.25.1