## Policy for kernel module utilities
######################################
##
## Getattr the dependencies of kernel modules.
##
##
##
## Domain allowed access.
##
##
#
interface(`modutils_getattr_module_deps',`
gen_require(`
type modules_dep_t;
')
files_search_kernel_modules($1)
allow $1 modules_dep_t:file getattr;
')
########################################
##
## Read the dependencies of kernel modules.
##
##
##
## Domain allowed access.
##
##
#
interface(`modutils_read_module_deps',`
gen_require(`
type modules_dep_t;
')
files_list_kernel_modules($1)
allow $1 modules_dep_t:file { read_file_perms map };
')
########################################
##
## Read the kernel modules. (Deprecated)
##
##
##
## Domain allowed access.
##
##
#
interface(`modutils_read_module_objects',`
refpolicywarn(`$0($*) has been deprecated, please use files_mmap_read_kernel_modules() instead.')
files_mmap_read_kernel_modules($1)
')
########################################
##
## Read the configuration options used when
## loading modules.
##
##
##
## Domain allowed access.
##
##
##
#
interface(`modutils_read_module_config',`
gen_require(`
type modules_conf_t;
')
# This file type can be in /etc or
# /lib(64)?/modules
files_search_etc($1)
files_search_boot($1)
allow $1 modules_conf_t:dir list_dir_perms;
allow $1 modules_conf_t:file read_file_perms;
allow $1 modules_conf_t:lnk_file read_lnk_file_perms;
')
########################################
##
## Rename a file with the configuration options used when
## loading modules.
##
##
##
## Domain allowed access.
##
##
#
interface(`modutils_rename_module_config',`
gen_require(`
type modules_conf_t;
')
rename_files_pattern($1, modules_conf_t, modules_conf_t)
')
########################################
##
## Unlink a file with the configuration options used when
## loading modules.
##
##
##
## Domain allowed access.
##
##
#
interface(`modutils_delete_module_config',`
gen_require(`
type modules_conf_t;
')
delete_files_pattern($1, modules_conf_t, modules_conf_t)
')
########################################
##
## Manage files with the configuration options used when
## loading modules.
##
##
##
## Domain allowed access.
##
##
#
interface(`modutils_manage_module_config',`
gen_require(`
type modules_conf_t;
')
manage_files_pattern($1, modules_conf_t, modules_conf_t)
')
########################################
##
## Execute any modutil,
## like insmod, kmod, depmod or updates-modules,
## in the kmod domain.
##
##
##
## Domain allowed to transition.
##
##
#
interface(`modutils_domtrans',`
gen_require(`
type kmod_t, kmod_exec_t;
')
corecmd_search_bin($1)
domtrans_pattern($1, kmod_exec_t, kmod_t)
')
########################################
##
## Execute any modutil,
## like insmod, kmod, depmod or updates-modules,
## in the kmod domain, and allow the specified role
## the kmod domain, and use the caller's terminal.
## Has a sigchld backchannel.
##
##
##
## Domain allowed to transition.
##
##
##
##
## Role allowed access.
##
##
##
#
interface(`modutils_run',`
gen_require(`
attribute_role kmod_roles;
')
modutils_domtrans($1)
roleattribute $2 kmod_roles;
')
########################################
##
## Execute any modutil,
## like insmod, kmod, depmod or updates-modules,
## in the caller domain.
##
##
##
## Domain allowed access.
##
##
#
interface(`modutils_exec',`
gen_require(`
type kmod_exec_t;
')
corecmd_search_bin($1)
can_exec($1, kmod_exec_t)
')