Chris PeBenito 17de1b
Chris PeBenito d46cfe
policy_module(daemontools,1.1.1)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
########################################
Chris PeBenito 17de1b
#
Chris PeBenito 17de1b
# Declarations
Chris PeBenito 17de1b
#
Chris PeBenito 17de1b
Chris PeBenito 17de1b
type svc_conf_t;
Chris PeBenito 17de1b
files_type(svc_conf_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
type svc_log_t;
Chris PeBenito 17de1b
files_type(svc_log_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
type svc_multilog_t;
Chris PeBenito 17de1b
type svc_multilog_exec_t;
Chris PeBenito d46cfe
application_domain(svc_multilog_t,svc_multilog_exec_t)
Chris PeBenito 17de1b
role system_r types svc_multilog_t;
Chris PeBenito 17de1b
Chris PeBenito 17de1b
type svc_run_t;
Chris PeBenito 17de1b
type svc_run_exec_t;
Chris PeBenito d46cfe
application_domain(svc_run_t,svc_run_exec_t)
Chris PeBenito 17de1b
role system_r types svc_run_t;
Chris PeBenito 17de1b
Chris PeBenito 17de1b
type svc_start_t;
Chris PeBenito 17de1b
type svc_start_exec_t;
Chris PeBenito 17de1b
init_domain(svc_start_t,svc_start_exec_t)
Chris PeBenito 17de1b
init_system_domain(svc_start_t,svc_start_exec_t)
Chris PeBenito 17de1b
role system_r types svc_start_t;
Chris PeBenito 17de1b
Chris PeBenito 17de1b
type svc_svc_t;
Chris PeBenito 17de1b
files_type(svc_svc_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
########################################
Chris PeBenito 17de1b
#
Chris PeBenito 17de1b
# multilog local policy
Chris PeBenito 17de1b
#
Chris PeBenito 17de1b
Chris PeBenito 17de1b
# multilog creates /service/*/log/status
Chris PeBenito c0868a
manage_files_pattern(svc_multilog_t,svc_svc_t,svc_svc_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
init_use_fds(svc_multilog_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
libs_use_ld_so(svc_multilog_t)
Chris PeBenito 17de1b
libs_use_shared_libs(svc_multilog_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
# writes to /var/log/*/*
Chris PeBenito 17de1b
logging_manage_generic_logs(svc_multilog_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
daemontools_ipc_domain(svc_multilog_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
########################################
Chris PeBenito 17de1b
#
Chris PeBenito 17de1b
# local policy for binaries that impose 
Chris PeBenito 17de1b
# a given environment to supervised daemons
Chris PeBenito 17de1b
# ie. softlimit, setuidgid, envuidgid, envdir, fghack ..
Chris PeBenito 17de1b
#
Chris PeBenito 17de1b
Chris PeBenito 17de1b
allow svc_run_t self:capability { setgid setuid chown fsetid };
Chris PeBenito 17de1b
allow svc_run_t self:process setrlimit;
Chris PeBenito c0868a
allow svc_run_t self:fifo_file rw_fifo_file_perms;
Chris PeBenito 17de1b
allow svc_run_t self:unix_stream_socket create_stream_socket_perms;
Chris PeBenito 17de1b
Chris PeBenito c0868a
allow svc_run_t svc_conf_t:dir list_dir_perms;
Chris PeBenito c0868a
allow svc_run_t svc_conf_t:file read_file_perms;
Chris PeBenito 17de1b
Chris PeBenito 17de1b
can_exec(svc_run_t svc_run_exec_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
kernel_read_system_state(svc_run_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
corecmd_exec_bin(svc_run_t)
Chris PeBenito 17de1b
corecmd_exec_shell(svc_run_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
files_read_etc_files(svc_run_t)
Chris PeBenito 17de1b
files_read_etc_runtime_files(svc_run_t)
Chris PeBenito 17de1b
files_search_pids(svc_run_t)
Chris PeBenito 17de1b
files_search_var_lib(svc_run_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
init_use_script_fds(svc_run_t)
Chris PeBenito 17de1b
init_use_fds(svc_run_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
libs_use_ld_so(svc_run_t)
Chris PeBenito 17de1b
libs_use_shared_libs(svc_run_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
daemontools_domtrans_multilog(svc_run_t)
Chris PeBenito 17de1b
daemontools_read_svc(svc_run_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
optional_policy(`
Chris PeBenito 17de1b
	qmail_read_config(svc_run_t)
Chris PeBenito 17de1b
')
Chris PeBenito 17de1b
Chris PeBenito 17de1b
########################################
Chris PeBenito 17de1b
#
Chris PeBenito 17de1b
# local policy for service monitoring programs
Chris PeBenito 17de1b
# ie svc, svscan, supervise ...
Chris PeBenito 17de1b
#
Chris PeBenito 17de1b
Chris PeBenito 17de1b
allow svc_start_t svc_run_t:process signal;
Chris PeBenito 17de1b
Chris PeBenito c0868a
allow svc_start_t self:fifo_file rw_fifo_file_perms;
Chris PeBenito 17de1b
allow svc_start_t self:capability kill;
Chris PeBenito 17de1b
allow svc_start_t self:unix_stream_socket create_socket_perms;
Chris PeBenito 17de1b
Chris PeBenito 17de1b
can_exec(svc_start_t svc_start_exec_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
corecmd_exec_bin(svc_start_t)
Chris PeBenito 17de1b
corecmd_exec_shell(svc_start_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
files_read_etc_files(svc_start_t)
Chris PeBenito 17de1b
files_read_etc_runtime_files(svc_start_t)
Chris PeBenito 17de1b
files_search_var(svc_start_t)
Chris PeBenito 17de1b
files_search_pids(svc_start_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
libs_use_ld_so(svc_start_t)
Chris PeBenito 17de1b
libs_use_shared_libs(svc_start_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
daemontools_domtrans_run(svc_start_t)
Chris PeBenito 17de1b
daemontools_manage_svc(svc_start_t)