Chris PeBenito 17de1b
Chris PeBenito 29af4c
policy_module(dovecot, 1.12.0)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
########################################
Chris PeBenito 17de1b
#
Chris PeBenito 17de1b
# Declarations
Chris PeBenito 17de1b
#
Chris PeBenito 17de1b
type dovecot_t;
Chris PeBenito 17de1b
type dovecot_exec_t;
Chris PeBenito 0bfccd
init_daemon_domain(dovecot_t, dovecot_exec_t)
Chris PeBenito 17de1b
Chris PeBenito 465510
type dovecot_auth_t;
Chris PeBenito 465510
type dovecot_auth_exec_t;
Chris PeBenito 465510
domain_type(dovecot_auth_t)
Chris PeBenito 0bfccd
domain_entry_file(dovecot_auth_t, dovecot_auth_exec_t)
Chris PeBenito 465510
role system_r types dovecot_auth_t;
Chris PeBenito 465510
Chris PeBenito bb8816
type dovecot_auth_tmp_t;
Chris PeBenito bb8816
files_tmp_file(dovecot_auth_tmp_t)
Chris PeBenito bb8816
Chris PeBenito 17de1b
type dovecot_cert_t;
Chris PeBenito 17de1b
files_type(dovecot_cert_t)
Chris PeBenito 17de1b
Chris PeBenito bb8816
type dovecot_deliver_t;
Chris PeBenito bb8816
type dovecot_deliver_exec_t;
Chris PeBenito bb8816
domain_type(dovecot_deliver_t)
Chris PeBenito bb8816
domain_entry_file(dovecot_deliver_t, dovecot_deliver_exec_t)
Chris PeBenito bb8816
role system_r types dovecot_deliver_t;
Chris PeBenito bb8816
Chris PeBenito 17de1b
type dovecot_etc_t;
Chris PeBenito 17de1b
files_config_file(dovecot_etc_t)
Chris PeBenito 17de1b
Chris PeBenito bb8816
type dovecot_initrc_exec_t;
Chris PeBenito bb8816
init_script_file(dovecot_initrc_exec_t)
Chris PeBenito bb8816
Chris PeBenito 17de1b
type dovecot_passwd_t;
Chris PeBenito 17de1b
files_type(dovecot_passwd_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
type dovecot_spool_t;
Chris PeBenito 17de1b
files_type(dovecot_spool_t)
Chris PeBenito 17de1b
Chris PeBenito d8eb3c
type dovecot_tmp_t;
Chris PeBenito d8eb3c
files_tmp_file(dovecot_tmp_t)
Chris PeBenito d8eb3c
Chris PeBenito 465510
# /var/lib/dovecot holds SSL parameters file
Chris PeBenito 465510
type dovecot_var_lib_t;
Chris PeBenito 4dd84b
files_type(dovecot_var_lib_t)
Chris PeBenito 465510
Chris PeBenito bb8816
type dovecot_var_log_t;
Chris PeBenito bb8816
logging_log_file(dovecot_var_log_t)
Chris PeBenito bb8816
Chris PeBenito 17de1b
type dovecot_var_run_t;
Chris PeBenito 17de1b
files_pid_file(dovecot_var_run_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
########################################
Chris PeBenito 17de1b
#
Chris PeBenito 17de1b
# dovecot local policy
Chris PeBenito 17de1b
#
Chris PeBenito 17de1b
Chris PeBenito d8eb3c
allow dovecot_t self:capability { dac_override dac_read_search chown kill net_bind_service setgid setuid sys_chroot };
Chris PeBenito 17de1b
dontaudit dovecot_t self:capability sys_tty_config;
Chris PeBenito 4dd84b
allow dovecot_t self:process { setrlimit signal_perms getcap setcap };
Chris PeBenito c0868a
allow dovecot_t self:fifo_file rw_fifo_file_perms;
Chris PeBenito 17de1b
allow dovecot_t self:tcp_socket create_stream_socket_perms;
Chris PeBenito 17de1b
allow dovecot_t self:unix_dgram_socket create_socket_perms;
Chris PeBenito 17de1b
allow dovecot_t self:unix_stream_socket { create_stream_socket_perms connectto };
Chris PeBenito 17de1b
Chris PeBenito c0868a
domtrans_pattern(dovecot_t, dovecot_auth_exec_t, dovecot_auth_t)
Chris PeBenito 17de1b
Chris PeBenito d8eb3c
allow dovecot_t dovecot_auth_t:process signal;
Chris PeBenito d8eb3c
Chris PeBenito c0868a
allow dovecot_t dovecot_cert_t:dir list_dir_perms;
Chris PeBenito 0bfccd
read_files_pattern(dovecot_t, dovecot_cert_t, dovecot_cert_t)
Chris PeBenito 0bfccd
read_lnk_files_pattern(dovecot_t, dovecot_cert_t, dovecot_cert_t)
Chris PeBenito 17de1b
Chris PeBenito c0868a
allow dovecot_t dovecot_etc_t:file read_file_perms;
Chris PeBenito 17de1b
files_search_etc(dovecot_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
can_exec(dovecot_t, dovecot_exec_t)
Chris PeBenito 17de1b
Chris PeBenito d8eb3c
manage_dirs_pattern(dovecot_t, dovecot_tmp_t, dovecot_tmp_t)
Chris PeBenito d8eb3c
manage_files_pattern(dovecot_t, dovecot_tmp_t, dovecot_tmp_t)
Chris PeBenito d8eb3c
files_tmp_filetrans(dovecot_t, dovecot_tmp_t, { file dir })
Chris PeBenito d8eb3c
Chris PeBenito d8eb3c
# Allow dovecot to create and read SSL parameters file
Chris PeBenito d8eb3c
manage_files_pattern(dovecot_t, dovecot_var_lib_t, dovecot_var_lib_t)
Chris PeBenito d8eb3c
files_search_var_lib(dovecot_t)
Chris PeBenito d8eb3c
files_read_var_symlinks(dovecot_t)
Chris PeBenito d8eb3c
Chris PeBenito d8eb3c
manage_dirs_pattern(dovecot_t, dovecot_var_log_t, dovecot_var_log_t)
Chris PeBenito bb8816
manage_files_pattern(dovecot_t, dovecot_var_log_t, dovecot_var_log_t)
Chris PeBenito d8eb3c
logging_log_filetrans(dovecot_t, dovecot_var_log_t, { file dir })
Chris PeBenito bb8816
Chris PeBenito 0bfccd
manage_dirs_pattern(dovecot_t, dovecot_spool_t, dovecot_spool_t)
Chris PeBenito 0bfccd
manage_files_pattern(dovecot_t, dovecot_spool_t, dovecot_spool_t)
Chris PeBenito 0bfccd
manage_lnk_files_pattern(dovecot_t, dovecot_spool_t, dovecot_spool_t)
Chris PeBenito 17de1b
Chris PeBenito 0bfccd
manage_files_pattern(dovecot_t, dovecot_var_run_t, dovecot_var_run_t)
Chris PeBenito d8eb3c
manage_lnk_files_pattern(dovecot_t, dovecot_var_run_t, dovecot_var_run_t)
Chris PeBenito 0bfccd
manage_sock_files_pattern(dovecot_t, dovecot_var_run_t, dovecot_var_run_t)
Chris PeBenito 0bfccd
files_pid_filetrans(dovecot_t, dovecot_var_run_t, file)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
kernel_read_kernel_sysctls(dovecot_t)
Chris PeBenito 17de1b
kernel_read_system_state(dovecot_t)
Chris PeBenito 17de1b
Chris PeBenito 190066
corenet_all_recvfrom_unlabeled(dovecot_t)
Chris PeBenito 190066
corenet_all_recvfrom_netlabel(dovecot_t)
Chris PeBenito 668b30
corenet_tcp_sendrecv_generic_if(dovecot_t)
Chris PeBenito c12621
corenet_tcp_sendrecv_generic_node(dovecot_t)
Chris PeBenito 17de1b
corenet_tcp_sendrecv_all_ports(dovecot_t)
Chris PeBenito c12621
corenet_tcp_bind_generic_node(dovecot_t)
Chris PeBenito d8eb3c
corenet_tcp_bind_mail_port(dovecot_t)
Chris PeBenito 17de1b
corenet_tcp_bind_pop_port(dovecot_t)
Chris PeBenito 17de1b
corenet_tcp_connect_all_ports(dovecot_t)
Chris PeBenito 17de1b
corenet_tcp_connect_postgresql_port(dovecot_t)
Chris PeBenito 17de1b
corenet_sendrecv_pop_server_packets(dovecot_t)
Chris PeBenito 17de1b
corenet_sendrecv_all_client_packets(dovecot_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
dev_read_sysfs(dovecot_t)
Chris PeBenito 17de1b
dev_read_urand(dovecot_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
fs_getattr_all_fs(dovecot_t)
Chris PeBenito d8eb3c
fs_getattr_all_dirs(dovecot_t)
Chris PeBenito 17de1b
fs_search_auto_mountpoints(dovecot_t)
Chris PeBenito 17de1b
fs_list_inotifyfs(dovecot_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
corecmd_exec_bin(dovecot_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
domain_use_interactive_fds(dovecot_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
files_read_etc_files(dovecot_t)
Chris PeBenito 17de1b
files_search_spool(dovecot_t)
Chris PeBenito 17de1b
files_search_tmp(dovecot_t)
Chris PeBenito 17de1b
files_dontaudit_list_default(dovecot_t)
Chris PeBenito 17de1b
# Dovecot now has quota support and it uses getmntent() to find the mountpoints.
Chris PeBenito 17de1b
files_read_etc_runtime_files(dovecot_t)
Chris PeBenito bb8816
files_search_all_mountpoints(dovecot_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
init_getattr_utmp(dovecot_t)
Chris PeBenito 17de1b
Chris PeBenito c0cf6e
auth_use_nsswitch(dovecot_t)
Chris PeBenito c0cf6e
Chris PeBenito 17de1b
logging_send_syslog_msg(dovecot_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
miscfiles_read_certs(dovecot_t)
Chris PeBenito 17de1b
miscfiles_read_localization(dovecot_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
userdom_dontaudit_use_unpriv_user_fds(dovecot_t)
Chris PeBenito 296273
userdom_manage_user_home_content_dirs(dovecot_t)
Chris PeBenito 296273
userdom_manage_user_home_content_files(dovecot_t)
Chris PeBenito 296273
userdom_manage_user_home_content_symlinks(dovecot_t)
Chris PeBenito 296273
userdom_manage_user_home_content_pipes(dovecot_t)
Chris PeBenito 296273
userdom_manage_user_home_content_sockets(dovecot_t)
Chris PeBenito 296273
userdom_user_home_dir_filetrans_user_home_content(dovecot_t, { dir file lnk_file fifo_file sock_file })
Chris PeBenito 17de1b
Chris PeBenito 17de1b
mta_manage_spool(dovecot_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
optional_policy(`
Chris PeBenito bb8816
	kerberos_keytab_template(dovecot, dovecot_t)
Chris PeBenito 17de1b
')
Chris PeBenito 17de1b
Chris PeBenito 17de1b
optional_policy(`
Chris PeBenito d8eb3c
	postgresql_stream_connect(dovecot_t)
Chris PeBenito d8eb3c
')
Chris PeBenito d8eb3c
Chris PeBenito d8eb3c
optional_policy(`
Chris PeBenito 17de1b
	seutil_sigchld_newrole(dovecot_t)
Chris PeBenito 17de1b
')
Chris PeBenito 17de1b
Chris PeBenito 17de1b
optional_policy(`
Chris PeBenito b129e2
	squid_dontaudit_search_cache(dovecot_t)
Chris PeBenito b129e2
')
Chris PeBenito b129e2
Chris PeBenito b129e2
optional_policy(`
Chris PeBenito 17de1b
	udev_read_db(dovecot_t)
Chris PeBenito 17de1b
')
Chris PeBenito 17de1b
Chris PeBenito 17de1b
########################################
Chris PeBenito 17de1b
#
Chris PeBenito 17de1b
# dovecot auth local policy
Chris PeBenito 17de1b
#
Chris PeBenito 17de1b
Chris PeBenito bb8816
allow dovecot_auth_t self:capability { chown dac_override setgid setuid };
Chris PeBenito 4dd84b
allow dovecot_auth_t self:process { signal_perms getcap setcap };
Chris PeBenito c0868a
allow dovecot_auth_t self:fifo_file rw_fifo_file_perms;
Chris PeBenito 17de1b
allow dovecot_auth_t self:unix_dgram_socket create_socket_perms;
Chris PeBenito 17de1b
allow dovecot_auth_t self:unix_stream_socket create_stream_socket_perms;
Chris PeBenito 17de1b
Chris PeBenito bb8816
allow dovecot_auth_t dovecot_t:unix_stream_socket { connectto rw_stream_socket_perms };
Chris PeBenito bb8816
Chris PeBenito bb8816
read_files_pattern(dovecot_auth_t, dovecot_passwd_t, dovecot_passwd_t)
Chris PeBenito 17de1b
Chris PeBenito bb8816
manage_dirs_pattern(dovecot_auth_t, dovecot_auth_tmp_t, dovecot_auth_tmp_t)
Chris PeBenito bb8816
manage_files_pattern(dovecot_auth_t, dovecot_auth_tmp_t, dovecot_auth_tmp_t)
Chris PeBenito bb8816
files_tmp_filetrans(dovecot_auth_t, dovecot_auth_tmp_t, { file dir })
Chris PeBenito 17de1b
Chris PeBenito ef659a
allow dovecot_auth_t dovecot_var_run_t:dir list_dir_perms;
Chris PeBenito bb8816
manage_sock_files_pattern(dovecot_auth_t, dovecot_var_run_t, dovecot_var_run_t)
Chris PeBenito bb8816
dovecot_stream_connect_auth(dovecot_auth_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
kernel_read_all_sysctls(dovecot_auth_t)
Chris PeBenito 17de1b
kernel_read_system_state(dovecot_auth_t)
Chris PeBenito 17de1b
Chris PeBenito bb8816
logging_send_audit_msgs(dovecot_auth_t)
Chris PeBenito bb8816
logging_send_syslog_msg(dovecot_auth_t)
Chris PeBenito bb8816
Chris PeBenito 17de1b
dev_read_urand(dovecot_auth_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
auth_domtrans_chk_passwd(dovecot_auth_t)
Chris PeBenito 17de1b
auth_use_nsswitch(dovecot_auth_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
files_read_etc_files(dovecot_auth_t)
Chris PeBenito 17de1b
files_read_etc_runtime_files(dovecot_auth_t)
Chris PeBenito 17de1b
files_search_pids(dovecot_auth_t)
Chris PeBenito bb8816
files_read_usr_files(dovecot_auth_t)
Chris PeBenito 17de1b
files_read_usr_symlinks(dovecot_auth_t)
Chris PeBenito d8eb3c
files_read_var_lib_files(dovecot_auth_t)
Chris PeBenito 17de1b
files_search_tmp(dovecot_auth_t)
Chris PeBenito eac818
files_read_var_lib_files(dovecot_t)
Chris PeBenito 17de1b
Chris PeBenito d9845a
init_rw_utmp(dovecot_auth_t)
Chris PeBenito d9845a
Chris PeBenito 17de1b
miscfiles_read_localization(dovecot_auth_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
seutil_dontaudit_search_config(dovecot_auth_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
optional_policy(`
Chris PeBenito 17de1b
	kerberos_use(dovecot_auth_t)
Chris PeBenito 4dd84b
Chris PeBenito 4dd84b
	# for gssapi (kerberos)
Chris PeBenito 4dd84b
	userdom_list_user_tmp(dovecot_auth_t)
Chris PeBenito 4dd84b
	userdom_read_user_tmp_files(dovecot_auth_t)
Chris PeBenito 4dd84b
	userdom_read_user_tmp_symlinks(dovecot_auth_t)
Chris PeBenito 17de1b
')
Chris PeBenito 17de1b
Chris PeBenito 17de1b
optional_policy(`
Chris PeBenito bb8816
	mysql_search_db(dovecot_auth_t)
Chris PeBenito bb8816
	mysql_stream_connect(dovecot_auth_t)
Chris PeBenito bb8816
')
Chris PeBenito bb8816
Chris PeBenito bb8816
optional_policy(`
Chris PeBenito bb8816
	nis_authenticate(dovecot_auth_t)
Chris PeBenito bb8816
')
Chris PeBenito bb8816
Chris PeBenito bb8816
optional_policy(`
Chris PeBenito bb8816
	postfix_search_spool(dovecot_auth_t)
Chris PeBenito bb8816
')
Chris PeBenito bb8816
Chris PeBenito bb8816
########################################
Chris PeBenito bb8816
#
Chris PeBenito bb8816
# dovecot deliver local policy
Chris PeBenito bb8816
#
Chris PeBenito bb8816
allow dovecot_deliver_t self:unix_dgram_socket create_socket_perms;
Chris PeBenito bb8816
Chris PeBenito d8eb3c
allow dovecot_deliver_t dovecot_t:process signull;
Chris PeBenito d8eb3c
Chris PeBenito bb8816
allow dovecot_deliver_t dovecot_etc_t:file read_file_perms;
Chris PeBenito bb8816
allow dovecot_deliver_t dovecot_var_run_t:dir list_dir_perms;
Chris PeBenito bb8816
Chris PeBenito bb8816
kernel_read_all_sysctls(dovecot_deliver_t)
Chris PeBenito bb8816
kernel_read_system_state(dovecot_deliver_t)
Chris PeBenito bb8816
Chris PeBenito bb8816
files_read_etc_files(dovecot_deliver_t)
Chris PeBenito bb8816
files_read_etc_runtime_files(dovecot_deliver_t)
Chris PeBenito bb8816
Chris PeBenito bb8816
auth_use_nsswitch(dovecot_deliver_t)
Chris PeBenito bb8816
Chris PeBenito bb8816
logging_send_syslog_msg(dovecot_deliver_t)
Chris PeBenito d8eb3c
logging_search_logs(dovecot_auth_t)
Chris PeBenito bb8816
Chris PeBenito bb8816
miscfiles_read_localization(dovecot_deliver_t)
Chris PeBenito bb8816
Chris PeBenito bb8816
dovecot_stream_connect_auth(dovecot_deliver_t)
Chris PeBenito bb8816
Chris PeBenito bb8816
files_search_tmp(dovecot_deliver_t)
Chris PeBenito bb8816
Chris PeBenito bb8816
fs_getattr_all_fs(dovecot_deliver_t)
Chris PeBenito bb8816
Chris PeBenito bb8816
userdom_manage_user_home_content_dirs(dovecot_deliver_t)
Chris PeBenito bb8816
userdom_manage_user_home_content_files(dovecot_deliver_t)
Chris PeBenito bb8816
userdom_manage_user_home_content_symlinks(dovecot_deliver_t)
Chris PeBenito bb8816
userdom_manage_user_home_content_pipes(dovecot_deliver_t)
Chris PeBenito bb8816
userdom_manage_user_home_content_sockets(dovecot_deliver_t)
Chris PeBenito bb8816
userdom_user_home_dir_filetrans_user_home_content(dovecot_deliver_t, { dir file lnk_file fifo_file sock_file })
Chris PeBenito bb8816
Chris PeBenito 4dd84b
tunable_policy(`use_nfs_home_dirs',`
Chris PeBenito d8eb3c
	fs_manage_nfs_dirs(dovecot_deliver_t)
Chris PeBenito d8eb3c
	fs_manage_nfs_files(dovecot_deliver_t)
Chris PeBenito d8eb3c
	fs_manage_nfs_symlinks(dovecot_deliver_t)
Chris PeBenito d8eb3c
	fs_manage_nfs_dirs(dovecot_t)
Chris PeBenito 4dd84b
	fs_manage_nfs_files(dovecot_t)
Chris PeBenito 4dd84b
	fs_manage_nfs_symlinks(dovecot_t)
Chris PeBenito 4dd84b
')
Chris PeBenito 4dd84b
Chris PeBenito 4dd84b
tunable_policy(`use_samba_home_dirs',`
Chris PeBenito d8eb3c
	fs_manage_cifs_dirs(dovecot_deliver_t)
Chris PeBenito d8eb3c
	fs_manage_cifs_files(dovecot_deliver_t)
Chris PeBenito d8eb3c
	fs_manage_cifs_symlinks(dovecot_deliver_t)
Chris PeBenito d8eb3c
	fs_manage_cifs_dirs(dovecot_t)
Chris PeBenito 4dd84b
	fs_manage_cifs_files(dovecot_t)
Chris PeBenito 4dd84b
	fs_manage_cifs_symlinks(dovecot_t)
Chris PeBenito 4dd84b
')
Chris PeBenito 4dd84b
Chris PeBenito bb8816
optional_policy(`
Chris PeBenito bb8816
	mta_manage_spool(dovecot_deliver_t)
Chris PeBenito 17de1b
')