Oreon-Lime-R2/selinux-policy/selinux-policy-bc228bd/selinux-policy-bc228bd0c249a9e4aa3dcf238c2b1bb138943b07/policy/modules/contrib/cockpit.if

306 lines
6.2 KiB
Text
Raw Permalink Normal View History

## <summary>policy for cockpit</summary>
########################################
## <summary>
## Execute TEMPLATE in the cockpit domin.
## </summary>
## <param name="domain">
## <summary>
## Domain allowed to transition.
## </summary>
## </param>
#
ifndef(`cockpit_ws_domtrans',`
interface(`cockpit_ws_domtrans',`
gen_require(`
type cockpit_ws_t, cockpit_ws_exec_t;
')
corecmd_search_bin($1)
domtrans_pattern($1, cockpit_ws_exec_t, cockpit_ws_t)
')
')
########################################
## <summary>
## Execute TEMPLATE in the cockpit domin.
## </summary>
## <param name="domain">
## <summary>
## Domain allowed to transition.
## </summary>
## </param>
#
ifndef(`cockpit_session_domtrans',`
interface(`cockpit_session_domtrans',`
gen_require(`
type cockpit_session_t, cockpit_session_exec_t;
')
corecmd_search_bin($1)
domtrans_pattern($1, cockpit_session_exec_t, cockpit_session_t)
')
')
########################################
## <summary>
## Read and write cockpit_session_t unnamed pipes.
## </summary>
## <param name="domain">
## <summary>
## Domain allowed access.
## </summary>
## </param>
#
ifndef(`cockpit_rw_pipes',`
interface(`cockpit_rw_pipes',`
gen_require(`
type cockpit_session_t;
')
allow $1 cockpit_session_t:fifo_file rw_fifo_file_perms;
')
')
########################################
## <summary>
## Create cockpit unix_stream_sockets.
## </summary>
## <param name="domain">
## <summary>
## Domain allowed access.
## </summary>
## </param>
#
ifndef(`cockpit_manage_unix_stream_sockets',`
interface(`cockpit_manage_unix_stream_sockets',`
gen_require(`
type cockpit_ws_t;
')
allow $1 cockpit_ws_t:unix_stream_socket { create_stream_socket_perms connectto };
')
')
########################################
## <summary>
## Search cockpit lib directories.
## </summary>
## <param name="domain">
## <summary>
## Domain allowed access.
## </summary>
## </param>
#
ifndef(`cockpit_search_lib',`
interface(`cockpit_search_lib',`
gen_require(`
type cockpit_var_lib_t;
')
allow $1 cockpit_var_lib_t:dir search_dir_perms;
files_search_var_lib($1)
')
')
########################################
## <summary>
## Read cockpit lib files.
## </summary>
## <param name="domain">
## <summary>
## Domain allowed access.
## </summary>
## </param>
#
ifndef(`cockpit_read_lib_files',`
interface(`cockpit_read_lib_files',`
gen_require(`
type cockpit_var_lib_t;
')
files_search_var_lib($1)
read_files_pattern($1, cockpit_var_lib_t, cockpit_var_lib_t)
')
')
########################################
## <summary>
## Manage cockpit lib files.
## </summary>
## <param name="domain">
## <summary>
## Domain allowed access.
## </summary>
## </param>
#
ifndef(`cockpit_manage_lib_files',`
interface(`cockpit_manage_lib_files',`
gen_require(`
type cockpit_var_lib_t;
')
files_search_var_lib($1)
manage_files_pattern($1, cockpit_var_lib_t, cockpit_var_lib_t)
')
')
########################################
## <summary>
## Manage cockpit lib directories.
## </summary>
## <param name="domain">
## <summary>
## Domain allowed access.
## </summary>
## </param>
#
ifndef(`cockpit_manage_lib_dirs',`
interface(`cockpit_manage_lib_dirs',`
gen_require(`
type cockpit_var_lib_t;
')
files_search_var_lib($1)
manage_dirs_pattern($1, cockpit_var_lib_t, cockpit_var_lib_t)
')
')
########################################
## <summary>
## Read cockpit pid files.
## </summary>
## <param name="domain">
## <summary>
## Domain allowed access.
## </summary>
## </param>
#
ifndef(`cockpit_read_pid_files',`
interface(`cockpit_read_pid_files',`
gen_require(`
type cockpit_var_run_t;
')
read_files_pattern($1, cockpit_var_run_t, cockpit_var_run_t)
read_lnk_files_pattern($1, cockpit_var_run_t, cockpit_var_run_t)
')
')
########################################
## <summary>
## Manage cockpit pid dirs.
## </summary>
## <param name="domain">
## <summary>
## Domain allowed access.
## </summary>
## </param>
#
ifndef(`cockpit_manage_pid_dirs',`
interface(`cockpit_manage_pid_dirs',`
gen_require(`
type cockpit_var_run_t;
')
manage_dirs_pattern($1, cockpit_var_run_t, cockpit_var_run_t)
')
')
########################################
## <summary>
## Manage cockpit pid dirs.
## </summary>
## <param name="domain">
## <summary>
## Domain allowed access.
## </summary>
## </param>
#
ifndef(`cockpit_manage_pid_files',`
interface(`cockpit_manage_pid_files',`
gen_require(`
type cockpit_var_run_t;
')
manage_files_pattern($1, cockpit_var_run_t, cockpit_var_run_t)
')
')
########################################
## <summary>
## Execute cockpit server in the cockpit domain.
## </summary>
## <param name="domain">
## <summary>
## Domain allowed to transition.
## </summary>
## </param>
#
ifndef(`cockpit_systemctl',`
interface(`cockpit_systemctl',`
gen_require(`
type cockpit_ws_t;
type cockpit_unit_file_t;
')
systemd_exec_systemctl($1)
init_reload_services($1)
systemd_read_fifo_file_passwd_run($1)
allow $1 cockpit_unit_file_t:file read_file_perms;
allow $1 cockpit_unit_file_t:service manage_service_perms;
ps_process_pattern($1, cockpit_ws_t)
')
')
########################################
## <summary>
## All of the rules required to administrate
## an cockpit environment
## </summary>
## <param name="domain">
## <summary>
## Domain allowed access.
## </summary>
## </param>
## <rolecap/>
#
ifndef(`cockpit_admin',`
interface(`cockpit_admin',`
gen_require(`
type cockpit_ws_t;
type cockpit_session_t;
type cockpit_var_lib_t;
type cockpit_var_run_t;
type cockpit_unit_file_t;
')
allow $1 cockpit_ws_t:process { signal_perms };
ps_process_pattern($1, cockpit_ws_t)
allow $1 cockpit_session_t:process { signal_perms };
ps_process_pattern($1, cockpit_session_t)
tunable_policy(`deny_ptrace',`',`
allow $1 cockpit_ws_t:process ptrace;
allow $1 cockpit_session_t:process ptrace;
')
files_search_var_lib($1)
admin_pattern($1, cockpit_var_lib_t)
files_search_pids($1)
admin_pattern($1, cockpit_var_run_t)
cockpit_systemctl($1)
admin_pattern($1, cockpit_unit_file_t)
allow $1 cockpit_unit_file_t:service all_service_perms;
optional_policy(`
systemd_passwd_agent_exec($1)
systemd_read_fifo_file_passwd_run($1)
')
')
')