## Kernel crash dumping mechanism
######################################
##
## Execute kdump in the kdump domain.
##
##
##
## Domain allowed to transition.
##
##
#
interface(`kdump_domtrans',`
gen_require(`
type kdump_t, kdump_exec_t;
')
corecmd_search_bin($1)
domtrans_pattern($1, kdump_exec_t, kdump_t)
')
######################################
##
## Execute kdumpctl in the kdumpctl domain.
##
##
##
## Domain allowed to transition.
##
##
#
interface(`kdumpctl_domtrans',`
gen_require(`
type kdumpctl_t, kdumpctl_exec_t;
')
corecmd_search_bin($1)
domtrans_pattern($1, kdumpctl_exec_t, kdumpctl_t)
')
#######################################
##
## Execute kdump in the kdump domain.
##
##
##
## Domain allowed to transition.
##
##
#
interface(`kdump_initrc_domtrans',`
gen_require(`
type kdump_initrc_exec_t;
')
init_labeled_script_domtrans($1, kdump_initrc_exec_t)
')
########################################
##
## Execute kdump server in the kdump domain.
##
##
##
## Domain allowed to transition.
##
##
#
interface(`kdump_systemctl',`
gen_require(`
type kdump_unit_file_t;
type kdump_t;
')
systemd_exec_systemctl($1)
init_reload_services($1)
systemd_search_unit_dirs($1)
allow $1 kdump_unit_file_t:file read_file_perms;
allow $1 kdump_unit_file_t:service all_service_perms;
ps_process_pattern($1, kdump_t)
')
#####################################
##
## Read kdump configuration file.
##
##
##
## Domain allowed access.
##
##
#
interface(`kdump_read_config',`
gen_require(`
type kdump_etc_t;
')
files_search_etc($1)
allow $1 kdump_etc_t:file read_file_perms;
')
#####################################
##
## Read kdump crash files.
##
##
##
## Domain allowed access.
##
##
#
interface(`kdump_read_crash',`
gen_require(`
type kdump_crash_t;
')
files_search_var($1)
read_files_pattern($1, kdump_crash_t, kdump_crash_t)
list_dirs_pattern($1, kdump_crash_t, kdump_crash_t)
')
#####################################
##
## Read kdump crash files.
##
##
##
## Domain allowed access.
##
##
#
interface(`kdump_manage_crash',`
gen_require(`
type kdump_crash_t;
')
files_search_var($1)
manage_files_pattern($1, kdump_crash_t, kdump_crash_t)
manage_dirs_pattern($1, kdump_crash_t, kdump_crash_t)
')
#####################################
##
## Dontaudit read kdump configuration file.
##
##
##
## Domain to not audit.
##
##
#
interface(`kdump_dontaudit_read_config',`
gen_require(`
type kdump_etc_t;
')
dontaudit $1 kdump_etc_t:file read_inherited_file_perms;
')
####################################
##
## Manage kdump configuration file.
##
##
##
## Domain allowed access.
##
##
#
interface(`kdump_manage_config',`
gen_require(`
type kdump_etc_t;
')
files_search_etc($1)
allow $1 kdump_etc_t:file manage_file_perms;
')
#####################################
##
## Read and write kdump lock files.
##
##
##
## Domain allowed access.
##
##
#
interface(`kdump_rw_lock',`
gen_require(`
type kdump_lock_t;
')
files_search_locks($1)
rw_files_pattern($1, kdump_lock_t, kdump_lock_t)
')
###################################
##
## Read/write inherited kdump /var/tmp named pipes.
##
##
##
## Domain allowed access.
##
##
#
interface(`kdump_rw_inherited_kdumpctl_tmp_pipes',`
gen_require(`
type kdumpctl_tmp_t;
')
files_search_tmp($1)
allow $1 kdumpctl_tmp_t:fifo_file rw_inherited_fifo_file_perms;
')
###################################
##
## Manage kdump /var/tmp files.
##
##
##
## Domain allowed access.
##
##
#
interface(`kdump_manage_kdumpctl_tmp_files',`
gen_require(`
type kdumpctl_tmp_t;
')
files_search_tmp($1)
manage_files_pattern($1, kdumpctl_tmp_t, kdumpctl_tmp_t)
manage_dirs_pattern($1, kdumpctl_tmp_t, kdumpctl_tmp_t)
manage_fifo_files_pattern($1, kdumpctl_tmp_t, kdumpctl_tmp_t)
manage_lnk_files_pattern($1, kdumpctl_tmp_t, kdumpctl_tmp_t)
allow $1 kdumpctl_tmp_t:file map;
')
#######################################
##
## Transition content labels to kdump named content
##
##
##
## Domain allowed access.
##
##
#
interface(`kdump_filetrans_named_content',`
gen_require(`
type kdump_lock_t;
')
files_lock_filetrans($1, kdump_lock_t, file, "kdump")
')
######################################
##
## All of the rules required to administrate
## an kdump environment
##
##
##
## Domain allowed access.
##
##
##
##
## The role to be allowed to manage the kdump domain.
##
##
##
#
interface(`kdump_admin',`
gen_require(`
type kdump_t, kdump_etc_t;
type kdump_initrc_exec_t;
type kdump_unit_file_t;
type kdump_crash_t;
')
allow $1 kdump_t:process signal_perms;
ps_process_pattern($1, kdump_t)
tunable_policy(`deny_ptrace',`',`
allow $1 kdump_t:process ptrace;
')
init_labeled_script_domtrans($1, kdump_initrc_exec_t)
domain_system_change_exemption($1)
role_transition $2 kdump_initrc_exec_t system_r;
allow $2 system_r;
files_search_etc($1)
admin_pattern($1, kdump_etc_t)
files_search_var($1)
admin_pattern($1, kdump_crash_t)
kdump_systemctl($1)
admin_pattern($1, kdump_unit_file_t)
allow $1 kdump_unit_file_t:service all_service_perms;
')
###################################
##
## Dontaudit Read/write inherited kdump /var/tmp named pipes.
##
##
##
## Domain to not audit
##
##
#
interface(`kdump_dontaudit_inherited_kdumpctl_tmp_pipes',`
gen_require(`
type kdumpctl_tmp_t;
')
dontaudit $1 kdumpctl_tmp_t:fifo_file rw_inherited_fifo_file_perms;
')
###################################
##
## Manage kdump lib files
##
##
##
## Domain to allow access
##
##
#
interface(`kdump_manage_lib_files',`
gen_require(`
type kdump_var_lib_t;
')
manage_files_pattern($1, kdump_var_lib_t, kdump_var_lib_t)
')
#######################################
##
## Send to kdumpctl over a unix dgram socket.
##
##
##
## Domain allowed access.
##
##
#
interface(`kdump_dgram_send_kdumpctl',`
gen_require(`
type kdumpctl_t;
')
allow $1 kdumpctl_t:unix_dgram_socket sendto;
')