aboutsummaryrefslogtreecommitdiff
blob: b208631f33b5a166f489f395a447852d557e2bbc (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
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
policy_module(spamassassin, 2.8.0)

########################################
#
# Declarations
#

## <desc>
##	<p>
##	Determine whether spamassassin
##	clients can use the network.
##	</p>
## </desc>
gen_tunable(spamassassin_can_network, false)

## <desc>
##	<p>
##	Determine whether spamd can manage
##	generic user home content.
##	</p>
## </desc>
gen_tunable(spamd_enable_home_dirs, false)

type spamd_update_t;
type spamd_update_exec_t;
init_system_domain(spamd_update_t, spamd_update_exec_t)

type spamassassin_t;
type spamassassin_exec_t;
typealias spamassassin_t alias { user_spamassassin_t staff_spamassassin_t sysadm_spamassassin_t };
typealias spamassassin_t alias { auditadm_spamassassin_t secadm_spamassassin_t };
userdom_user_application_domain(spamassassin_t, spamassassin_exec_t)

type spamassassin_home_t;
typealias spamassassin_home_t alias { user_spamassassin_home_t staff_spamassassin_home_t sysadm_spamassassin_home_t };
typealias spamassassin_home_t alias { auditadm_spamassassin_home_t secadm_spamassassin_home_t };
userdom_user_home_content(spamassassin_home_t)

type spamassassin_tmp_t;
typealias spamassassin_tmp_t alias { user_spamassassin_tmp_t staff_spamassassin_tmp_t sysadm_spamassassin_tmp_t };
typealias spamassassin_tmp_t alias { auditadm_spamassassin_tmp_t secadm_spamassassin_tmp_t };
userdom_user_tmp_file(spamassassin_tmp_t)

type spamc_t;
type spamc_exec_t;
typealias spamc_t alias { user_spamc_t staff_spamc_t sysadm_spamc_t };
typealias spamc_t alias { auditadm_spamc_t secadm_spamc_t };
userdom_user_application_domain(spamc_t, spamc_exec_t)

type spamc_tmp_t;
typealias spamc_tmp_t alias { user_spamc_tmp_t staff_spamc_tmp_t sysadm_spamc_tmp_t };
typealias spamc_tmp_t alias { auditadm_spamc_tmp_t secadm_spamc_tmp_t };
userdom_user_tmp_file(spamc_tmp_t)

type spamd_t;
type spamd_exec_t;
init_daemon_domain(spamd_t, spamd_exec_t)

type spamd_compiled_t;
files_type(spamd_compiled_t)

type spamd_etc_t;
files_config_file(spamd_etc_t)

type spamd_home_t;
userdom_user_home_content(spamd_home_t)

type spamd_initrc_exec_t;
init_script_file(spamd_initrc_exec_t)

type spamd_log_t;
logging_log_file(spamd_log_t)

type spamd_spool_t;
files_type(spamd_spool_t)

type spamd_tmp_t;
files_tmp_file(spamd_tmp_t)

type spamd_var_lib_t;
files_type(spamd_var_lib_t)

type spamd_var_run_t;
files_pid_file(spamd_var_run_t)

########################################
#
# Standalone local policy
#

allow spamassassin_t self:process ~{ ptrace setcurrent setexec setfscreate setrlimit execmem execstack execheap };
allow spamassassin_t self:fd use;
allow spamassassin_t self:fifo_file rw_fifo_file_perms;
allow spamassassin_t self:unix_dgram_socket sendto;
allow spamassassin_t self:unix_stream_socket { accept connectto listen };

manage_dirs_pattern(spamassassin_t, spamassassin_home_t, spamassassin_home_t)
manage_files_pattern(spamassassin_t, spamassassin_home_t, spamassassin_home_t)
manage_lnk_files_pattern(spamassassin_t, spamassassin_home_t, spamassassin_home_t)
manage_fifo_files_pattern(spamassassin_t, spamassassin_home_t, spamassassin_home_t)
manage_sock_files_pattern(spamassassin_t, spamassassin_home_t, spamassassin_home_t)
userdom_user_home_dir_filetrans(spamassassin_t, spamassassin_home_t, dir, ".spamassassin")

manage_dirs_pattern(spamassassin_t, spamassassin_tmp_t, spamassassin_tmp_t)
manage_files_pattern(spamassassin_t, spamassassin_tmp_t, spamassassin_tmp_t)
files_tmp_filetrans(spamassassin_t, spamassassin_tmp_t, { file dir })

kernel_read_kernel_sysctls(spamassassin_t)

dev_read_urand(spamassassin_t)

fs_getattr_all_fs(spamassassin_t)
fs_search_auto_mountpoints(spamassassin_t)

domain_use_interactive_fds(spamassassin_t)

files_read_etc_files(spamassassin_t)
files_read_etc_runtime_files(spamassassin_t)
files_list_home(spamassassin_t)
files_read_usr_files(spamassassin_t)
files_dontaudit_search_var(spamassassin_t)

logging_send_syslog_msg(spamassassin_t)

miscfiles_read_localization(spamassassin_t)

sysnet_dns_name_resolve(spamassassin_t)

tunable_policy(`spamassassin_can_network',`
	allow spamassassin_t self:tcp_socket { accept listen };

	corenet_all_recvfrom_unlabeled(spamassassin_t)
	corenet_all_recvfrom_netlabel(spamassassin_t)
	corenet_tcp_sendrecv_generic_if(spamassassin_t)
	corenet_tcp_sendrecv_generic_node(spamassassin_t)
	corenet_tcp_sendrecv_all_ports(spamassassin_t)

	corenet_tcp_connect_all_ports(spamassassin_t)
	corenet_sendrecv_all_client_packets(spamassassin_t)
')

tunable_policy(`use_nfs_home_dirs',`
	fs_manage_nfs_dirs(spamassassin_t)
	fs_manage_nfs_files(spamassassin_t)
	fs_manage_nfs_symlinks(spamassassin_t)
')

tunable_policy(`use_samba_home_dirs',`
	fs_manage_cifs_dirs(spamassassin_t)
	fs_manage_cifs_files(spamassassin_t)
	fs_manage_cifs_symlinks(spamassassin_t)
')

optional_policy(`
	tunable_policy(`spamassassin_can_network && allow_ypbind',`
		nis_use_ypbind_uncond(spamassassin_t)
	')
')

optional_policy(`
	mta_read_config(spamassassin_t)
	sendmail_stub(spamassassin_t)
')

########################################
#
# Client local policy
#

allow spamc_t self:capability dac_override;
allow spamc_t self:process ~{ ptrace setcurrent setexec setfscreate setrlimit execmem execstack execheap };
allow spamc_t self:fd use;
allow spamc_t self:fifo_file rw_fifo_file_perms;
allow spamc_t self:unix_dgram_socket sendto;
allow spamc_t self:unix_stream_socket { accept connectto listen };
allow spamc_t self:tcp_socket { accept listen };

manage_dirs_pattern(spamc_t, spamc_tmp_t, spamc_tmp_t)
manage_files_pattern(spamc_t, spamc_tmp_t, spamc_tmp_t)
files_tmp_filetrans(spamc_t, spamc_tmp_t, { file dir })

manage_dirs_pattern(spamc_t, spamassassin_home_t, spamassassin_home_t)
manage_files_pattern(spamc_t, spamassassin_home_t, spamassassin_home_t)
manage_lnk_files_pattern(spamc_t, spamassassin_home_t, spamassassin_home_t)
manage_fifo_files_pattern(spamc_t, spamassassin_home_t, spamassassin_home_t)
manage_sock_files_pattern(spamc_t, spamassassin_home_t, spamassassin_home_t)
userdom_user_home_dir_filetrans(spamc_t, spamassassin_home_t, dir, ".spamassassin")

list_dirs_pattern(spamc_t, spamd_var_lib_t, spamd_var_lib_t)
read_files_pattern(spamc_t, spamd_var_lib_t, spamd_var_lib_t)

stream_connect_pattern(spamc_t, { spamd_var_run_t spamd_tmp_t }, { spamd_var_run_t spamd_tmp_t }, spamd_t)

kernel_read_kernel_sysctls(spamc_t)
kernel_read_system_state(spamc_t)

corenet_all_recvfrom_unlabeled(spamc_t)
corenet_all_recvfrom_netlabel(spamc_t)
corenet_tcp_sendrecv_generic_if(spamc_t)
corenet_tcp_sendrecv_generic_node(spamc_t)
corenet_tcp_sendrecv_all_ports(spamc_t)

corenet_sendrecv_all_client_packets(spamc_t)
corenet_tcp_connect_all_ports(spamc_t)

corecmd_exec_bin(spamc_t)

domain_use_interactive_fds(spamc_t)

fs_getattr_all_fs(spamc_t)
fs_search_auto_mountpoints(spamc_t)

files_read_etc_runtime_files(spamc_t)
files_read_usr_files(spamc_t)
files_dontaudit_search_var(spamc_t)
files_list_home(spamc_t)
files_list_var_lib(spamc_t)

auth_use_nsswitch(spamc_t)

logging_send_syslog_msg(spamc_t)

miscfiles_read_localization(spamc_t)

tunable_policy(`use_nfs_home_dirs',`
	fs_manage_nfs_dirs(spamc_t)
	fs_manage_nfs_files(spamc_t)
	fs_manage_nfs_symlinks(spamc_t)
')

tunable_policy(`use_samba_home_dirs',`
	fs_manage_cifs_dirs(spamc_t)
	fs_manage_cifs_files(spamc_t)
	fs_manage_cifs_symlinks(spamc_t)
')

optional_policy(`
	abrt_stream_connect(spamc_t)
')

optional_policy(`
	amavis_manage_spool_files(spamc_t)
')

optional_policy(`
	evolution_stream_connect(spamc_t)
')

optional_policy(`
	milter_manage_spamass_state(spamc_t)
')

optional_policy(`
	mta_send_mail(spamc_t)
	mta_read_config(spamc_t)
	mta_read_queue(spamc_t)
	sendmail_rw_pipes(spamc_t)
	sendmail_stub(spamc_t)
')

optional_policy(`
	postfix_domtrans_postdrop(spamc_t)
	postfix_search_spool(spamc_t)
	postfix_rw_local_pipes(spamc_t)
	postfix_rw_inherited_master_pipes(spamc_t)
')

########################################
#
# Daemon local policy
#

allow spamd_t self:capability { kill setuid setgid dac_override sys_tty_config };
dontaudit spamd_t self:capability sys_tty_config;
allow spamd_t self:process ~{ ptrace setcurrent setexec setfscreate setrlimit execmem execstack execheap };
allow spamd_t self:fd use;
allow spamd_t self:fifo_file rw_fifo_file_perms;
allow spamd_t self:unix_dgram_socket sendto;
allow spamd_t self:unix_stream_socket { accept connectto listen };
allow spamd_t self:tcp_socket { accept listen };

manage_dirs_pattern(spamd_t, spamd_home_t, spamd_home_t)
manage_files_pattern(spamd_t, spamd_home_t, spamd_home_t)
manage_lnk_files_pattern(spamd_t, spamd_home_t, spamd_home_t)
manage_fifo_files_pattern(spamd_t, spamd_home_t, spamd_home_t)
manage_sock_files_pattern(spamd_t, spamd_home_t, spamd_home_t)
userdom_user_home_dir_filetrans(spamd_t, spamd_home_t, dir, ".spamd")

manage_dirs_pattern(spamd_t, spamassassin_home_t, spamassassin_home_t)
manage_files_pattern(spamd_t, spamassassin_home_t, spamassassin_home_t)
manage_lnk_files_pattern(spamd_t, spamassassin_home_t, spamassassin_home_t)
manage_fifo_files_pattern(spamd_t, spamassassin_home_t, spamassassin_home_t)
manage_sock_files_pattern(spamd_t, spamassassin_home_t, spamassassin_home_t)
userdom_user_home_dir_filetrans(spamd_t, spamassassin_home_t, dir, ".spamassassin")

manage_dirs_pattern(spamd_t, spamd_compiled_t, spamd_compiled_t)
manage_files_pattern(spamd_t, spamd_compiled_t, spamd_compiled_t)

allow spamd_t spamd_log_t:file { append_file_perms create_file_perms setattr_file_perms };
logging_log_filetrans(spamd_t, spamd_log_t, file)

manage_dirs_pattern(spamd_t, spamd_spool_t, spamd_spool_t)
manage_files_pattern(spamd_t, spamd_spool_t, spamd_spool_t)
manage_sock_files_pattern(spamd_t, spamd_spool_t, spamd_spool_t)
files_spool_filetrans(spamd_t, spamd_spool_t, { file dir })

manage_dirs_pattern(spamd_t, spamd_tmp_t, spamd_tmp_t)
manage_files_pattern(spamd_t, spamd_tmp_t, spamd_tmp_t)
files_tmp_filetrans(spamd_t, spamd_tmp_t, { file dir })

allow spamd_t spamd_var_lib_t:dir list_dir_perms;
manage_files_pattern(spamd_t, spamd_var_lib_t, spamd_var_lib_t)
manage_lnk_files_pattern(spamd_t, spamd_var_lib_t, spamd_var_lib_t)

manage_dirs_pattern(spamd_t, spamd_var_run_t, spamd_var_run_t)
manage_files_pattern(spamd_t, spamd_var_run_t, spamd_var_run_t)
manage_sock_files_pattern(spamd_t, spamd_var_run_t, spamd_var_run_t)
files_pid_filetrans(spamd_t, spamd_var_run_t, { file dir })

can_exec(spamd_t, { spamd_exec_t spamd_compiled_t })

kernel_read_all_sysctls(spamd_t)
kernel_read_system_state(spamd_t)

corenet_all_recvfrom_unlabeled(spamd_t)
corenet_all_recvfrom_netlabel(spamd_t)
corenet_tcp_sendrecv_generic_if(spamd_t)
corenet_udp_sendrecv_generic_if(spamd_t)
corenet_tcp_sendrecv_generic_node(spamd_t)
corenet_udp_sendrecv_generic_node(spamd_t)
corenet_tcp_sendrecv_all_ports(spamd_t)
corenet_udp_sendrecv_all_ports(spamd_t)
corenet_tcp_bind_generic_node(spamd_t)
corenet_udp_bind_generic_node(spamd_t)

corenet_sendrecv_spamd_server_packets(spamd_t)
corenet_tcp_bind_spamd_port(spamd_t)

corenet_sendrecv_razor_client_packets(spamd_t)
corenet_tcp_connect_razor_port(spamd_t)

corenet_sendrecv_smtp_client_packets(spamd_t)
corenet_tcp_connect_smtp_port(spamd_t)

corenet_sendrecv_generic_server_packets(spamd_t)
corenet_udp_bind_generic_port(spamd_t)

corenet_sendrecv_imaze_server_packets(spamd_t)
corenet_udp_bind_imaze_port(spamd_t)

corenet_dontaudit_udp_bind_all_ports(spamd_t)

corecmd_exec_bin(spamd_t)

dev_read_sysfs(spamd_t)
dev_read_urand(spamd_t)

domain_use_interactive_fds(spamd_t)

files_read_usr_files(spamd_t)
files_read_etc_runtime_files(spamd_t)

fs_getattr_all_fs(spamd_t)
fs_search_auto_mountpoints(spamd_t)

auth_use_nsswitch(spamd_t)
auth_dontaudit_read_shadow(spamd_t)

init_dontaudit_rw_utmp(spamd_t)

libs_use_ld_so(spamd_t)
libs_use_shared_libs(spamd_t)

logging_send_syslog_msg(spamd_t)

miscfiles_read_localization(spamd_t)

sysnet_use_ldap(spamd_t)

userdom_use_unpriv_users_fds(spamd_t)

tunable_policy(`spamd_enable_home_dirs',`
	userdom_manage_user_home_content_dirs(spamd_t)
	userdom_manage_user_home_content_files(spamd_t)
	userdom_manage_user_home_content_symlinks(spamd_t)
')

tunable_policy(`use_nfs_home_dirs',`
	fs_manage_nfs_dirs(spamd_t)
	fs_manage_nfs_files(spamd_t)
	fs_manage_nfs_symlinks(spamd_t)
')

tunable_policy(`use_samba_home_dirs',`
	fs_manage_cifs_dirs(spamd_t)
	fs_manage_cifs_files(spamd_t)
	fs_manage_cifs_symlinks(spamd_t)
')

optional_policy(`
	amavis_manage_lib_files(spamd_t)
')

optional_policy(`
	clamav_stream_connect(spamd_t)
')

optional_policy(`
	cron_system_entry(spamd_t, spamd_exec_t)
')

optional_policy(`
	daemontools_service_domain(spamd_t, spamd_exec_t)
')

optional_policy(`
	dcc_domtrans_cdcc(spamd_t)
	dcc_domtrans_client(spamd_t)
	dcc_signal_client(spamd_t)
	dcc_stream_connect_dccifd(spamd_t)
')

optional_policy(`
	evolution_home_filetrans(spamd_t, spamd_tmp_t, { file sock_file })
')

optional_policy(`
	exim_manage_spool_dirs(spamd_t)
	exim_manage_spool_files(spamd_t)
')

optional_policy(`
	milter_manage_spamass_state(spamd_t)
')

optional_policy(`
	mysql_stream_connect(spamd_t)
	mysql_tcp_connect(spamd_t)
')

optional_policy(`
	postfix_read_config(spamd_t)
')

optional_policy(`
	postgresql_stream_connect(spamd_t)
	postgresql_tcp_connect(spamd_t)
')

optional_policy(`
	pyzor_domtrans(spamd_t)
	pyzor_signal(spamd_t)
')

optional_policy(`
	razor_domtrans(spamd_t)
	razor_read_lib_files(spamd_t)
	razor_manage_home_content(spamd_t)
')

optional_policy(`
	seutil_sigchld_newrole(spamd_t)
')

optional_policy(`
	sendmail_stub(spamd_t)
	mta_read_config(spamd_t)
	mta_send_mail(spamd_t)
')

optional_policy(`
	udev_read_db(spamd_t)
')

########################################
#
# Update local policy
#

allow spamd_update_t self:capability dac_override;
allow spamd_update_t self:fifo_file manage_fifo_file_perms;
allow spamd_update_t self:unix_stream_socket create_stream_socket_perms;

manage_dirs_pattern(spamd_update_t, spamd_tmp_t, spamd_tmp_t)
manage_files_pattern(spamd_update_t, spamd_tmp_t, spamd_tmp_t)
files_tmp_filetrans(spamd_update_t, spamd_tmp_t, { file dir })

manage_dirs_pattern(spamd_update_t, spamd_var_lib_t, spamd_var_lib_t)
manage_files_pattern(spamd_update_t, spamd_var_lib_t, spamd_var_lib_t)
manage_lnk_files_pattern(spamd_update_t, spamd_var_lib_t, spamd_var_lib_t)

kernel_read_system_state(spamd_update_t)

corenet_all_recvfrom_unlabeled(spamd_update_t)
corenet_all_recvfrom_netlabel(spamd_update_t)
corenet_tcp_sendrecv_generic_if(spamd_update_t)
corenet_tcp_sendrecv_generic_node(spamd_update_t)
corenet_tcp_sendrecv_all_ports(spamd_update_t)

corenet_sendrecv_http_client_packets(spamd_update_t)
corenet_tcp_connect_http_port(spamd_update_t)
corenet_tcp_sendrecv_http_port(spamd_update_t)

corecmd_exec_bin(spamd_update_t)
corecmd_exec_shell(spamd_update_t)

dev_read_urand(spamd_update_t)

domain_use_interactive_fds(spamd_update_t)

files_read_usr_files(spamd_update_t)

auth_use_nsswitch(spamd_update_t)
auth_dontaudit_read_shadow(spamd_update_t)

miscfiles_read_localization(spamd_update_t)

userdom_use_user_terminals(spamd_update_t)

optional_policy(`
	cron_system_entry(spamd_update_t, spamd_update_exec_t)
')

# probably want a solution same as httpd_use_gpg since this will
# give spamd_update a path to users gpg keys
# optional_policy(`
#	gpg_domtrans(spamd_update_t)
# ')

optional_policy(`
	mta_read_config(spamd_update_t)
')