aboutsummaryrefslogtreecommitdiff
blob: b257d77f2966590e411d51833a958505999fd5e5 (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
policy_module(amavis, 1.19.0)

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

## <desc>
##	<p>
##	Determine whether amavis can
##	use JIT compiler.
##	</p>
## </desc>
gen_tunable(amavis_use_jit, false)

type amavis_t;
type amavis_exec_t;
init_daemon_domain(amavis_t, amavis_exec_t)

type amavis_etc_t;
files_config_file(amavis_etc_t)

type amavis_initrc_exec_t;
init_script_file(amavis_initrc_exec_t)

type amavis_var_run_t;
files_pid_file(amavis_var_run_t)

type amavis_var_lib_t;
files_type(amavis_var_lib_t)

type amavis_var_log_t;
logging_log_file(amavis_var_log_t)

type amavis_tmp_t;
files_tmp_file(amavis_tmp_t)

type amavis_quarantine_t;
files_type(amavis_quarantine_t)

type amavis_spool_t;
files_type(amavis_spool_t)

########################################
#
# Local policy
#

allow amavis_t self:capability { chown dac_override kill setgid setuid };
dontaudit amavis_t self:capability sys_tty_config;
allow amavis_t self:process signal_perms;
allow amavis_t self:fifo_file rw_fifo_file_perms;
allow amavis_t self:unix_stream_socket { accept connectto listen };
allow amavis_t self:tcp_socket { listen accept };

allow amavis_t amavis_etc_t:dir list_dir_perms;
read_files_pattern(amavis_t, amavis_etc_t, amavis_etc_t)
read_lnk_files_pattern(amavis_t, amavis_etc_t, amavis_etc_t)

manage_dirs_pattern(amavis_t, amavis_quarantine_t, amavis_quarantine_t)
manage_files_pattern(amavis_t, amavis_quarantine_t, amavis_quarantine_t)
manage_sock_files_pattern(amavis_t, amavis_quarantine_t, amavis_quarantine_t)

manage_dirs_pattern(amavis_t, amavis_spool_t, amavis_spool_t)
manage_files_pattern(amavis_t, amavis_spool_t, amavis_spool_t)
manage_lnk_files_pattern(amavis_t, amavis_spool_t, amavis_spool_t)
manage_sock_files_pattern(amavis_t, amavis_spool_t, amavis_spool_t)
filetrans_pattern(amavis_t, amavis_spool_t, amavis_var_run_t, sock_file)

manage_files_pattern(amavis_t, amavis_tmp_t, amavis_tmp_t)
allow amavis_t amavis_tmp_t:dir setattr_dir_perms;
files_tmp_filetrans(amavis_t, amavis_tmp_t, file)

manage_dirs_pattern(amavis_t, amavis_var_lib_t, amavis_var_lib_t)
manage_files_pattern(amavis_t, amavis_var_lib_t, amavis_var_lib_t)
manage_sock_files_pattern(amavis_t, amavis_var_lib_t, amavis_var_lib_t)

allow amavis_t amavis_var_log_t:dir setattr_dir_perms;
manage_files_pattern(amavis_t, amavis_var_log_t, amavis_var_log_t)
manage_sock_files_pattern(amavis_t, amavis_var_log_t, amavis_var_log_t)
logging_log_filetrans(amavis_t, amavis_var_log_t, { sock_file file dir })

manage_dirs_pattern(amavis_t, amavis_var_run_t, amavis_var_run_t)
manage_files_pattern(amavis_t, amavis_var_run_t, amavis_var_run_t)
manage_sock_files_pattern(amavis_t, amavis_var_run_t, amavis_var_run_t)
files_pid_filetrans(amavis_t, amavis_var_run_t, { dir file sock_file })

can_exec(amavis_t, amavis_exec_t)

kernel_read_kernel_sysctls(amavis_t)
kernel_read_system_state(amavis_t)
kernel_dontaudit_list_proc(amavis_t)
kernel_dontaudit_read_proc_symlinks(amavis_t)

corecmd_exec_bin(amavis_t)
corecmd_exec_shell(amavis_t)

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

corenet_sendrecv_amavisd_send_client_packets(amavis_t)
corenet_tcp_connect_amavisd_send_port(amavis_t)

corenet_sendrecv_amavisd_recv_server_packets(amavis_t)
corenet_tcp_bind_amavisd_recv_port(amavis_t)

corenet_sendrecv_generic_server_packets(amavis_t)
corenet_udp_bind_generic_port(amavis_t)
corenet_dontaudit_udp_bind_all_ports(amavis_t)

corenet_sendrecv_razor_client_packets(amavis_t)
corenet_tcp_connect_razor_port(amavis_t)

dev_read_rand(amavis_t)
dev_read_sysfs(amavis_t)
dev_read_urand(amavis_t)

domain_use_interactive_fds(amavis_t)
domain_dontaudit_read_all_domains_state(amavis_t)

files_read_etc_runtime_files(amavis_t)
files_read_usr_files(amavis_t)
files_search_spool(amavis_t)

fs_getattr_xattr_fs(amavis_t)

auth_use_nsswitch(amavis_t)
auth_dontaudit_read_shadow(amavis_t)

init_read_state(amavis_t)
init_read_utmp(amavis_t)
init_stream_connect_script(amavis_t)

logging_send_syslog_msg(amavis_t)

miscfiles_read_localization(amavis_t)

userdom_dontaudit_search_user_home_dirs(amavis_t)

tunable_policy(`amavis_use_jit',`
	allow amavis_t self:process execmem;
',`
	dontaudit amavis_t self:process execmem;
')

optional_policy(`
	clamav_scannable_files(amavis_spool_t)
	clamav_stream_connect(amavis_t)
	clamav_domtrans_clamscan(amavis_t)
	clamav_read_state_clamd(amavis_t)
')

optional_policy(`
	cron_use_fds(amavis_t)
	cron_use_system_job_fds(amavis_t)
	cron_rw_pipes(amavis_t)
')

optional_policy(`
	dcc_domtrans_client(amavis_t)
	dcc_stream_connect_dccifd(amavis_t)
')

optional_policy(`
	mta_read_config(amavis_t)
')

optional_policy(`
	postfix_read_config(amavis_t)
	postfix_list_spool(amavis_t)
')

optional_policy(`
	pyzor_domtrans(amavis_t)
	pyzor_signal(amavis_t)
')

optional_policy(`
	razor_domtrans(amavis_t)
')

optional_policy(`
	snmp_manage_var_lib_dirs(amavis_t)
	snmp_manage_var_lib_files(amavis_t)
	snmp_stream_connect(amavis_t)
')

optional_policy(`
	spamassassin_exec(amavis_t)
	spamassassin_exec_client(amavis_t)
	spamassassin_read_lib_files(amavis_t)
')