## 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) list_dirs_pattern($1, mock_var_lib_t, mock_var_lib_t) read_files_pattern($1, mock_var_lib_t, mock_var_lib_t) read_lnk_files_pattern($1, mock_var_lib_t, mock_var_lib_t) ') ######################################## ## ## Getattr on mock lib file,dir,sock_file ... ## ## ## ## Domain allowed access. ## ## # interface(`mock_getattr_lib',` gen_require(` type mock_var_lib_t; ') allow $1 mock_var_lib_t:dir_file_class_set getattr; ') ######################################## ## ## 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) ') ######################################## ## ## Manage mock lib files. ## ## ## ## Domain allowed access. ## ## # interface(`mock_dontaudit_write_lib_chr_files',` gen_require(` type mock_var_lib_t; ') dontaudit $1 mock_var_lib_t:chr_file write; ') ####################################### ## ## Dontaudit read and write an leaked file descriptors ## ## ## ## Domain to not audit. ## ## # interface(`mock_dontaudit_leaks',` gen_require(` type mock_tmp_t; ') dontaudit $1 mock_tmp_t:file rw_inherited_file_perms; ') ######################################## ## ## 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; type mock_build_t; ') mock_domtrans($1) role $2 types mock_t; role $2 types mock_build_t; mount_run(mock_t, $2) ') ######################################## ## ## 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_run($2, $1) ps_process_pattern($2, mock_t) allow $2 mock_t:process signal_perms; tunable_policy(`deny_ptrace',`',` allow $2 mock_t:process ptrace; ') optional_policy(` mock_read_lib_files($2) ') ') ####################################### ## ## 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. ## ## # interface(`mock_admin',` gen_require(` type mock_t, mock_var_lib_t; type mock_build_t, mock_etc_t, mock_tmp_t; ') allow $1 mock_t:process signal_perms; ps_process_pattern($1, mock_t) tunable_policy(`deny_ptrace',`',` allow $1 mock_t:process ptrace; allow $1 mock_build_t:process ptrace; ') allow $1 mock_build_t:process signal_perms; ps_process_pattern($1, mock_build_t) files_list_var_lib($1) admin_pattern($1, mock_var_lib_t) files_list_tmp($1) admin_pattern($1, mock_tmp_t) files_search_etc($1) admin_pattern($1, mock_etc_t) ')