2020-03-19 18:07:12 +00:00
|
|
|
policy_module(mcelog, 1.7.1)
|
2018-06-23 13:00:56 +00:00
|
|
|
|
|
|
|
########################################
|
|
|
|
#
|
|
|
|
# Declarations
|
|
|
|
#
|
|
|
|
|
|
|
|
## <desc>
|
|
|
|
## <p>
|
|
|
|
## Determine whether mcelog supports
|
|
|
|
## client mode.
|
|
|
|
## </p>
|
|
|
|
## </desc>
|
|
|
|
gen_tunable(mcelog_client, false)
|
|
|
|
|
|
|
|
## <desc>
|
|
|
|
## <p>
|
|
|
|
## Determine whether mcelog can execute scripts.
|
|
|
|
## </p>
|
|
|
|
## </desc>
|
|
|
|
gen_tunable(mcelog_exec_scripts, true)
|
|
|
|
|
|
|
|
## <desc>
|
|
|
|
## <p>
|
|
|
|
## Determine whether mcelog can use all
|
|
|
|
## the user ttys.
|
|
|
|
## </p>
|
|
|
|
## </desc>
|
|
|
|
gen_tunable(mcelog_foreground, false)
|
|
|
|
|
|
|
|
## <desc>
|
|
|
|
## <p>
|
|
|
|
## Determine whether mcelog supports
|
|
|
|
## server mode.
|
|
|
|
## </p>
|
|
|
|
## </desc>
|
|
|
|
gen_tunable(mcelog_server, false)
|
|
|
|
|
|
|
|
## <desc>
|
|
|
|
## <p>
|
|
|
|
## Determine whether mcelog can use syslog.
|
|
|
|
## </p>
|
|
|
|
## </desc>
|
|
|
|
gen_tunable(mcelog_syslog, false)
|
|
|
|
|
|
|
|
type mcelog_t;
|
|
|
|
type mcelog_exec_t;
|
|
|
|
init_daemon_domain(mcelog_t, mcelog_exec_t)
|
|
|
|
application_executable_file(mcelog_exec_t)
|
|
|
|
|
|
|
|
type mcelog_initrc_exec_t;
|
|
|
|
init_script_file(mcelog_initrc_exec_t)
|
|
|
|
|
|
|
|
type mcelog_etc_t;
|
|
|
|
files_config_file(mcelog_etc_t)
|
|
|
|
|
|
|
|
type mcelog_log_t;
|
|
|
|
logging_log_file(mcelog_log_t)
|
|
|
|
|
2019-09-08 20:55:02 +00:00
|
|
|
type mcelog_runtime_t alias mcelog_var_run_t;
|
|
|
|
files_pid_file(mcelog_runtime_t)
|
2018-06-23 13:00:56 +00:00
|
|
|
|
|
|
|
########################################
|
|
|
|
#
|
|
|
|
# Local policy
|
|
|
|
#
|
|
|
|
|
|
|
|
allow mcelog_t self:capability sys_admin;
|
|
|
|
allow mcelog_t self:unix_stream_socket connected_socket_perms;
|
|
|
|
|
|
|
|
allow mcelog_t mcelog_etc_t:dir list_dir_perms;
|
|
|
|
read_files_pattern(mcelog_t, mcelog_etc_t, mcelog_etc_t)
|
|
|
|
|
|
|
|
manage_dirs_pattern(mcelog_t, mcelog_log_t, mcelog_log_t)
|
|
|
|
append_files_pattern(mcelog_t, mcelog_log_t, mcelog_log_t)
|
|
|
|
create_files_pattern(mcelog_t, mcelog_log_t, mcelog_log_t)
|
|
|
|
setattr_files_pattern(mcelog_t, mcelog_log_t, mcelog_log_t)
|
|
|
|
logging_log_filetrans(mcelog_t, mcelog_log_t, { dir file })
|
|
|
|
|
2019-09-08 20:55:02 +00:00
|
|
|
manage_dirs_pattern(mcelog_t, mcelog_runtime_t, mcelog_runtime_t)
|
|
|
|
manage_files_pattern(mcelog_t, mcelog_runtime_t, mcelog_runtime_t)
|
|
|
|
manage_sock_files_pattern(mcelog_t, mcelog_runtime_t, mcelog_runtime_t)
|
|
|
|
files_pid_filetrans(mcelog_t, mcelog_runtime_t, { dir file sock_file })
|
2018-06-23 13:00:56 +00:00
|
|
|
|
|
|
|
kernel_read_system_state(mcelog_t)
|
|
|
|
|
Make raw memory access tunable
Modern systems shouldn't need direct access to raw memory
devices (/dev/mem, /dev/kmem, /dev/mergemem, dev/oldmem, /dev/port)
anymore, so let's remove the access in most cases and make it tunable
in the rest.
Add dev_read_raw_memory_cond(), dev_write_raw_memory_cond() and
dev_wx_raw_memory_cond(), which are conditional to new boolean
allow_raw_memory_access.
Remove raw memory access for a few domains that should never have
needed it (colord_t, iscsid_t, mdamd_t, txtstat_t), should not need it
anymore (dmidecode_t, Debian devicekit_diskt_t, hald_t, hald_mac_t,
xserver_t) or the domains that should transition to different domain
for this (rpm_t, kudzu_t, dpkg_t).
Signed-off-by: Topi Miettinen <toiwoton@gmail.com>
2020-02-22 15:49:24 +00:00
|
|
|
dev_read_raw_memory_cond(mcelog_t, allow_raw_memory_access)
|
2018-06-23 13:00:56 +00:00
|
|
|
dev_read_kmsg(mcelog_t)
|
|
|
|
dev_rw_cpu_microcode(mcelog_t)
|
|
|
|
dev_rw_sysfs(mcelog_t)
|
|
|
|
|
|
|
|
files_read_etc_files(mcelog_t)
|
|
|
|
|
|
|
|
mls_file_read_all_levels(mcelog_t)
|
|
|
|
|
|
|
|
locallogin_use_fds(mcelog_t)
|
|
|
|
|
|
|
|
miscfiles_read_localization(mcelog_t)
|
|
|
|
|
|
|
|
tunable_policy(`mcelog_client',`
|
|
|
|
allow mcelog_t self:unix_stream_socket connectto;
|
|
|
|
')
|
|
|
|
|
|
|
|
tunable_policy(`mcelog_exec_scripts',`
|
|
|
|
allow mcelog_t self:fifo_file rw_fifo_file_perms;
|
|
|
|
corecmd_exec_bin(mcelog_t)
|
|
|
|
corecmd_exec_shell(mcelog_t)
|
|
|
|
')
|
|
|
|
|
|
|
|
tunable_policy(`mcelog_foreground',`
|
|
|
|
userdom_use_user_terminals(mcelog_t)
|
|
|
|
')
|
|
|
|
|
|
|
|
tunable_policy(`mcelog_server',`
|
|
|
|
allow mcelog_t self:unix_stream_socket { listen accept };
|
|
|
|
')
|
|
|
|
|
|
|
|
tunable_policy(`mcelog_syslog',`
|
|
|
|
logging_send_syslog_msg(mcelog_t)
|
|
|
|
')
|
|
|
|
|
|
|
|
optional_policy(`
|
|
|
|
cron_system_entry(mcelog_t, mcelog_exec_t)
|
|
|
|
')
|