## policy for pki
########################################
##
## Execute pki_ra server in the pki_ra domain.
##
##
##
## The type of the process performing this action.
##
##
#
interface(`pki_ra_script_domtrans',`
gen_require(`
attribute pki_ra_script;
')
init_script_domtrans_spec($1,pki_ra_script)
')
########################################
##
## Create a set of derived types for apache
## web content.
##
##
##
## The prefix to be used for deriving type names.
##
##
#
template(`pki_tps_template',`
gen_require(`
attribute pki_tps_process;
attribute pki_tps_config, pki_tps_var_lib, pki_tps_var_run;
attribute pki_tps_executable, pki_tps_script, pki_tps_var_log;
')
########################################
#
# Declarations
#
type $1_t, pki_tps_process;
type $1_exec_t, pki_tps_executable;
domain_type($1_t)
init_daemon_domain($1_t, $1_exec_t)
type $1_script_exec_t, pki_tps_script;
init_script_file($1_script_exec_t)
type $1_etc_rw_t, pki_tps_config;
files_type($1_etc_rw_t)
type $1_var_run_t, pki_tps_var_run;
files_pid_file($1_var_run_t)
type $1_var_lib_t, pki_tps_var_lib;
files_type($1_var_lib_t)
type $1_log_t, pki_tps_var_log;
logging_log_file($1_log_t)
########################################
#
# $1 local policy
#
## internal communication is often done using fifo and unix sockets.
allow $1_t self:fifo_file rw_file_perms;
allow $1_t self:unix_stream_socket create_stream_socket_perms;
# Init script handling
domain_use_interactive_fds($1_t)
files_read_etc_files($1_t)
allow pki_tps_t pki_tps_etc_rw_t:lnk_file read;
manage_dirs_pattern($1_t, $1_etc_rw_t, $1_etc_rw_t)
manage_files_pattern($1_t, $1_etc_rw_t, $1_etc_rw_t)
files_etc_filetrans($1_t,$1_etc_rw_t, { file dir })
manage_dirs_pattern($1_t, $1_var_run_t, $1_var_run_t)
manage_files_pattern($1_t, $1_var_run_t, $1_var_run_t)
files_pid_filetrans($1_t,$1_var_run_t, { file dir })
manage_dirs_pattern($1_t, $1_var_lib_t, $1_var_lib_t)
manage_files_pattern($1_t, $1_var_lib_t, $1_var_lib_t)
read_lnk_files_pattern($1_t, $1_var_lib_t, $1_var_lib_t)
files_var_lib_filetrans($1_t, $1_var_lib_t, { file dir } )
manage_dirs_pattern($1_t, $1_log_t, $1_log_t)
manage_files_pattern($1_t, $1_log_t, $1_log_t)
logging_log_filetrans($1_t, $1_log_t, { file dir } )
init_dontaudit_write_utmp($1_t)
libs_use_ld_so($1_t)
libs_use_shared_libs($1_t)
miscfiles_read_localization($1_t)
ifdef(`targeted_policy',`
term_dontaudit_use_unallocated_ttys($1_t)
term_dontaudit_use_generic_ptys($1_t)
')
gen_require(`
type httpd_t;
type httpd_exec_t;
type httpd_suexec_exec_t;
')
#============= httpd_t ==============
allow httpd_t $1_var_run_t:dir search;
allow httpd_t $1_var_run_t:file read_file_perms;
')
template(`pki_ra_template',`
gen_require(`
attribute pki_ra_process;
attribute pki_ra_config, pki_ra_var_lib, pki_ra_var_run;
attribute pki_ra_executable, pki_ra_script, pki_ra_var_log;
')
########################################
#
# Declarations
#
type $1_t, pki_ra_process;
type $1_exec_t, pki_ra_executable;
domain_type($1_t)
init_daemon_domain($1_t, $1_exec_t)
type $1_script_exec_t, pki_ra_script;
init_script_file($1_script_exec_t)
type $1_etc_rw_t, pki_ra_config;
files_type($1_etc_rw_t)
type $1_var_run_t, pki_ra_var_run;
files_pid_file($1_var_run_t)
type $1_var_lib_t, pki_ra_var_lib;
files_type($1_var_lib_t)
type $1_log_t, pki_ra_var_log;
logging_log_file($1_log_t)
########################################
#
# $1 local policy
#
## internal communication is often done using fifo and unix sockets.
allow $1_t self:fifo_file rw_file_perms;
allow $1_t self:unix_stream_socket create_stream_socket_perms;
# Init script handling
domain_use_interactive_fds($1_t)
files_read_etc_files($1_t)
manage_dirs_pattern($1_t, $1_etc_rw_t, $1_etc_rw_t)
manage_files_pattern($1_t, $1_etc_rw_t, $1_etc_rw_t)
files_etc_filetrans($1_t,$1_etc_rw_t, { file dir })
manage_dirs_pattern($1_t, $1_var_run_t, $1_var_run_t)
manage_files_pattern($1_t, $1_var_run_t, $1_var_run_t)
files_pid_filetrans($1_t,$1_var_run_t, { file dir })
manage_dirs_pattern($1_t, $1_var_lib_t, $1_var_lib_t)
manage_files_pattern($1_t, $1_var_lib_t, $1_var_lib_t)
read_lnk_files_pattern($1_t, $1_var_lib_t, $1_var_lib_t)
files_var_lib_filetrans($1_t, $1_var_lib_t, { file dir } )
manage_dirs_pattern($1_t, $1_log_t, $1_log_t)
manage_files_pattern($1_t, $1_log_t, $1_log_t)
logging_log_filetrans($1_t, $1_log_t, { file dir } )
init_dontaudit_write_utmp($1_t)
libs_use_ld_so($1_t)
libs_use_shared_libs($1_t)
miscfiles_read_localization($1_t)
ifdef(`targeted_policy',`
term_dontaudit_use_unallocated_ttys($1_t)
term_dontaudit_use_generic_ptys($1_t)
')
gen_require(`
type httpd_t;
type devlog_t;
type syslogd_t;
type httpd_exec_t;
type httpd_suexec_exec_t;
')
#============= httpd_t ==============
allow httpd_t $1_var_run_t:dir search;
allow httpd_t $1_var_run_t:file read_file_perms;
')
########################################
##
## All of the rules required to administrate
## an pki_ra environment
##
##
##
## Domain allowed access.
########################################
##
## All of the rules required to administrate
## an pki_ra environment
##
##
##
## Domain allowed access.
##
##
##
##
## The role to be allowed to manage the syslog domain.
##
##
##
##
## The type of the user terminal.
##
##
##
#
interface(`pki_ra_admin',`
gen_require(`
attribute pki_ra_process;
attribute pki_ra_config;
attribute pki_ra_executable;
attribute pki_ra_var_lib;
attribute pki_ra_var_log;
attribute pki_ra_var_run;
attribute pki_ra_script;
')
allow $1 pki_ra_process:process { ptrace signal_perms };
ps_process_pattern($1, pki_ra_t)
# Allow pki_ra_t to restart the service
pki_ra_script_domtrans($1)
domain_system_change_exemption($1)
role_transition $2 pki_ra_script system_r;
allow $2 system_r;
manage_all_pattern($1, pki_ra_config)
manage_all_pattern($1, pki_ra_var_run)
manage_all_pattern($1, pki_ra_var_lib)
manage_all_pattern($1, pki_ra_var_log)
manage_all_pattern($1, pki_ra_config)
')
########################################
##
## Execute pki_tps server in the pki_tps domain.
##
##
##
## The type of the process performing this action.
##
##
#
interface(`pki_tps_script_domtrans',`
gen_require(`
attribute pki_tps_script;
')
init_script_domtrans_spec($1,pki_tps_script)
')
########################################
##
## All of the rules required to administrate
## an pki_tps environment
##
##
##
## Domain allowed access.
##
##
##
##
## The role to be allowed to manage the syslog domain.
##
##
##
##
## The type of the user terminal.
##
##
##
#
interface(`pki_tps_admin',`
gen_require(`
attribute pki_tps_process;
attribute pki_tps_config;
attribute pki_tps_executable;
attribute pki_tps_var_lib;
attribute pki_tps_var_log;
attribute pki_tps_var_run;
attribute pki_tps_script;
')
allow $1 pki_tps_process:process { ptrace signal_perms };
ps_process_pattern($1, pki_tps_t)
# Allow pki_tps_t to restart the service
pki_tps_script_domtrans($1)
domain_system_change_exemption($1)
role_transition $2 pki_tps_script system_r;
allow $2 system_r;
manage_all_pattern($1, pki_tps_config)
manage_all_pattern($1, pki_tps_var_run)
manage_all_pattern($1, pki_tps_var_lib)
manage_all_pattern($1, pki_tps_var_log)
manage_all_pattern($1, pki_tps_config)
')