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
|
policy_module(spamassassin, 2.5.0)
########################################
#
# Declarations
#
## <desc>
## <p>
## Allow user spamassassin clients to use the network.
## </p>
## </desc>
gen_tunable(spamassassin_can_network, false)
## <desc>
## <p>
## Allow spamd to read/write user home directories.
## </p>
## </desc>
gen_tunable(spamd_enable_home_dirs, true)
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_spool_t;
files_type(spamd_spool_t)
type spamd_tmp_t;
files_tmp_file(spamd_tmp_t)
# var/lib files
type spamd_var_lib_t;
files_type(spamd_var_lib_t)
type spamd_var_run_t;
files_pid_file(spamd_var_run_t)
##############################
#
# Standalone program 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:sock_file read_sock_file_perms;
allow spamassassin_t self:unix_dgram_socket create_socket_perms;
allow spamassassin_t self:unix_stream_socket create_stream_socket_perms;
allow spamassassin_t self:unix_dgram_socket sendto;
allow spamassassin_t self:unix_stream_socket connectto;
allow spamassassin_t self:shm create_shm_perms;
allow spamassassin_t self:sem create_sem_perms;
allow spamassassin_t self:msgq create_msgq_perms;
allow spamassassin_t self:msg { send receive };
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 file lnk_file sock_file fifo_file })
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 })
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 file lnk_file sock_file fifo_file })
kernel_read_kernel_sysctls(spamassassin_t)
dev_read_urand(spamassassin_t)
fs_search_auto_mountpoints(spamassassin_t)
# this should probably be removed
corecmd_list_bin(spamassassin_t)
corecmd_read_bin_symlinks(spamassassin_t)
corecmd_read_bin_files(spamassassin_t)
corecmd_read_bin_pipes(spamassassin_t)
corecmd_read_bin_sockets(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)
# cjp: this could probably be removed
seutil_read_config(spamassassin_t)
sysnet_dns_name_resolve(spamassassin_t)
# set tunable if you have spamassassin do DNS lookups
tunable_policy(`spamassassin_can_network',`
allow spamassassin_t self:tcp_socket create_stream_socket_perms;
allow spamassassin_t self:udp_socket create_socket_perms;
corenet_all_recvfrom_unlabeled(spamassassin_t)
corenet_all_recvfrom_netlabel(spamassassin_t)
corenet_tcp_sendrecv_generic_if(spamassassin_t)
corenet_udp_sendrecv_generic_if(spamassassin_t)
corenet_tcp_sendrecv_generic_node(spamassassin_t)
corenet_udp_sendrecv_generic_node(spamassassin_t)
corenet_tcp_sendrecv_all_ports(spamassassin_t)
corenet_udp_sendrecv_all_ports(spamassassin_t)
corenet_tcp_connect_all_ports(spamassassin_t)
corenet_sendrecv_all_client_packets(spamassassin_t)
sysnet_read_config(spamassassin_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(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(`
# Write pid file and socket in ~/.evolution/cache/tmp
evolution_home_filetrans(spamd_t, spamd_tmp_t, { file sock_file })
')
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: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:sock_file read_sock_file_perms;
allow spamc_t self:shm create_shm_perms;
allow spamc_t self:sem create_sem_perms;
allow spamc_t self:msgq create_msgq_perms;
allow spamc_t self:msg { send receive };
allow spamc_t self:unix_dgram_socket create_socket_perms;
allow spamc_t self:unix_stream_socket create_stream_socket_perms;
allow spamc_t self:unix_dgram_socket sendto;
allow spamc_t self:unix_stream_socket connectto;
allow spamc_t self:tcp_socket create_stream_socket_perms;
allow spamc_t self:udp_socket create_socket_perms;
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 })
# Allow connecting to a local spamd
allow spamc_t spamd_t:unix_stream_socket connectto;
allow spamc_t spamd_tmp_t:sock_file rw_sock_file_perms;
kernel_read_kernel_sysctls(spamc_t)
corenet_all_recvfrom_unlabeled(spamc_t)
corenet_all_recvfrom_netlabel(spamc_t)
corenet_tcp_sendrecv_generic_if(spamc_t)
corenet_udp_sendrecv_generic_if(spamc_t)
corenet_tcp_sendrecv_generic_node(spamc_t)
corenet_udp_sendrecv_generic_node(spamc_t)
corenet_tcp_sendrecv_all_ports(spamc_t)
corenet_udp_sendrecv_all_ports(spamc_t)
corenet_tcp_connect_all_ports(spamc_t)
corenet_sendrecv_all_client_packets(spamc_t)
fs_search_auto_mountpoints(spamc_t)
# cjp: these should probably be removed:
corecmd_list_bin(spamc_t)
corecmd_read_bin_symlinks(spamc_t)
corecmd_read_bin_files(spamc_t)
corecmd_read_bin_pipes(spamc_t)
corecmd_read_bin_sockets(spamc_t)
domain_use_interactive_fds(spamc_t)
files_read_etc_files(spamc_t)
files_read_etc_runtime_files(spamc_t)
files_read_usr_files(spamc_t)
files_dontaudit_search_var(spamc_t)
# cjp: this may be removable:
files_list_home(spamc_t)
logging_send_syslog_msg(spamc_t)
miscfiles_read_localization(spamc_t)
# cjp: this should probably be removed:
seutil_read_config(spamc_t)
sysnet_read_config(spamc_t)
optional_policy(`
# Allow connection to spamd socket above
evolution_stream_connect(spamc_t)
')
optional_policy(`
# Needed for pyzor/razor called from spamd
milter_manage_spamass_state(spamc_t)
')
optional_policy(`
nis_use_ypbind(spamc_t)
')
optional_policy(`
nscd_socket_use(spamc_t)
')
optional_policy(`
mta_read_config(spamc_t)
sendmail_stub(spamc_t)
')
########################################
#
# Server local policy
#
# Spamassassin, when run as root and using per-user config files,
# setuids to the user running spamc. Comment this if you are not
# using this ability.
allow spamd_t self:capability { 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:sock_file read_sock_file_perms;
allow spamd_t self:shm create_shm_perms;
allow spamd_t self:sem create_sem_perms;
allow spamd_t self:msgq create_msgq_perms;
allow spamd_t self:msg { send receive };
allow spamd_t self:unix_dgram_socket create_socket_perms;
allow spamd_t self:unix_stream_socket create_stream_socket_perms;
allow spamd_t self:unix_dgram_socket sendto;
allow spamd_t self:unix_stream_socket connectto;
allow spamd_t self:tcp_socket create_stream_socket_perms;
allow spamd_t self:udp_socket create_socket_perms;
allow spamd_t self:netlink_route_socket r_netlink_socket_perms;
manage_dirs_pattern(spamd_t, spamd_spool_t, spamd_spool_t)
manage_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 })
# var/lib files for spamd
allow spamd_t spamd_var_lib_t:dir list_dir_perms;
read_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)
files_pid_filetrans(spamd_t, spamd_var_run_t, { dir file })
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_tcp_bind_spamd_port(spamd_t)
corenet_tcp_connect_razor_port(spamd_t)
corenet_tcp_connect_smtp_port(spamd_t)
corenet_sendrecv_razor_client_packets(spamd_t)
corenet_sendrecv_spamd_server_packets(spamd_t)
# spamassassin 3.1 needs this for its
# DnsResolver.pm module which binds to
# random ports >= 1024.
corenet_udp_bind_generic_node(spamd_t)
corenet_udp_bind_generic_port(spamd_t)
corenet_udp_bind_imaze_port(spamd_t)
corenet_dontaudit_udp_bind_all_ports(spamd_t)
corenet_sendrecv_imaze_server_packets(spamd_t)
corenet_sendrecv_generic_server_packets(spamd_t)
dev_read_sysfs(spamd_t)
dev_read_urand(spamd_t)
fs_getattr_all_fs(spamd_t)
fs_search_auto_mountpoints(spamd_t)
auth_dontaudit_read_shadow(spamd_t)
corecmd_exec_bin(spamd_t)
domain_use_interactive_fds(spamd_t)
files_read_usr_files(spamd_t)
files_read_etc_files(spamd_t)
files_read_etc_runtime_files(spamd_t)
# /var/lib/spamassin
files_read_var_lib_files(spamd_t)
init_dontaudit_rw_utmp(spamd_t)
logging_send_syslog_msg(spamd_t)
miscfiles_read_localization(spamd_t)
sysnet_read_config(spamd_t)
sysnet_use_ldap(spamd_t)
sysnet_dns_name_resolve(spamd_t)
userdom_use_unpriv_users_fds(spamd_t)
userdom_search_user_home_dirs(spamd_t)
tunable_policy(`use_nfs_home_dirs',`
fs_manage_nfs_files(spamd_t)
')
tunable_policy(`use_samba_home_dirs',`
fs_manage_cifs_files(spamd_t)
')
optional_policy(`
amavis_manage_lib_files(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_client(spamd_t)
dcc_stream_connect_dccifd(spamd_t)
')
optional_policy(`
milter_manage_spamass_state(spamd_t)
')
optional_policy(`
corenet_tcp_connect_mysqld_port(spamd_t)
corenet_sendrecv_mysqld_client_packets(spamd_t)
mysql_search_db(spamd_t)
mysql_stream_connect(spamd_t)
')
optional_policy(`
nis_use_ypbind(spamd_t)
')
optional_policy(`
postfix_read_config(spamd_t)
')
optional_policy(`
corenet_tcp_connect_postgresql_port(spamd_t)
corenet_sendrecv_postgresql_client_packets(spamd_t)
postgresql_stream_connect(spamd_t)
')
optional_policy(`
pyzor_domtrans(spamd_t)
pyzor_signal(spamd_t)
')
optional_policy(`
razor_domtrans(spamd_t)
')
optional_policy(`
seutil_sigchld_newrole(spamd_t)
')
optional_policy(`
sendmail_stub(spamd_t)
mta_read_config(spamd_t)
')
optional_policy(`
udev_read_db(spamd_t)
')
|