## SELinux policy for RHCS - Red Hat Cluster Suite
#######################################
##
## Creates types and rules for a basic
## rhcs init daemon domain.
##
##
##
## Prefix for the domain.
##
##
#
template(`rhcs_domain_template',`
gen_require(`
attribute cluster_domain;
')
##############################
#
# $1_t declarations
#
type $1_t, cluster_domain;
type $1_exec_t;
init_daemon_domain($1_t, $1_exec_t)
type $1_tmpfs_t;
files_tmpfs_file($1_tmpfs_t)
# log files
type $1_var_log_t;
logging_log_file($1_var_log_t)
# pid files
type $1_var_run_t;
files_pid_file($1_var_run_t)
##############################
#
# $1_t local policy
#
manage_dirs_pattern($1_t, $1_tmpfs_t, $1_tmpfs_t)
manage_files_pattern($1_t, $1_tmpfs_t, $1_tmpfs_t)
fs_tmpfs_filetrans($1_t, $1_tmpfs_t, { dir file })
manage_files_pattern($1_t, $1_var_log_t, $1_var_log_t)
manage_sock_files_pattern($1_t, $1_var_log_t, $1_var_log_t)
logging_log_filetrans($1_t, $1_var_log_t, { file sock_file })
manage_files_pattern($1_t, $1_var_run_t, $1_var_run_t)
manage_fifo_files_pattern($1_t, $1_var_run_t, $1_var_run_t)
manage_sock_files_pattern($1_t, $1_var_run_t, $1_var_run_t)
files_pid_filetrans($1_t, $1_var_run_t, { file fifo_file })
')
######################################
##
## Execute a domain transition to run dlm_controld.
##
##
##
## Domain allowed to transition.
##
##
#
interface(`dlm_controld_domtrans',`
gen_require(`
type dlm_controld_t, dlm_controld_exec_t;
')
corecmd_search_bin($1)
domtrans_pattern($1, dlm_controld_exec_t, dlm_controld_t)
')
#####################################
##
## Connect to dlm_controld over a unix domain
## stream socket.
##
##
##
## Domain allowed access.
##
##
#
interface(`dlm_controld_stream_connect',`
gen_require(`
type dlm_controld_t, dlm_controld_var_run_t;
')
files_search_pids($1)
stream_connect_pattern($1, dlm_controld_var_run_t, dlm_controld_var_run_t, dlm_controld_t)
')
#####################################
##
## Allow read and write access to dlm_controld semaphores.
##
##
##
## Domain allowed access.
##
##
#
interface(`dlm_controld_rw_semaphores',`
gen_require(`
type dlm_controld_t;
')
allow $1 dlm_controld_t:sem { rw_sem_perms destroy };
')
#####################################
##
## Manage dlm_controld tmpfs files.
##
##
##
## Domain allowed access.
##
##
#
interface(`dlm_controld_manage_tmpfs_files',`
gen_require(`
type dlm_controld_tmpfs_t;
')
fs_search_tmpfs($1)
manage_files_pattern($1, dlm_controld_tmpfs_t, dlm_controld_tmpfs_t)
')
######################################
##
## Execute a domain transition to run fenced.
##
##
##
## Domain allowed access.
##
##
#
interface(`fenced_domtrans',`
gen_require(`
type fenced_t, fenced_exec_t;
')
corecmd_search_bin($1)
domtrans_pattern($1, fenced_exec_t, fenced_t)
')
######################################
##
## Allow read and write access to fenced semaphores.
##
##
##
## Domain allowed access.
##
##
#
interface(`fenced_rw_semaphores',`
gen_require(`
type fenced_t;
')
allow $1 fenced_t:sem { rw_sem_perms destroy };
')
######################################
##
## Connect to fenced over an unix domain stream socket.
##
##
##
## Domain allowed access.
##
##
#
interface(`fenced_stream_connect',`
gen_require(`
type fenced_var_run_t, fenced_t;
')
allow $1 fenced_t:unix_stream_socket connectto;
allow $1 fenced_var_run_t:sock_file { getattr write };
files_search_pids($1)
')
#####################################
##
## Managed fenced tmpfs files.
##
##
##
## Domain allowed access.
##
##
#
interface(`fenced_manage_tmpfs_files',`
gen_require(`
type fenced_tmpfs_t;
')
fs_search_tmpfs($1)
manage_files_pattern($1, fenced_tmpfs_t, fenced_tmpfs_t)
')
#####################################
##
## Execute a domain transition to run gfs_controld.
##
##
##
## Domain allowed access.
##
##
#
interface(`gfs_controld_domtrans',`
gen_require(`
type gfs_controld_t, gfs_controld_exec_t;
')
corecmd_search_bin($1)
domtrans_pattern($1, gfs_controld_exec_t, gfs_controld_t)
')
###################################
##
## Manage gfs_controld tmpfs files.
##
##
##
## Domain allowed access.
##
##
#
interface(`gfs_controld_manage_tmpfs_files',`
gen_require(`
type gfs_controld_tmpfs_t;
')
fs_search_tmpfs($1)
manage_files_pattern($1, gfs_controld_tmpfs_t, gfs_controld_tmpfs_t)
')
####################################
##
## Allow read and write access to gfs_controld semaphores.
##
##
##
## Domain allowed access.
##
##
#
interface(`gfs_controld_rw_semaphores',`
gen_require(`
type gfs_controld_t;
')
allow $1 gfs_controld_t:sem { rw_sem_perms destroy };
')
########################################
##
## Read and write to gfs_controld_t shared memory.
##
##
##
## Domain allowed access.
##
##
#
interface(`gfs_controld_t_rw_shm',`
gen_require(`
type gfs_controld_t;
')
allow $1 gfs_controld_t:shm { rw_shm_perms destroy };
')
#####################################
##
## Connect to gfs_controld_t over an unix domain stream socket.
##
##
##
## Domain allowed access.
##
##
#
interface(`gfs_controld_stream_connect',`
gen_require(`
type gfs_controld_t, gfs_controld_var_run_t;
')
files_search_pids($1)
stream_connect_pattern($1, gfs_controld_var_run_t, gfs_controld_var_run_t, gfs_controld_t)
')
######################################
##
## Execute a domain transition to run groupd.
##
##
##
## Domain allowed access.
##
##
#
interface(`groupd_domtrans',`
gen_require(`
type groupd_t, groupd_exec_t;
')
corecmd_search_bin($1)
domtrans_pattern($1, groupd_exec_t, groupd_t)
')
#####################################
##
## Connect to groupd over a unix domain
## stream socket.
##
##
##
## Domain allowed access.
##
##
#
interface(`groupd_stream_connect',`
gen_require(`
type groupd_t, groupd_var_run_t;
')
files_search_pids($1)
stream_connect_pattern($1, groupd_var_run_t, groupd_var_run_t, groupd_t)
')
#####################################
##
## Allow read and write access to groupd semaphores.
##
##
##
## Domain allowed access.
##
##
#
interface(`groupd_rw_semaphores',`
gen_require(`
type groupd_t;
')
allow $1 groupd_t:sem { rw_sem_perms destroy };
')
########################################
##
## Read and write to group shared memory.
##
##
##
## Domain allowed access.
##
##
#
interface(`groupd_rw_shm',`
gen_require(`
type groupd_t;
')
allow $1 groupd_t:shm { rw_shm_perms destroy };
')
#####################################
##
## Manage groupd tmpfs files.
##
##
##
## Domain allowed access.
##
##
#
interface(`groupd_manage_tmpfs_files',`
gen_require(`
type groupd_tmpfs_t;
')
fs_search_tmpfs($1)
manage_files_pattern($1, groupd_tmpfs_t, groupd_tmpfs_t)
')
######################################
##
## Execute a domain transition to run qdiskd.
##
##
##
## Domain allowed access.
##
##
#
interface(`qdiskd_domtrans',`
gen_require(`
type qdiskd_t, qdiskd_exec_t;
')
corecmd_search_bin($1)
domtrans_pattern($1, qdiskd_exec_t, qdiskd_t)
')