Chris PeBenito 6f8cda
Chris PeBenito 6f8cda
policy_module(courier,1.0.0)
Chris PeBenito 6f8cda
Chris PeBenito 6f8cda
########################################
Chris PeBenito 6f8cda
#
Chris PeBenito 6f8cda
# Declarations
Chris PeBenito 6f8cda
#
Chris PeBenito 6f8cda
Chris PeBenito 6f8cda
courier_domain_template(authdaemon)
Chris PeBenito 6f8cda
Chris PeBenito 6f8cda
type courier_etc_t;
Chris PeBenito 6f8cda
files_type(courier_etc_t)
Chris PeBenito 6f8cda
Chris PeBenito 6f8cda
courier_domain_template(pcp)
Chris PeBenito 6f8cda
Chris PeBenito 6f8cda
courier_domain_template(pop)
Chris PeBenito 6f8cda
Chris PeBenito 6f8cda
courier_domain_template(tcpd)
Chris PeBenito 6f8cda
Chris PeBenito 6f8cda
type courier_var_lib_t;
Chris PeBenito 6f8cda
files_type(courier_var_lib_t)
Chris PeBenito 6f8cda
Chris PeBenito 6f8cda
type courier_var_run_t;
Chris PeBenito 6f8cda
files_pid_file(courier_var_run_t)
Chris PeBenito 6f8cda
Chris PeBenito 6f8cda
type courier_exec_t;
Chris PeBenito 6f8cda
files_type(courier_exec_t)
Chris PeBenito 6f8cda
Chris PeBenito 6f8cda
courier_domain_template(sqwebmail)
Chris PeBenito 6f8cda
typealias courier_sqwebmail_exec_t alias sqwebmail_cron_exec_t;
Chris PeBenito 6f8cda
Chris PeBenito 6f8cda
########################################
Chris PeBenito 6f8cda
#
Chris PeBenito 6f8cda
# Authdaemon local policy
Chris PeBenito 6f8cda
#
Chris PeBenito 6f8cda
Chris PeBenito 6f8cda
allow courier_authdaemon_t self:capability { setuid setgid sys_tty_config };
Chris PeBenito 6f8cda
allow courier_authdaemon_t self:unix_stream_socket connectto;
Chris PeBenito 6f8cda
Chris PeBenito 6f8cda
can_exec(courier_authdaemon_t, courier_exec_t)
Chris PeBenito 6f8cda
Chris PeBenito 6f8cda
allow courier_authdaemon_t courier_tcpd_t:fd use;
Chris PeBenito 6f8cda
allow courier_authdaemon_t courier_tcpd_t:tcp_socket rw_stream_socket_perms;
Chris PeBenito 6f8cda
allow courier_authdaemon_t courier_tcpd_t:fifo_file rw_file_perms;
Chris PeBenito 6f8cda
Chris PeBenito 6f8cda
allow courier_authdaemon_t courier_tcpd_t:tcp_socket rw_stream_socket_perms;
Chris PeBenito 6f8cda
allow courier_authdaemon_t courier_tcpd_t:unix_stream_socket rw_stream_socket_perms;
Chris PeBenito 6f8cda
allow courier_authdaemon_t courier_tcpd_t:process sigchld;
Chris PeBenito 6f8cda
allow courier_authdaemon_t courier_tcpd_t:fd use;
Chris PeBenito 6f8cda
allow courier_authdaemon_t courier_tcpd_t:tcp_socket rw_stream_socket_perms;
Chris PeBenito 6f8cda
allow courier_authdaemon_t courier_tcpd_t:fifo_file rw_file_perms;
Chris PeBenito 6f8cda
Chris PeBenito 6f8cda
corecmd_search_sbin(courier_authdaemon_t)
Chris PeBenito 6f8cda
Chris PeBenito 6f8cda
# for SSP
Chris PeBenito 6f8cda
dev_read_urand(courier_authdaemon_t)
Chris PeBenito 6f8cda
Chris PeBenito 6f8cda
files_getattr_tmp_dirs(courier_authdaemon_t)
Chris PeBenito 6f8cda
Chris PeBenito 6f8cda
auth_domtrans_chk_passwd(courier_authdaemon_t)
Chris PeBenito 6f8cda
Chris PeBenito 6f8cda
libs_read_lib_files(courier_authdaemon_t)
Chris PeBenito 6f8cda
Chris PeBenito 6f8cda
miscfiles_read_localization(courier_authdaemon_t)
Chris PeBenito 6f8cda
Chris PeBenito 6f8cda
# should not be needed!
Chris PeBenito 6f8cda
userdom_search_unpriv_users_home_dirs(courier_authdaemon_t)
Chris PeBenito 6f8cda
userdom_dontaudit_search_sysadm_home_dirs(courier_authdaemon_t)
Chris PeBenito 6f8cda
Chris PeBenito 6f8cda
courier_domtrans_pop(courier_authdaemon_t)
Chris PeBenito 6f8cda
Chris PeBenito 6f8cda
########################################
Chris PeBenito 6f8cda
#
Chris PeBenito 6f8cda
# Calendar (PCP) local policy
Chris PeBenito 6f8cda
#
Chris PeBenito 6f8cda
Chris PeBenito 6f8cda
allow courier_pcp_t self:capability { setuid setgid };
Chris PeBenito 6f8cda
Chris PeBenito 6f8cda
dev_read_rand(courier_pcp_t)
Chris PeBenito 6f8cda
Chris PeBenito 6f8cda
########################################
Chris PeBenito 6f8cda
#
Chris PeBenito 6f8cda
# POP3/IMAP local policy
Chris PeBenito 6f8cda
#
Chris PeBenito 6f8cda
Chris PeBenito 6f8cda
allow courier_pop_t courier_authdaemon_t:tcp_socket rw_stream_socket_perms;
Chris PeBenito 6f8cda
allow courier_pop_t courier_authdaemon_t:process sigchld;
Chris PeBenito 6f8cda
Chris PeBenito 6f8cda
allow courier_pop_t courier_tcpd_t:{ unix_stream_socket tcp_socket } rw_stream_socket_perms;
Chris PeBenito 6f8cda
Chris PeBenito 6f8cda
# inherits file handle - should it?
Chris PeBenito 6f8cda
allow courier_pop_t courier_var_lib_t:file { read write };
Chris PeBenito 6f8cda
Chris PeBenito 6f8cda
miscfiles_read_localization(courier_pop_t)
Chris PeBenito 6f8cda
Chris PeBenito 6f8cda
courier_domtrans_authdaemon(courier_pop_t)
Chris PeBenito 6f8cda
Chris PeBenito 6f8cda
# do the actual work (read the Maildir)
Chris PeBenito 6f8cda
userdom_manage_unpriv_users_home_content_files(courier_pop_t)
Chris PeBenito 6f8cda
# cjp: the fact that this is different for pop vs imap means that
Chris PeBenito 6f8cda
# there should probably be a courier_pop_t and courier_imap_t
Chris PeBenito 6f8cda
# this should also probably be a separate type too instead of
Chris PeBenito 6f8cda
# the regular home dir
Chris PeBenito 6f8cda
userdom_manage_unpriv_users_home_content_dirs(courier_pop_t)
Chris PeBenito 6f8cda
Chris PeBenito 6f8cda
########################################
Chris PeBenito 6f8cda
#
Chris PeBenito 6f8cda
# TCPd local policy
Chris PeBenito 6f8cda
#
Chris PeBenito 6f8cda
Chris PeBenito 6f8cda
allow courier_tcpd_t self:capability kill;
Chris PeBenito 6f8cda
Chris PeBenito 6f8cda
can_exec(courier_tcpd_t, courier_exec_t)
Chris PeBenito 6f8cda
Chris PeBenito 6f8cda
allow courier_tcpd_t courier_var_lib_t:dir rw_dir_perms;
Chris PeBenito 6f8cda
allow courier_tcpd_t courier_var_lib_t:file manage_file_perms;
Chris PeBenito 6f8cda
allow courier_tcpd_t courier_var_lib_t:lnk_file create_lnk_perms;
Chris PeBenito 6f8cda
files_search_var_lib(courier_tcpd_t)
Chris PeBenito 6f8cda
Chris PeBenito 6f8cda
corecmd_search_sbin(courier_tcpd_t)
Chris PeBenito 6f8cda
Chris PeBenito 6f8cda
corenet_tcp_bind_pop_port(courier_tcpd_t)
Chris PeBenito 6f8cda
Chris PeBenito 6f8cda
# for TLS
Chris PeBenito 6f8cda
dev_read_rand(courier_tcpd_t)
Chris PeBenito 6f8cda
dev_read_urand(courier_tcpd_t)
Chris PeBenito 6f8cda
Chris PeBenito 6f8cda
miscfiles_read_localization(courier_tcpd_t)
Chris PeBenito 6f8cda
Chris PeBenito 6f8cda
courier_domtrans_pop(courier_tcpd_t)
Chris PeBenito 6f8cda
Chris PeBenito 6f8cda
########################################
Chris PeBenito 6f8cda
#
Chris PeBenito 6f8cda
# Webmail local policy
Chris PeBenito 6f8cda
#
Chris PeBenito 6f8cda
Chris PeBenito 6f8cda
kernel_read_kernel_sysctls(courier_sqwebmail_t)
Chris PeBenito 6f8cda
Chris PeBenito 6f8cda
optional_policy(`
Chris PeBenito 6f8cda
	cron_system_entry(courier_sqwebmail_t,courier_sqwebmail_exec_t)
Chris PeBenito 6f8cda
')