]> git.ipfire.org Git - people/stevee/selinux-policy.git/blob - policy/modules/services/dovecot.te
Change all calls that use the use_nfs_home_dirs to use attributes for either userdom_...
[people/stevee/selinux-policy.git] / policy / modules / services / dovecot.te
1 policy_module(dovecot, 1.12.1)
2
3 ########################################
4 #
5 # Declarations
6 #
7 type dovecot_t;
8 type dovecot_exec_t;
9 init_daemon_domain(dovecot_t, dovecot_exec_t)
10
11 type dovecot_auth_t;
12 type dovecot_auth_exec_t;
13 domain_type(dovecot_auth_t)
14 domain_entry_file(dovecot_auth_t, dovecot_auth_exec_t)
15 role system_r types dovecot_auth_t;
16
17 type dovecot_auth_tmp_t;
18 files_tmp_file(dovecot_auth_tmp_t)
19
20 type dovecot_cert_t;
21 miscfiles_cert_type(dovecot_cert_t)
22
23 type dovecot_deliver_t;
24 type dovecot_deliver_exec_t;
25 domain_type(dovecot_deliver_t)
26 domain_entry_file(dovecot_deliver_t, dovecot_deliver_exec_t)
27 role system_r types dovecot_deliver_t;
28
29 type dovecot_deliver_tmp_t;
30 files_tmp_file(dovecot_deliver_tmp_t)
31
32 type dovecot_etc_t;
33 files_config_file(dovecot_etc_t)
34
35 type dovecot_initrc_exec_t;
36 init_script_file(dovecot_initrc_exec_t)
37
38 type dovecot_passwd_t;
39 files_type(dovecot_passwd_t)
40
41 type dovecot_spool_t;
42 files_spool_file(dovecot_spool_t)
43
44 type dovecot_tmp_t;
45 files_tmp_file(dovecot_tmp_t)
46
47 # /var/lib/dovecot holds SSL parameters file
48 type dovecot_var_lib_t;
49 files_type(dovecot_var_lib_t)
50
51 type dovecot_var_log_t;
52 logging_log_file(dovecot_var_log_t)
53
54 type dovecot_var_run_t;
55 files_pid_file(dovecot_var_run_t)
56
57 ########################################
58 #
59 # dovecot local policy
60 #
61
62 allow dovecot_t self:capability { dac_override dac_read_search chown fsetid kill net_bind_service setgid setuid sys_chroot };
63 dontaudit dovecot_t self:capability sys_tty_config;
64 allow dovecot_t self:process { setrlimit signal_perms getcap setcap setsched };
65 allow dovecot_t self:fifo_file rw_fifo_file_perms;
66 allow dovecot_t self:tcp_socket create_stream_socket_perms;
67 allow dovecot_t self:unix_dgram_socket create_socket_perms;
68 allow dovecot_t self:unix_stream_socket { create_stream_socket_perms connectto };
69
70 domtrans_pattern(dovecot_t, dovecot_auth_exec_t, dovecot_auth_t)
71
72 allow dovecot_t dovecot_auth_t:process signal;
73
74 allow dovecot_t dovecot_cert_t:dir list_dir_perms;
75 read_files_pattern(dovecot_t, dovecot_cert_t, dovecot_cert_t)
76 read_lnk_files_pattern(dovecot_t, dovecot_cert_t, dovecot_cert_t)
77
78 allow dovecot_t dovecot_etc_t:dir list_dir_perms;
79 read_files_pattern(dovecot_t, dovecot_etc_t, dovecot_etc_t)
80 read_lnk_files_pattern(dovecot_t, dovecot_etc_t, dovecot_etc_t)
81 files_search_etc(dovecot_t)
82
83 can_exec(dovecot_t, dovecot_exec_t)
84
85 manage_dirs_pattern(dovecot_t, dovecot_tmp_t, dovecot_tmp_t)
86 manage_files_pattern(dovecot_t, dovecot_tmp_t, dovecot_tmp_t)
87 files_tmp_filetrans(dovecot_t, dovecot_tmp_t, { file dir })
88
89 # Allow dovecot to create and read SSL parameters file
90 manage_files_pattern(dovecot_t, dovecot_var_lib_t, dovecot_var_lib_t)
91 files_search_var_lib(dovecot_t)
92 files_read_var_symlinks(dovecot_t)
93
94 manage_dirs_pattern(dovecot_t, dovecot_var_log_t, dovecot_var_log_t)
95 manage_files_pattern(dovecot_t, dovecot_var_log_t, dovecot_var_log_t)
96 logging_log_filetrans(dovecot_t, dovecot_var_log_t, { file dir })
97
98 manage_dirs_pattern(dovecot_t, dovecot_spool_t, dovecot_spool_t)
99 manage_files_pattern(dovecot_t, dovecot_spool_t, dovecot_spool_t)
100 manage_lnk_files_pattern(dovecot_t, dovecot_spool_t, dovecot_spool_t)
101
102 manage_dirs_pattern(dovecot_t, dovecot_var_run_t, dovecot_var_run_t)
103 manage_files_pattern(dovecot_t, dovecot_var_run_t, dovecot_var_run_t)
104 manage_lnk_files_pattern(dovecot_t, dovecot_var_run_t, dovecot_var_run_t)
105 manage_sock_files_pattern(dovecot_t, dovecot_var_run_t, dovecot_var_run_t)
106 files_pid_filetrans(dovecot_t, dovecot_var_run_t, { dir file })
107
108 kernel_read_kernel_sysctls(dovecot_t)
109 kernel_read_system_state(dovecot_t)
110
111 corenet_all_recvfrom_unlabeled(dovecot_t)
112 corenet_all_recvfrom_netlabel(dovecot_t)
113 corenet_tcp_sendrecv_generic_if(dovecot_t)
114 corenet_tcp_sendrecv_generic_node(dovecot_t)
115 corenet_tcp_sendrecv_all_ports(dovecot_t)
116 corenet_tcp_bind_generic_node(dovecot_t)
117 corenet_tcp_bind_mail_port(dovecot_t)
118 corenet_tcp_bind_pop_port(dovecot_t)
119 corenet_tcp_bind_lmtp_port(dovecot_t)
120 corenet_tcp_bind_sieve_port(dovecot_t)
121 corenet_tcp_connect_all_ports(dovecot_t)
122 corenet_tcp_connect_postgresql_port(dovecot_t)
123 corenet_sendrecv_pop_server_packets(dovecot_t)
124 corenet_sendrecv_all_client_packets(dovecot_t)
125
126 dev_read_sysfs(dovecot_t)
127 dev_read_urand(dovecot_t)
128
129 fs_getattr_all_fs(dovecot_t)
130 fs_getattr_all_dirs(dovecot_t)
131 fs_search_auto_mountpoints(dovecot_t)
132 fs_list_inotifyfs(dovecot_t)
133
134 corecmd_exec_bin(dovecot_t)
135
136 domain_use_interactive_fds(dovecot_t)
137
138 files_read_etc_files(dovecot_t)
139 files_search_spool(dovecot_t)
140 files_search_tmp(dovecot_t)
141 files_dontaudit_list_default(dovecot_t)
142 # Dovecot now has quota support and it uses getmntent() to find the mountpoints.
143 files_read_etc_runtime_files(dovecot_t)
144 files_search_all_mountpoints(dovecot_t)
145 files_read_var_lib_files(dovecot_t)
146
147 init_getattr_utmp(dovecot_t)
148
149 auth_use_nsswitch(dovecot_t)
150
151 logging_send_syslog_msg(dovecot_t)
152
153 miscfiles_read_generic_certs(dovecot_t)
154 miscfiles_read_localization(dovecot_t)
155
156 userdom_home_manager(dovecot_t)
157 userdom_dontaudit_use_unpriv_user_fds(dovecot_t)
158 userdom_manage_user_home_content_dirs(dovecot_t)
159 userdom_manage_user_home_content_files(dovecot_t)
160 userdom_manage_user_home_content_symlinks(dovecot_t)
161 userdom_manage_user_home_content_pipes(dovecot_t)
162 userdom_manage_user_home_content_sockets(dovecot_t)
163 userdom_user_home_dir_filetrans_user_home_content(dovecot_t, { dir file lnk_file fifo_file sock_file })
164
165 mta_manage_spool(dovecot_t)
166
167 optional_policy(`
168 kerberos_keytab_template(dovecot, dovecot_t)
169 ')
170
171 optional_policy(`
172 gnome_manage_data(dovecot_t)
173 ')
174
175 optional_policy(`
176 postfix_manage_private_sockets(dovecot_t)
177 postfix_search_spool(dovecot_t)
178 ')
179
180 optional_policy(`
181 postgresql_stream_connect(dovecot_t)
182 ')
183
184 optional_policy(`
185 seutil_sigchld_newrole(dovecot_t)
186 ')
187
188 optional_policy(`
189 squid_dontaudit_search_cache(dovecot_t)
190 ')
191
192 optional_policy(`
193 udev_read_db(dovecot_t)
194 ')
195
196 ########################################
197 #
198 # dovecot auth local policy
199 #
200
201 allow dovecot_auth_t self:capability { chown dac_override ipc_lock setgid setuid sys_nice };
202 allow dovecot_auth_t self:process { getsched setsched signal_perms getcap setcap };
203 allow dovecot_auth_t self:fifo_file rw_fifo_file_perms;
204 allow dovecot_auth_t self:unix_dgram_socket create_socket_perms;
205 allow dovecot_auth_t self:unix_stream_socket create_stream_socket_perms;
206
207 allow dovecot_auth_t dovecot_t:unix_stream_socket { connectto rw_stream_socket_perms };
208
209 read_files_pattern(dovecot_auth_t, dovecot_passwd_t, dovecot_passwd_t)
210
211 read_files_pattern(dovecot_auth_t, dovecot_etc_t, dovecot_etc_t)
212 read_lnk_files_pattern(dovecot_auth_t, dovecot_etc_t, dovecot_etc_t)
213
214 manage_dirs_pattern(dovecot_auth_t, dovecot_auth_tmp_t, dovecot_auth_tmp_t)
215 manage_files_pattern(dovecot_auth_t, dovecot_auth_tmp_t, dovecot_auth_tmp_t)
216 files_tmp_filetrans(dovecot_auth_t, dovecot_auth_tmp_t, { file dir })
217
218 allow dovecot_auth_t dovecot_var_run_t:dir list_dir_perms;
219 manage_sock_files_pattern(dovecot_auth_t, dovecot_var_run_t, dovecot_var_run_t)
220 dovecot_stream_connect_auth(dovecot_auth_t)
221
222 kernel_read_all_sysctls(dovecot_auth_t)
223 kernel_read_system_state(dovecot_auth_t)
224
225 corecmd_exec_bin(dovecot_auth_t)
226
227 logging_send_audit_msgs(dovecot_auth_t)
228 logging_send_syslog_msg(dovecot_auth_t)
229
230 dev_search_sysfs(dovecot_auth_t)
231 dev_read_urand(dovecot_auth_t)
232
233 auth_domtrans_chk_passwd(dovecot_auth_t)
234 auth_use_nsswitch(dovecot_auth_t)
235
236 files_read_etc_files(dovecot_auth_t)
237 files_read_etc_runtime_files(dovecot_auth_t)
238 files_search_pids(dovecot_auth_t)
239 files_read_usr_files(dovecot_auth_t)
240 files_read_usr_symlinks(dovecot_auth_t)
241 files_read_var_lib_files(dovecot_auth_t)
242 files_search_tmp(dovecot_auth_t)
243
244 fs_getattr_xattr_fs(dovecot_auth_t)
245
246 init_rw_utmp(dovecot_auth_t)
247
248 miscfiles_read_localization(dovecot_auth_t)
249
250 seutil_dontaudit_search_config(dovecot_auth_t)
251
252 optional_policy(`
253 kerberos_use(dovecot_auth_t)
254
255 # for gssapi (kerberos)
256 userdom_list_user_tmp(dovecot_auth_t)
257 userdom_read_user_tmp_files(dovecot_auth_t)
258 userdom_read_user_tmp_symlinks(dovecot_auth_t)
259 ')
260
261 optional_policy(`
262 mysql_search_db(dovecot_auth_t)
263 mysql_stream_connect(dovecot_auth_t)
264 mysql_read_config(dovecot_auth_t)
265 mysql_tcp_connect(dovecot_auth_t)
266 ')
267
268 optional_policy(`
269 nis_authenticate(dovecot_auth_t)
270 ')
271
272 optional_policy(`
273 postfix_manage_private_sockets(dovecot_auth_t)
274 postfix_rw_master_pipes(dovecot_deliver_t)
275 postfix_search_spool(dovecot_auth_t)
276 ')
277
278 ########################################
279 #
280 # dovecot deliver local policy
281 #
282
283 allow dovecot_deliver_t self:fifo_file rw_fifo_file_perms;
284 allow dovecot_deliver_t self:unix_dgram_socket create_socket_perms;
285
286 allow dovecot_deliver_t dovecot_t:process signull;
287
288 allow dovecot_deliver_t dovecot_etc_t:dir list_dir_perms;
289 read_files_pattern(dovecot_deliver_t, dovecot_etc_t, dovecot_etc_t)
290 read_lnk_files_pattern(dovecot_deliver_t, dovecot_etc_t, dovecot_etc_t)
291
292 allow dovecot_deliver_t dovecot_cert_t:dir search_dir_perms;
293
294 append_files_pattern(dovecot_deliver_t, dovecot_var_log_t, dovecot_var_log_t)
295
296 manage_dirs_pattern(dovecot_deliver_t, dovecot_deliver_tmp_t, dovecot_deliver_tmp_t)
297 manage_files_pattern(dovecot_deliver_t, dovecot_deliver_tmp_t, dovecot_deliver_tmp_t)
298 files_tmp_filetrans(dovecot_deliver_t, dovecot_deliver_tmp_t, { file dir })
299
300 allow dovecot_deliver_t dovecot_var_run_t:dir list_dir_perms;
301 read_sock_files_pattern(dovecot_deliver_t, dovecot_var_run_t, dovecot_var_run_t)
302 dovecot_stream_connect(dovecot_deliver_t)
303
304 can_exec(dovecot_deliver_t, dovecot_deliver_exec_t)
305
306 kernel_read_all_sysctls(dovecot_deliver_t)
307 kernel_read_system_state(dovecot_deliver_t)
308
309 corecmd_exec_bin(dovecot_deliver_t)
310
311 files_read_etc_files(dovecot_deliver_t)
312 files_read_etc_runtime_files(dovecot_deliver_t)
313
314 auth_use_nsswitch(dovecot_deliver_t)
315
316 logging_send_syslog_msg(dovecot_deliver_t)
317 logging_append_all_logs(dovecot_deliver_t)
318
319 miscfiles_read_localization(dovecot_deliver_t)
320
321 dovecot_stream_connect_auth(dovecot_deliver_t)
322
323 files_search_tmp(dovecot_deliver_t)
324
325 fs_getattr_all_fs(dovecot_deliver_t)
326
327 userdom_manage_user_home_content_dirs(dovecot_deliver_t)
328 userdom_manage_user_home_content_files(dovecot_deliver_t)
329 userdom_manage_user_home_content_symlinks(dovecot_deliver_t)
330 userdom_manage_user_home_content_pipes(dovecot_deliver_t)
331 userdom_manage_user_home_content_sockets(dovecot_deliver_t)
332 userdom_user_home_dir_filetrans_user_home_content(dovecot_deliver_t, { dir file lnk_file fifo_file sock_file })
333
334 userdom_home_manager(dovecot_deliver_t)
335
336 optional_policy(`
337 gnome_manage_data(dovecot_deliver_t)
338 ')
339
340 optional_policy(`
341 mta_manage_spool(dovecot_deliver_t)
342 mta_read_queue(dovecot_deliver_t)
343 ')
344
345 optional_policy(`
346 postfix_use_fds_master(dovecot_deliver_t)
347 ')
348
349 optional_policy(`
350 # Handle sieve scripts
351 sendmail_domtrans(dovecot_deliver_t)
352 ')