commit:     2ce9c1574e77cfedf075413013b6247ff0e7f8ce
Author:     Christian Göttsche <cgzones <AT> googlemail <DOT> com>
AuthorDate: Thu Feb 22 17:00:49 2024 +0000
Commit:     Kenton Groombridge <concord <AT> gentoo <DOT> org>
CommitDate: Fri Mar  1 17:05:54 2024 +0000
URL:        
https://gitweb.gentoo.org/proj/hardened-refpolicy.git/commit/?id=2ce9c157

systemd: generator updates

    type=1400 audit(1708552475.580:3): avc:  denied  { getattr } for  pid=528 
comm="systemd-sysv-ge" path="/etc/init.d/auditd" dev="vda1" ino=262124 
scontext=system_u:system_r:systemd_generator_t:s0 
tcontext=system_u:object_r:auditd_initrc_exec_t:s0 tclass=file permissive=1
    type=1400 audit(1708552475.580:4): avc:  denied  { getattr } for  pid=528 
comm="systemd-sysv-ge" path="/usr/lib/systemd/system/auditd.service" dev="vda1" 
ino=395421 scontext=system_u:system_r:systemd_generator_t:s0 
tcontext=system_u:object_r:auditd_unit_t:s0 tclass=file permissive=1
    type=1400 audit(1708552475.580:5): avc:  denied  { getattr } for  pid=528 
comm="systemd-sysv-ge" path="/etc/init.d/vnstat" dev="vda1" ino=261247 
scontext=system_u:system_r:systemd_generator_t:s0 
tcontext=system_u:object_r:vnstatd_initrc_exec_t:s0 tclass=file permissive=1
    type=1400 audit(1708552475.580:6): avc:  denied  { getattr } for  pid=528 
comm="systemd-sysv-ge" path="/usr/lib/systemd/system/vnstat.service" dev="vda1" 
ino=394196 scontext=system_u:system_r:systemd_generator_t:s0 
tcontext=system_u:object_r:vnstatd_unit_t:s0 tclass=file permissive=1
    type=1400 audit(1708552475.580:7): avc:  denied  { getattr } for  pid=528 
comm="systemd-sysv-ge" path="/usr/lib/systemd/system/dbus-broker.service" 
dev="vda1" ino=394383 scontext=system_u:system_r:systemd_generator_t:s0 
tcontext=system_u:object_r:dbusd_unit_t:s0 tclass=file permissive=1
    type=1400 audit(1708552475.584:8): avc:  denied  { getattr } for  pid=528 
comm="systemd-sysv-ge" path="/usr/lib/systemd/system/qemu-guest-agent.service" 
dev="vda1" ino=392981 scontext=system_u:system_r:systemd_generator_t:s0 
tcontext=system_u:object_r:qemu_unit_t:s0 tclass=file permissive=1
    type=1400 audit(1708552475.584:9): avc:  denied  { getattr } for  pid=528 
comm="systemd-sysv-ge" path="/usr/lib/systemd/system/ssh.service" dev="vda1" 
ino=393521 scontext=system_u:system_r:systemd_generator_t:s0 
tcontext=system_u:object_r:sshd_unit_t:s0 tclass=file permissive=1

Signed-off-by: Christian Göttsche <cgzones <AT> googlemail.com>
Signed-off-by: Kenton Groombridge <concord <AT> gentoo.org>

 policy/modules/system/init.if    | 20 ++++++++++++++++++++
 policy/modules/system/systemd.te |  3 ++-
 2 files changed, 22 insertions(+), 1 deletion(-)

diff --git a/policy/modules/system/init.if b/policy/modules/system/init.if
index 3e4192eb4..597fd169a 100644
--- a/policy/modules/system/init.if
+++ b/policy/modules/system/init.if
@@ -3858,6 +3858,26 @@ interface(`init_list_all_units',`
        read_lnk_files_pattern($1, systemdunit, systemdunit)
 ')
 
+########################################
+## <summary>
+##     Get the attributes of systemd unit directories and the files in them.
+## </summary>
+## <param name="domain">
+##     <summary>
+##     Domain allowed access.
+##     </summary>
+## </param>
+#
+interface(`init_getattr_all_unit_files',`
+       gen_require(`
+               attribute systemdunit;
+       ')
+
+       list_dirs_pattern($1, systemdunit, systemdunit)
+       getattr_files_pattern($1, systemdunit, systemdunit)
+       read_lnk_files_pattern($1, systemdunit, systemdunit)
+')
+
 ########################################
 ## <summary>
 ##     Manage systemd unit dirs and the files in them

diff --git a/policy/modules/system/systemd.te b/policy/modules/system/systemd.te
index 63fef177b..e3af88033 100644
--- a/policy/modules/system/systemd.te
+++ b/policy/modules/system/systemd.te
@@ -536,10 +536,11 @@ init_rename_runtime_files(systemd_generator_t)
 init_search_runtime(systemd_generator_t)
 init_setattr_runtime_files(systemd_generator_t)
 init_write_runtime_files(systemd_generator_t)
-init_list_all_units(systemd_generator_t)
 init_read_generic_units_files(systemd_generator_t)
 init_read_generic_units_symlinks(systemd_generator_t)
 init_read_script_files(systemd_generator_t)
+init_getattr_all_unit_files(systemd_generator_t)
+init_getattr_all_script_files(systemd_generator_t)
 
 kernel_use_fds(systemd_generator_t)
 kernel_read_system_state(systemd_generator_t)

Reply via email to