## OpenStack image registry and delivery service.
#######################################
##
## Creates types and rules for a basic
## glance daemon domain.
##
##
##
## Prefix for the domain.
##
##
#
template(`glance_basic_types_template',`
gen_require(`
attribute glance_domain;
')
type $1_t, glance_domain;
type $1_exec_t;
type $1_unit_file_t;
systemd_unit_file($1_unit_file_t)
kernel_read_system_state($1_t)
corenet_all_recvfrom_unlabeled($1_t)
corenet_all_recvfrom_netlabel($1_t)
logging_send_syslog_msg($1_t)
auth_use_nsswitch($1_t)
')
########################################
##
## Execute a domain transition to
## run glance registry.
##
##
##
## Domain allowed to transition.
##
##
#
interface(`glance_domtrans_registry',`
gen_require(`
type glance_registry_t, glance_registry_exec_t;
')
corecmd_search_bin($1)
domtrans_pattern($1, glance_registry_exec_t, glance_registry_t)
')
########################################
##
## Execute a domain transition to
## run glance api.
##
##
##
## Domain allowed to transition.
##
##
#
interface(`glance_domtrans_api',`
gen_require(`
type glance_api_t, glance_api_exec_t;
')
corecmd_search_bin($1)
domtrans_pattern($1, glance_api_exec_t, glance_api_t)
')
########################################
##
## Read glance log files.
##
##
##
## Domain allowed access.
##
##
##
#
interface(`glance_read_log',`
gen_require(`
type glance_log_t;
')
logging_search_logs($1)
read_files_pattern($1, glance_log_t, glance_log_t)
')
########################################
##
## Append glance log files.
##
##
##
## Domain allowed access.
##
##
#
interface(`glance_append_log',`
gen_require(`
type glance_log_t;
')
logging_search_logs($1)
append_files_pattern($1, glance_log_t, glance_log_t)
')
########################################
##
## Create, read, write, and delete
## glance log files.
##
##
##
## Domain allowed access.
##
##
#
interface(`glance_manage_log',`
gen_require(`
type glance_log_t;
')
logging_search_logs($1)
manage_dirs_pattern($1, glance_log_t, glance_log_t)
manage_files_pattern($1, glance_log_t, glance_log_t)
manage_lnk_files_pattern($1, glance_log_t, glance_log_t)
')
########################################
##
## Search glance lib directories.
##
##
##
## Domain allowed access.
##
##
#
interface(`glance_search_lib',`
gen_require(`
type glance_var_lib_t;
')
allow $1 glance_var_lib_t:dir search_dir_perms;
files_search_var_lib($1)
')
########################################
##
## Read glance lib files.
##
##
##
## Domain allowed access.
##
##
#
interface(`glance_read_lib_files',`
gen_require(`
type glance_var_lib_t;
')
files_search_var_lib($1)
read_files_pattern($1, glance_var_lib_t, glance_var_lib_t)
')
########################################
##
## Create, read, write, and delete
## glance lib files.
##
##
##
## Domain allowed access.
##
##
#
interface(`glance_manage_lib_files',`
gen_require(`
type glance_var_lib_t;
')
files_search_var_lib($1)
manage_files_pattern($1, glance_var_lib_t, glance_var_lib_t)
')
########################################
##
## Create, read, write, and delete
## glance lib directories.
##
##
##
## Domain allowed access.
##
##
#
interface(`glance_manage_lib_dirs',`
gen_require(`
type glance_var_lib_t;
')
files_search_var_lib($1)
manage_dirs_pattern($1, glance_var_lib_t, glance_var_lib_t)
')
########################################
##
## Read glance pid files.
##
##
##
## Domain allowed access.
##
##
#
interface(`glance_read_pid_files',`
gen_require(`
type glance_var_run_t;
')
files_search_pids($1)
read_files_pattern($1, glance_var_run_t, glance_var_run_t)
')
########################################
##
## Create, read, write, and delete
## glance pid files.
##
##
##
## Domain allowed access.
##
##
#
interface(`glance_manage_pid_files',`
gen_require(`
type glance_var_run_t;
')
files_search_pids($1)
manage_files_pattern($1, glance_var_run_t, glance_var_run_t)
')
########################################
##
## All of the rules required to
## administrate an glance environment.
##
##
##
## Domain allowed access.
##
##
##
##
## Role allowed access.
##
##
##
#
interface(`glance_admin',`
gen_require(`
type glance_registry_t, glance_api_t, glance_log_t;
type glance_var_lib_t, glance_var_run_t;
type glance_registry_initrc_exec_t, glance_api_initrc_exec_t;
')
allow $1 glance_registry_t:process signal_perms;
ps_process_pattern($1, glance_registry_t)
tunable_policy(`deny_ptrace',`',`
allow $1 glance_registry_t:process ptrace;
allow $1 glance_api_t:process ptrace;
')
init_labeled_script_domtrans($1, { glance_api_initrc_exec_t glance_registry_initrc_exec_t })
domain_system_change_exemption($1)
role_transition $2 { glance_api_initrc_exec_t glance_registry_initrc_exec_t } system_r;
allow $2 system_r;
logging_search_logs($1)
admin_pattern($1, glance_log_t)
files_search_var_lib($1)
admin_pattern($1, glance_var_lib_t)
files_search_pids($1)
admin_pattern($1, glance_var_run_t)
')