Blob Blame History Raw
policy_module(dspam, 1.0.5)

########################################
#
# Declarations
#

type dspam_t;
type dspam_exec_t;
init_daemon_domain(dspam_t, dspam_exec_t)

type dspam_initrc_exec_t;
init_script_file(dspam_initrc_exec_t)

type dspam_log_t;
logging_log_file(dspam_log_t)

type dspam_var_lib_t;
files_type(dspam_var_lib_t)

type dspam_var_run_t;
files_pid_file(dspam_var_run_t)

########################################
#
# Local policy
#

allow dspam_t self:capability net_admin;
allow dspam_t self:process signal;

allow dspam_t self:tcp_socket { listen accept };

allow dspam_t self:fifo_file rw_fifo_file_perms;
allow dspam_t self:unix_stream_socket { accept listen };

manage_dirs_pattern(dspam_t, dspam_log_t, dspam_log_t)
append_files_pattern(dspam_t, dspam_log_t, dspam_log_t)
create_files_pattern(dspam_t, dspam_log_t, dspam_log_t)
setattr_files_pattern(dspam_t, dspam_log_t, dspam_log_t)
logging_log_filetrans(dspam_t, dspam_log_t, dir)

manage_dirs_pattern(dspam_t, dspam_var_lib_t, dspam_var_lib_t)
manage_files_pattern(dspam_t, dspam_var_lib_t, dspam_var_lib_t)
files_var_lib_filetrans(dspam_t, dspam_var_lib_t, dir)

manage_dirs_pattern(dspam_t, dspam_var_run_t, dspam_var_run_t)
manage_files_pattern(dspam_t, dspam_var_run_t, dspam_var_run_t)
manage_sock_files_pattern(dspam_t, dspam_var_run_t, dspam_var_run_t)
files_pid_filetrans(dspam_t, dspam_var_run_t, dir)

corenet_all_recvfrom_unlabeled(dspam_t)
corenet_all_recvfrom_netlabel(dspam_t)
corenet_tcp_sendrecv_generic_if(dspam_t)
corenet_tcp_sendrecv_generic_node(dspam_t)
corenet_tcp_bind_generic_node(dspam_t)

corenet_sendrecv_spamd_client_packets(dspam_t)
corenet_sendrecv_spamd_server_packets(dspam_t)
corenet_tcp_bind_spamd_port(dspam_t)
corenet_tcp_connect_spamd_port(dspam_t)
corenet_tcp_sendrecv_spamd_port(dspam_t)

files_search_spool(dspam_t)

auth_use_nsswitch(dspam_t)

logging_send_syslog_msg(dspam_t)


optional_policy(`
	apache_content_template(dspam)

	read_files_pattern(httpd_dspam_script_t, dspam_var_lib_t, dspam_var_lib_t)

	files_search_var_lib(httpd_dspam_script_t)
	list_dirs_pattern(dspam_t, httpd_dspam_content_t, httpd_dspam_content_t)
	manage_dirs_pattern(dspam_t, httpd_dspam_content_rw_t, httpd_dspam_content_rw_t)
	manage_files_pattern(dspam_t, httpd_dspam_content_rw_t, httpd_dspam_content_rw_t)

	domain_dontaudit_read_all_domains_state(httpd_dspam_script_t)

	term_dontaudit_search_ptys(httpd_dspam_script_t)
	term_dontaudit_getattr_all_ttys(httpd_dspam_script_t)
	term_dontaudit_getattr_all_ptys(httpd_dspam_script_t)

	init_read_utmp(httpd_dspam_script_t)

	logging_send_syslog_msg(httpd_dspam_script_t)

	mta_send_mail(httpd_dspam_script_t)

	optional_policy(`
	    mysql_tcp_connect(httpd_dspam_script_t)
	    mysql_stream_connect(httpd_dspam_script_t)
	')
')

optional_policy(`
	mysql_stream_connect(dspam_t)
	mysql_read_config(dspam_t)

	mysql_tcp_connect(dspam_t)
')

optional_policy(`
	postgresql_stream_connect(dspam_t)
	postgresql_unpriv_client(dspam_t)

	postgresql_tcp_connect(dspam_t)
')