## Policy for kernel module utilities
########################################
##
## 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;
')
########################################
##
## 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: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;
')
allow $1 modules_conf_t:file rename_file_perms;
')
########################################
##
## Unconditionally execute insmod in the insmod domain.
##
##
##
## Domain allowed access.
##
##
#
# cjp: this is added for pppd, due to nested
# conditionals not working.
interface(`modutils_domtrans_insmod_uncond',`
gen_require(`
type insmod_t, insmod_exec_t;
')
corecmd_search_sbin($1)
domtrans_pattern($1, insmod_exec_t, insmod_t)
')
########################################
##
## Execute insmod in the insmod domain.
##
##
##
## Domain allowed access.
##
##
#
interface(`modutils_domtrans_insmod',`
gen_require(`
bool secure_mode_insmod;
')
if (!secure_mode_insmod) {
modutils_domtrans_insmod_uncond($1)
}
')
########################################
##
## Execute insmod in the insmod domain, and
## allow the specified role the insmod domain,
## and use the caller's terminal. Has a sigchld
## backchannel.
##
##
##
## Domain allowed access.
##
##
##
##
## The role to be allowed the insmod domain.
##
##
##
##
## The type of the terminal allow the insmod domain to use.
##
##
##
#
interface(`modutils_run_insmod',`
gen_require(`
type insmod_t;
')
modutils_domtrans_insmod($1)
role $2 types insmod_t;
allow insmod_t $3:chr_file rw_term_perms;
')
########################################
##
## Execute insmod in the caller domain.
##
##
##
## Domain allowed access.
##
##
#
interface(`modutils_exec_insmod',`
gen_require(`
type insmod_exec_t;
')
corecmd_search_sbin($1)
can_exec($1, insmod_exec_t)
')
########################################
##
## Execute depmod in the depmod domain.
##
##
##
## Domain allowed access.
##
##
#
interface(`modutils_domtrans_depmod',`
gen_require(`
type depmod_t, depmod_exec_t;
')
corecmd_search_sbin($1)
domtrans_pattern($1, depmod_exec_t, depmod_t)
')
########################################
##
## Execute depmod in the depmod domain.
##
##
##
## Domain allowed access.
##
##
##
##
## The role to be allowed the depmod domain.
##
##
##
##
## The type of the terminal allow the depmod domain to use.
##
##
##
#
interface(`modutils_run_depmod',`
gen_require(`
type depmod_t;
')
modutils_domtrans_depmod($1)
role $2 types depmod_t;
allow insmod_t $3:chr_file rw_term_perms;
')
########################################
##
## Execute depmod in the caller domain.
##
##
##
## Domain allowed access.
##
##
#
interface(`modutils_exec_depmod',`
gen_require(`
type depmod_exec_t;
')
corecmd_search_sbin($1)
can_exec($1, depmod_exec_t)
')
########################################
##
## Execute depmod in the depmod domain.
##
##
##
## Domain allowed access.
##
##
#
interface(`modutils_domtrans_update_mods',`
gen_require(`
type update_modules_t, update_modules_exec_t;
')
corecmd_search_sbin($1)
domtrans_pattern($1, update_modules_exec_t, update_modules_t)
')
########################################
##
## Execute update_modules in the update_modules domain.
##
##
##
## Domain allowed access.
##
##
##
##
## The role to be allowed the update_modules domain.
##
##
##
##
## The type of the terminal allow the update_modules domain to use.
##
##
##
#
interface(`modutils_run_update_mods',`
gen_require(`
type update_modules_t;
')
modutils_domtrans_update_mods($1)
role $2 types update_modules_t;
allow update_modules_t $3:chr_file rw_term_perms;
')
########################################
##
## Execute update_modules in the caller domain.
##
##
##
## Domain allowed access.
##
##
#
interface(`modutils_exec_update_mods',`
gen_require(`
type update_modules_exec_t;
')
corecmd_search_sbin($1)
can_exec($1, update_modules_exec_t)
')