From 59136d8a7c858fdab7dd87040dd29d91d0b2dddd Mon Sep 17 00:00:00 2001 From: Chris PeBenito Date: Fri, 26 Aug 2022 18:05:28 +0000 Subject: [PATCH] systemd: Minor coredump fixes. Signed-off-by: Chris PeBenito --- policy/modules/kernel/corecommands.if | 20 ++++++++++++++++++++ policy/modules/system/systemd.te | 11 ++++------- 2 files changed, 24 insertions(+), 7 deletions(-) diff --git a/policy/modules/kernel/corecommands.if b/policy/modules/kernel/corecommands.if index 9458fddc8..08ed91f19 100644 --- a/policy/modules/kernel/corecommands.if +++ b/policy/modules/kernel/corecommands.if @@ -720,6 +720,26 @@ interface(`corecmd_read_all_executables',` read_files_pattern($1, exec_type, exec_type) ') +######################################## +## +## Mmap read-only all executable files. +## +## +## +## Domain allowed access. +## +## +## +# +interface(`corecmd_mmap_read_all_executables',` + gen_require(` + attribute exec_type; + ') + + corecmd_search_bin($1) + mmap_read_files_pattern($1, exec_type, exec_type) +') + ######################################## ## ## Execute all executable files. diff --git a/policy/modules/system/systemd.te b/policy/modules/system/systemd.te index c52591e1b..841ffbef8 100644 --- a/policy/modules/system/systemd.te +++ b/policy/modules/system/systemd.te @@ -443,14 +443,14 @@ ifdef(`enable_mls',` # coredump local policy # -allow systemd_coredump_t self:capability { setgid setuid setpcap sys_ptrace }; +allow systemd_coredump_t self:capability { dac_read_search setgid setuid setpcap sys_ptrace }; +dontaudit systemd_coredump_t self:capability { dac_override net_admin }; allow systemd_coredump_t self:cap_userns { sys_admin sys_ptrace }; allow systemd_coredump_t self:process { getcap setcap setfscreate }; allow systemd_coredump_t self:user_namespace create; allow systemd_coredump_t self:unix_dgram_socket { create write connect getopt setopt }; allow systemd_coredump_t self:unix_stream_socket { create_stream_socket_perms connectto }; allow systemd_coredump_t self:fifo_file rw_inherited_fifo_file_perms; -dontaudit systemd_coredump_t self:capability net_admin; mmap_manage_files_pattern(systemd_coredump_t, systemd_coredump_var_lib_t, systemd_coredump_var_lib_t) @@ -461,7 +461,7 @@ kernel_rw_pipes(systemd_coredump_t) kernel_use_fds(systemd_coredump_t) corecmd_exec_bin(systemd_coredump_t) -corecmd_read_all_executables(systemd_coredump_t) +corecmd_mmap_read_all_executables(systemd_coredump_t) dev_write_kmsg(systemd_coredump_t) @@ -472,12 +472,9 @@ files_read_etc_files(systemd_coredump_t) files_search_var_lib(systemd_coredump_t) files_mounton_root(systemd_coredump_t) -fs_getattr_xattr_fs(systemd_coredump_t) +fs_getattr_all_fs(systemd_coredump_t) fs_getattr_nsfs_files(systemd_coredump_t) fs_search_cgroup_dirs(systemd_coredump_t) -fs_getattr_cgroup(systemd_coredump_t) - -selinux_getattr_fs(systemd_coredump_t) init_list_var_lib_dirs(systemd_coredump_t) init_read_state(systemd_coredump_t)