aboutsummaryrefslogtreecommitdiff
blob: 12a590104a1cb89cedaa7b1b8868c6acb68cc59d (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
policy_module(boinc, 1.6.0)

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

## <desc>
##	<p>
##	Determine whether boinc can execmem/execstack.
##	</p>
## </desc>
gen_tunable(boinc_execmem, true)

type boinc_t;
type boinc_exec_t;
init_daemon_domain(boinc_t, boinc_exec_t)

type boinc_initrc_exec_t;
init_script_file(boinc_initrc_exec_t)

type boinc_tmp_t;
files_tmp_file(boinc_tmp_t)

type boinc_tmpfs_t;
files_tmpfs_file(boinc_tmpfs_t)

type boinc_var_lib_t;
files_type(boinc_var_lib_t)

type boinc_project_var_lib_t;
files_type(boinc_project_var_lib_t)

type boinc_log_t;
logging_log_file(boinc_log_t)

type boinc_project_t;
domain_type(boinc_project_t)
domain_entry_file(boinc_project_t, boinc_project_var_lib_t)
role system_r types boinc_project_t;

type boinc_project_tmp_t;
files_tmp_file(boinc_project_tmp_t)

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

allow boinc_t self:process { setsched setpgid signull sigkill signal };
allow boinc_t self:unix_stream_socket { accept listen };
allow boinc_t self:tcp_socket { accept listen };
allow boinc_t self:shm create_shm_perms;
allow boinc_t self:fifo_file rw_fifo_file_perms;
allow boinc_t self:sem create_sem_perms;

can_exec(boinc_t, boinc_exec_t)

manage_dirs_pattern(boinc_t, boinc_tmp_t, boinc_tmp_t)
manage_files_pattern(boinc_t, boinc_tmp_t, boinc_tmp_t)
files_tmp_filetrans(boinc_t, boinc_tmp_t, { dir file })

manage_files_pattern(boinc_t, boinc_tmpfs_t, boinc_tmpfs_t)
fs_tmpfs_filetrans(boinc_t, boinc_tmpfs_t, file)

manage_dirs_pattern(boinc_t, boinc_var_lib_t, boinc_var_lib_t)
manage_files_pattern(boinc_t, boinc_var_lib_t, boinc_var_lib_t)
manage_lnk_files_pattern(boinc_t, boinc_var_lib_t, boinc_var_lib_t)

# entry files to the boinc_project_t domain
manage_dirs_pattern(boinc_t, boinc_project_var_lib_t, boinc_project_var_lib_t)
manage_files_pattern(boinc_t, boinc_project_var_lib_t, boinc_project_var_lib_t)
filetrans_pattern(boinc_t, boinc_var_lib_t, boinc_project_var_lib_t, dir, "slots")
filetrans_pattern(boinc_t, boinc_var_lib_t, boinc_project_var_lib_t, dir, "projects")

manage_files_pattern(boinc_t, boinc_log_t, boinc_log_t)
create_files_pattern(boinc_t, boinc_log_t, boinc_log_t)
setattr_files_pattern(boinc_t, boinc_log_t, boinc_log_t)
logging_log_filetrans(boinc_t, boinc_log_t, file)

can_exec(boinc_t, boinc_var_lib_t)
libs_exec_lib_files(boinc_t)
# for mmap of ld.so.cache
libs_legacy_use_ld_so(boinc_t)

domtrans_pattern(boinc_t, boinc_project_var_lib_t, boinc_project_t)

kernel_read_system_state(boinc_t)
kernel_search_vm_sysctl(boinc_t)
kernel_read_crypto_sysctls(boinc_t)
kernel_read_kernel_sysctls(boinc_t)

corenet_all_recvfrom_unlabeled(boinc_t)
corenet_all_recvfrom_netlabel(boinc_t)
corenet_tcp_sendrecv_generic_if(boinc_t)
corenet_tcp_sendrecv_generic_node(boinc_t)
corenet_tcp_bind_generic_node(boinc_t)

corenet_sendrecv_boinc_client_packets(boinc_t)
corenet_sendrecv_boinc_server_packets(boinc_t)
corenet_tcp_bind_boinc_port(boinc_t)
corenet_tcp_connect_boinc_port(boinc_t)
corenet_tcp_sendrecv_boinc_port(boinc_t)

corenet_sendrecv_boinc_client_server_packets(boinc_t)
corenet_tcp_bind_boinc_client_port(boinc_t)
corenet_tcp_sendrecv_boinc_client_port(boinc_t)

corenet_sendrecv_http_client_packets(boinc_t)
corenet_tcp_connect_http_port(boinc_t)
corenet_tcp_sendrecv_http_port(boinc_t)

corenet_sendrecv_http_cache_client_packets(boinc_t)
corenet_tcp_connect_http_cache_port(boinc_t)
corenet_tcp_sendrecv_http_cache_port(boinc_t)

corenet_sendrecv_squid_client_packets(boinc_t)
corenet_tcp_connect_squid_port(boinc_t)
corenet_tcp_sendrecv_squid_port(boinc_t)

corecmd_exec_bin(boinc_t)
corecmd_exec_shell(boinc_t)

dev_read_rand(boinc_t)
dev_read_urand(boinc_t)
dev_read_sysfs(boinc_t)
dev_rw_xserver_misc(boinc_t)

domain_read_all_domains_state(boinc_t)

files_dontaudit_getattr_boot_dirs(boinc_t)
files_getattr_all_dirs(boinc_t)
files_getattr_all_files(boinc_t)
files_read_etc_files(boinc_t)
files_read_etc_runtime_files(boinc_t)
files_read_usr_files(boinc_t)

fs_getattr_all_fs(boinc_t)

term_getattr_all_ptys(boinc_t)
term_getattr_unallocated_ttys(boinc_t)

init_read_utmp(boinc_t)

logging_send_syslog_msg(boinc_t)

miscfiles_read_fonts(boinc_t)
miscfiles_read_generic_certs(boinc_t)
miscfiles_read_localization(boinc_t)

tunable_policy(`boinc_execmem',`
	allow boinc_t self:process { execstack execmem };
')

optional_policy(`
	mta_send_mail(boinc_t)
')

optional_policy(`
	sysnet_dns_name_resolve(boinc_t)
')

optional_policy(`
	corenet_tcp_connect_xserver_port(boinc_t)

	xserver_list_xdm_tmp(boinc_t)
	xserver_non_drawing_client(boinc_t)
')

########################################
#
# Project local policy
#

allow boinc_project_t self:capability { setgid setuid };
allow boinc_project_t self:process { execmem execstack noatsecure ptrace setcap getcap setpgid setsched signal_perms };

manage_dirs_pattern(boinc_project_t, boinc_project_tmp_t, boinc_project_tmp_t)
manage_files_pattern(boinc_project_t, boinc_project_tmp_t, boinc_project_tmp_t)
manage_sock_files_pattern(boinc_project_t, boinc_project_tmp_t, boinc_project_tmp_t)
files_tmp_filetrans(boinc_project_t, boinc_project_tmp_t, { dir file sock_file})

manage_dirs_pattern(boinc_project_t, boinc_project_var_lib_t, boinc_project_var_lib_t)
manage_files_pattern(boinc_project_t, boinc_project_var_lib_t, boinc_project_var_lib_t)

allow boinc_project_t boinc_project_var_lib_t:file execmod;
can_exec(boinc_project_t, boinc_project_var_lib_t)

allow boinc_project_t boinc_t:shm rw_shm_perms;
allow boinc_project_t boinc_tmpfs_t:file { read write };

kernel_read_kernel_sysctls(boinc_project_t)
kernel_read_network_state(boinc_project_t)
kernel_search_vm_sysctl(boinc_project_t)

corenet_all_recvfrom_unlabeled(boinc_project_t)
corenet_all_recvfrom_netlabel(boinc_project_t)
corenet_tcp_sendrecv_generic_if(boinc_project_t)
corenet_tcp_sendrecv_generic_node(boinc_project_t)
corenet_tcp_bind_generic_node(boinc_project_t)

corenet_sendrecv_boinc_client_packets(boinc_project_t)
corenet_tcp_connect_boinc_port(boinc_project_t)
corenet_tcp_sendrecv_boinc_port(boinc_project_t)

dev_getattr_input_dev(boinc_t)
dev_getattr_mouse_dev(boinc_t)

files_dontaudit_search_home(boinc_project_t)

term_getattr_ptmx(boinc_t)
term_getattr_generic_ptys(boinc_t)

userdom_getattr_user_ttys(boinc_t)

optional_policy(`
	# for lsb_release -a
	apt_read_cache(boinc_t)
	apt_read_db(boinc_t)
	dpkg_exec(boinc_t)
	dpkg_read_db(boinc_t)

	apt_read_cache(boinc_project_t)
	apt_read_db(boinc_project_t)
	dpkg_exec(boinc_project_t)
	dpkg_read_db(boinc_project_t)
')

optional_policy(`
	java_exec(boinc_project_t)
')