## Opensm is an InfiniBand compliant Subnet Manager and Administration, and runs on top of OpenIB
########################################
##
## Execute opensm in the opensm domin.
##
##
##
## Domain allowed to transition.
##
##
#
interface(`opensm_domtrans',`
gen_require(`
type opensm_t, opensm_exec_t;
')
corecmd_search_bin($1)
domtrans_pattern($1, opensm_exec_t, opensm_t)
')
########################################
##
## Search opensm cache directories.
##
##
##
## Domain allowed access.
##
##
#
interface(`opensm_search_cache',`
gen_require(`
type opensm_cache_t;
')
allow $1 opensm_cache_t:dir search_dir_perms;
files_search_var($1)
')
########################################
##
## Read opensm cache files.
##
##
##
## Domain allowed access.
##
##
#
interface(`opensm_read_cache_files',`
gen_require(`
type opensm_cache_t;
')
files_search_var($1)
read_files_pattern($1, opensm_cache_t, opensm_cache_t)
')
########################################
##
## Create, read, write, and delete
## opensm cache files.
##
##
##
## Domain allowed access.
##
##
#
interface(`opensm_manage_cache_files',`
gen_require(`
type opensm_cache_t;
')
files_search_var($1)
manage_files_pattern($1, opensm_cache_t, opensm_cache_t)
')
########################################
##
## Manage opensm cache dirs.
##
##
##
## Domain allowed access.
##
##
#
interface(`opensm_manage_cache_dirs',`
gen_require(`
type opensm_cache_t;
')
files_search_var($1)
manage_dirs_pattern($1, opensm_cache_t, opensm_cache_t)
')
########################################
##
## Read opensm's log files.
##
##
##
## Domain allowed access.
##
##
#
interface(`opensm_read_log',`
gen_require(`
type opensm_log_t;
')
logging_search_logs($1)
read_files_pattern($1, opensm_log_t, opensm_log_t)
')
########################################
##
## Append to opensm log files.
##
##
##
## Domain allowed access.
##
##
#
interface(`opensm_append_log',`
gen_require(`
type opensm_log_t;
')
logging_search_logs($1)
append_files_pattern($1, opensm_log_t, opensm_log_t)
')
########################################
##
## Manage opensm log files
##
##
##
## Domain allowed access.
##
##
#
interface(`opensm_manage_log',`
gen_require(`
type opensm_log_t;
')
logging_search_logs($1)
manage_dirs_pattern($1, opensm_log_t, opensm_log_t)
manage_files_pattern($1, opensm_log_t, opensm_log_t)
manage_lnk_files_pattern($1, opensm_log_t, opensm_log_t)
')
########################################
##
## Execute opensm server in the opensm domain.
##
##
##
## Domain allowed to transition.
##
##
#
interface(`opensm_systemctl',`
gen_require(`
type opensm_t;
type opensm_unit_file_t;
')
systemd_exec_systemctl($1)
init_reload_services($1)
systemd_read_fifo_file_passwd_run($1)
allow $1 opensm_unit_file_t:file read_file_perms;
allow $1 opensm_unit_file_t:service manage_service_perms;
ps_process_pattern($1, opensm_t)
')
########################################
##
## All of the rules required to administrate
## an opensm environment
##
##
##
## Domain allowed access.
##
##
##
#
interface(`opensm_admin',`
gen_require(`
type opensm_t;
type opensm_cache_t;
type opensm_log_t;
type opensm_unit_file_t;
')
allow $1 opensm_t:process { signal_perms };
ps_process_pattern($1, opensm_t)
tunable_policy(`deny_ptrace',`',`
allow $1 opensm_t:process ptrace;
')
files_search_var($1)
admin_pattern($1, opensm_cache_t)
logging_search_logs($1)
admin_pattern($1, opensm_log_t)
opensm_systemctl($1)
admin_pattern($1, opensm_unit_file_t)
allow $1 opensm_unit_file_t:service all_service_perms;
optional_policy(`
systemd_passwd_agent_exec($1)
systemd_read_fifo_file_passwd_run($1)
')
')