selinux-policy/policy/modules/services/dovecot.te

330 lines
9.7 KiB
Plaintext
Raw Normal View History

2010-05-24 19:32:01 +00:00
policy_module(dovecot, 1.12.0)
2005-10-21 15:38:22 +00:00
########################################
#
# Declarations
#
2005-10-25 17:50:00 +00:00
type dovecot_t;
2005-10-21 15:38:22 +00:00
type dovecot_exec_t;
init_daemon_domain(dovecot_t, dovecot_exec_t)
2005-10-21 15:38:22 +00:00
type dovecot_auth_t;
type dovecot_auth_exec_t;
domain_type(dovecot_auth_t)
domain_entry_file(dovecot_auth_t, dovecot_auth_exec_t)
role system_r types dovecot_auth_t;
2009-06-30 19:27:21 +00:00
type dovecot_auth_tmp_t;
files_tmp_file(dovecot_auth_tmp_t)
2005-10-21 15:38:22 +00:00
type dovecot_cert_t;
2010-08-26 13:41:21 +00:00
miscfiles_cert_type(dovecot_cert_t)
2005-10-21 15:38:22 +00:00
2009-06-30 19:27:21 +00:00
type dovecot_deliver_t;
type dovecot_deliver_exec_t;
domain_type(dovecot_deliver_t)
domain_entry_file(dovecot_deliver_t, dovecot_deliver_exec_t)
role system_r types dovecot_deliver_t;
type dovecot_deliver_tmp_t;
files_tmp_file(dovecot_deliver_tmp_t)
2005-10-24 18:40:24 +00:00
type dovecot_etc_t;
files_config_file(dovecot_etc_t)
2005-10-21 15:38:22 +00:00
2009-06-30 19:27:21 +00:00
type dovecot_initrc_exec_t;
init_script_file(dovecot_initrc_exec_t)
2005-10-21 15:38:22 +00:00
type dovecot_passwd_t;
files_type(dovecot_passwd_t)
type dovecot_spool_t;
files_type(dovecot_spool_t)
2010-05-03 18:37:19 +00:00
type dovecot_tmp_t;
files_tmp_file(dovecot_tmp_t)
# /var/lib/dovecot holds SSL parameters file
type dovecot_var_lib_t;
2010-01-07 16:50:47 +00:00
files_type(dovecot_var_lib_t)
2009-06-30 19:27:21 +00:00
type dovecot_var_log_t;
logging_log_file(dovecot_var_log_t)
2005-10-21 15:38:22 +00:00
type dovecot_var_run_t;
files_pid_file(dovecot_var_run_t)
########################################
#
# dovecot local policy
#
2005-11-25 16:43:03 +00:00
2010-05-03 18:37:19 +00:00
allow dovecot_t self:capability { dac_override dac_read_search chown kill net_bind_service setgid setuid sys_chroot };
2005-10-21 15:38:22 +00:00
dontaudit dovecot_t self:capability sys_tty_config;
2010-08-26 13:41:21 +00:00
allow dovecot_t self:process { setrlimit signal_perms getcap setcap setsched };
2006-12-12 20:08:08 +00:00
allow dovecot_t self:fifo_file rw_fifo_file_perms;
2005-10-21 15:38:22 +00:00
allow dovecot_t self:tcp_socket create_stream_socket_perms;
allow dovecot_t self:unix_dgram_socket create_socket_perms;
2005-11-10 21:37:54 +00:00
allow dovecot_t self:unix_stream_socket { create_stream_socket_perms connectto };
2005-10-21 15:38:22 +00:00
2006-12-12 20:08:08 +00:00
domtrans_pattern(dovecot_t, dovecot_auth_exec_t, dovecot_auth_t)
2005-10-21 15:38:22 +00:00
2010-05-03 18:37:19 +00:00
allow dovecot_t dovecot_auth_t:process signal;
2006-12-12 20:08:08 +00:00
allow dovecot_t dovecot_cert_t:dir list_dir_perms;
read_files_pattern(dovecot_t, dovecot_cert_t, dovecot_cert_t)
read_lnk_files_pattern(dovecot_t, dovecot_cert_t, dovecot_cert_t)
2005-10-21 15:38:22 +00:00
2010-08-26 13:41:21 +00:00
allow dovecot_t dovecot_etc_t:dir list_dir_perms;
read_files_pattern(dovecot_t, dovecot_etc_t, dovecot_etc_t)
2005-10-21 15:38:22 +00:00
files_search_etc(dovecot_t)
can_exec(dovecot_t, dovecot_exec_t)
2010-05-03 18:37:19 +00:00
manage_dirs_pattern(dovecot_t, dovecot_tmp_t, dovecot_tmp_t)
manage_files_pattern(dovecot_t, dovecot_tmp_t, dovecot_tmp_t)
files_tmp_filetrans(dovecot_t, dovecot_tmp_t, { file dir })
# Allow dovecot to create and read SSL parameters file
manage_files_pattern(dovecot_t, dovecot_var_lib_t, dovecot_var_lib_t)
files_search_var_lib(dovecot_t)
files_read_var_symlinks(dovecot_t)
manage_dirs_pattern(dovecot_t, dovecot_var_log_t, dovecot_var_log_t)
2009-06-30 19:27:21 +00:00
manage_files_pattern(dovecot_t, dovecot_var_log_t, dovecot_var_log_t)
2010-05-03 18:37:19 +00:00
logging_log_filetrans(dovecot_t, dovecot_var_log_t, { file dir })
2009-06-30 19:27:21 +00:00
manage_dirs_pattern(dovecot_t, dovecot_spool_t, dovecot_spool_t)
manage_files_pattern(dovecot_t, dovecot_spool_t, dovecot_spool_t)
manage_lnk_files_pattern(dovecot_t, dovecot_spool_t, dovecot_spool_t)
2005-10-21 15:38:22 +00:00
2010-08-26 13:41:21 +00:00
manage_dirs_pattern(dovecot_t, dovecot_var_run_t, dovecot_var_run_t)
manage_files_pattern(dovecot_t, dovecot_var_run_t, dovecot_var_run_t)
2010-05-03 18:37:19 +00:00
manage_lnk_files_pattern(dovecot_t, dovecot_var_run_t, dovecot_var_run_t)
manage_sock_files_pattern(dovecot_t, dovecot_var_run_t, dovecot_var_run_t)
2010-08-26 13:41:21 +00:00
files_pid_filetrans(dovecot_t, dovecot_var_run_t, { dir file })
2005-10-21 15:38:22 +00:00
kernel_read_kernel_sysctls(dovecot_t)
2005-10-21 15:38:22 +00:00
kernel_read_system_state(dovecot_t)
corenet_all_recvfrom_unlabeled(dovecot_t)
corenet_all_recvfrom_netlabel(dovecot_t)
corenet_tcp_sendrecv_generic_if(dovecot_t)
corenet_tcp_sendrecv_generic_node(dovecot_t)
2005-10-21 15:38:22 +00:00
corenet_tcp_sendrecv_all_ports(dovecot_t)
corenet_tcp_bind_generic_node(dovecot_t)
2010-05-03 18:37:19 +00:00
corenet_tcp_bind_mail_port(dovecot_t)
2005-10-21 21:35:25 +00:00
corenet_tcp_bind_pop_port(dovecot_t)
2005-10-21 19:36:49 +00:00
corenet_tcp_connect_all_ports(dovecot_t)
corenet_tcp_connect_postgresql_port(dovecot_t)
2006-06-02 15:06:45 +00:00
corenet_sendrecv_pop_server_packets(dovecot_t)
corenet_sendrecv_all_client_packets(dovecot_t)
2005-10-21 15:38:22 +00:00
dev_read_sysfs(dovecot_t)
dev_read_urand(dovecot_t)
fs_getattr_all_fs(dovecot_t)
2010-05-03 18:37:19 +00:00
fs_getattr_all_dirs(dovecot_t)
2005-10-21 15:38:22 +00:00
fs_search_auto_mountpoints(dovecot_t)
fs_list_inotifyfs(dovecot_t)
2005-10-21 15:38:22 +00:00
corecmd_exec_bin(dovecot_t)
2006-02-20 21:33:25 +00:00
domain_use_interactive_fds(dovecot_t)
2005-10-21 15:38:22 +00:00
files_read_etc_files(dovecot_t)
files_search_spool(dovecot_t)
files_search_tmp(dovecot_t)
2006-01-06 22:51:40 +00:00
files_dontaudit_list_default(dovecot_t)
# Dovecot now has quota support and it uses getmntent() to find the mountpoints.
files_read_etc_runtime_files(dovecot_t)
2009-06-30 19:27:21 +00:00
files_search_all_mountpoints(dovecot_t)
2005-10-21 15:38:22 +00:00
init_getattr_utmp(dovecot_t)
2005-10-21 15:38:22 +00:00
auth_use_nsswitch(dovecot_t)
2005-10-21 15:38:22 +00:00
logging_send_syslog_msg(dovecot_t)
miscfiles_read_generic_certs(dovecot_t)
2005-10-21 15:38:22 +00:00
miscfiles_read_localization(dovecot_t)
2006-02-20 21:33:25 +00:00
userdom_dontaudit_use_unpriv_user_fds(dovecot_t)
2008-11-05 16:10:46 +00:00
userdom_manage_user_home_content_dirs(dovecot_t)
userdom_manage_user_home_content_files(dovecot_t)
userdom_manage_user_home_content_symlinks(dovecot_t)
userdom_manage_user_home_content_pipes(dovecot_t)
userdom_manage_user_home_content_sockets(dovecot_t)
userdom_user_home_dir_filetrans_user_home_content(dovecot_t, { dir file lnk_file fifo_file sock_file })
2005-10-21 15:38:22 +00:00
mta_manage_spool(dovecot_t)
2005-10-21 15:38:22 +00:00
optional_policy(`
2009-06-30 19:27:21 +00:00
kerberos_keytab_template(dovecot, dovecot_t)
2005-10-21 15:38:22 +00:00
')
2010-08-26 13:41:21 +00:00
optional_policy(`
postfix_manage_private_sockets(dovecot_t)
postfix_search_spool(dovecot_t)
2010-08-26 13:41:21 +00:00
')
2010-05-03 18:37:19 +00:00
optional_policy(`
postgresql_stream_connect(dovecot_t)
')
optional_policy(`
2005-10-21 15:38:22 +00:00
seutil_sigchld_newrole(dovecot_t)
')
optional_policy(`
squid_dontaudit_search_cache(dovecot_t)
')
optional_policy(`
2005-10-21 15:38:22 +00:00
udev_read_db(dovecot_t)
')
########################################
#
# dovecot auth local policy
#
2005-11-25 16:43:03 +00:00
2009-06-30 19:27:21 +00:00
allow dovecot_auth_t self:capability { chown dac_override setgid setuid };
2010-01-07 16:50:47 +00:00
allow dovecot_auth_t self:process { signal_perms getcap setcap };
2006-12-12 20:08:08 +00:00
allow dovecot_auth_t self:fifo_file rw_fifo_file_perms;
2005-10-21 15:38:22 +00:00
allow dovecot_auth_t self:unix_dgram_socket create_socket_perms;
allow dovecot_auth_t self:unix_stream_socket create_stream_socket_perms;
2009-06-30 19:27:21 +00:00
allow dovecot_auth_t dovecot_t:unix_stream_socket { connectto rw_stream_socket_perms };
read_files_pattern(dovecot_auth_t, dovecot_passwd_t, dovecot_passwd_t)
2005-10-21 15:38:22 +00:00
2009-06-30 19:27:21 +00:00
manage_dirs_pattern(dovecot_auth_t, dovecot_auth_tmp_t, dovecot_auth_tmp_t)
manage_files_pattern(dovecot_auth_t, dovecot_auth_tmp_t, dovecot_auth_tmp_t)
files_tmp_filetrans(dovecot_auth_t, dovecot_auth_tmp_t, { file dir })
2005-10-21 15:38:22 +00:00
allow dovecot_auth_t dovecot_var_run_t:dir list_dir_perms;
2009-06-30 19:27:21 +00:00
manage_sock_files_pattern(dovecot_auth_t, dovecot_var_run_t, dovecot_var_run_t)
dovecot_stream_connect_auth(dovecot_auth_t)
2005-12-13 20:38:19 +00:00
kernel_read_all_sysctls(dovecot_auth_t)
2005-10-21 15:38:22 +00:00
kernel_read_system_state(dovecot_auth_t)
2009-06-30 19:27:21 +00:00
logging_send_audit_msgs(dovecot_auth_t)
logging_send_syslog_msg(dovecot_auth_t)
2005-10-21 15:38:22 +00:00
dev_read_urand(dovecot_auth_t)
auth_domtrans_chk_passwd(dovecot_auth_t)
2005-11-29 21:51:24 +00:00
auth_use_nsswitch(dovecot_auth_t)
2005-10-21 15:38:22 +00:00
files_read_etc_files(dovecot_auth_t)
2005-11-29 21:51:24 +00:00
files_read_etc_runtime_files(dovecot_auth_t)
2005-10-21 15:38:22 +00:00
files_search_pids(dovecot_auth_t)
2009-06-30 19:27:21 +00:00
files_read_usr_files(dovecot_auth_t)
2005-12-13 20:38:19 +00:00
files_read_usr_symlinks(dovecot_auth_t)
2010-05-03 18:37:19 +00:00
files_read_var_lib_files(dovecot_auth_t)
2005-12-13 20:38:19 +00:00
files_search_tmp(dovecot_auth_t)
files_read_var_lib_files(dovecot_t)
2005-10-21 15:38:22 +00:00
init_rw_utmp(dovecot_auth_t)
2005-10-21 15:38:22 +00:00
miscfiles_read_localization(dovecot_auth_t)
seutil_dontaudit_search_config(dovecot_auth_t)
optional_policy(`
2005-10-21 15:38:22 +00:00
kerberos_use(dovecot_auth_t)
2010-01-07 16:50:47 +00:00
# for gssapi (kerberos)
userdom_list_user_tmp(dovecot_auth_t)
userdom_read_user_tmp_files(dovecot_auth_t)
userdom_read_user_tmp_symlinks(dovecot_auth_t)
2005-10-21 15:38:22 +00:00
')
optional_policy(`
2009-06-30 19:27:21 +00:00
mysql_search_db(dovecot_auth_t)
mysql_stream_connect(dovecot_auth_t)
')
optional_policy(`
nis_authenticate(dovecot_auth_t)
')
optional_policy(`
2010-08-26 13:41:21 +00:00
postfix_manage_private_sockets(dovecot_auth_t)
2009-06-30 19:27:21 +00:00
postfix_search_spool(dovecot_auth_t)
')
########################################
#
# dovecot deliver local policy
#
allow dovecot_deliver_t self:unix_dgram_socket create_socket_perms;
2010-05-03 18:37:19 +00:00
allow dovecot_deliver_t dovecot_t:process signull;
2010-08-26 13:41:21 +00:00
read_files_pattern(dovecot_deliver_t, dovecot_etc_t, dovecot_etc_t)
2009-06-30 19:27:21 +00:00
allow dovecot_deliver_t dovecot_var_run_t:dir list_dir_perms;
2010-08-26 13:41:21 +00:00
allow dovecot_deliver_t dovecot_cert_t:dir search_dir_perms;
append_files_pattern(dovecot_deliver_t, dovecot_var_log_t, dovecot_var_log_t)
2010-08-26 13:41:21 +00:00
manage_dirs_pattern(dovecot_deliver_t, dovecot_deliver_tmp_t, dovecot_deliver_tmp_t)
manage_files_pattern(dovecot_deliver_t, dovecot_deliver_tmp_t, dovecot_deliver_tmp_t)
files_tmp_filetrans(dovecot_deliver_t, dovecot_deliver_tmp_t, { file dir })
2010-08-26 13:41:21 +00:00
can_exec(dovecot_deliver_t, dovecot_deliver_exec_t)
2009-06-30 19:27:21 +00:00
kernel_read_all_sysctls(dovecot_deliver_t)
kernel_read_system_state(dovecot_deliver_t)
2010-08-26 13:41:21 +00:00
corecmd_exec_bin(dovecot_deliver_t)
2009-06-30 19:27:21 +00:00
files_read_etc_files(dovecot_deliver_t)
files_read_etc_runtime_files(dovecot_deliver_t)
auth_use_nsswitch(dovecot_deliver_t)
logging_send_syslog_msg(dovecot_deliver_t)
logging_append_all_logs(dovecot_deliver_t)
2009-06-30 19:27:21 +00:00
miscfiles_read_localization(dovecot_deliver_t)
dovecot_stream_connect_auth(dovecot_deliver_t)
files_search_tmp(dovecot_deliver_t)
fs_getattr_all_fs(dovecot_deliver_t)
userdom_manage_user_home_content_dirs(dovecot_deliver_t)
userdom_manage_user_home_content_files(dovecot_deliver_t)
userdom_manage_user_home_content_symlinks(dovecot_deliver_t)
userdom_manage_user_home_content_pipes(dovecot_deliver_t)
userdom_manage_user_home_content_sockets(dovecot_deliver_t)
userdom_user_home_dir_filetrans_user_home_content(dovecot_deliver_t, { dir file lnk_file fifo_file sock_file })
2010-01-07 16:50:47 +00:00
tunable_policy(`use_nfs_home_dirs',`
2010-05-03 18:37:19 +00:00
fs_manage_nfs_dirs(dovecot_deliver_t)
fs_manage_nfs_files(dovecot_deliver_t)
fs_manage_nfs_symlinks(dovecot_deliver_t)
fs_manage_nfs_dirs(dovecot_t)
2010-01-07 16:50:47 +00:00
fs_manage_nfs_files(dovecot_t)
fs_manage_nfs_symlinks(dovecot_t)
')
tunable_policy(`use_samba_home_dirs',`
2010-05-03 18:37:19 +00:00
fs_manage_cifs_dirs(dovecot_deliver_t)
fs_manage_cifs_files(dovecot_deliver_t)
fs_manage_cifs_symlinks(dovecot_deliver_t)
fs_manage_cifs_dirs(dovecot_t)
2010-01-07 16:50:47 +00:00
fs_manage_cifs_files(dovecot_t)
fs_manage_cifs_symlinks(dovecot_t)
')
2009-06-30 19:27:21 +00:00
optional_policy(`
mta_manage_spool(dovecot_deliver_t)
2010-08-26 13:41:21 +00:00
mta_read_queue(dovecot_deliver_t)
2005-10-21 15:38:22 +00:00
')