policy_module(calamaris)

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

attribute_role calamaris_roles;

type calamaris_t;
type calamaris_exec_t;
application_domain(calamaris_t, calamaris_exec_t)
role calamaris_roles types calamaris_t;

type calamaris_log_t;
logging_log_file(calamaris_log_t)

type calamaris_www_t;
files_type(calamaris_www_t)

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

allow calamaris_t self:capability dac_override;
allow calamaris_t self:process { setsched signal_perms };
allow calamaris_t self:fifo_file rw_fifo_file_perms;
allow calamaris_t self:unix_stream_socket { accept listen };
allow calamaris_t self:tcp_socket { accept listen };

manage_dirs_pattern(calamaris_t, calamaris_log_t, calamaris_log_t)
manage_files_pattern(calamaris_t, calamaris_log_t, calamaris_log_t)
logging_log_filetrans(calamaris_t, calamaris_log_t, { dir file })

manage_files_pattern(calamaris_t, calamaris_www_t, calamaris_www_t)
manage_lnk_files_pattern(calamaris_t, calamaris_www_t, calamaris_www_t)

kernel_read_all_sysctls(calamaris_t)
kernel_read_system_state(calamaris_t)

corecmd_exec_bin(calamaris_t)

dev_read_urand(calamaris_t)

files_read_usr_files(calamaris_t)
files_read_etc_runtime_files(calamaris_t)

libs_read_lib_files(calamaris_t)

auth_use_nsswitch(calamaris_t)

logging_send_syslog_msg(calamaris_t)

miscfiles_read_localization(calamaris_t)

userdom_dontaudit_list_user_home_dirs(calamaris_t)

optional_policy(`
	apache_search_sys_content(calamaris_t)
')

optional_policy(`
	cron_system_entry(calamaris_t, calamaris_exec_t)
')

optional_policy(`
	mta_send_mail(calamaris_t)
')

optional_policy(`
	squid_read_log(calamaris_t)
')
