summaryrefslogtreecommitdiff
path: root/policy/modules/services/dovecot.te
blob: 166d4dca53f663030a1dd5ada36aac862de5cde0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203

policy_module(dovecot,1.2.4)

########################################
#
# Declarations
#
type dovecot_t;
type dovecot_exec_t;
init_daemon_domain(dovecot_t,dovecot_exec_t)

type dovecot_cert_t;
files_type(dovecot_cert_t)

type dovecot_etc_t;
files_config_file(dovecot_etc_t)

type dovecot_passwd_t;
files_type(dovecot_passwd_t)

type dovecot_spool_t;
files_type(dovecot_spool_t)

type dovecot_var_run_t;
files_pid_file(dovecot_var_run_t)

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;

########################################
#
# dovecot local policy
#

allow dovecot_t self:capability { dac_override dac_read_search chown net_bind_service setgid setuid sys_chroot };
dontaudit dovecot_t self:capability sys_tty_config;
allow dovecot_t self:process { setrlimit signal_perms };
allow dovecot_t self:fifo_file rw_file_perms;
allow dovecot_t self:tcp_socket create_stream_socket_perms;
allow dovecot_t self:unix_dgram_socket create_socket_perms;
allow dovecot_t self:unix_stream_socket { create_stream_socket_perms connectto };
allow dovecot_t self:netlink_route_socket r_netlink_socket_perms;

domain_auto_trans(dovecot_t, dovecot_auth_exec_t, dovecot_auth_t)
allow dovecot_t dovecot_auth_t:fd use;
allow dovecot_auth_t dovecot_t:process sigchld;
allow dovecot_auth_t dovecot_t:fd use;
allow dovecot_auth_t dovecot_t:fifo_file { ioctl read write getattr lock append };

allow dovecot_t dovecot_cert_t:dir r_dir_perms;
allow dovecot_t dovecot_cert_t:file r_file_perms;
allow dovecot_t dovecot_cert_t:lnk_file { getattr read };

allow dovecot_t dovecot_etc_t:file r_file_perms;
files_search_etc(dovecot_t)

can_exec(dovecot_t, dovecot_exec_t)

allow dovecot_t dovecot_spool_t:dir create_dir_perms;
allow dovecot_t dovecot_spool_t:file create_file_perms;
allow dovecot_t dovecot_spool_t:lnk_file create_lnk_perms;

allow dovecot_t dovecot_var_run_t:file create_file_perms;
allow dovecot_t dovecot_var_run_t:sock_file create_file_perms;
allow dovecot_t dovecot_var_run_t:dir rw_dir_perms;
files_pid_filetrans(dovecot_t,dovecot_var_run_t,file)

kernel_read_kernel_sysctls(dovecot_t)
kernel_read_system_state(dovecot_t)

corenet_non_ipsec_sendrecv(dovecot_t)
corenet_tcp_sendrecv_all_if(dovecot_t)
corenet_tcp_sendrecv_all_nodes(dovecot_t)
corenet_tcp_sendrecv_all_ports(dovecot_t)
corenet_tcp_bind_all_nodes(dovecot_t)
corenet_tcp_bind_pop_port(dovecot_t)
corenet_tcp_connect_all_ports(dovecot_t)
corenet_tcp_connect_postgresql_port(dovecot_t)
corenet_sendrecv_pop_server_packets(dovecot_t)
corenet_sendrecv_all_client_packets(dovecot_t)

dev_read_sysfs(dovecot_t)
dev_read_urand(dovecot_t)

fs_getattr_all_fs(dovecot_t)
fs_search_auto_mountpoints(dovecot_t)
fs_list_inotifyfs(dovecot_t)

term_dontaudit_use_console(dovecot_t)

corecmd_exec_bin(dovecot_t)

domain_use_interactive_fds(dovecot_t)

files_read_etc_files(dovecot_t)
files_search_spool(dovecot_t)
files_search_tmp(dovecot_t)
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)
files_getattr_all_mountpoints(dovecot_t)

init_use_fds(dovecot_t)
init_use_script_ptys(dovecot_t)
init_getattr_utmp(dovecot_t)

libs_use_ld_so(dovecot_t)
libs_use_shared_libs(dovecot_t)

logging_send_syslog_msg(dovecot_t)

miscfiles_read_certs(dovecot_t)
miscfiles_read_localization(dovecot_t)

sysnet_read_config(dovecot_t)
sysnet_use_ldap(dovecot_auth_t)

userdom_dontaudit_use_unpriv_user_fds(dovecot_t)
userdom_dontaudit_search_sysadm_home_dirs(dovecot_t)
userdom_priveleged_home_dir_manager(dovecot_t)

mta_manage_spool(dovecot_t)

ifdef(`targeted_policy',`
	term_dontaudit_use_unallocated_ttys(dovecot_t)
	term_dontaudit_use_generic_ptys(dovecot_t)
	files_dontaudit_read_root_files(dovecot_t)
')

optional_policy(`
	kerberos_use(dovecot_t)
')

optional_policy(`
	nis_use_ypbind(dovecot_t)
')

optional_policy(`
	seutil_sigchld_newrole(dovecot_t)
')

optional_policy(`
	udev_read_db(dovecot_t)
')

########################################
#
# dovecot auth local policy
#

allow dovecot_auth_t self:capability { setgid setuid };
allow dovecot_auth_t self:process signal_perms;
allow dovecot_auth_t self:fifo_file rw_file_perms;
allow dovecot_auth_t self:unix_dgram_socket create_socket_perms;
allow dovecot_auth_t self:unix_stream_socket create_stream_socket_perms;

allow dovecot_auth_t dovecot_t:unix_stream_socket { getattr accept read write ioctl };

allow dovecot_auth_t dovecot_passwd_t:file { getattr read };

allow dovecot_auth_t dovecot_var_run_t:dir r_dir_perms;

kernel_read_all_sysctls(dovecot_auth_t)
kernel_read_system_state(dovecot_auth_t)

dev_read_urand(dovecot_auth_t)

auth_domtrans_chk_passwd(dovecot_auth_t)
auth_use_nsswitch(dovecot_auth_t)

files_read_etc_files(dovecot_auth_t)
files_read_etc_runtime_files(dovecot_auth_t)
files_search_pids(dovecot_auth_t)
files_read_usr_symlinks(dovecot_auth_t)
files_search_tmp(dovecot_auth_t)

libs_use_ld_so(dovecot_auth_t)
libs_use_shared_libs(dovecot_auth_t)

miscfiles_read_localization(dovecot_auth_t)

seutil_dontaudit_search_config(dovecot_auth_t)

sysnet_dns_name_resolve(dovecot_auth_t)

optional_policy(`
	kerberos_use(dovecot_auth_t)
')

optional_policy(`
	logging_send_syslog_msg(dovecot_auth_t)
')

optional_policy(`
	nis_use_ypbind(dovecot_auth_t)
')

optional_policy(`
	nscd_socket_use(dovecot_auth_t)
')