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
|
policy_module(qmail, 1.4.2)
########################################
#
# Declarations
#
attribute qmail_user_domains;
type qmail_alias_home_t;
files_type(qmail_alias_home_t)
qmail_child_domain_template(qmail_clean, qmail_start_t)
type qmail_etc_t;
files_config_file(qmail_etc_t)
type qmail_exec_t;
files_type(qmail_exec_t)
type qmail_inject_t, qmail_user_domains;
type qmail_inject_exec_t;
domain_type(qmail_inject_t)
domain_entry_file(qmail_inject_t, qmail_inject_exec_t)
mta_mailserver_user_agent(qmail_inject_t)
role system_r types qmail_inject_t;
qmail_child_domain_template(qmail_local, qmail_lspawn_t)
mta_mailserver_delivery(qmail_local_t)
qmail_child_domain_template(qmail_lspawn, qmail_start_t)
mta_mailserver_delivery(qmail_lspawn_t)
qmail_child_domain_template(qmail_queue, qmail_inject_t)
typeattribute qmail_queue_t qmail_user_domains;
mta_mailserver_user_agent(qmail_queue_t)
qmail_child_domain_template(qmail_remote, qmail_rspawn_t)
mta_mailserver_sender(qmail_remote_t)
qmail_child_domain_template(qmail_rspawn, qmail_start_t)
qmail_child_domain_template(qmail_send, qmail_start_t)
qmail_child_domain_template(qmail_smtpd, qmail_tcp_env_t)
qmail_child_domain_template(qmail_splogger, qmail_start_t)
type qmail_spool_t;
files_type(qmail_spool_t)
type qmail_start_t;
type qmail_start_exec_t;
init_daemon_domain(qmail_start_t, qmail_start_exec_t)
type qmail_tcp_env_t;
type qmail_tcp_env_exec_t;
application_domain(qmail_tcp_env_t, qmail_tcp_env_exec_t)
########################################
#
# qmail-clean local policy
# this component cleans up the queue directory
#
read_files_pattern(qmail_clean_t, qmail_spool_t, qmail_spool_t)
delete_files_pattern(qmail_clean_t, qmail_spool_t, qmail_spool_t)
########################################
#
# qmail-inject local policy
# this component preprocesses mail from stdin and invokes qmail-queue
#
allow qmail_inject_t self:fifo_file write_fifo_file_perms;
allow qmail_inject_t self:process signal_perms;
allow qmail_inject_t qmail_queue_exec_t:file read_file_perms;
corecmd_search_bin(qmail_inject_t)
files_search_var(qmail_inject_t)
miscfiles_read_localization(qmail_inject_t)
qmail_read_config(qmail_inject_t)
########################################
#
# qmail-local local policy
# this component delivers a mail message
#
allow qmail_local_t self:fifo_file write_file_perms;
allow qmail_local_t self:process signal_perms;
allow qmail_local_t self:unix_stream_socket create_stream_socket_perms;
manage_dirs_pattern(qmail_local_t, qmail_alias_home_t, qmail_alias_home_t)
manage_files_pattern(qmail_local_t, qmail_alias_home_t, qmail_alias_home_t)
can_exec(qmail_local_t, qmail_local_exec_t)
allow qmail_local_t qmail_queue_exec_t:file read_file_perms;
allow qmail_local_t qmail_spool_t:file read_file_perms;
kernel_read_system_state(qmail_local_t)
corecmd_exec_bin(qmail_local_t)
corecmd_exec_shell(qmail_local_t)
files_read_etc_files(qmail_local_t)
files_read_etc_runtime_files(qmail_local_t)
auth_use_nsswitch(qmail_local_t)
logging_send_syslog_msg(qmail_local_t)
mta_append_spool(qmail_local_t)
qmail_domtrans_queue(qmail_local_t)
optional_policy(`
spamassassin_domtrans_client(qmail_local_t)
')
########################################
#
# qmail-lspawn local policy
# this component schedules local deliveries
#
allow qmail_lspawn_t self:capability { setuid setgid };
allow qmail_lspawn_t self:process signal_perms;
allow qmail_lspawn_t self:fifo_file rw_fifo_file_perms;
allow qmail_lspawn_t self:unix_stream_socket create_socket_perms;
can_exec(qmail_lspawn_t, qmail_exec_t)
allow qmail_lspawn_t qmail_local_exec_t:file read_file_perms;
read_files_pattern(qmail_lspawn_t, qmail_spool_t, qmail_spool_t)
corecmd_search_bin(qmail_lspawn_t)
files_read_etc_files(qmail_lspawn_t)
files_search_pids(qmail_lspawn_t)
files_search_tmp(qmail_lspawn_t)
########################################
#
# qmail-queue local policy
# this component places a mail in a delivery queue, later to be processed by qmail-send
#
allow qmail_queue_t qmail_lspawn_t:fd use;
allow qmail_queue_t qmail_lspawn_t:fifo_file write_fifo_file_perms;
allow qmail_queue_t qmail_smtpd_t:fd use;
allow qmail_queue_t qmail_smtpd_t:fifo_file read_fifo_file_perms;
allow qmail_queue_t qmail_smtpd_t:process sigchld;
manage_dirs_pattern(qmail_queue_t, qmail_spool_t, qmail_spool_t)
manage_files_pattern(qmail_queue_t, qmail_spool_t, qmail_spool_t)
rw_fifo_files_pattern(qmail_queue_t, qmail_spool_t, qmail_spool_t)
corecmd_exec_bin(qmail_queue_t)
logging_send_syslog_msg(qmail_queue_t)
optional_policy(`
daemontools_ipc_domain(qmail_queue_t)
')
########################################
#
# qmail-remote local policy
# this component sends mail via SMTP
#
allow qmail_remote_t self:tcp_socket create_socket_perms;
allow qmail_remote_t self:udp_socket create_socket_perms;
rw_files_pattern(qmail_remote_t, qmail_spool_t, qmail_spool_t)
corenet_all_recvfrom_unlabeled(qmail_remote_t)
corenet_all_recvfrom_netlabel(qmail_remote_t)
corenet_tcp_sendrecv_generic_if(qmail_remote_t)
corenet_udp_sendrecv_generic_if(qmail_remote_t)
corenet_tcp_sendrecv_generic_node(qmail_remote_t)
corenet_udp_sendrecv_generic_node(qmail_remote_t)
corenet_tcp_sendrecv_smtp_port(qmail_remote_t)
corenet_udp_sendrecv_dns_port(qmail_remote_t)
corenet_tcp_connect_smtp_port(qmail_remote_t)
corenet_sendrecv_smtp_client_packets(qmail_remote_t)
dev_read_rand(qmail_remote_t)
dev_read_urand(qmail_remote_t)
sysnet_read_config(qmail_remote_t)
########################################
#
# qmail-rspawn local policy
# this component scedules remote deliveries
#
allow qmail_rspawn_t self:process signal_perms;
allow qmail_rspawn_t self:fifo_file read_fifo_file_perms;
allow qmail_rspawn_t qmail_remote_exec_t:file read_file_perms;
rw_files_pattern(qmail_rspawn_t, qmail_spool_t, qmail_spool_t)
corecmd_search_bin(qmail_rspawn_t)
########################################
#
# qmail-send local policy
# this component delivers mail messages from the queue
#
allow qmail_send_t self:process signal_perms;
allow qmail_send_t self:fifo_file write_fifo_file_perms;
manage_dirs_pattern(qmail_send_t, qmail_spool_t, qmail_spool_t)
manage_files_pattern(qmail_send_t, qmail_spool_t, qmail_spool_t)
read_fifo_files_pattern(qmail_send_t, qmail_spool_t, qmail_spool_t)
qmail_domtrans_queue(qmail_send_t)
optional_policy(`
daemontools_ipc_domain(qmail_send_t)
')
########################################
#
# qmail-smtpd local policy
# this component receives mails via SMTP
#
allow qmail_smtpd_t self:process signal_perms;
allow qmail_smtpd_t self:fifo_file write_fifo_file_perms;
allow qmail_smtpd_t self:tcp_socket create_socket_perms;
allow qmail_smtpd_t qmail_queue_exec_t:file read_file_perms;
dev_read_rand(qmail_smtpd_t)
dev_read_urand(qmail_smtpd_t)
qmail_domtrans_queue(qmail_smtpd_t)
optional_policy(`
daemontools_ipc_domain(qmail_smtpd_t)
')
optional_policy(`
kerberos_keytab_template(qmail, qmail_smtpd_t)
')
optional_policy(`
ucspitcp_service_domain(qmail_smtpd_t, qmail_smtpd_exec_t)
')
########################################
#
# splogger local policy
# this component creates entries in syslog
#
allow qmail_splogger_t self:unix_dgram_socket create_socket_perms;
files_read_etc_files(qmail_splogger_t)
init_dontaudit_use_script_fds(qmail_splogger_t)
miscfiles_read_localization(qmail_splogger_t)
########################################
#
# qmail-start local policy
# this component starts up the mail delivery component
#
allow qmail_start_t self:capability { setgid setuid };
dontaudit qmail_start_t self:capability sys_tty_config;
allow qmail_start_t self:fifo_file rw_fifo_file_perms;
allow qmail_start_t self:process signal_perms;
can_exec(qmail_start_t, qmail_start_exec_t)
corecmd_search_bin(qmail_start_t)
files_search_var(qmail_start_t)
qmail_read_config(qmail_start_t)
optional_policy(`
daemontools_service_domain(qmail_start_t, qmail_start_exec_t)
daemontools_ipc_domain(qmail_start_t)
')
########################################
#
# tcp-env local policy
# this component sets up TCP-related environment variables
#
allow qmail_tcp_env_t qmail_smtpd_exec_t:file read_file_perms;
corecmd_search_bin(qmail_tcp_env_t)
sysnet_read_config(qmail_tcp_env_t)
optional_policy(`
inetd_tcp_service_domain(qmail_tcp_env_t, qmail_tcp_env_exec_t)
')
optional_policy(`
ucspitcp_service_domain(qmail_tcp_env_t, qmail_tcp_env_exec_t)
')
|