aboutsummaryrefslogtreecommitdiff
blob: 2b15088a70c0df616bdb16b888f145a4ed85887e (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
policy_module(rpm, 1.23.0)

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

attribute_role rpm_roles;

type debuginfo_exec_t;
domain_entry_file(rpm_t, debuginfo_exec_t)

type rpm_t;
type rpm_exec_t;
init_system_domain(rpm_t, rpm_exec_t)
domain_obj_id_change_exemption(rpm_t)
domain_role_change_exemption(rpm_t)
domain_system_change_exemption(rpm_t)
domain_interactive_fd(rpm_t)
role rpm_roles types rpm_t;

type rpm_initrc_exec_t;
init_script_file(rpm_initrc_exec_t)

type rpm_file_t;
files_type(rpm_file_t)

type rpm_tmp_t;
files_tmp_file(rpm_tmp_t)

type rpm_tmpfs_t;
files_tmpfs_file(rpm_tmpfs_t)

type rpm_lock_t;
files_lock_file(rpm_lock_t)

type rpm_log_t;
logging_log_file(rpm_log_t)

type rpm_unit_t;
init_unit_file(rpm_unit_t)

type rpm_var_lib_t;
files_type(rpm_var_lib_t)
typealias rpm_var_lib_t alias var_lib_rpm_t;

type rpm_var_cache_t;
files_type(rpm_var_cache_t)

type rpm_var_run_t;
files_pid_file(rpm_var_run_t)

type rpm_script_t;
type rpm_script_exec_t;
domain_obj_id_change_exemption(rpm_script_t)
domain_system_change_exemption(rpm_script_t)
corecmd_shell_entry_type(rpm_script_t)
corecmd_bin_entry_type(rpm_script_t)
domain_type(rpm_script_t)
domain_entry_file(rpm_t, rpm_script_exec_t)
domain_interactive_fd(rpm_script_t)
role rpm_roles types rpm_script_t;
role system_r types rpm_script_t;

type rpm_script_tmp_t;
files_tmp_file(rpm_script_tmp_t)

type rpm_script_tmpfs_t;
files_tmpfs_file(rpm_script_tmpfs_t)

########################################
#
# rpm Local policy
#

allow rpm_t self:capability { chown dac_override fowner fsetid ipc_lock mknod setfcap setgid setuid sys_chroot sys_nice sys_tty_config };
allow rpm_t self:process { transition signal_perms getsched setsched getsession getpgid setpgid getcap setcap share getattr setexec setfscreate noatsecure siginh setrlimit rlimitinh dyntransition execmem setkeycreate setsockcreate getrlimit };
allow rpm_t self:fd use;
allow rpm_t self:fifo_file rw_fifo_file_perms;
allow rpm_t self:unix_dgram_socket sendto;
allow rpm_t self:unix_stream_socket { accept connectto listen };
allow rpm_t self:udp_socket connect;
allow rpm_t self:tcp_socket { accept listen };
allow rpm_t self:shm create_shm_perms;
allow rpm_t self:sem create_sem_perms;
allow rpm_t self:msgq create_msgq_perms;
allow rpm_t self:msg { send receive };
allow rpm_t self:file rw_file_perms;
allow rpm_t self:netlink_kobject_uevent_socket create_socket_perms;

allow rpm_t rpm_log_t:file { append_file_perms create_file_perms setattr_file_perms };
logging_log_filetrans(rpm_t, rpm_log_t, file)

manage_dirs_pattern(rpm_t, rpm_tmp_t, rpm_tmp_t)
manage_files_pattern(rpm_t, rpm_tmp_t, rpm_tmp_t)
files_tmp_filetrans(rpm_t, rpm_tmp_t, { file dir })

manage_dirs_pattern(rpm_t, rpm_tmpfs_t, rpm_tmpfs_t)
manage_files_pattern(rpm_t, rpm_tmpfs_t, rpm_tmpfs_t)
manage_lnk_files_pattern(rpm_t, rpm_tmpfs_t, rpm_tmpfs_t)
manage_fifo_files_pattern(rpm_t, rpm_tmpfs_t, rpm_tmpfs_t)
manage_sock_files_pattern(rpm_t, rpm_tmpfs_t, rpm_tmpfs_t)
fs_tmpfs_filetrans(rpm_t, rpm_tmpfs_t, { dir file lnk_file sock_file fifo_file })

manage_dirs_pattern(rpm_t, rpm_var_cache_t, rpm_var_cache_t)
manage_files_pattern(rpm_t, rpm_var_cache_t, rpm_var_cache_t)
files_var_filetrans(rpm_t, rpm_var_cache_t, dir)

manage_files_pattern(rpm_t, rpm_lock_t, rpm_lock_t)
files_lock_filetrans(rpm_t, rpm_lock_t, file)

manage_dirs_pattern(rpm_t, rpm_var_lib_t, rpm_var_lib_t)
manage_files_pattern(rpm_t, rpm_var_lib_t, rpm_var_lib_t)
files_var_lib_filetrans(rpm_t, rpm_var_lib_t, { dir file })

manage_dirs_pattern(rpm_t, rpm_var_run_t, rpm_var_run_t)
manage_files_pattern(rpm_t, rpm_var_run_t, rpm_var_run_t)
files_pid_filetrans(rpm_t, rpm_var_run_t, { dir file })

can_exec(rpm_t, { rpm_tmp_t rpm_tmpfs_t })

kernel_read_crypto_sysctls(rpm_t)
kernel_read_network_state(rpm_t)
kernel_read_system_state(rpm_t)
kernel_read_kernel_sysctls(rpm_t)
kernel_read_network_state_symlinks(rpm_t)
kernel_rw_irq_sysctls(rpm_t)

corecmd_exec_all_executables(rpm_t)

corenet_all_recvfrom_unlabeled(rpm_t)
corenet_all_recvfrom_netlabel(rpm_t)
corenet_tcp_sendrecv_generic_if(rpm_t)
corenet_tcp_sendrecv_generic_node(rpm_t)
corenet_tcp_sendrecv_all_ports(rpm_t)

corenet_sendrecv_all_client_packets(rpm_t)
corenet_tcp_connect_all_ports(rpm_t)

dev_list_sysfs(rpm_t)
dev_list_usbfs(rpm_t)
dev_read_urand(rpm_t)
dev_read_raw_memory(rpm_t)

dev_manage_all_dev_nodes(rpm_t)
dev_relabel_all_dev_nodes(rpm_t)

dev_create_generic_blk_files(rpm_t)
dev_create_generic_chr_files(rpm_t)

domain_read_all_domains_state(rpm_t)
domain_getattr_all_domains(rpm_t)
domain_use_interactive_fds(rpm_t)
domain_dontaudit_getattr_all_pipes(rpm_t)
domain_dontaudit_getattr_all_tcp_sockets(rpm_t)
domain_dontaudit_getattr_all_udp_sockets(rpm_t)
domain_dontaudit_getattr_all_packet_sockets(rpm_t)
domain_dontaudit_getattr_all_raw_sockets(rpm_t)
domain_dontaudit_getattr_all_stream_sockets(rpm_t)
domain_dontaudit_getattr_all_dgram_sockets(rpm_t)
domain_signull_all_domains(rpm_t)

files_exec_etc_files(rpm_t)
files_relabel_non_auth_files(rpm_t)
files_manage_non_auth_files(rpm_t)

fs_getattr_all_dirs(rpm_t)
fs_list_inotifyfs(rpm_t)
fs_manage_nfs_dirs(rpm_t)
fs_manage_nfs_files(rpm_t)
fs_manage_nfs_symlinks(rpm_t)
fs_getattr_all_fs(rpm_t)
fs_search_auto_mountpoints(rpm_t)

mls_file_read_all_levels(rpm_t)
mls_file_write_all_levels(rpm_t)
mls_file_relabel(rpm_t)
mls_file_upgrade(rpm_t)
mls_file_downgrade(rpm_t)

selinux_get_fs_mount(rpm_t)
selinux_validate_context(rpm_t)
selinux_compute_access_vector(rpm_t)
selinux_compute_create_context(rpm_t)
selinux_compute_relabel_context(rpm_t)
selinux_compute_user_contexts(rpm_t)

storage_raw_write_fixed_disk(rpm_t)
storage_raw_read_fixed_disk(rpm_t)

term_list_ptys(rpm_t)

auth_dontaudit_read_shadow(rpm_t)
auth_use_nsswitch(rpm_t)

rpm_domtrans_script(rpm_t)

init_domtrans_script(rpm_t)
init_use_script_ptys(rpm_t)
init_signull_script(rpm_t)

libs_exec_ld_so(rpm_t)
libs_exec_lib_files(rpm_t)
libs_run_ldconfig(rpm_t, rpm_roles)

logging_send_syslog_msg(rpm_t)

seutil_manage_src_policy(rpm_t)
seutil_manage_bin_policy(rpm_t)

userdom_use_user_terminals(rpm_t)
userdom_use_unpriv_users_fds(rpm_t)

optional_policy(`
	cron_system_entry(rpm_t, rpm_exec_t)
')

optional_policy(`
	dbus_system_domain(rpm_t, rpm_exec_t)
	dbus_system_domain(rpm_t, debuginfo_exec_t)

	optional_policy(`
		hal_dbus_chat(rpm_t)
	')

	optional_policy(`
		networkmanager_dbus_chat(rpm_t)
	')

	optional_policy(`
		unconfined_dbus_chat(rpm_t)
	')
')

optional_policy(`
	prelink_run(rpm_t, rpm_roles)
')

########################################
#
# rpm-script Local policy
#

allow rpm_script_t self:capability { chown dac_override dac_read_search fowner fsetid ipc_lock kill mknod net_admin setgid setuid sys_admin sys_chroot sys_nice sys_rawio };
allow rpm_script_t self:process { transition signal_perms getsched setsched getsession getpgid setpgid getcap setcap share getattr noatsecure siginh rlimitinh dyntransition execmem execstack setkeycreate setsockcreate getrlimit };
allow rpm_script_t self:fd use;
allow rpm_script_t self:fifo_file rw_fifo_file_perms;
allow rpm_script_t self:unix_dgram_socket sendto;
allow rpm_script_t self:unix_stream_socket { accept connectto listen };
allow rpm_script_t self:shm create_shm_perms;
allow rpm_script_t self:sem create_sem_perms;
allow rpm_script_t self:msgq create_msgq_perms;
allow rpm_script_t self:msg { send receive };
allow rpm_script_t self:netlink_kobject_uevent_socket create_socket_perms;

allow rpm_script_t rpm_t:netlink_route_socket { read write };

allow rpm_script_t rpm_tmp_t:file read_file_perms;

allow rpm_script_t rpm_script_tmp_t:dir mounton;
manage_dirs_pattern(rpm_script_t, rpm_script_tmp_t, rpm_script_tmp_t)
manage_files_pattern(rpm_script_t, rpm_script_tmp_t, rpm_script_tmp_t)
manage_blk_files_pattern(rpm_script_t, rpm_script_tmp_t, rpm_script_tmp_t)
manage_chr_files_pattern(rpm_script_t, rpm_script_tmp_t, rpm_script_tmp_t)
files_tmp_filetrans(rpm_script_t, rpm_script_tmp_t, { file dir })

manage_dirs_pattern(rpm_script_t, rpm_script_tmpfs_t, rpm_script_tmpfs_t)
manage_files_pattern(rpm_script_t, rpm_script_tmpfs_t, rpm_script_tmpfs_t)
manage_lnk_files_pattern(rpm_script_t, rpm_script_tmpfs_t, rpm_script_tmpfs_t)
manage_fifo_files_pattern(rpm_script_t, rpm_script_tmpfs_t, rpm_script_tmpfs_t)
manage_sock_files_pattern(rpm_script_t, rpm_script_tmpfs_t, rpm_script_tmpfs_t)
fs_tmpfs_filetrans(rpm_script_t, rpm_script_tmpfs_t, { dir file lnk_file sock_file fifo_file })

can_exec(rpm_script_t, { rpm_script_tmp_t rpm_script_tmpfs_t })

kernel_read_crypto_sysctls(rpm_script_t)
kernel_read_kernel_sysctls(rpm_script_t)
kernel_read_system_state(rpm_script_t)
kernel_read_network_state(rpm_script_t)
kernel_list_all_proc(rpm_script_t)
kernel_read_software_raid_state(rpm_script_t)

corenet_all_recvfrom_unlabeled(rpm_script_t)
corenet_all_recvfrom_netlabel(rpm_script_t)
corenet_tcp_sendrecv_generic_if(rpm_script_t)
corenet_tcp_sendrecv_generic_node(rpm_script_t)

corenet_sendrecv_http_client_packets(rpm_script_t)
corenet_tcp_connect_http_port(rpm_script_t)
corenet_tcp_sendrecv_http_port(rpm_script_t)

corecmd_exec_all_executables(rpm_script_t)

dev_list_sysfs(rpm_script_t)
dev_manage_generic_blk_files(rpm_script_t)
dev_manage_generic_chr_files(rpm_script_t)
dev_manage_all_blk_files(rpm_script_t)
dev_manage_all_chr_files(rpm_script_t)

domain_read_all_domains_state(rpm_script_t)
domain_getattr_all_domains(rpm_script_t)
domain_use_interactive_fds(rpm_script_t)
domain_signal_all_domains(rpm_script_t)
domain_signull_all_domains(rpm_script_t)

files_exec_etc_files(rpm_script_t)
files_exec_usr_files(rpm_script_t)
files_manage_non_auth_files(rpm_script_t)
files_relabel_non_auth_files(rpm_script_t)

fs_manage_nfs_files(rpm_script_t)
fs_getattr_nfs(rpm_script_t)
fs_search_all(rpm_script_t)
fs_getattr_all_fs(rpm_script_t)
fs_getattr_xattr_fs(rpm_script_t)
fs_mount_xattr_fs(rpm_script_t)
fs_unmount_xattr_fs(rpm_script_t)
fs_search_auto_mountpoints(rpm_script_t)

mcs_killall(rpm_script_t)

mls_file_read_all_levels(rpm_script_t)
mls_file_write_all_levels(rpm_script_t)

selinux_get_fs_mount(rpm_script_t)
selinux_validate_context(rpm_script_t)
selinux_compute_access_vector(rpm_script_t)
selinux_compute_create_context(rpm_script_t)
selinux_compute_relabel_context(rpm_script_t)
selinux_compute_user_contexts(rpm_script_t)

storage_raw_read_fixed_disk(rpm_script_t)
storage_raw_write_fixed_disk(rpm_script_t)

term_getattr_unallocated_ttys(rpm_script_t)
term_list_ptys(rpm_script_t)
term_use_all_terms(rpm_script_t)

auth_dontaudit_getattr_shadow(rpm_script_t)
auth_use_nsswitch(rpm_script_t)

init_domtrans_script(rpm_script_t)
init_telinit(rpm_script_t)

libs_exec_ld_so(rpm_script_t)
libs_exec_lib_files(rpm_script_t)
libs_run_ldconfig(rpm_script_t, rpm_roles)

logging_send_syslog_msg(rpm_script_t)

miscfiles_read_localization(rpm_script_t)

modutils_run(rpm_script_t, rpm_roles)

seutil_run_loadpolicy(rpm_script_t, rpm_roles)
seutil_run_setfiles(rpm_script_t, rpm_roles)
seutil_run_semanage(rpm_script_t, rpm_roles)

userdom_use_all_users_fds(rpm_script_t)

ifdef(`distro_redhat',`
	optional_policy(`
		mta_send_mail(rpm_script_t)
		mta_system_content(rpm_var_run_t)
	')
')

tunable_policy(`allow_execmem',`
	allow rpm_script_t self:process execmem;
')

optional_policy(`
	bootloader_run(rpm_script_t, rpm_roles)
')

optional_policy(`
	dbus_system_bus_client(rpm_script_t)

	optional_policy(`
		unconfined_dbus_chat(rpm_script_t)
	')
')

optional_policy(`
	lvm_run(rpm_script_t, rpm_roles)
')

optional_policy(`
	ntp_domtrans(rpm_script_t)
')

optional_policy(`
	tzdata_run(rpm_t, rpm_roles)
	tzdata_run(rpm_script_t, rpm_roles)
')

optional_policy(`
	udev_domtrans(rpm_script_t)
')

optional_policy(`
	unconfined_domtrans(rpm_script_t)

	optional_policy(`
		java_domtrans_unconfined(rpm_script_t)
	')

	optional_policy(`
		mono_domtrans(rpm_script_t)
	')
')

optional_policy(`
	usermanage_run_groupadd(rpm_script_t, rpm_roles)
	usermanage_run_useradd(rpm_script_t, rpm_roles)
')

ifdef(`distro_gentoo',`
	# Moved out of files_relabel_non_auth_files as it cannot be used in tunables otherwise
	seutil_relabelto_bin_policy(rpm_t)
	seutil_relabelto_bin_policy(rpm_script_t)
')