## policy for mock
########################################
##
## Execute a domain transition to run mock.
##
##
##
## Domain allowed to transition.
##
##
#
interface(`mock_domtrans',`
gen_require(`
type mock_t, mock_exec_t;
')
domtrans_pattern($1, mock_exec_t, mock_t)
')
########################################
##
## Search mock lib directories.
##
##
##
## Domain allowed access.
##
##
#
interface(`mock_search_lib',`
gen_require(`
type mock_var_lib_t;
')
allow $1 mock_var_lib_t:dir search_dir_perms;
files_search_var_lib($1)
')
########################################
##
## Read mock lib files.
##
##
##
## Domain allowed access.
##
##
#
interface(`mock_read_lib_files',`
gen_require(`
type mock_var_lib_t;
')
files_search_var_lib($1)
read_files_pattern($1, mock_var_lib_t, mock_var_lib_t)
')
########################################
##
## Create, read, write, and delete
## mock lib files.
##
##
##
## Domain allowed access.
##
##
#
interface(`mock_manage_lib_files',`
gen_require(`
type mock_var_lib_t;
')
files_search_var_lib($1)
manage_files_pattern($1, mock_var_lib_t, mock_var_lib_t)
')
########################################
##
## Manage mock lib dirs files.
##
##
##
## Domain allowed access.
##
##
#
interface(`mock_manage_lib_dirs',`
gen_require(`
type mock_var_lib_t;
')
files_search_var_lib($1)
manage_dirs_pattern($1, mock_var_lib_t, mock_var_lib_t)
')
#########################################
##
## Manage mock lib symlinks.
##
##
##
## Domain allowed access.
##
##
#
interface(`mock_manage_lib_symlinks',`
gen_require(`
type mock_var_lib_t;
')
files_search_var_lib($1)
manage_lnk_files_pattern($1, mock_var_lib_t, mock_var_lib_t)
')
########################################
##
## Manage mock lib files.
##
##
##
## Domain allowed access.
##
##
#
interface(`mock_manage_lib_chr_files',`
gen_require(`
type mock_var_lib_t;
')
files_search_var_lib($1)
manage_chr_files_pattern($1, mock_var_lib_t, mock_var_lib_t)
')
########################################
##
## Execute mock in the mock domain, and
## allow the specified role the mock domain.
##
##
##
## Domain allowed access
##
##
##
##
## The role to be allowed the mock domain.
##
##
#
interface(`mock_run',`
gen_require(`
type mock_t;
')
mock_domtrans($1)
role $2 types mock_t;
')
########################################
##
## Role access for mock
##
##
##
## Role allowed access
##
##
##
##
## User domain for the role
##
##
#
interface(`mock_role',`
gen_require(`
type mock_t;
')
role $1 types mock_t;
mock_domtrans($2)
ps_process_pattern($2, mock_t)
allow $2 mock_t:process signal;
')
#######################################
##
## Send a generic signal to mock.
##
##
##
## Domain allowed access.
##
##
#
interface(`mock_signal',`
gen_require(`
type mock_t;
')
allow $1 mock_t:process signal;
')
########################################
##
## All of the rules required to administrate
## an mock environment
##
##
##
## Domain allowed access.
##
##
##
##
## Role allowed access.
##
##
##
#
interface(`mock_admin',`
gen_require(`
type mock_t;
type mock_var_lib_t;
')
allow $1 mock_t:process { ptrace signal_perms };
ps_process_pattern($1, mock_t)
files_search_var_lib($1)
admin_pattern($1, mock_var_lib_t)
')