## policy for zoneminder
########################################
##
## Transition to zoneminder.
##
##
##
## Domain allowed to transition.
##
##
#
interface(`zoneminder_domtrans',`
gen_require(`
type zoneminder_t, zoneminder_exec_t;
')
corecmd_search_bin($1)
domtrans_pattern($1, zoneminder_exec_t, zoneminder_t)
')
########################################
##
## Allow the specified domain to execute zoneminder
## in the caller domain.
##
##
##
## Domain allowed to transition.
##
##
#
interface(`zoneminder_exec',`
gen_require(`
type zoneminder_exec_t;
')
corecmd_search_bin($1)
can_exec($1, zoneminder_exec_t)
')
########################################
##
## Execute zoneminder server in the zoneminder domain.
##
##
##
## Domain allowed access.
##
##
#
interface(`zoneminder_initrc_domtrans',`
gen_require(`
type zoneminder_initrc_exec_t;
')
init_labeled_script_domtrans($1, zoneminder_initrc_exec_t)
')
########################################
##
## Read zoneminder's log files.
##
##
##
## Domain allowed access.
##
##
##
#
interface(`zoneminder_read_log',`
gen_require(`
type zoneminder_log_t;
')
logging_search_logs($1)
read_files_pattern($1, zoneminder_log_t, zoneminder_log_t)
')
########################################
##
## Append to zoneminder log files.
##
##
##
## Domain allowed access.
##
##
#
interface(`zoneminder_append_log',`
gen_require(`
type zoneminder_log_t;
')
logging_search_logs($1)
append_files_pattern($1, zoneminder_log_t, zoneminder_log_t)
')
########################################
##
## Manage zoneminder log files
##
##
##
## Domain allowed access.
##
##
#
interface(`zoneminder_manage_log',`
gen_require(`
type zoneminder_log_t;
')
logging_search_logs($1)
manage_dirs_pattern($1, zoneminder_log_t, zoneminder_log_t)
manage_files_pattern($1, zoneminder_log_t, zoneminder_log_t)
manage_lnk_files_pattern($1, zoneminder_log_t, zoneminder_log_t)
')
########################################
##
## Search zoneminder lib directories.
##
##
##
## Domain allowed access.
##
##
#
interface(`zoneminder_search_lib',`
gen_require(`
type zoneminder_var_lib_t;
')
allow $1 zoneminder_var_lib_t:dir search_dir_perms;
files_search_var_lib($1)
')
########################################
##
## Read zoneminder lib files.
##
##
##
## Domain allowed access.
##
##
#
interface(`zoneminder_read_lib_files',`
gen_require(`
type zoneminder_var_lib_t;
')
files_search_var_lib($1)
read_files_pattern($1, zoneminder_var_lib_t, zoneminder_var_lib_t)
')
########################################
##
## Manage zoneminder lib files.
##
##
##
## Domain allowed access.
##
##
#
interface(`zoneminder_manage_lib_files',`
gen_require(`
type zoneminder_var_lib_t;
')
files_search_var_lib($1)
manage_files_pattern($1, zoneminder_var_lib_t, zoneminder_var_lib_t)
')
########################################
##
## Manage zoneminder lib directories.
##
##
##
## Domain allowed access.
##
##
#
interface(`zoneminder_manage_lib_dirs',`
gen_require(`
type zoneminder_var_lib_t;
')
files_search_var_lib($1)
manage_dirs_pattern($1, zoneminder_var_lib_t, zoneminder_var_lib_t)
')
########################################
##
## Manage zoneminder sock_files files.
##
##
##
## Domain allowed access.
##
##
#
interface(`zoneminder_manage_lib_sock_files',`
gen_require(`
type zoneminder_var_lib_t;
')
files_search_var_lib($1)
manage_sock_files_pattern($1, zoneminder_var_lib_t, zoneminder_var_lib_t)
')
########################################
##
## Search zoneminder spool directories.
##
##
##
## Domain allowed access.
##
##
#
interface(`zoneminder_search_spool',`
gen_require(`
type zoneminder_spool_t;
')
allow $1 zoneminder_spool_t:dir search_dir_perms;
files_search_spool($1)
')
########################################
##
## Read zoneminder spool files.
##
##
##
## Domain allowed access.
##
##
#
interface(`zoneminder_read_spool_files',`
gen_require(`
type zoneminder_spool_t;
')
files_search_spool($1)
read_files_pattern($1, zoneminder_spool_t, zoneminder_spool_t)
')
########################################
##
## Manage zoneminder spool files.
##
##
##
## Domain allowed access.
##
##
#
interface(`zoneminder_manage_spool_files',`
gen_require(`
type zoneminder_spool_t;
')
files_search_spool($1)
manage_files_pattern($1, zoneminder_spool_t, zoneminder_spool_t)
')
########################################
##
## Manage zoneminder spool dirs.
##
##
##
## Domain allowed access.
##
##
#
interface(`zoneminder_manage_spool_dirs',`
gen_require(`
type zoneminder_spool_t;
')
files_search_spool($1)
manage_dirs_pattern($1, zoneminder_spool_t, zoneminder_spool_t)
')
########################################
##
## Connect to zoneminder over a unix stream socket.
##
##
##
## Domain allowed access.
##
##
#
interface(`zoneminder_stream_connect',`
gen_require(`
type zoneminder_t, zoneminder_var_lib_t;
')
files_search_pids($1)
stream_connect_pattern($1, zoneminder_var_lib_t, zoneminder_var_lib_t, zoneminder_t)
')
######################################
##
## Read/write zonerimender tmpfs files.
##
##
##
## Domain allowed access.
##
##
#
interface(`zoneminder_rw_tmpfs_files',`
gen_require(`
type zoneminder_tmpfs_t;
')
fs_search_tmpfs($1)
rw_files_pattern($1, zoneminder_tmpfs_t, zoneminder_tmpfs_t)
')
########################################
##
## All of the rules required to administrate
## an zoneminder environment
##
##
##
## Domain allowed access.
##
##
##
##
## Role allowed access.
##
##
##
#
interface(`zoneminder_admin',`
gen_require(`
type zoneminder_t;
type zoneminder_initrc_exec_t;
type zoneminder_log_t;
type zoneminder_var_lib_t;
type zoneminder_spool_t;
')
allow $1 zoneminder_t:process { ptrace signal_perms };
ps_process_pattern($1, zoneminder_t)
zoneminder_initrc_domtrans($1)
domain_system_change_exemption($1)
role_transition $2 zoneminder_initrc_exec_t system_r;
allow $2 system_r;
logging_search_logs($1)
admin_pattern($1, zoneminder_log_t)
files_search_var_lib($1)
admin_pattern($1, zoneminder_var_lib_t)
files_search_spool($1)
admin_pattern($1, zoneminder_spool_t)
')