Repository navigation
Expand file tree
/
Copy pathtrivalent.te
More file actions
433 lines (371 loc) · 14.5 KB
/
Copy pathtrivalent.te
File metadata and controls
433 lines (371 loc) · 14.5 KB
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
policy_module(trivalent, 1.0.4)
# SPDX-FileCopyrightText: Copyright 2025-2026 The Secureblue Authors
#
# SPDX-License-Identifier: Apache-2.0 OR MIT
########################################
#
# Declarations
#
## <desc>
## <p>
## Allow chromium to read/write/map v4l devices
## </p>
## <p>
## Needed for camera access
## </p>
## </desc>
gen_tunable(trivalent_rwmap_video_dev, true)
## <desc>
## <p>
## Allow chromium to execute flatpaks
## </p>
## <p>
## Needed for extensions to be able to interact with certain flatpaks like keepassxc
## </p>
## </desc>
gen_tunable(trivalent_exec_flatpaks, true)
## <desc>
## <p>
## Allow Trivalent to play DRM protected content
## which implies executing writable files.
## </p>
## </desc>
gen_tunable(trivalent_drm, true)
attribute_role trivalent_roles;
attribute trivalent_domain;
attribute trivalent_script_domain;
type trivalent_exec_t;
application_executable_file(trivalent_exec_t)
type trivalent_home_t;
userdom_user_home_content(trivalent_home_t)
# Widevine CDM library file (DRM)
type trivalent_home_cdm_lib_t;
userdom_user_home_content(trivalent_home_cdm_lib_t)
type trivalent_script_exec_t;
application_executable_file(trivalent_script_exec_t)
##############################
#
# Local policy
#
gen_require(`
attribute userdomain;
class dbus acquire_svc;
type audio_home_t;
type chrome_sandbox_home_t;
type device_t;
type dosfs_t;
type fonts_cache_t;
type http_port_t;
type http_cache_port_t;
type howl_port_t;
type ld_so_cache_t;
type null_device_t;
type root_t;
type pki_ca_port_t;
type nsfs_t;
type tmp_t;
type tmpfs_t;
type user_home_t;
type xserver_misc_device_t;
')
trivalent_filetrans_home_content(userdomain)
trivalent_filetrans_home_content(trivalent_domain)
trivalent_filetrans_home_content(trivalent_script_domain)
# internal
allow trivalent_domain self:process { execmem getcap getsched setcap setrlimit setsched sigkill signal signull };
tunable_policy(`deny_ptrace',`',`
allow trivalent_domain self:process ptrace;
')
allow trivalent_domain self:dir manage_dir_perms;
allow trivalent_domain self:lnk_file manage_lnk_file_perms;
allow trivalent_domain self:fifo_file { manage_fifo_file_perms relabelfrom relabelto };
allow trivalent_domain self:sem create_sem_perms;
allow trivalent_domain self:user_namespace create;
allow trivalent_domain self:cap_userns { sys_admin sys_chroot sys_ptrace net_admin };
# Internal sockets
allow trivalent_domain self:netlink_kobject_uevent_socket client_stream_socket_perms;
allow trivalent_domain self:netlink_route_socket create_netlink_socket_perms;
allow trivalent_domain self:tcp_socket create_stream_socket_perms;
allow trivalent_domain self:udp_socket create_socket_perms;
allow trivalent_domain self:unix_dgram_socket create_socket_perms;
allow trivalent_domain self:unix_stream_socket { create_stream_socket_perms connectto };
allow trivalent_domain trivalent_exec_t:file execute_no_trans;
allow trivalent_domain chrome_sandbox_home_t:dir { manage_dir_perms };
allow trivalent_domain chrome_sandbox_home_t:file { manage_file_perms map };
allow trivalent_domain chrome_sandbox_home_t:lnk_file { manage_lnk_file_perms };
allow trivalent_domain trivalent_home_t:dir { manage_dir_perms };
allow trivalent_domain trivalent_home_t:file { manage_file_perms map };
allow trivalent_domain trivalent_home_t:lnk_file { manage_lnk_file_perms };
manage_files_pattern(trivalent_domain, trivalent_home_t, trivalent_home_cdm_lib_t)
# not covered by interfaces
allow trivalent_domain fonts_cache_t:dir mounton;
allow trivalent_domain howl_port_t:udp_socket name_bind;
allow trivalent_domain http_port_t:tcp_socket { name_connect };
allow trivalent_domain http_cache_port_t:tcp_socket { name_connect };
allow trivalent_domain pki_ca_port_t:tcp_socket name_connect;
allow trivalent_domain root_t:dir mounton;
allow trivalent_domain tmp_t:lnk_file { create unlink };
allow trivalent_domain tmp_t:sock_file { create unlink };
allow trivalent_domain tmp_t:dir mounton;
allow trivalent_domain tmpfs_t:file mounton;
allow trivalent_domain tmpfs_t:dir { create };
# required for trivalent to be able to detect whether it's the default browser
allow trivalent_domain trivalent_script_exec_t:file { execute getattr read execute_no_trans ioctl open };
# homedir access
allow trivalent_domain user_home_t:dir { manage_dir_perms };
allow trivalent_domain user_home_t:file { manage_file_perms };
allow trivalent_domain user_home_t:lnk_file { manage_lnk_file_perms };
allow trivalent_domain audio_home_t:dir { manage_dir_perms };
allow trivalent_domain audio_home_t:file { manage_file_perms };
allow trivalent_domain audio_home_t:lnk_file { manage_lnk_file_perms };
optional_policy(`
gen_require(`
attribute file_manager_type;
')
# required for trivalent/FM clipboard sharing
allow trivalent_domain file_manager_type:fifo_file write;
')
# allow trivalent to interface with flatpaks (necessary for keepassxc extension, for example)
# uncomment this once new flatpak policy is in use
# optional_policy(`
# flatpak_read_apps(trivalent_domain)
# flatpak_exec_apps(trivalent_domain)
# ')
tunable_policy(`trivalent_exec_flatpaks', `
gen_require(`
type data_home_t;
type flatpak_home_t;
')
# User flatpaks
exec_files_pattern(trivalent_domain, data_home_t, data_home_t)
read_lnk_files_pattern(trivalent_domain, data_home_t, data_home_t)
exec_files_pattern(trivalent_domain, flatpak_home_t, flatpak_home_t)
read_lnk_files_pattern(trivalent_domain, flatpak_home_t, flatpak_home_t)
list_dirs_pattern(trivalent_domain, flatpak_home_t, flatpak_home_t)
# System flatpaks
exec_files_pattern(trivalent_domain, var_lib_t, var_lib_t)
read_lnk_files_pattern(trivalent_domain, var_lib_t, var_lib_t)
')
tunable_policy(`trivalent_drm', `
mmap_exec_files_pattern(trivalent_domain, trivalent_home_t, trivalent_home_cdm_lib_t)
')
# allow trivalent to own its mpris daemon
dbus_connect_session_bus(trivalent_domain)
# xwayland/nvidia
xserver_exec(trivalent_domain)
dev_rw_xserver_misc(trivalent_domain)
dev_map_xserver_misc(trivalent_domain)
allow trivalent_domain xserver_misc_device_t:chr_file { getattr ioctl map open read write };
xserver_stream_connect_xdm(trivalent_domain)
xserver_stream_connect(trivalent_domain)
files_list_home(trivalent_domain)
files_search_home(trivalent_domain)
files_read_usr_files(trivalent_domain)
files_read_etc_files(trivalent_domain)
files_read_etc_runtime_files(trivalent_domain)
files_watch_etc_dirs(trivalent_domain)
files_getattr_all_dirs(trivalent_domain)
files_watch_root_dirs(trivalent_domain)
files_read_var_lib_files(trivalent_domain)
files_rw_generic_tmp_dir(trivalent_domain)
files_manage_generic_tmp_files(trivalent_domain)
files_manage_generic_tmp_dirs(trivalent_domain)
files_rw_generic_tmp_sockets(trivalent_domain)
files_rw_tmp_file_leaks(trivalent_domain)
files_map_generic_tmp_files(trivalent_domain)
# memory pressure
kernel_read_psi(trivalent_domain)
kernel_read_kernel_sysctls(trivalent_domain)
kernel_read_fs_sysctls(trivalent_domain)
# required to connect to wayland
dbus_system_bus_client(trivalent_domain)
dbus_session_bus_client(trivalent_domain)
dbus_write_session_tmp_sock_files(trivalent_domain)
devicekit_dbus_chat_disk(trivalent_domain)
devicekit_dbus_chat_power(trivalent_domain)
systemd_dbus_chat_hostnamed(trivalent_domain)
fs_rw_inherited_tmpfs_files(trivalent_domain)
fs_getattr_xattr_fs(trivalent_domain)
fs_getattr_tmpfs(trivalent_domain)
fs_manage_tmpfs_files(trivalent_domain)
fs_map_tmpfs_files(trivalent_domain)
fs_search_cgroup_dirs(trivalent_domain)
fs_associate_proc(trivalent_domain)
fs_unmount_tmpfs(trivalent_domain)
fs_mount_tmpfs(trivalent_domain)
fs_remount_tmpfs(trivalent_domain)
fs_manage_tmpfs_symlinks(trivalent_domain)
fs_all_mount_fs_perms_xattr_fs(trivalent_domain)
fs_mounton_tmpfs(trivalent_domain)
miscfiles_read_all_certs(trivalent_domain)
miscfiles_map_generic_certs(trivalent_domain)
miscfiles_read_localization(trivalent_domain)
miscfiles_watch_localization_dirs(trivalent_domain)
miscfiles_read_hwdata(trivalent_domain)
alsa_read_rw_config(trivalent_domain)
pulseaudio_stream_connect(trivalent_domain)
pulseaudio_read_home_files(trivalent_domain)
cups_read_config(trivalent_domain)
cups_stream_connect(trivalent_domain)
dev_read_sysfs(trivalent_domain)
dev_rw_dma_dev(trivalent_domain)
dev_rw_dri(trivalent_domain)
dev_rw_generic_usb_dev(trivalent_domain)
dev_read_sound(trivalent_domain)
dev_write_sound(trivalent_domain)
dev_read_urand(trivalent_domain)
dev_read_rand(trivalent_domain)
tunable_policy(`trivalent_rwmap_video_dev', `
dev_read_video_dev(trivalent_domain)
dev_write_video_dev(trivalent_domain)
dev_map_video_dev(trivalent_domain)
')
udev_read_pid_files(trivalent_domain)
term_mount_pty_fs(trivalent_domain)
gnome_search_gconf_data_dir(trivalent_domain)
gnome_manage_cache_home_dir(trivalent_domain)
gnome_manage_generic_cache_files(trivalent_domain)
gnome_manage_generic_cache_sockets(trivalent_domain)
gnome_manage_home_config(trivalent_domain)
gnome_manage_home_config_dirs(trivalent_domain)
gnome_manage_data(trivalent_domain)
gnome_manage_generic_home_files(trivalent_domain)
gnome_manage_generic_home_dirs(trivalent_domain)
gnome_map_generic_data_home_files(trivalent_domain)
gnome_manage_gstreamer_home_files(trivalent_domain)
gnome_dbus_chat_gconfdefault(trivalent_domain)
gnome_dbus_chat_gkeyringd(trivalent_domain)
userdom_manage_user_tmp_sockets(trivalent_domain)
userdom_manage_user_tmp_files(trivalent_domain)
userdom_map_tmp_files(trivalent_domain)
userdom_manage_tmpfs_files(trivalent_domain)
userdom_read_inherited_user_tmp_files(trivalent_domain)
userdom_manage_home_certs(trivalent_domain)
userdom_use_user_terminals(trivalent_domain)
userdom_list_user_home_dirs(trivalent_domain)
logging_write_journal_files(trivalent_domain)
logging_write_syslog_pid_socket(trivalent_domain)
auth_read_passwd_file(trivalent_domain)
# needed to be able to xdg-open, which is bin_t
corecmd_exec_bin(trivalent_domain)
pcscd_stream_connect(trivalent_domain)
xserver_use_user_fonts(trivalent_domain)
xserver_map_user_fonts(trivalent_domain)
systemd_dbus_chat_hostnamed(trivalent_domain)
systemd_resolved_watch_pid_dirs(trivalent_domain)
init_search_pid_dirs(trivalent_domain)
init_read_state(trivalent_domain)
corenet_tcp_connect_all_unreserved_ports(trivalent_domain)
corenet_tcp_connect_generic_port(trivalent_domain)
corenet_tcp_connect_ftp_port(trivalent_domain)
corenet_tcp_connect_http_port(trivalent_domain)
corenet_tcp_connect_ipp_port(trivalent_domain)
corenet_tcp_bind_generic_node(trivalent_domain)
corenet_udp_bind_generic_node(trivalent_domain)
corenet_udp_bind_all_unreserved_ports(trivalent_domain)
sysnet_read_config(trivalent_domain)
sysnet_dns_name_resolve(trivalent_domain)
networkmanager_dbus_chat(trivalent_domain)
storage_getattr_fixed_disk_dev(trivalent_domain)
optional_policy(`
bluetooth_dbus_chat(trivalent_domain)
')
optional_policy(`
# copy/pasting to distrobox apps
container_spc_rw_pipes(trivalent_domain)
')
allow trivalent_script_domain trivalent_domain:dir { getattr search };
allow trivalent_script_domain trivalent_domain:file { open read };
allow trivalent_script_domain self:dir { add_entry_dir_perms };
allow trivalent_script_domain self:file { create };
allow trivalent_script_domain self:user_namespace create;
allow trivalent_script_domain self:cap_userns { sys_ptrace sys_admin setpcap };
allow trivalent_script_domain self:process { setcap setsched };
tunable_policy(`deny_ptrace',`',`
allow trivalent_script_domain self:process ptrace;
')
allow trivalent_script_domain user_home_t:dir { search };
allow trivalent_script_domain cache_home_t:dir { mounton };
allow trivalent_script_domain chrome_sandbox_home_t:dir { manage_dir_perms };
allow trivalent_script_domain chrome_sandbox_home_t:file { manage_file_perms };
allow trivalent_script_domain chrome_sandbox_home_t:lnk_file read;
allow trivalent_script_domain trivalent_home_t:dir { manage_dir_perms };
allow trivalent_script_domain trivalent_home_t:file { manage_file_perms map };
allow trivalent_script_domain trivalent_home_t:lnk_file { manage_lnk_file_perms };
allow trivalent_script_domain nsfs_t:file getattr;
allow trivalent_script_domain ld_so_cache_t:file mounton;
allow trivalent_script_domain root_t:dir mounton;
allow trivalent_script_domain tmp_t:dir mounton;
allow trivalent_script_domain tmp_t:sock_file getattr;
allow trivalent_script_domain tmpfs_t:dir { create };
allow trivalent_script_domain device_t:filesystem remount;
allow trivalent_script_domain dosfs_t:filesystem remount;
allow trivalent_script_domain null_device_t:chr_file mounton;
# xwayland/nvidia
xserver_exec(trivalent_script_domain)
dev_rw_xserver_misc(trivalent_script_domain)
dev_map_xserver_misc(trivalent_script_domain)
allow trivalent_script_domain xserver_misc_device_t:chr_file { getattr ioctl map open read write };
domain_dontaudit_search_all_domains_state(trivalent_script_domain)
files_manage_generic_tmp_dirs(trivalent_script_domain)
fs_mounton_tmpfs(trivalent_script_domain)
fs_unmount_tmpfs(trivalent_script_domain)
fs_mount_tmpfs(trivalent_script_domain)
gnome_manage_data(trivalent_script_domain)
gnome_manage_home_config(trivalent_script_domain)
gnome_manage_home_config_dirs(trivalent_script_domain)
gnome_manage_cache_home_dir(trivalent_script_domain)
gnome_manage_generic_cache_files(trivalent_script_domain)
gnome_manage_generic_cache_sockets(trivalent_script_domain)
gnome_map_generic_cache_files(trivalent_script_domain)
corecmd_exec_shell(trivalent_script_domain)
corecmd_exec_bin(trivalent_script_domain)
files_getattr_all_dirs(trivalent_script_domain)
userdom_list_user_home_dirs(trivalent_script_domain)
kernel_list_proc(trivalent_script_domain)
kernel_read_proc_files(trivalent_script_domain)
kernel_getattr_proc_files(trivalent_script_domain)
kernel_getattr_proc(trivalent_script_domain)
seutil_exec_setfiles(trivalent_script_domain)
seutil_manage_file_contexts(trivalent_script_domain)
userdom_use_inherited_user_terminals(trivalent_script_domain)
fs_all_mount_fs_perms_xattr_fs(trivalent_script_domain)
optional_policy(`
bubblewrap_exec(trivalent_script_domain)
bubblewrap_exec(trivalent_domain)
')
optional_policy(`
gen_require(`
type unconfined_t;
role unconfined_r;
')
trivalent_role_template(unconfined, unconfined_r, unconfined_t)
')
optional_policy(`
gen_require(`
type flatpak_t;
type unconfined_trivalent_script_t;
')
domtrans_pattern(flatpak_t, trivalent_script_exec_t, unconfined_trivalent_script_t)
')
optional_policy(`
gen_require(`
type sysadm_t;
role sysadm_r;
')
trivalent_role_template(sysadm, sysadm_r, sysadm_t)
')
optional_policy(`
gen_require(`
type staff_t;
role staff_r;
')
trivalent_role_template(staff, staff_r, staff_t)
')
optional_policy(`
gen_require(`
type user_t;
role user_r;
')
trivalent_role_template(user, user_r, user_t)
')