]> git.ipfire.org Git - people/stevee/selinux-policy.git/blame - policy/modules/system/userdomain.if
Change auth_use_nsswitch, init_system_daemon and init_daemon_domain to use attributes...
[people/stevee/selinux-policy.git] / policy / modules / system / userdomain.if
CommitLineData
490639cd 1## <summary>Policy for user domains</summary>
b16c6b8c 2
8fd36732
CP
3#######################################
4## <summary>
bbcd3c97 5## The template containing the most basic rules common to all users.
8fd36732
CP
6## </summary>
7## <desc>
8## <p>
bbcd3c97 9## The template containing the most basic rules common to all users.
8fd36732
CP
10## </p>
11## <p>
bbcd3c97
CP
12## This template creates a user domain, types, and
13## rules for the user's tty and pty.
8fd36732
CP
14## </p>
15## </desc>
16## <param name="userdomain_prefix">
885b83ec 17## <summary>
8fd36732
CP
18## The prefix of the user domain (e.g., user
19## is the prefix for user_t).
885b83ec 20## </summary>
8fd36732 21## </param>
bbcd3c97 22## <rolebase/>
b16c6b8c 23#
bbcd3c97 24template(`userdom_base_user_template',`
c6a60bb2
CP
25
26 gen_require(`
d6d16b97 27 attribute userdomain;
296273a7 28 type user_devpts_t, user_tty_device_t;
c6a60bb2
CP
29 class context contains;
30 ')
31
0c73cd25 32 attribute $1_file_type;
3eaa9939 33 attribute $1_usertype;
0c73cd25 34
3eaa9939 35 type $1_t, userdomain, $1_usertype;
c9428d33
CP
36 domain_type($1_t)
37 corecmd_shell_entry_type($1_t)
d40c0ecf 38 corecmd_bin_entry_type($1_t)
2e863f8a 39 domain_user_exemption_target($1_t)
296273a7 40 ubac_constrained($1_t)
0c73cd25
CP
41 role $1_r types $1_t;
42 allow system_r $1_r;
43
296273a7 44 term_user_pty($1_t, user_devpts_t)
0c73cd25 45
296273a7 46 term_user_tty($1_t, user_tty_device_t)
3eaa9939
DW
47 term_dontaudit_getattr_generic_ptys($1_t)
48
49 allow $1_usertype $1_usertype:process { ptrace signal_perms getsched setsched share getpgid setpgid getcap setcap getsession getattr };
50 allow $1_usertype $1_usertype:fd use;
51 allow $1_usertype $1_t:key { create view read write search link setattr };
52
53 allow $1_usertype $1_usertype:fifo_file rw_fifo_file_perms;
54 allow $1_usertype $1_usertype:unix_dgram_socket { create_socket_perms sendto };
55 allow $1_usertype $1_usertype:unix_stream_socket { create_stream_socket_perms connectto };
56 allow $1_usertype $1_usertype:shm create_shm_perms;
57 allow $1_usertype $1_usertype:sem create_sem_perms;
58 allow $1_usertype $1_usertype:msgq create_msgq_perms;
59 allow $1_usertype $1_usertype:msg { send receive };
60 allow $1_usertype $1_usertype:context contains;
61 dontaudit $1_usertype $1_usertype:socket create;
62
63 allow $1_usertype user_devpts_t:chr_file { setattr rw_chr_file_perms };
64 term_create_pty($1_usertype, user_devpts_t)
296273a7 65 # avoid annoying messages on terminal hangup on role change
3eaa9939 66 dontaudit $1_usertype user_devpts_t:chr_file ioctl;
0c73cd25 67
3eaa9939 68 allow $1_usertype user_tty_device_t:chr_file { setattr rw_chr_file_perms };
296273a7 69 # avoid annoying messages on terminal hangup on role change
3eaa9939
DW
70 dontaudit $1_usertype user_tty_device_t:chr_file ioctl;
71
72 application_exec_all($1_usertype)
73
74 kernel_read_kernel_sysctls($1_usertype)
75 kernel_read_all_sysctls($1_usertype)
76 kernel_dontaudit_list_unlabeled($1_usertype)
77 kernel_dontaudit_getattr_unlabeled_files($1_usertype)
78 kernel_dontaudit_getattr_unlabeled_symlinks($1_usertype)
79 kernel_dontaudit_getattr_unlabeled_pipes($1_usertype)
80 kernel_dontaudit_getattr_unlabeled_sockets($1_usertype)
81 kernel_dontaudit_getattr_unlabeled_blk_files($1_usertype)
82 kernel_dontaudit_getattr_unlabeled_chr_files($1_usertype)
83 kernel_dontaudit_list_proc($1_usertype)
84
85 dev_dontaudit_getattr_all_blk_files($1_usertype)
86 dev_dontaudit_getattr_all_chr_files($1_usertype)
87 dev_getattr_mtrr_dev($1_t)
847937da 88
2ec4c9d3 89 # When the user domain runs ps, there will be a number of access
ff8f0a63 90 # denials when ps tries to search /proc. Do not audit these denials.
3eaa9939
DW
91 domain_dontaudit_read_all_domains_state($1_usertype)
92 domain_dontaudit_getattr_all_domains($1_usertype)
93 domain_dontaudit_getsession_all_domains($1_usertype)
7bbb31df 94 dev_dontaudit_all_access_check($1_usertype)
3eaa9939
DW
95
96 files_read_etc_files($1_usertype)
97 files_list_mnt($1_usertype)
1415ddd2 98 files_list_var($1_usertype)
3eaa9939 99 files_read_mnt_files($1_usertype)
7455c4b3 100 files_dontaudit_access_check_mnt($1_usertype)
3eaa9939
DW
101 files_read_etc_runtime_files($1_usertype)
102 files_read_usr_files($1_usertype)
103 files_read_usr_src_files($1_usertype)
bbcd3c97
CP
104 # Read directories and files with the readable_t type.
105 # This type is a general type for "world"-readable files.
3eaa9939
DW
106 files_list_world_readable($1_usertype)
107 files_read_world_readable_files($1_usertype)
108 files_read_world_readable_symlinks($1_usertype)
109 files_read_world_readable_pipes($1_usertype)
110 files_read_world_readable_sockets($1_usertype)
a2868f6e 111 # old broswer_domain():
3eaa9939
DW
112 files_dontaudit_getattr_all_dirs($1_usertype)
113 files_dontaudit_list_non_security($1_usertype)
114 files_dontaudit_getattr_all_files($1_usertype)
115 files_dontaudit_getattr_non_security_symlinks($1_usertype)
116 files_dontaudit_getattr_non_security_pipes($1_usertype)
117 files_dontaudit_getattr_non_security_sockets($1_usertype)
d255399f 118 files_dontaudit_setattr_etc_runtime_files($1_usertype)
3eaa9939
DW
119
120 files_exec_usr_files($1_t)
121
122 fs_list_cgroup_dirs($1_usertype)
123 fs_dontaudit_rw_cgroup_files($1_usertype)
124
125 storage_rw_fuse($1_usertype)
126
ae68f77d 127 auth_use_nsswitch($1_t)
0c73cd25 128
3eaa9939 129 init_stream_connect($1_usertype)
9461b606
DW
130 # The library functions always try to open read-write first,
131 # then fall back to read-only if it fails.
132 init_dontaudit_rw_utmp($1_usertype)
bbcd3c97 133
3eaa9939 134 libs_exec_ld_so($1_usertype)
6b19be33 135
7e9cab9c
DW
136 logging_send_audit_msgs($1_t)
137
bbcd3c97 138 miscfiles_read_localization($1_t)
83406219 139 miscfiles_read_generic_certs($1_t)
6b19be33 140
cab9bc9c 141 miscfiles_read_all_certs($1_usertype)
3eaa9939
DW
142 miscfiles_read_localization($1_usertype)
143 miscfiles_read_man_pages($1_usertype)
144 miscfiles_read_public_files($1_usertype)
bbcd3c97 145
780fa294
DW
146 systemd_dbus_chat_logind($1_usertype)
147
bbcd3c97
CP
148 tunable_policy(`allow_execmem',`
149 # Allow loading DSOs that require executable stack.
150 allow $1_t self:process execmem;
151 ')
152
153 tunable_policy(`allow_execmem && allow_execstack',`
154 # Allow making the stack executable via mprotect.
155 allow $1_t self:process execstack;
156 ')
3eaa9939 157
d0f23a26
DW
158 optional_policy(`
159 abrt_stream_connect($1_usertype)
160 ')
161
3eaa9939
DW
162 optional_policy(`
163 fs_list_cgroup_dirs($1_usertype)
164 ')
a8183914 165
3eaa9939
DW
166 optional_policy(`
167 ssh_rw_stream_sockets($1_usertype)
168 ssh_delete_tmp($1_t)
169 ssh_signal($1_t)
170 ')
bbcd3c97
CP
171')
172
173#######################################
174## <summary>
296273a7
CP
175## Allow a home directory for which the
176## role has read-only access.
bbcd3c97
CP
177## </summary>
178## <desc>
179## <p>
296273a7
CP
180## Allow a home directory for which the
181## role has read-only access.
bbcd3c97
CP
182## </p>
183## <p>
184## This does not allow execute access.
185## </p>
186## </desc>
296273a7 187## <param name="role">
bbcd3c97 188## <summary>
296273a7
CP
189## The user role
190## </summary>
191## </param>
192## <param name="userdomain">
193## <summary>
194## The user domain
bbcd3c97
CP
195## </summary>
196## </param>
197## <rolebase/>
198#
296273a7 199interface(`userdom_ro_home_role',`
d6d16b97 200 gen_require(`
296273a7 201 type user_home_t, user_home_dir_t;
d6d16b97
CP
202 ')
203
3eaa9939
DW
204 role $1 types { user_home_t user_home_dir_t };
205
bbcd3c97
CP
206 ##############################
207 #
208 # Domain access to home dir
209 #
210
296273a7
CP
211 type_member $2 user_home_dir_t:dir user_home_dir_t;
212
bbcd3c97 213 # read-only home directory
296273a7
CP
214 allow $2 user_home_dir_t:dir list_dir_perms;
215 allow $2 user_home_t:dir list_dir_perms;
216 allow $2 user_home_t:file entrypoint;
217 read_files_pattern($2, { user_home_t user_home_dir_t }, user_home_t)
218 read_lnk_files_pattern($2, { user_home_t user_home_dir_t }, user_home_t)
219 read_fifo_files_pattern($2, { user_home_t user_home_dir_t }, user_home_t)
220 read_sock_files_pattern($2, { user_home_t user_home_dir_t }, user_home_t)
221 files_list_home($2)
bbcd3c97 222
bbcd3c97
CP
223')
224
225#######################################
226## <summary>
296273a7
CP
227## Allow a home directory for which the
228## role has full access.
bbcd3c97
CP
229## </summary>
230## <desc>
231## <p>
296273a7
CP
232## Allow a home directory for which the
233## role has full access.
bbcd3c97
CP
234## </p>
235## <p>
236## This does not allow execute access.
237## </p>
238## </desc>
296273a7 239## <param name="role">
bbcd3c97 240## <summary>
296273a7
CP
241## The user role
242## </summary>
243## </param>
244## <param name="userdomain">
245## <summary>
246## The user domain
bbcd3c97
CP
247## </summary>
248## </param>
249## <rolebase/>
250#
296273a7 251interface(`userdom_manage_home_role',`
d6d16b97 252 gen_require(`
296273a7 253 type user_home_t, user_home_dir_t;
3eaa9939 254 attribute user_home_type;
d6d16b97
CP
255 ')
256
3eaa9939
DW
257 role $1 types { user_home_type user_home_dir_t };
258
bbcd3c97
CP
259 ##############################
260 #
261 # Domain access to home dir
262 #
263
296273a7
CP
264 type_member $2 user_home_dir_t:dir user_home_dir_t;
265
bbcd3c97 266 # full control of the home directory
3eaa9939 267 allow $2 user_home_t:dir mounton;
296273a7 268 allow $2 user_home_t:file entrypoint;
3eaa9939
DW
269
270 allow $2 user_home_type:dir_file_class_set { relabelto relabelfrom };
271 allow $2 user_home_dir_t:lnk_file read_lnk_file_perms;
272 manage_dirs_pattern($2, { user_home_dir_t user_home_type }, user_home_type)
273 manage_files_pattern($2, { user_home_dir_t user_home_type }, user_home_type)
274 manage_lnk_files_pattern($2, { user_home_dir_t user_home_type }, user_home_type)
275 manage_sock_files_pattern($2, { user_home_dir_t user_home_type }, user_home_type)
276 manage_fifo_files_pattern($2, { user_home_dir_t user_home_type }, user_home_type)
277 relabel_dirs_pattern($2, { user_home_dir_t user_home_type }, user_home_type)
278 relabel_files_pattern($2, { user_home_dir_t user_home_type }, user_home_type)
279 relabel_lnk_files_pattern($2, { user_home_dir_t user_home_type }, user_home_type)
280 relabel_sock_files_pattern($2, { user_home_dir_t user_home_type }, user_home_type)
281 relabel_fifo_files_pattern($2, { user_home_dir_t user_home_type }, user_home_type)
296273a7
CP
282 filetrans_pattern($2, user_home_dir_t, user_home_t, { dir file lnk_file sock_file fifo_file })
283 files_list_home($2)
bbcd3c97 284
c0868a7a 285 # cjp: this should probably be removed:
296273a7 286 allow $2 user_home_dir_t:dir { manage_dir_perms relabel_dir_perms };
c0868a7a 287
bbcd3c97 288 tunable_policy(`use_nfs_home_dirs',`
3eaa9939
DW
289 fs_mount_nfs($2)
290 fs_mounton_nfs($2)
296273a7
CP
291 fs_manage_nfs_dirs($2)
292 fs_manage_nfs_files($2)
293 fs_manage_nfs_symlinks($2)
294 fs_manage_nfs_named_sockets($2)
295 fs_manage_nfs_named_pipes($2)
bbcd3c97
CP
296 ')
297
298 tunable_policy(`use_samba_home_dirs',`
3eaa9939
DW
299 fs_mount_cifs($2)
300 fs_mounton_cifs($2)
296273a7
CP
301 fs_manage_cifs_dirs($2)
302 fs_manage_cifs_files($2)
303 fs_manage_cifs_symlinks($2)
304 fs_manage_cifs_named_sockets($2)
305 fs_manage_cifs_named_pipes($2)
bbcd3c97
CP
306 ')
307')
308
309#######################################
310## <summary>
296273a7 311## Manage user temporary files
bbcd3c97 312## </summary>
296273a7 313## <param name="role">
bbcd3c97 314## <summary>
296273a7 315## Role allowed access.
bbcd3c97
CP
316## </summary>
317## </param>
296273a7 318## <param name="domain">
bbcd3c97 319## <summary>
296273a7 320## Domain allowed access.
bbcd3c97
CP
321## </summary>
322## </param>
323## <rolebase/>
324#
296273a7 325interface(`userdom_manage_tmp_role',`
d6d16b97 326 gen_require(`
8c9f6ee9 327 attribute user_tmp_type;
296273a7 328 type user_tmp_t;
d6d16b97
CP
329 ')
330
3eaa9939
DW
331 role $1 types user_tmp_t;
332
296273a7 333 files_poly_member_tmp($2, user_tmp_t)
bbcd3c97 334
8c9f6ee9
DG
335 manage_dirs_pattern($2, user_tmp_type, user_tmp_type)
336 manage_files_pattern($2, user_tmp_type, user_tmp_type)
337 manage_lnk_files_pattern($2, user_tmp_type, user_tmp_type)
338 manage_sock_files_pattern($2, user_tmp_type, user_tmp_type)
339 manage_fifo_files_pattern($2, user_tmp_type, user_tmp_type)
296273a7 340 files_tmp_filetrans($2, user_tmp_t, { dir file lnk_file sock_file fifo_file })
8c9f6ee9
DG
341 relabel_dirs_pattern($2, user_tmp_type, user_tmp_type)
342 relabel_files_pattern($2, user_tmp_type, user_tmp_type)
343 relabel_lnk_files_pattern($2, user_tmp_type, user_tmp_type)
344 relabel_sock_files_pattern($2, user_tmp_type, user_tmp_type)
345 relabel_fifo_files_pattern($2, user_tmp_type, user_tmp_type)
3eaa9939
DW
346')
347
348#######################################
349## <summary>
350## Dontaudit search of user bin dirs.
351## </summary>
352## <param name="domain">
353## <summary>
24280f35 354## Domain to not audit.
3eaa9939
DW
355## </summary>
356## </param>
357#
358interface(`userdom_dontaudit_search_user_bin_dirs',`
359 gen_require(`
360 type home_bin_t;
361 ')
362
363 dontaudit $1 home_bin_t:dir search_dir_perms;
364')
365
366#######################################
367## <summary>
368## Execute user bin files.
369## </summary>
370## <param name="domain">
371## <summary>
372## Domain allowed access.
373## </summary>
374## </param>
375#
376interface(`userdom_exec_user_bin_files',`
377 gen_require(`
378 attribute user_home_type;
379 type home_bin_t, user_home_dir_t;
380 ')
381
382 exec_files_pattern($1, { user_home_dir_t user_home_type }, home_bin_t)
383 files_search_home($1)
bbcd3c97
CP
384')
385
386#######################################
387## <summary>
296273a7 388## The execute access user temporary files.
bbcd3c97 389## </summary>
296273a7 390## <param name="domain">
bbcd3c97 391## <summary>
296273a7 392## Domain allowed access.
bbcd3c97
CP
393## </summary>
394## </param>
395## <rolebase/>
396#
296273a7
CP
397interface(`userdom_exec_user_tmp_files',`
398 gen_require(`
399 type user_tmp_t;
400 ')
401
402 exec_files_pattern($1, user_tmp_t, user_tmp_t)
3eaa9939 403 dontaudit $1 user_tmp_t:sock_file execute;
296273a7 404 files_search_tmp($1)
bbcd3c97
CP
405')
406
407#######################################
408## <summary>
296273a7 409## Role access for the user tmpfs type
bbcd3c97
CP
410## that the user has full access.
411## </summary>
412## <desc>
413## <p>
296273a7 414## Role access for the user tmpfs type
bbcd3c97
CP
415## that the user has full access.
416## </p>
417## <p>
418## This does not allow execute access.
419## </p>
420## </desc>
296273a7 421## <param name="role">
bbcd3c97 422## <summary>
296273a7 423## Role allowed access.
bbcd3c97
CP
424## </summary>
425## </param>
296273a7 426## <param name="domain">
bbcd3c97 427## <summary>
296273a7 428## Domain allowed access.
bbcd3c97
CP
429## </summary>
430## </param>
296273a7 431## <rolecap/>
bbcd3c97 432#
296273a7 433interface(`userdom_manage_tmpfs_role',`
bbcd3c97 434 gen_require(`
faa4eacc 435 attribute user_tmpfs_type;
296273a7 436 type user_tmpfs_t;
bbcd3c97 437 ')
bbcd3c97 438
3eaa9939
DW
439 role $1 types user_tmpfs_t;
440
8c9f6ee9
DG
441 manage_dirs_pattern($2, user_tmpfs_type, user_tmpfs_type)
442 manage_files_pattern($2, user_tmpfs_type, user_tmpfs_type)
443 manage_lnk_files_pattern($2, user_tmpfs_type, user_tmpfs_type)
444 manage_sock_files_pattern($2, user_tmpfs_type, user_tmpfs_type)
445 manage_fifo_files_pattern($2, user_tmpfs_type, user_tmpfs_type)
296273a7 446 fs_tmpfs_filetrans($2, user_tmpfs_t, { dir file lnk_file sock_file fifo_file })
8c9f6ee9
DG
447 relabel_dirs_pattern($2, user_tmpfs_type, user_tmpfs_type)
448 relabel_files_pattern($2, user_tmpfs_type, user_tmpfs_type)
449 relabel_lnk_files_pattern($2, user_tmpfs_type, user_tmpfs_type)
450 relabel_sock_files_pattern($2, user_tmpfs_type, user_tmpfs_type)
451 relabel_fifo_files_pattern($2, user_tmpfs_type, user_tmpfs_type)
bbcd3c97
CP
452')
453
454#######################################
455## <summary>
3eaa9939 456## The interface allowing the user basic
bbcd3c97
CP
457## network permissions
458## </summary>
3eaa9939 459## <param name="userdomain">
bbcd3c97 460## <summary>
3eaa9939 461## The user domain
bbcd3c97
CP
462## </summary>
463## </param>
464## <rolebase/>
465#
3eaa9939
DW
466interface(`userdom_basic_networking',`
467
468 allow $1 self:tcp_socket create_stream_socket_perms;
469 allow $1 self:udp_socket create_socket_perms;
470
471 corenet_all_recvfrom_unlabeled($1)
472 corenet_all_recvfrom_netlabel($1)
473 corenet_tcp_sendrecv_generic_if($1)
474 corenet_udp_sendrecv_generic_if($1)
475 corenet_tcp_sendrecv_generic_node($1)
476 corenet_udp_sendrecv_generic_node($1)
477 corenet_tcp_sendrecv_all_ports($1)
478 corenet_udp_sendrecv_all_ports($1)
479 corenet_tcp_connect_all_ports($1)
480 corenet_sendrecv_all_client_packets($1)
dc1920b2
CP
481
482 optional_policy(`
3eaa9939
DW
483 init_tcp_recvfrom_all_daemons($1)
484 init_udp_recvfrom_all_daemons($1)
dc1920b2
CP
485 ')
486
0b6acad1 487 optional_policy(`
3eaa9939 488 ipsec_match_default_spd($1)
0b6acad1 489 ')
3eaa9939 490
bbcd3c97
CP
491')
492
493#######################################
494## <summary>
93c49bdb 495## The template for creating a user xwindows client. (Deprecated)
bbcd3c97
CP
496## </summary>
497## <param name="userdomain_prefix">
498## <summary>
499## The prefix of the user domain (e.g., user
500## is the prefix for user_t).
501## </summary>
502## </param>
503## <rolebase/>
504#
505template(`userdom_xwindows_client_template',`
93c49bdb 506 refpolicywarn(`$0() has been deprecated, please use xserver_role() instead.')
bbcd3c97 507 gen_require(`
296273a7 508 type $1_t, user_tmpfs_t;
bbcd3c97
CP
509 ')
510
847937da
CP
511 dev_rw_xserver_misc($1_t)
512 dev_rw_power_management($1_t)
513 dev_read_input($1_t)
514 dev_read_misc($1_t)
515 dev_write_misc($1_t)
516 # open office is looking for the following
517 dev_getattr_agp_dev($1_t)
518 dev_dontaudit_rw_dri($1_t)
519 # GNOME checks for usb and other devices:
520 dev_rw_usbfs($1_t)
3eaa9939 521 dev_rw_generic_usb_dev($1_t)
847937da 522
4279891d 523 xserver_user_x_domain_template($1, $1_t, user_tmpfs_t)
847937da
CP
524 xserver_xsession_entry_type($1_t)
525 xserver_dontaudit_write_log($1_t)
526 xserver_stream_connect_xdm($1_t)
527 # certain apps want to read xdm.pid file
528 xserver_read_xdm_pid($1_t)
529 # gnome-session creates socket under /tmp/.ICE-unix/
530 xserver_create_xdm_tmp_sockets($1_t)
531 # Needed for escd, remove if we get escd policy
532 xserver_manage_xdm_tmp_files($1_t)
bbcd3c97
CP
533')
534
535#######################################
536## <summary>
537## The template for allowing the user to change passwords.
538## </summary>
539## <param name="userdomain_prefix">
540## <summary>
541## The prefix of the user domain (e.g., user
542## is the prefix for user_t).
543## </summary>
544## </param>
545## <rolebase/>
546#
547template(`userdom_change_password_template',`
548 gen_require(`
296273a7 549 type $1_t;
bbcd3c97
CP
550 role $1_r;
551 ')
552
553 optional_policy(`
f4aae210
MG
554 usermanage_run_chfn($1_t,$1_r)
555 usermanage_run_passwd($1_t,$1_r)
bbcd3c97 556 ')
bbcd3c97
CP
557')
558
559#######################################
560## <summary>
561## The template containing rules common to unprivileged
562## users and administrative users.
563## </summary>
564## <desc>
565## <p>
566## This template creates a user domain, types, and
567## rules for the user's tty, pty, tmp, and tmpfs files.
568## </p>
569## </desc>
570## <param name="userdomain_prefix">
571## <summary>
572## The prefix of the user domain (e.g., user
573## is the prefix for user_t).
574## </summary>
575## </param>
576#
577template(`userdom_common_user_template',`
563e58e8
CP
578 gen_require(`
579 attribute unpriv_userdomain;
580 ')
bbcd3c97 581
3eaa9939 582 userdom_basic_networking($1_usertype)
bbcd3c97 583
bbcd3c97
CP
584 ##############################
585 #
586 # User domain Local policy
587 #
588
bbcd3c97
CP
589 # evolution and gnome-session try to create a netlink socket
590 dontaudit $1_t self:netlink_socket { create ioctl read getattr write setattr append bind connect getopt setopt shutdown };
591 dontaudit $1_t self:netlink_route_socket { create ioctl read getattr write setattr append bind connect getopt setopt shutdown nlmsg_read nlmsg_write };
3eaa9939
DW
592 allow $1_t self:netlink_kobject_uevent_socket create_socket_perms;
593 allow $1_t self:socket create_socket_perms;
bbcd3c97 594
3eaa9939 595 allow $1_usertype unpriv_userdomain:fd use;
bbcd3c97 596
3eaa9939
DW
597 kernel_read_system_state($1_usertype)
598 kernel_read_network_state($1_usertype)
5aff16e1 599 kernel_read_software_raid_state($1_usertype)
3eaa9939 600 kernel_read_net_sysctls($1_usertype)
bbcd3c97 601 # Very permissive allowing every domain to see every type:
3eaa9939 602 kernel_get_sysvipc_info($1_usertype)
bbcd3c97 603 # Find CDROM devices:
3eaa9939
DW
604 kernel_read_device_sysctls($1_usertype)
605 kernel_request_load_module($1_usertype)
296273a7 606
3eaa9939
DW
607 corenet_udp_bind_generic_node($1_usertype)
608 corenet_udp_bind_generic_port($1_usertype)
bbcd3c97 609
3eaa9939
DW
610 dev_read_rand($1_usertype)
611 dev_write_sound($1_usertype)
612 dev_read_sound($1_usertype)
613 dev_read_sound_mixer($1_usertype)
614 dev_write_sound_mixer($1_usertype)
bbcd3c97 615
3eaa9939
DW
616 files_exec_etc_files($1_usertype)
617 files_search_locks($1_usertype)
bbcd3c97 618 # Check to see if cdrom is mounted
3eaa9939 619 files_search_mnt($1_usertype)
bbcd3c97 620 # cjp: perhaps should cut back on file reads:
3eaa9939
DW
621 files_read_var_files($1_usertype)
622 files_read_var_symlinks($1_usertype)
623 files_read_generic_spool($1_usertype)
624 files_read_var_lib_files($1_usertype)
bbcd3c97 625 # Stat lost+found.
3eaa9939
DW
626 files_getattr_lost_found_dirs($1_usertype)
627 files_read_config_files($1_usertype)
628 fs_read_noxattr_fs_files($1_usertype)
629 fs_read_noxattr_fs_symlinks($1_usertype)
630 fs_rw_cgroup_files($1_usertype)
bbcd3c97 631
f3ef2629
DW
632 application_getattr_socket($1_usertype)
633
3eaa9939
DW
634 logging_send_syslog_msg($1_usertype)
635 logging_send_audit_msgs($1_usertype)
636 selinux_get_enforce_mode($1_usertype)
e2b9add5 637
bbcd3c97 638 # cjp: some of this probably can be removed
3eaa9939
DW
639 selinux_get_fs_mount($1_usertype)
640 selinux_validate_context($1_usertype)
641 selinux_compute_access_vector($1_usertype)
642 selinux_compute_create_context($1_usertype)
643 selinux_compute_relabel_context($1_usertype)
644 selinux_compute_user_contexts($1_usertype)
bbcd3c97
CP
645
646 # for eject
3eaa9939 647 storage_getattr_fixed_disk_dev($1_usertype)
bbcd3c97 648
f4aae210
MG
649 auth_read_login_records($1_usertype)
650 auth_run_pam($1_t,$1_r)
651 auth_run_utempter($1_t,$1_r)
bbcd3c97 652
3eaa9939 653 init_read_utmp($1_usertype)
0c73cd25 654
3eaa9939
DW
655 seutil_read_file_contexts($1_usertype)
656 seutil_read_default_contexts($1_usertype)
296273a7 657 seutil_run_newrole($1_t,$1_r)
6b19be33 658 seutil_exec_checkpolicy($1_t)
3eaa9939 659 seutil_exec_setfiles($1_usertype)
bbcd3c97
CP
660 # for when the network connection is killed
661 # this is needed when a login role can change
662 # to this one.
663 seutil_dontaudit_signal_newrole($1_t)
a1fcff33 664
34c8fabe 665 tunable_policy(`user_direct_mouse',`
3eaa9939 666 dev_read_mouse($1_usertype)
34c8fabe 667 ')
0c73cd25 668
34c8fabe 669 tunable_policy(`user_ttyfile_stat',`
c3c753f7 670 term_getattr_all_ttys($1_t)
34c8fabe 671 ')
0c73cd25 672
6b19be33 673 optional_policy(`
3eaa9939 674 alsa_read_rw_config($1_usertype)
413aac13 675 alsa_manage_home_files($1_t)
413aac13 676 alsa_relabel_home_files($1_t)
6b19be33
CP
677 ')
678
bb7170f6 679 optional_policy(`
ac9aa26d 680 # Allow graphical boot to check battery lifespan
3eaa9939 681 apm_stream_connect($1_usertype)
ac9aa26d
CP
682 ')
683
bb7170f6 684 optional_policy(`
3eaa9939 685 canna_stream_connect($1_usertype)
3509484c
CP
686 ')
687
bb7170f6 688 optional_policy(`
3eaa9939
DW
689 chrome_role($1_r, $1_usertype)
690 ')
691
bfc1cfe9
MG
692 optional_policy(`
693 colord_read_lib_files($1_usertype)
694 ')
695
3eaa9939
DW
696 optional_policy(`
697 dbus_system_bus_client($1_usertype)
698
699 allow $1_usertype $1_usertype:dbus send_msg;
700
701 optional_policy(`
702 avahi_dbus_chat($1_usertype)
703 ')
704
705 optional_policy(`
706 policykit_dbus_chat($1_usertype)
707 ')
708
709 optional_policy(`
710 bluetooth_dbus_chat($1_usertype)
711 ')
712
713 optional_policy(`
714 consolekit_dbus_chat($1_usertype)
715 consolekit_read_log($1_usertype)
716 ')
717
718 optional_policy(`
719 devicekit_dbus_chat($1_usertype)
720 devicekit_dbus_chat_power($1_usertype)
721 devicekit_dbus_chat_disk($1_usertype)
722 ')
723
724 optional_policy(`
725 evolution_dbus_chat($1_usertype)
726 evolution_alarm_dbus_chat($1_usertype)
727 ')
d828b5ca 728
bbcd3c97 729 optional_policy(`
3eaa9939 730 gnome_dbus_chat_gconfdefault($1_usertype)
bbcd3c97
CP
731 ')
732
6b19be33 733 optional_policy(`
3eaa9939 734 hal_dbus_chat($1_usertype)
6b19be33
CP
735 ')
736
1acd60e5
MG
737 optional_policy(`
738 kde_dbus_chat_backlighthelper($1_usertype)
739 ')
740
bb7170f6 741 optional_policy(`
3eaa9939 742 modemmanager_dbus_chat($1_usertype)
9fd4b818
CP
743 ')
744
bb7170f6 745 optional_policy(`
3eaa9939
DW
746 networkmanager_dbus_chat($1_usertype)
747 networkmanager_read_lib_files($1_usertype)
ac9aa26d
CP
748 ')
749
bb7170f6 750 optional_policy(`
3eaa9939 751 vpn_dbus_chat($1_usertype)
d828b5ca 752 ')
0c3d1705
CP
753 ')
754
bb7170f6 755 optional_policy(`
3eaa9939
DW
756 git_session_role($1_r, $1_usertype)
757 ')
758
759 optional_policy(`
760 inetd_use_fds($1_usertype)
761 inetd_rw_tcp_sockets($1_usertype)
b24f35d8
CP
762 ')
763
bb7170f6 764 optional_policy(`
3eaa9939
DW
765 inn_read_config($1_usertype)
766 inn_read_news_lib($1_usertype)
767 inn_read_news_spool($1_usertype)
9b06402e
CP
768 ')
769
cdd2b8d2
MG
770 optional_policy(`
771 lircd_stream_connect($1_usertype)
772 ')
773
6b19be33 774 optional_policy(`
3eaa9939 775 locate_read_lib_files($1_usertype)
6b19be33
CP
776 ')
777
bbcd3c97
CP
778 # for running depmod as part of the kernel packaging process
779 optional_policy(`
3eaa9939
DW
780 modutils_read_module_config($1_usertype)
781 ')
782
783 optional_policy(`
784 mta_rw_spool($1_usertype)
785 mta_manage_queue($1_usertype)
780198a1 786 mta_filetrans_home_content($1_usertype)
bbcd3c97
CP
787 ')
788
cc0c00d0 789 optional_policy(`
3eaa9939 790 nsplugin_role($1_r, $1_usertype)
cc0c00d0
CP
791 ')
792
bb7170f6 793 optional_policy(`
bbcd3c97
CP
794 tunable_policy(`allow_user_mysql_connect',`
795 mysql_stream_connect($1_t)
42be7c21
CP
796 ')
797 ')
798
329138be
DG
799 optional_policy(`
800 oident_manage_user_content($1_t)
801 oident_relabel_user_content($1_t)
802 ')
803
bb7170f6 804 optional_policy(`
2ec4c9d3 805 # to allow monitoring of pcmcia status
3eaa9939 806 pcmcia_read_pid($1_usertype)
2ec4c9d3
CP
807 ')
808
6b19be33 809 optional_policy(`
3eaa9939
DW
810 pcscd_read_pub_files($1_usertype)
811 pcscd_stream_connect($1_usertype)
6b19be33
CP
812 ')
813
cb10a2d5
CP
814 optional_policy(`
815 tunable_policy(`allow_user_postgresql_connect',`
3eaa9939
DW
816 postgresql_stream_connect($1_usertype)
817 postgresql_tcp_connect($1_usertype)
cb10a2d5
CP
818 ')
819 ')
820
b057be8d 821 optional_policy(`
3eaa9939 822 resmgr_stream_connect($1_usertype)
b057be8d
CP
823 ')
824
bb7170f6 825 optional_policy(`
3eaa9939
DW
826 rpc_dontaudit_getattr_exports($1_usertype)
827 rpc_manage_nfs_rw_content($1_usertype)
f00434fa
CP
828 ')
829
bb7170f6 830 optional_policy(`
3eaa9939 831 rpcbind_stream_connect($1_usertype)
ac9aa26d
CP
832 ')
833
bb7170f6 834 optional_policy(`
3eaa9939 835 samba_stream_connect_winbind($1_usertype)
1d427acc
CP
836 ')
837
bb7170f6 838 optional_policy(`
3eaa9939 839 sandbox_transition($1_usertype, $1_r)
8cc49473 840 ')
3eaa9939
DW
841
842 optional_policy(`
843 seunshare_role_template($1, $1_r, $1_t)
844 ')
845
846 optional_policy(`
847 slrnpull_search_spool($1_usertype)
848 ')
849
2ec4c9d3 850')
b16c6b8c 851
8fd36732
CP
852#######################################
853## <summary>
847937da 854## The template for creating a login user.
8fd36732
CP
855## </summary>
856## <desc>
857## <p>
858## This template creates a user domain, types, and
859## rules for the user's tty, pty, home directories,
860## tmp, and tmpfs files.
861## </p>
862## </desc>
863## <param name="userdomain_prefix">
885b83ec 864## <summary>
8fd36732
CP
865## The prefix of the user domain (e.g., user
866## is the prefix for user_t).
885b83ec 867## </summary>
8fd36732 868## </param>
b16c6b8c 869#
847937da 870template(`userdom_login_user_template', `
b1a90365
CP
871 gen_require(`
872 class context contains;
873 ')
874
847937da 875 userdom_base_user_template($1)
563e58e8 876
3eaa9939
DW
877 userdom_manage_home_role($1_r, $1_usertype)
878
879 userdom_manage_tmp_role($1_r, $1_usertype)
880 userdom_manage_tmpfs_role($1_r, $1_usertype)
847937da 881
3eaa9939
DW
882 ifelse(`$1',`unconfined',`',`
883 gen_tunable(allow_$1_exec_content, true)
847937da 884
3eaa9939
DW
885 tunable_policy(`allow_$1_exec_content',`
886 userdom_exec_user_tmp_files($1_usertype)
887 userdom_exec_user_home_content_files($1_usertype)
888 ')
889 tunable_policy(`allow_$1_exec_content && use_nfs_home_dirs',`
890 fs_exec_nfs_files($1_usertype)
891 ')
892
893 tunable_policy(`allow_$1_exec_content && use_samba_home_dirs',`
894 fs_exec_cifs_files($1_usertype)
895 ')
896 ')
847937da
CP
897
898 userdom_change_password_template($1)
563e58e8 899
0c73cd25
CP
900 ##############################
901 #
847937da 902 # User domain Local policy
0c73cd25 903 #
b16c6b8c 904
847937da
CP
905 allow $1_t self:capability { setgid chown fowner };
906 dontaudit $1_t self:capability { sys_nice fsetid };
907
908 allow $1_t self:process ~{ setcurrent setexec setrlimit execmem execstack execheap };
909 dontaudit $1_t self:process setrlimit;
910 dontaudit $1_t self:netlink_route_socket { create ioctl read getattr write setattr append bind connect getopt setopt shutdown nlmsg_read nlmsg_write };
911
912 allow $1_t self:context contains;
913
3eaa9939
DW
914 kernel_dontaudit_read_system_state($1_usertype)
915 kernel_dontaudit_list_all_proc($1_usertype)
847937da 916
3eaa9939
DW
917 dev_read_sysfs($1_usertype)
918 dev_read_urand($1_usertype)
847937da 919
3eaa9939 920 domain_use_interactive_fds($1_usertype)
847937da 921 # Command completion can fire hundreds of denials
3eaa9939 922 domain_dontaudit_exec_all_entry_files($1_usertype)
847937da 923
3eaa9939
DW
924 files_dontaudit_list_default($1_usertype)
925 files_dontaudit_read_default_files($1_usertype)
847937da 926 # Stat lost+found.
3eaa9939 927 files_getattr_lost_found_dirs($1_usertype)
847937da 928
3eaa9939
DW
929 fs_get_all_fs_quotas($1_usertype)
930 fs_getattr_all_fs($1_usertype)
931 fs_search_all($1_usertype)
932 fs_list_inotifyfs($1_usertype)
933 fs_rw_anon_inodefs_files($1_usertype)
847937da
CP
934
935 auth_dontaudit_write_login_records($1_t)
3eaa9939 936 auth_rw_cache($1_t)
847937da 937
e933ac40
MG
938 application_exec_all($1_t)
939 # The library functions always try to open read-write first,
940 # then fall back to read-only if it fails.
941 init_dontaudit_rw_utmp($1_t)
942
847937da 943 # Stop warnings about access to /dev/console
3eaa9939
DW
944 init_dontaudit_use_fds($1_usertype)
945 init_dontaudit_use_script_fds($1_usertype)
847937da 946
3eaa9939 947 libs_exec_lib_files($1_usertype)
847937da 948
3eaa9939 949 logging_dontaudit_getattr_all_logs($1_usertype)
847937da 950
847937da 951 # for running TeX programs
3eaa9939
DW
952 miscfiles_read_tetex_data($1_usertype)
953 miscfiles_exec_tetex_data($1_usertype)
954
955 seutil_read_config($1_usertype)
847937da 956
3eaa9939
DW
957 optional_policy(`
958 cups_read_config($1_usertype)
959 cups_stream_connect($1_usertype)
960 cups_stream_connect_ptal($1_usertype)
961 ')
847937da
CP
962
963 optional_policy(`
3eaa9939 964 kerberos_use($1_usertype)
d141ac47 965 kerberos_filetrans_home_content($1_usertype)
847937da
CP
966 ')
967
968 optional_policy(`
3eaa9939 969 mta_dontaudit_read_spool_symlinks($1_usertype)
847937da
CP
970 ')
971
972 optional_policy(`
3eaa9939 973 quota_dontaudit_getattr_db($1_usertype)
847937da
CP
974 ')
975
976 optional_policy(`
3eaa9939
DW
977 rpm_read_db($1_usertype)
978 rpm_dontaudit_manage_db($1_usertype)
979 rpm_read_cache($1_usertype)
847937da
CP
980 ')
981
982 optional_policy(`
3eaa9939 983 oddjob_run_mkhomedir($1_t, $1_r)
847937da
CP
984 ')
985')
986
987#######################################
988## <summary>
989## The template for creating a unprivileged login user.
990## </summary>
991## <desc>
992## <p>
993## This template creates a user domain, types, and
994## rules for the user's tty, pty, home directories,
995## tmp, and tmpfs files.
996## </p>
997## </desc>
998## <param name="userdomain_prefix">
999## <summary>
1000## The prefix of the user domain (e.g., user
1001## is the prefix for user_t).
1002## </summary>
1003## </param>
1004#
1005template(`userdom_restricted_user_template',`
1006 gen_require(`
1007 attribute unpriv_userdomain;
847937da
CP
1008 ')
1009
1010 userdom_login_user_template($1)
b16c6b8c 1011
0f707d52 1012 typeattribute $1_t unpriv_userdomain;
15722ec9 1013 domain_interactive_fd($1_t)
b16c6b8c 1014
3eaa9939
DW
1015 allow $1_usertype self:netlink_kobject_uevent_socket create_socket_perms;
1016 dontaudit $1_usertype self:netlink_audit_socket create_socket_perms;
1017
0c73cd25
CP
1018 ##############################
1019 #
1020 # Local policy
1021 #
1022
847937da 1023 optional_policy(`
e933ac40 1024 loadkeys_run($1_t, $1_r)
847937da
CP
1025 ')
1026')
1027
1028#######################################
1029## <summary>
1030## The template for creating a unprivileged xwindows login user.
1031## </summary>
1032## <desc>
1033## <p>
1034## The template for creating a unprivileged xwindows login user.
1035## </p>
1036## <p>
1037## This template creates a user domain, types, and
1038## rules for the user's tty, pty, home directories,
1039## tmp, and tmpfs files.
1040## </p>
1041## </desc>
1042## <param name="userdomain_prefix">
1043## <summary>
1044## The prefix of the user domain (e.g., user
1045## is the prefix for user_t).
1046## </summary>
1047## </param>
1048#
1049template(`userdom_restricted_xwindows_user_template',`
1050
1051 userdom_restricted_user_template($1)
1052
847937da
CP
1053 ##############################
1054 #
1055 # Local policy
1056 #
1057
296273a7 1058 auth_role($1_r, $1_t)
3eaa9939 1059 auth_search_pam_console_data($1_usertype)
b45aaab9 1060 auth_dontaudit_read_login_records($1_usertype)
847937da 1061
3eaa9939
DW
1062 dev_read_sound($1_usertype)
1063 dev_write_sound($1_usertype)
847937da 1064 # gnome keyring wants to read this.
3eaa9939
DW
1065 dev_dontaudit_read_rand($1_usertype)
1066 # temporarily allow since openoffice requires this
1067 dev_read_rand($1_usertype)
847937da 1068
3eaa9939
DW
1069 dev_read_video_dev($1_usertype)
1070 dev_write_video_dev($1_usertype)
1071 dev_rw_wireless($1_usertype)
1072
773094ba
DW
1073 libs_dontaudit_setattr_lib_files($1_usertype)
1074
3eaa9939
DW
1075 tunable_policy(`user_rw_noexattrfile',`
1076 dev_rw_usbfs($1_t)
1077 dev_rw_generic_usb_dev($1_usertype)
1078
1079 fs_manage_noxattr_fs_files($1_usertype)
1080 fs_manage_noxattr_fs_dirs($1_usertype)
1081 fs_manage_dos_dirs($1_usertype)
1082 fs_manage_dos_files($1_usertype)
1083 storage_raw_read_removable_device($1_usertype)
1084 storage_raw_write_removable_device($1_usertype)
1085 ')
1086
1087 logging_send_syslog_msg($1_usertype)
847937da
CP
1088 logging_dontaudit_send_audit_msgs($1_t)
1089
1090 # Need to to this just so screensaver will work. Should be moved to screensaver domain
1091 logging_send_audit_msgs($1_t)
1092 selinux_get_enforce_mode($1_t)
3eaa9939
DW
1093 seutil_exec_restorecond($1_t)
1094 seutil_read_file_contexts($1_t)
1095 seutil_read_default_contexts($1_t)
847937da 1096
93c49bdb
CP
1097 xserver_restricted_role($1_r, $1_t)
1098
847937da 1099 optional_policy(`
3eaa9939 1100 alsa_read_rw_config($1_usertype)
847937da
CP
1101 ')
1102
a8183914
MG
1103 # cjp: needed by KDE apps
1104 # bug: #682499
1105 optional_policy(`
1106 gnome_read_usr_config($1_usertype)
ac7085d0 1107 gnome_role_gkeyringd($1, $1_r, $1_usertype)
3a7aacc9 1108 # cjp: telepathy F15 bugs
2aa4540b 1109 telepathy_role($1_r, $1_t, $1)
a8183914
MG
1110 ')
1111
847937da 1112 optional_policy(`
3eaa9939
DW
1113 dbus_role_template($1, $1_r, $1_usertype)
1114 dbus_system_bus_client($1_usertype)
1115 allow $1_usertype $1_usertype:dbus send_msg;
1116
1117 optional_policy(`
1118 abrt_dbus_chat($1_usertype)
1119 abrt_run_helper($1_usertype, $1_r)
1120 ')
1121
1122 optional_policy(`
b45aaab9 1123 consolekit_dontaudit_read_log($1_usertype)
3eaa9939
DW
1124 consolekit_dbus_chat($1_usertype)
1125 ')
1126
1127 optional_policy(`
1128 cups_dbus_chat($1_usertype)
1129 cups_dbus_chat_config($1_usertype)
1130 ')
847937da
CP
1131
1132 optional_policy(`
3eaa9939
DW
1133 devicekit_dbus_chat($1_usertype)
1134 devicekit_dbus_chat_disk($1_usertype)
1135 devicekit_dbus_chat_power($1_usertype)
847937da
CP
1136 ')
1137
1138 optional_policy(`
3eaa9939 1139 fprintd_dbus_chat($1_t)
847937da
CP
1140 ')
1141 ')
1142
1143 optional_policy(`
3eaa9939
DW
1144 openoffice_role_template($1, $1_r, $1_usertype)
1145 ')
1146
1147 optional_policy(`
1148 policykit_role($1_r, $1_usertype)
1149 ')
1150
1151 optional_policy(`
1152 pulseaudio_role($1_r, $1_usertype)
9bf4902f
DG
1153 pulseaudio_filetrans_admin_home_content($1_usertype)
1154 pulseaudio_filetrans_home_content($1_usertype)
3eaa9939
DW
1155 ')
1156
1157 optional_policy(`
1158 rtkit_scheduled($1_usertype)
847937da
CP
1159 ')
1160
847937da
CP
1161 optional_policy(`
1162 setroubleshoot_dontaudit_stream_connect($1_t)
3eaa9939
DW
1163 ')
1164
1165 optional_policy(`
1166 udev_read_db($1_usertype)
1167 ')
1168
1169 optional_policy(`
1170 wm_role_template($1, $1_r, $1_t)
847937da
CP
1171 ')
1172')
1173
1174#######################################
1175## <summary>
1176## The template for creating a unprivileged user roughly
1177## equivalent to a regular linux user.
1178## </summary>
1179## <desc>
1180## <p>
1181## The template for creating a unprivileged user roughly
1182## equivalent to a regular linux user.
1183## </p>
1184## <p>
1185## This template creates a user domain, types, and
1186## rules for the user's tty, pty, home directories,
1187## tmp, and tmpfs files.
1188## </p>
1189## </desc>
1190## <param name="userdomain_prefix">
1191## <summary>
1192## The prefix of the user domain (e.g., user
1193## is the prefix for user_t).
1194## </summary>
1195## </param>
1196#
1197template(`userdom_unpriv_user_template', `
1198
1199 ##############################
1200 #
1201 # Declarations
1202 #
1203
1204 # Inherit rules for ordinary users.
3eaa9939 1205 userdom_restricted_xwindows_user_template($1)
847937da
CP
1206 userdom_common_user_template($1)
1207
1208 ##############################
1209 #
1210 # Local policy
1211 #
0c73cd25
CP
1212
1213 # port access is audited even if dac would not have allowed it, so dontaudit it here
3eaa9939 1214# corenet_dontaudit_tcp_bind_all_reserved_ports($1_t)
bbcd3c97
CP
1215 # Need the following rule to allow users to run vpnc
1216 corenet_tcp_bind_xserver_port($1_t)
8b456c73 1217 corenet_tcp_bind_generic_node($1_usertype)
0c73cd25 1218
3eaa9939 1219 storage_rw_fuse($1_t)
a1fcff33 1220
e933ac40
MG
1221 files_exec_usr_files($1_t)
1222 # cjp: why?
1223 files_read_kernel_symbol_table($1_t)
1224
1225 ifndef(`enable_mls',`
1226 fs_exec_noxattr($1_t)
1227
1228 tunable_policy(`user_rw_noexattrfile',`
1229 fs_manage_noxattr_fs_files($1_t)
1230 fs_manage_noxattr_fs_dirs($1_t)
1231 # Write floppies
1232 storage_raw_read_removable_device($1_t)
1233 storage_raw_write_removable_device($1_t)
1234 ',`
1235 storage_raw_read_removable_device($1_t)
1236 ')
1237 ')
1238
3eaa9939 1239 miscfiles_read_hwdata($1_usertype)
0c73cd25
CP
1240
1241 # Allow users to run TCP servers (bind to ports and accept connection from
6073ea1e 1242 # the same domain and outside users) disabling this forces FTP passive mode
0c73cd25 1243 # and may change other protocols
40068f3d
DW
1244
1245 tunable_policy(`user_share_music',`
7d5759fd 1246 corenet_tcp_bind_daap_port($1_usertype)
40068f3d
DW
1247 ')
1248
34c8fabe 1249 tunable_policy(`user_tcp_server',`
3eaa9939
DW
1250 corenet_tcp_bind_all_unreserved_ports($1_usertype)
1251 ')
1252
1253 tunable_policy(`user_setrlimit',`
1254 allow $1_usertype self:process setrlimit;
34c8fabe 1255 ')
0c73cd25 1256
bb7170f6 1257 optional_policy(`
3eaa9939
DW
1258 cdrecord_role($1_r, $1_t)
1259 ')
1260
1261 optional_policy(`
1262 cron_role($1_r, $1_t)
1263 ')
1264
1265 optional_policy(`
1266 games_rw_data($1_usertype)
1267 ')
1268
1269 optional_policy(`
1270 gpg_role($1_r, $1_usertype)
1271 ')
1272
1273 optional_policy(`
1274 gnomeclock_dbus_chat($1_t)
1275 ')
1276
1277 optional_policy(`
1278 gpm_stream_connect($1_usertype)
1279 ')
1280
1281 optional_policy(`
1282 execmem_role_template($1, $1_r, $1_t)
1283 ')
1284
1285 optional_policy(`
1286 java_role_template($1, $1_r, $1_t)
1287 ')
1288
1289 optional_policy(`
1290 mono_role_template($1, $1_r, $1_t)
1291 ')
1292
1293 optional_policy(`
1294 mount_run_fusermount($1_t, $1_r)
5598732f 1295 mount_read_pid_files($1_t)
3eaa9939
DW
1296 ')
1297
1298 optional_policy(`
1299 wine_role_template($1, $1_r, $1_t)
1f91e1bf
CP
1300 ')
1301
bb7170f6 1302 optional_policy(`
3eaa9939 1303 postfix_run_postdrop($1_t, $1_r)
e08118a5
CP
1304 ')
1305
3eaa9939 1306 # Run pppd in pppd_t by default for user
6b19be33 1307 optional_policy(`
3eaa9939 1308 ppp_run_cond($1_t, $1_r)
6b19be33 1309 ')
b16c6b8c 1310')
4d8ddf9a 1311
8fd36732
CP
1312#######################################
1313## <summary>
1314## The template for creating an administrative user.
1315## </summary>
1316## <desc>
1317## <p>
1318## This template creates a user domain, types, and
1319## rules for the user's tty, pty, home directories,
1320## tmp, and tmpfs files.
1321## </p>
2ec4c9d3 1322## <p>
8fd36732
CP
1323## The privileges given to administrative users are:
1324## <ul>
1325## <li>Raw disk access</li>
1326## <li>Set all sysctls</li>
1327## <li>All kernel ring buffer controls</li>
8fd36732
CP
1328## <li>Create, read, write, and delete all files but shadow</li>
1329## <li>Manage source and binary format SELinux policy</li>
1330## <li>Run insmod</li>
1331## </ul>
2ec4c9d3
CP
1332## </p>
1333## </desc>
8fd36732 1334## <param name="userdomain_prefix">
885b83ec 1335## <summary>
8fd36732
CP
1336## The prefix of the user domain (e.g., sysadm
1337## is the prefix for sysadm_t).
885b83ec 1338## </summary>
8fd36732 1339## </param>
4d8ddf9a 1340#
bbcd3c97 1341template(`userdom_admin_user_template',`
142e9f40 1342 gen_require(`
0be901ba 1343 attribute admindomain;
3eaa9939 1344 class passwd { passwd chfn chsh rootok crontab };
142e9f40
CP
1345 ')
1346
0c73cd25
CP
1347 ##############################
1348 #
1349 # Declarations
1350 #
1351
1352 # Inherit rules for ordinary users.
847937da 1353 userdom_login_user_template($1)
bbcd3c97 1354 userdom_common_user_template($1)
0c73cd25 1355
1815bad1 1356 domain_obj_id_change_exemption($1_t)
0c73cd25
CP
1357 role system_r types $1_t;
1358
0be901ba 1359 typeattribute $1_t admindomain;
bd75703c 1360
142e9f40 1361 ifdef(`direct_sysadm_daemon',`
1815bad1 1362 domain_system_change_exemption($1_t)
142e9f40 1363 ')
2a98379a 1364
0c73cd25
CP
1365 ##############################
1366 #
1367 # $1_t local policy
1368 #
1369
847937da 1370 allow $1_t self:capability ~{ sys_module audit_control audit_write };
4ba442da 1371 allow $1_t self:capability2 syslog;
0c73cd25 1372 allow $1_t self:process { setexec setfscreate };
bd75703c
CP
1373 allow $1_t self:netlink_audit_socket nlmsg_readpriv;
1374 allow $1_t self:tun_socket create;
0c73cd25
CP
1375 # Set password information for other users.
1376 allow $1_t self:passwd { passwd chfn chsh };
0c73cd25
CP
1377 # Skip authentication when pam_rootok is specified.
1378 allow $1_t self:passwd rootok;
1379
3eaa9939
DW
1380 # Manipulate other users crontab.
1381 allow $1_t self:passwd crontab;
1382
0c73cd25 1383 kernel_read_software_raid_state($1_t)
445522dc 1384 kernel_getattr_core_if($1_t)
0fd9dc55 1385 kernel_getattr_message_if($1_t)
0c73cd25
CP
1386 kernel_change_ring_buffer_level($1_t)
1387 kernel_clear_ring_buffer($1_t)
1388 kernel_read_ring_buffer($1_t)
1389 kernel_get_sysvipc_info($1_t)
445522dc 1390 kernel_rw_all_sysctls($1_t)
8fd36732
CP
1391 # signal unlabeled processes:
1392 kernel_kill_unlabeled($1_t)
1393 kernel_signal_unlabeled($1_t)
1394 kernel_sigstop_unlabeled($1_t)
1395 kernel_signull_unlabeled($1_t)
1396 kernel_sigchld_unlabeled($1_t)
3eaa9939 1397 kernel_signal($1_t)
2ec4c9d3
CP
1398
1399 corenet_tcp_bind_generic_port($1_t)
1400 # allow setting up tunnels
5b6ddb98 1401 corenet_rw_tun_tap_dev($1_t)
2ec4c9d3 1402
207c4763
CP
1403 dev_getattr_generic_blk_files($1_t)
1404 dev_getattr_generic_chr_files($1_t)
bbcd3c97
CP
1405 # for lsof
1406 dev_getattr_mtrr_dev($1_t)
1407 # Allow MAKEDEV to work
1408 dev_create_all_blk_files($1_t)
1409 dev_create_all_chr_files($1_t)
1410 dev_delete_all_blk_files($1_t)
1411 dev_delete_all_chr_files($1_t)
1412 dev_rename_all_blk_files($1_t)
1413 dev_rename_all_chr_files($1_t)
1414 dev_create_generic_symlinks($1_t)
bba79b24
DW
1415 dev_rw_generic_usb_dev($1_t)
1416 dev_rw_usbfs($1_t)
0c73cd25 1417
c9428d33
CP
1418 domain_setpriority_all_domains($1_t)
1419 domain_read_all_domains_state($1_t)
ccc59782 1420 domain_getattr_all_domains($1_t)
d79b5476 1421 domain_getcap_all_domains($1_t)
ccc59782 1422 domain_dontaudit_ptrace_all_domains($1_t)
0c73cd25
CP
1423 # signal all domains:
1424 domain_kill_all_domains($1_t)
1425 domain_signal_all_domains($1_t)
1426 domain_signull_all_domains($1_t)
1427 domain_sigstop_all_domains($1_t)
1428 domain_sigstop_all_domains($1_t)
1429 domain_sigchld_all_domains($1_t)
2ec4c9d3
CP
1430 # for lsof
1431 domain_getattr_all_sockets($1_t)
3eaa9939 1432 domain_dontaudit_getattr_all_sockets($1_t)
0c73cd25 1433
99505c1c 1434 files_exec_usr_src_files($1_t)
0c73cd25 1435
bbcd3c97 1436 fs_getattr_all_fs($1_t)
3eaa9939
DW
1437 fs_getattr_all_files($1_t)
1438 fs_list_all($1_t)
bbcd3c97
CP
1439 fs_set_all_quotas($1_t)
1440 fs_exec_noxattr($1_t)
1441
1442 storage_raw_read_removable_device($1_t)
1443 storage_raw_write_removable_device($1_t)
579a217f 1444 storage_dontaudit_read_fixed_disk($1_t)
bbcd3c97 1445
af2d8802 1446 term_use_all_inherited_terms($1_t)
9e6ca004 1447 term_use_unallocated_ttys($1_t)
bbcd3c97
CP
1448
1449 auth_getattr_shadow($1_t)
1450 # Manage almost all files
1451 auth_manage_all_files_except_shadow($1_t)
1452 # Relabel almost all files
1453 auth_relabel_all_files_except_shadow($1_t)
1454
1455 init_telinit($1_t)
0c73cd25 1456
c9428d33 1457 logging_send_syslog_msg($1_t)
0c73cd25 1458
2371d8d8
MG
1459 optional_policy(`
1460 modutils_domtrans_insmod($1_t)
1461 modutils_domtrans_depmod($1_t)
1462 ')
0c73cd25 1463
0c73cd25
CP
1464 # The following rule is temporary until such time that a complete
1465 # policy management infrastructure is in place so that an administrator
1466 # cannot directly manipulate policy files with arbitrary programs.
1815bad1 1467 seutil_manage_src_policy($1_t)
0c73cd25
CP
1468 # Violates the goal of limiting write access to checkpolicy.
1469 # But presently necessary for installing the file_contexts file.
1815bad1 1470 seutil_manage_bin_policy($1_t)
0c73cd25 1471
eedf23b8
DW
1472 systemd_config_all_services($1_t)
1473
296273a7
CP
1474 userdom_manage_user_home_content_dirs($1_t)
1475 userdom_manage_user_home_content_files($1_t)
1476 userdom_manage_user_home_content_symlinks($1_t)
1477 userdom_manage_user_home_content_pipes($1_t)
1478 userdom_manage_user_home_content_sockets($1_t)
1479 userdom_user_home_dir_filetrans_user_home_content($1_t, { dir file lnk_file fifo_file sock_file })
1480
bbcd3c97
CP
1481 tunable_policy(`user_rw_noexattrfile',`
1482 fs_manage_noxattr_fs_files($1_t)
1483 fs_manage_noxattr_fs_dirs($1_t)
1484 ',`
1485 fs_read_noxattr_fs_files($1_t)
1486 ')
1487
e8cb08ae
CP
1488 optional_policy(`
1489 postgresql_unconfined($1_t)
1490 ')
1491
6b19be33
CP
1492 optional_policy(`
1493 userhelper_exec($1_t)
1494 ')
1495')
1496
1497########################################
1498## <summary>
1499## Allow user to run as a secadm
1500## </summary>
1501## <desc>
1502## <p>
1503## Create objects in a user home directory
1504## with an automatic type transition to
1505## a specified private type.
1506## </p>
1507## <p>
1508## This is a templated interface, and should only
1509## be called from a per-userdomain template.
1510## </p>
1511## </desc>
6b19be33
CP
1512## <param name="domain">
1513## <summary>
1514## Domain allowed access.
1515## </summary>
1516## </param>
1517## <param name="role">
1518## <summary>
1519## The role of the object to create.
1520## </summary>
1521## </param>
6b19be33
CP
1522#
1523template(`userdom_security_admin_template',`
1524 allow $1 self:capability { dac_read_search dac_override };
1525
1526 corecmd_exec_shell($1)
1527
1528 domain_obj_id_change_exemption($1)
1529
1530 dev_relabel_all_dev_nodes($1)
1531
1532 files_create_boot_flag($1)
3eaa9939
DW
1533 files_create_default_dir($1)
1534 files_root_filetrans_default($1, dir)
6b19be33
CP
1535
1536 # Necessary for managing /boot/efi
1537 fs_manage_dos_files($1)
1538
1539 mls_process_read_up($1)
f8233ab7 1540 mls_file_read_all_levels($1)
6b19be33
CP
1541 mls_file_upgrade($1)
1542 mls_file_downgrade($1)
1543
1544 selinux_set_enforce_mode($1)
f0435b1a 1545 selinux_set_all_booleans($1)
6b19be33 1546 selinux_set_parameters($1)
4ba442da 1547 selinux_read_policy($1)
6b19be33
CP
1548
1549 auth_relabel_all_files_except_shadow($1)
1550 auth_relabel_shadow($1)
1551
1552 init_exec($1)
1553
1554 logging_send_syslog_msg($1)
1555 logging_read_audit_log($1)
1556 logging_read_generic_logs($1)
1557 logging_read_audit_config($1)
1558
1559 seutil_manage_bin_policy($1)
f362730d
DW
1560 seutil_manage_default_contexts($1)
1561 seutil_manage_file_contexts($1)
1562 seutil_manage_module_store($1)
1563 seutil_manage_config($1)
296273a7 1564 seutil_run_checkpolicy($1,$2)
f4aae210
MG
1565 seutil_run_loadpolicy($1,$2)
1566 seutil_run_semanage($1,$2)
1567 seutil_run_setsebool($1,$2)
296273a7 1568 seutil_run_setfiles($1, $2)
6b19be33 1569
f4aae210
MG
1570 seutil_manage_bin_policy($1)
1571 seutil_manage_default_contexts($1)
1572 seutil_manage_file_contexts($1)
1573 seutil_manage_module_store($1)
1574 seutil_manage_config($1)
1575
6b19be33 1576 optional_policy(`
f4aae210 1577 aide_run($1,$2)
6b19be33
CP
1578 ')
1579
1580 optional_policy(`
1581 consoletype_exec($1)
1582 ')
1583
1584 optional_policy(`
1585 dmesg_exec($1)
1586 ')
1587
f4aae210
MG
1588 optional_policy(`
1589 ipsec_run_setkey($1,$2)
9e8f65c8
CP
1590 ')
1591
6b19be33 1592 optional_policy(`
f4aae210 1593 netlabel_run_mgmt($1,$2)
a1fcff33 1594 ')
ff449b62
CP
1595
1596 optional_policy(`
1597 samhain_run($1, $2)
1598 ')
4d8ddf9a 1599')
490639cd 1600
b1bf2f78
CP
1601########################################
1602## <summary>
296273a7
CP
1603## Make the specified type usable in a
1604## user home directory.
b1bf2f78 1605## </summary>
296273a7 1606## <param name="type">
b1bf2f78 1607## <summary>
296273a7
CP
1608## Type to be used as a file in the
1609## user home directory.
b1bf2f78
CP
1610## </summary>
1611## </param>
b1bf2f78 1612#
296273a7
CP
1613interface(`userdom_user_home_content',`
1614 gen_require(`
1615 type user_home_t;
3eaa9939 1616 attribute user_home_type;
296273a7
CP
1617 ')
1618
1619 allow $1 user_home_t:filesystem associate;
1620 files_type($1)
1621 ubac_constrained($1)
3eaa9939
DW
1622
1623 files_poly_member($1)
1624 typeattribute $1 user_home_type;
b1bf2f78
CP
1625')
1626
ca9e8850
DW
1627########################################
1628## <summary>
1629## Make the specified type usable in a
1630## generic temporary directory.
1631## </summary>
1632## <param name="type">
1633## <summary>
1634## Type to be used as a file in the
1635## generic temporary directory.
1636## </summary>
1637## </param>
1638#
1639interface(`userdom_user_tmp_content',`
1640 gen_require(`
1641 attribute user_tmp_type;
1642 ')
1643
1644 typeattribute $1 user_tmp_type;
1645
1646 files_tmp_file($1)
1647 ubac_constrained($1)
1648')
1649
04b8986d
DG
1650########################################
1651## <summary>
1652## Make the specified type usable in a
1653## generic tmpfs_t directory.
1654## </summary>
1655## <param name="type">
1656## <summary>
1657## Type to be used as a file in the
1658## generic temporary directory.
1659## </summary>
1660## </param>
1661#
1662interface(`userdom_user_tmpfs_content',`
1663 gen_require(`
1664 attribute user_tmpfs_type;
1665 ')
1666
1667 typeattribute $1 user_tmpfs_type;
1668
1669 files_tmpfs_file($1)
1670 ubac_constrained($1)
1671')
1672
bd75703c
CP
1673########################################
1674## <summary>
1675## Allow domain to attach to TUN devices created by administrative users.
1676## </summary>
1677## <param name="domain">
1678## <summary>
1679## Domain allowed access.
1680## </summary>
1681## </param>
1682#
1683interface(`userdom_attach_admin_tun_iface',`
1684 gen_require(`
0be901ba 1685 attribute admindomain;
bd75703c
CP
1686 ')
1687
0be901ba 1688 allow $1 admindomain:tun_socket relabelfrom;
bd75703c
CP
1689 allow $1 self:tun_socket relabelto;
1690')
1691
b1bf2f78
CP
1692########################################
1693## <summary>
296273a7 1694## Set the attributes of a user pty.
b1bf2f78 1695## </summary>
296273a7 1696## <param name="domain">
b1bf2f78 1697## <summary>
296273a7 1698## Domain allowed access.
b1bf2f78
CP
1699## </summary>
1700## </param>
b1bf2f78 1701#
296273a7
CP
1702interface(`userdom_setattr_user_ptys',`
1703 gen_require(`
1704 type user_devpts_t;
1705 ')
1706
bf530f53 1707 allow $1 user_devpts_t:chr_file setattr_chr_file_perms;
b1bf2f78
CP
1708')
1709
1710########################################
1711## <summary>
296273a7 1712## Create a user pty.
b1bf2f78 1713## </summary>
296273a7 1714## <param name="domain">
b1bf2f78 1715## <summary>
296273a7 1716## Domain allowed access.
b1bf2f78
CP
1717## </summary>
1718## </param>
b1bf2f78 1719#
296273a7
CP
1720interface(`userdom_create_user_pty',`
1721 gen_require(`
1722 type user_devpts_t;
1723 ')
1724
1725 term_create_pty($1, user_devpts_t)
b1bf2f78
CP
1726')
1727
1728########################################
1729## <summary>
296273a7 1730## Get the attributes of user home directories.
b1bf2f78 1731## </summary>
296273a7 1732## <param name="domain">
b1bf2f78 1733## <summary>
296273a7 1734## Domain allowed access.
b1bf2f78
CP
1735## </summary>
1736## </param>
b1bf2f78 1737#
296273a7
CP
1738interface(`userdom_getattr_user_home_dirs',`
1739 gen_require(`
1740 type user_home_dir_t;
1741 ')
1742
1743 allow $1 user_home_dir_t:dir getattr_dir_perms;
1744 files_search_home($1)
b1bf2f78
CP
1745')
1746
1747########################################
1748## <summary>
296273a7 1749## Do not audit attempts to get the attributes of user home directories.
b1bf2f78 1750## </summary>
296273a7 1751## <param name="domain">
b1bf2f78 1752## <summary>
a0546c9d 1753## Domain to not audit.
b1bf2f78
CP
1754## </summary>
1755## </param>
b1bf2f78 1756#
296273a7
CP
1757interface(`userdom_dontaudit_getattr_user_home_dirs',`
1758 gen_require(`
1759 type user_home_dir_t;
1760 ')
1761
1762 dontaudit $1 user_home_dir_t:dir getattr_dir_perms;
b1bf2f78
CP
1763')
1764
1765########################################
1766## <summary>
296273a7 1767## Search user home directories.
b1bf2f78 1768## </summary>
296273a7 1769## <param name="domain">
b1bf2f78 1770## <summary>
296273a7 1771## Domain allowed access.
b1bf2f78
CP
1772## </summary>
1773## </param>
b1bf2f78 1774#
296273a7
CP
1775interface(`userdom_search_user_home_dirs',`
1776 gen_require(`
1777 type user_home_dir_t;
1778 ')
1779
1780 allow $1 user_home_dir_t:dir search_dir_perms;
3eaa9939 1781 allow $1 user_home_dir_t:lnk_file read_lnk_file_perms;
296273a7 1782 files_search_home($1)
b1bf2f78
CP
1783')
1784
1785########################################
1786## <summary>
c46376e6 1787## Do not audit attempts to search user home directories.
b1bf2f78 1788## </summary>
c46376e6
CP
1789## <desc>
1790## <p>
1791## Do not audit attempts to search user home directories.
1792## This will supress SELinux denial messages when the specified
1793## domain is denied the permission to search these directories.
1794## </p>
1795## </desc>
296273a7 1796## <param name="domain">
b1bf2f78 1797## <summary>
c46376e6 1798## Domain to not audit.
b1bf2f78
CP
1799## </summary>
1800## </param>
c46376e6 1801## <infoflow type="none"/>
b1bf2f78 1802#
296273a7
CP
1803interface(`userdom_dontaudit_search_user_home_dirs',`
1804 gen_require(`
1805 type user_home_dir_t;
1806 ')
1807
1808 dontaudit $1 user_home_dir_t:dir search_dir_perms;
b1bf2f78
CP
1809')
1810
1811########################################
1812## <summary>
ff8f0a63 1813## List user home directories.
b1bf2f78 1814## </summary>
296273a7 1815## <param name="domain">
b1bf2f78 1816## <summary>
ff8f0a63 1817## Domain allowed access.
b1bf2f78
CP
1818## </summary>
1819## </param>
b1bf2f78 1820#
296273a7
CP
1821interface(`userdom_list_user_home_dirs',`
1822 gen_require(`
1823 type user_home_dir_t;
1824 ')
b1bf2f78 1825
296273a7
CP
1826 allow $1 user_home_dir_t:dir list_dir_perms;
1827 files_search_home($1)
3eaa9939
DW
1828
1829 tunable_policy(`use_nfs_home_dirs',`
1830 fs_list_nfs($1)
1831 ')
1832
1833 tunable_policy(`use_samba_home_dirs',`
1834 fs_list_cifs($1)
1835 ')
de8af9dc
CP
1836')
1837
7c2f5a82
CP
1838########################################
1839## <summary>
296273a7 1840## Do not audit attempts to list user home subdirectories.
7c2f5a82
CP
1841## </summary>
1842## <param name="domain">
885b83ec 1843## <summary>
a7ee7f81 1844## Domain to not audit.
885b83ec 1845## </summary>
7c2f5a82
CP
1846## </param>
1847#
296273a7 1848interface(`userdom_dontaudit_list_user_home_dirs',`
7c2f5a82 1849 gen_require(`
296273a7 1850 type user_home_dir_t;
3eaa9939 1851 type user_home_t;
7c2f5a82
CP
1852 ')
1853
296273a7 1854 dontaudit $1 user_home_dir_t:dir list_dir_perms;
3eaa9939 1855 dontaudit $1 user_home_t:dir list_dir_perms;
7c2f5a82
CP
1856')
1857
1858########################################
1859## <summary>
296273a7 1860## Create user home directories.
7c2f5a82
CP
1861## </summary>
1862## <param name="domain">
885b83ec 1863## <summary>
7c2f5a82 1864## Domain allowed access.
885b83ec 1865## </summary>
7c2f5a82
CP
1866## </param>
1867#
296273a7
CP
1868interface(`userdom_create_user_home_dirs',`
1869 gen_require(`
1870 type user_home_dir_t;
1871 ')
1872
1873 allow $1 user_home_dir_t:dir create_dir_perms;
7c2f5a82
CP
1874')
1875
1876########################################
1877## <summary>
296273a7 1878## Create user home directories.
7c2f5a82
CP
1879## </summary>
1880## <param name="domain">
885b83ec 1881## <summary>
7c2f5a82 1882## Domain allowed access.
885b83ec 1883## </summary>
7c2f5a82
CP
1884## </param>
1885#
296273a7 1886interface(`userdom_manage_user_home_dirs',`
7c2f5a82 1887 gen_require(`
296273a7 1888 type user_home_dir_t;
7c2f5a82
CP
1889 ')
1890
296273a7 1891 allow $1 user_home_dir_t:dir manage_dir_perms;
7c2f5a82
CP
1892')
1893
d490eb6b 1894########################################
ab940a4c 1895## <summary>
296273a7 1896## Relabel to user home directories.
ab940a4c 1897## </summary>
414e4151 1898## <param name="domain">
885b83ec 1899## <summary>
725926c5 1900## Domain allowed access.
885b83ec 1901## </summary>
414e4151 1902## </param>
d490eb6b 1903#
296273a7
CP
1904interface(`userdom_relabelto_user_home_dirs',`
1905 gen_require(`
1906 type user_home_dir_t;
1907 ')
d490eb6b 1908
296273a7 1909 allow $1 user_home_dir_t:dir relabelto;
7c2f5a82
CP
1910')
1911
3eaa9939
DW
1912
1913########################################
1914## <summary>
1915## Relabel to user home files.
1916## </summary>
1917## <param name="domain">
1918## <summary>
1919## Domain allowed access.
1920## </summary>
1921## </param>
1922#
1923interface(`userdom_relabelto_user_home_files',`
1924 gen_require(`
1925 type user_home_t;
1926 ')
1927
1928 allow $1 user_home_t:file relabelto;
1929')
1930########################################
1931## <summary>
1932## Relabel user home files.
1933## </summary>
1934## <param name="domain">
1935## <summary>
1936## Domain allowed access.
1937## </summary>
1938## </param>
1939#
1940interface(`userdom_relabel_user_home_files',`
1941 gen_require(`
1942 type user_home_t;
1943 ')
1944
83029ff3 1945 allow $1 user_home_t:file relabel_file_perms;
3eaa9939
DW
1946')
1947
7c2f5a82
CP
1948########################################
1949## <summary>
296273a7
CP
1950## Create directories in the home dir root with
1951## the user home directory type.
7c2f5a82
CP
1952## </summary>
1953## <param name="domain">
885b83ec 1954## <summary>
7c2f5a82 1955## Domain allowed access.
885b83ec 1956## </summary>
7c2f5a82
CP
1957## </param>
1958#
296273a7
CP
1959interface(`userdom_home_filetrans_user_home_dir',`
1960 gen_require(`
1961 type user_home_dir_t;
1962 ')
7c2f5a82 1963
296273a7 1964 files_home_filetrans($1, user_home_dir_t, dir)
7c2f5a82
CP
1965')
1966
d42c7ede
CP
1967########################################
1968## <summary>
296273a7
CP
1969## Do a domain transition to the specified
1970## domain when executing a program in the
1971## user home directory.
d42c7ede
CP
1972## </summary>
1973## <desc>
1974## <p>
296273a7
CP
1975## Do a domain transition to the specified
1976## domain when executing a program in the
1977## user home directory.
d42c7ede
CP
1978## </p>
1979## <p>
296273a7
CP
1980## No interprocess communication (signals, pipes,
1981## etc.) is provided by this interface since
1982## the domains are not owned by this module.
d42c7ede
CP
1983## </p>
1984## </desc>
296273a7 1985## <param name="source_domain">
d42c7ede 1986## <summary>
a0546c9d 1987## Domain allowed to transition.
d42c7ede
CP
1988## </summary>
1989## </param>
296273a7 1990## <param name="target_domain">
d42c7ede 1991## <summary>
296273a7 1992## Domain to transition to.
d42c7ede
CP
1993## </summary>
1994## </param>
1995#
296273a7
CP
1996interface(`userdom_user_home_domtrans',`
1997 gen_require(`
1998 type user_home_dir_t, user_home_t;
1999 ')
d42c7ede 2000
296273a7
CP
2001 domain_auto_trans($1, user_home_t, $2)
2002 allow $1 user_home_dir_t:dir search_dir_perms;
2003 files_search_home($1)
d42c7ede
CP
2004')
2005
ae9e2716
CP
2006########################################
2007## <summary>
296273a7 2008## Do not audit attempts to search user home content directories.
ae9e2716
CP
2009## </summary>
2010## <param name="domain">
885b83ec 2011## <summary>
a7ee7f81 2012## Domain to not audit.
885b83ec 2013## </summary>
ae9e2716
CP
2014## </param>
2015#
296273a7
CP
2016interface(`userdom_dontaudit_search_user_home_content',`
2017 gen_require(`
2018 type user_home_t;
2019 ')
ae9e2716 2020
296273a7 2021 dontaudit $1 user_home_t:dir search_dir_perms;
3eaa9939
DW
2022 fs_dontaudit_list_nfs($1)
2023 fs_dontaudit_list_cifs($1)
ae9e2716
CP
2024')
2025
2d743657
CP
2026########################################
2027## <summary>
2028## List contents of users home directory.
2029## </summary>
2030## <param name="domain">
2031## <summary>
2032## Domain allowed access.
2033## </summary>
2034## </param>
2035#
2036interface(`userdom_list_user_home_content',`
2037 gen_require(`
3eaa9939
DW
2038 type user_home_dir_t;
2039 attribute user_home_type;
2d743657
CP
2040 ')
2041
3eaa9939
DW
2042 files_list_home($1)
2043 allow $1 { user_home_dir_t user_home_type }:dir list_dir_perms;
2d743657
CP
2044')
2045
cdc86ee5
CP
2046########################################
2047## <summary>
296273a7
CP
2048## Create, read, write, and delete directories
2049## in a user home subdirectory.
cdc86ee5
CP
2050## </summary>
2051## <param name="domain">
2052## <summary>
2053## Domain allowed access.
2054## </summary>
2055## </param>
2056#
296273a7
CP
2057interface(`userdom_manage_user_home_content_dirs',`
2058 gen_require(`
2059 type user_home_dir_t, user_home_t;
2060 ')
2061
2062 manage_dirs_pattern($1, { user_home_dir_t user_home_t }, user_home_t)
2063 files_search_home($1)
cdc86ee5
CP
2064')
2065
4083191c
CP
2066########################################
2067## <summary>
2068## Delete directories in a user home subdirectory.
2069## </summary>
2070## <param name="domain">
2071## <summary>
2072## Domain allowed access.
2073## </summary>
2074## </param>
2075#
2076interface(`userdom_delete_user_home_content_dirs',`
2077 gen_require(`
2078 type user_home_t;
2079 ')
2080
2081 allow $1 user_home_t:dir delete_dir_perms;
2082')
2083
a6687c87
DG
2084########################################
2085## <summary>
2086## Delete all directories in a user home subdirectory.
2087## </summary>
2088## <param name="domain">
2089## <summary>
2090## Domain allowed access.
2091## </summary>
2092## </param>
2093#
2094interface(`userdom_delete_all_user_home_content_dirs',`
2095 gen_require(`
2096 attribute user_home_type;
2097 ')
2098
2099 allow $1 user_home_type:dir delete_dir_perms;
2100')
2101
3eaa9939
DW
2102########################################
2103## <summary>
2104## Set the attributes of user home files.
2105## </summary>
2106## <param name="domain">
2107## <summary>
2108## Domain allowed access.
2109## </summary>
2110## </param>
2111## <rolecap/>
2112#
2113interface(`userdom_setattr_user_home_content_files',`
2114 gen_require(`
2115 type user_home_t;
2116 ')
2117
2118 allow $1 user_home_t:file setattr;
2119')
2120
d6d16b97
CP
2121########################################
2122## <summary>
296273a7
CP
2123## Do not audit attempts to set the
2124## attributes of user home files.
d6d16b97
CP
2125## </summary>
2126## <param name="domain">
2127## <summary>
a0546c9d 2128## Domain to not audit.
d6d16b97
CP
2129## </summary>
2130## </param>
2131#
296273a7
CP
2132interface(`userdom_dontaudit_setattr_user_home_content_files',`
2133 gen_require(`
2134 type user_home_t;
2135 ')
d6d16b97 2136
bf530f53 2137 dontaudit $1 user_home_t:file setattr_file_perms;
b0d2243c
CP
2138')
2139
a6687c87
DG
2140########################################
2141## <summary>
2142## Set the attributes of all user home directories.
2143## </summary>
2144## <param name="domain">
2145## <summary>
2146## Domain allowed access.
2147## </summary>
2148## </param>
2149## <rolecap/>
2150#
2151interface(`userdom_setattr_all_user_home_content_dirs',`
2152 gen_require(`
2153 attribute user_home_type;
2154 ')
2155
2156 allow $1 user_home_type:dir setattr_dir_perms;
2157')
2158
fd89e19f
CP
2159########################################
2160## <summary>
296273a7 2161## Mmap user home files.
fd89e19f
CP
2162## </summary>
2163## <param name="domain">
885b83ec 2164## <summary>
725926c5 2165## Domain allowed access.
885b83ec 2166## </summary>
fd89e19f
CP
2167## </param>
2168#
296273a7
CP
2169interface(`userdom_mmap_user_home_content_files',`
2170 gen_require(`
2171 type user_home_dir_t, user_home_t;
2172 ')
fd89e19f 2173
296273a7
CP
2174 mmap_files_pattern($1, { user_home_dir_t user_home_t }, user_home_t)
2175 files_search_home($1)
1f91e1bf
CP
2176')
2177
725926c5
CP
2178########################################
2179## <summary>
296273a7 2180## Read user home files.
725926c5
CP
2181## </summary>
2182## <param name="domain">
885b83ec 2183## <summary>
725926c5 2184## Domain allowed access.
885b83ec 2185## </summary>
725926c5
CP
2186## </param>
2187#
296273a7
CP
2188interface(`userdom_read_user_home_content_files',`
2189 gen_require(`
2190 type user_home_dir_t, user_home_t;
2191 ')
2192
3eaa9939 2193 list_dirs_pattern($1, { user_home_dir_t user_home_t }, { user_home_dir_t user_home_t })
296273a7
CP
2194 read_files_pattern($1, { user_home_dir_t user_home_t }, user_home_t)
2195 files_search_home($1)
725926c5
CP
2196')
2197
daa0e0b0 2198########################################
ab940a4c 2199## <summary>
3eaa9939 2200## Do not audit attempts to getattr user home files.
ab940a4c 2201## </summary>
414e4151 2202## <param name="domain">
885b83ec 2203## <summary>
296273a7 2204## Domain to not audit.
885b83ec 2205## </summary>
414e4151 2206## </param>
490639cd 2207#
3eaa9939 2208interface(`userdom_dontaudit_getattr_user_home_content',`
296273a7 2209 gen_require(`
3eaa9939 2210 attribute user_home_type;
296273a7
CP
2211 ')
2212
3eaa9939
DW
2213 dontaudit $1 user_home_type:dir getattr;
2214 dontaudit $1 user_home_type:file getattr;
2215')
2216
2217########################################
2218## <summary>
2219## Do not audit attempts to read user home files.
2220## </summary>
2221## <param name="domain">
2222## <summary>
2223## Domain to not audit.
2224## </summary>
2225## </param>
2226#
2227interface(`userdom_dontaudit_read_user_home_content_files',`
2228 gen_require(`
2229 attribute user_home_type;
2230 type user_home_dir_t;
2231 ')
2232
2233 dontaudit $1 user_home_dir_t:dir list_dir_perms;
2234 dontaudit $1 user_home_type:dir list_dir_perms;
2235 dontaudit $1 user_home_type:file read_file_perms;
2236 dontaudit $1 user_home_type:lnk_file read_lnk_file_perms;
fd89e19f
CP
2237')
2238
50aca6d2
CP
2239########################################
2240## <summary>
296273a7 2241## Do not audit attempts to append user home files.
50aca6d2
CP
2242## </summary>
2243## <param name="domain">
885b83ec 2244## <summary>
50aca6d2 2245## Domain to not audit.
885b83ec 2246## </summary>
50aca6d2
CP
2247## </param>
2248#
296273a7
CP
2249interface(`userdom_dontaudit_append_user_home_content_files',`
2250 gen_require(`
2251 type user_home_t;
2252 ')
2253
bf530f53 2254 dontaudit $1 user_home_t:file append_file_perms;
50aca6d2
CP
2255')
2256
fd89e19f
CP
2257########################################
2258## <summary>
296273a7 2259## Do not audit attempts to write user home files.
fd89e19f
CP
2260## </summary>
2261## <param name="domain">
885b83ec 2262## <summary>
296273a7 2263## Domain to not audit.
885b83ec 2264## </summary>
fd89e19f
CP
2265## </param>
2266#
296273a7
CP
2267interface(`userdom_dontaudit_write_user_home_content_files',`
2268 gen_require(`
2269 type user_home_t;
2270 ')
2271
bf530f53 2272 dontaudit $1 user_home_t:file write_file_perms;
daa0e0b0
CP
2273')
2274
4083191c
CP
2275########################################
2276## <summary>
2277## Delete files in a user home subdirectory.
2278## </summary>
2279## <param name="domain">
2280## <summary>
2281## Domain allowed access.
2282## </summary>
2283## </param>
2284#
2285interface(`userdom_delete_user_home_content_files',`
2286 gen_require(`
2287 type user_home_t;
2288 ')
2289
2290 allow $1 user_home_t:file delete_file_perms;
2291')
2292
a6687c87
DG
2293########################################
2294## <summary>
2295## Delete all files in a user home subdirectory.
2296## </summary>
2297## <param name="domain">
2298## <summary>
2299## Domain allowed access.
2300## </summary>
2301## </param>
2302#
2303interface(`userdom_delete_all_user_home_content_files',`
2304 gen_require(`
2305 attribute user_home_type;
2306 ')
2307
2308 allow $1 user_home_type:file delete_file_perms;
2309')
2310
d4dca585 2311########################################
ae841c05
DW
2312## <summary>
2313## Delete sock files in a user home subdirectory.
2314## </summary>
2315## <param name="domain">
2316## <summary>
2317## Domain allowed access.
2318## </summary>
2319## </param>
2320#
2321interface(`userdom_delete_user_home_content_sock_files',`
2322 gen_require(`
2323 type user_home_t;
2324 ')
2325
2326 allow $1 user_home_t:sock_file delete_file_perms;
2327')
2328
a6687c87
DG
2329########################################
2330## <summary>
2331## Delete all sock files in a user home subdirectory.
2332## </summary>
2333## <param name="domain">
2334## <summary>
2335## Domain allowed access.
2336## </summary>
2337## </param>
2338#
2339interface(`userdom_delete_all_user_home_content_sock_files',`
2340 gen_require(`
2341 attribute user_home_type;
2342 ')
2343
2344 allow $1 user_home_type:sock_file delete_file_perms;
2345')
2346
d4dca585
CP
2347########################################
2348## <summary>
296273a7 2349## Do not audit attempts to write user home files.
d4dca585
CP
2350## </summary>
2351## <param name="domain">
885b83ec 2352## <summary>
d4dca585 2353## Domain to not audit.
885b83ec 2354## </summary>
d4dca585
CP
2355## </param>
2356#
296273a7
CP
2357interface(`userdom_dontaudit_relabel_user_home_content_files',`
2358 gen_require(`
2359 type user_home_t;
2360 ')
2361
2362 dontaudit $1 user_home_t:file relabel_file_perms;
d4dca585
CP
2363')
2364
0404a390 2365########################################
ab940a4c 2366## <summary>
296273a7 2367## Read user home subdirectory symbolic links.
ab940a4c 2368## </summary>
414e4151 2369## <param name="domain">
885b83ec 2370## <summary>
725926c5 2371## Domain allowed access.
885b83ec 2372## </summary>
414e4151 2373## </param>
0404a390 2374#
296273a7
CP
2375interface(`userdom_read_user_home_content_symlinks',`
2376 gen_require(`
2377 type user_home_dir_t, user_home_t;
2378 ')
2379
3eaa9939 2380 allow $1 { user_home_dir_t user_home_t }:lnk_file read_lnk_file_perms;
daa0e0b0
CP
2381')
2382
763c441e 2383########################################
ab940a4c 2384## <summary>
296273a7 2385## Execute user home files.
ab940a4c 2386## </summary>
414e4151 2387## <param name="domain">
885b83ec 2388## <summary>
296273a7 2389## Domain allowed access.
885b83ec 2390## </summary>
414e4151 2391## </param>
296273a7 2392## <rolecap/>
763c441e 2393#
296273a7
CP
2394interface(`userdom_exec_user_home_content_files',`
2395 gen_require(`
3eaa9939
DW
2396 type user_home_dir_t;
2397 attribute user_home_type;
296273a7
CP
2398 ')
2399
2400 files_search_home($1)
3eaa9939
DW
2401 exec_files_pattern($1, { user_home_dir_t user_home_type }, user_home_type)
2402 dontaudit $1 user_home_type:sock_file execute;
296273a7 2403 ')
763c441e 2404
fd89e19f
CP
2405########################################
2406## <summary>
296273a7 2407## Do not audit attempts to execute user home files.
fd89e19f
CP
2408## </summary>
2409## <param name="domain">
885b83ec 2410## <summary>
a0546c9d 2411## Domain to not audit.
885b83ec 2412## </summary>
fd89e19f
CP
2413## </param>
2414#
296273a7
CP
2415interface(`userdom_dontaudit_exec_user_home_content_files',`
2416 gen_require(`
2417 type user_home_t;
2418 ')
2419
bf530f53 2420 dontaudit $1 user_home_t:file exec_file_perms;
fd89e19f
CP
2421')
2422
2423########################################
2424## <summary>
296273a7
CP
2425## Create, read, write, and delete files
2426## in a user home subdirectory.
fd89e19f
CP
2427## </summary>
2428## <param name="domain">
885b83ec 2429## <summary>
725926c5 2430## Domain allowed access.
885b83ec 2431## </summary>
fd89e19f
CP
2432## </param>
2433#
296273a7
CP
2434interface(`userdom_manage_user_home_content_files',`
2435 gen_require(`
2436 type user_home_dir_t, user_home_t;
2437 ')
2438
2439 manage_files_pattern($1, user_home_t, user_home_t)
2440 allow $1 user_home_dir_t:dir search_dir_perms;
2441 files_search_home($1)
fd89e19f
CP
2442')
2443
799a0b43
CP
2444########################################
2445## <summary>
296273a7
CP
2446## Do not audit attempts to create, read, write, and delete directories
2447## in a user home subdirectory.
799a0b43
CP
2448## </summary>
2449## <param name="domain">
885b83ec 2450## <summary>
a0546c9d 2451## Domain to not audit.
885b83ec 2452## </summary>
799a0b43
CP
2453## </param>
2454#
296273a7
CP
2455interface(`userdom_dontaudit_manage_user_home_content_dirs',`
2456 gen_require(`
2457 type user_home_dir_t, user_home_t;
2458 ')
2459
2460 dontaudit $1 user_home_t:dir manage_dir_perms;
799a0b43
CP
2461')
2462
44fc06b0
CP
2463########################################
2464## <summary>
296273a7
CP
2465## Create, read, write, and delete symbolic links
2466## in a user home subdirectory.
44fc06b0
CP
2467## </summary>
2468## <param name="domain">
885b83ec 2469## <summary>
296273a7 2470## Domain allowed access.
885b83ec 2471## </summary>
44fc06b0
CP
2472## </param>
2473#
296273a7
CP
2474interface(`userdom_manage_user_home_content_symlinks',`
2475 gen_require(`
2476 type user_home_dir_t, user_home_t;
2477 ')
2478
2479 manage_lnk_files_pattern($1, user_home_t, user_home_t)
2480 allow $1 user_home_dir_t:dir search_dir_perms;
2481 files_search_home($1)
44fc06b0
CP
2482')
2483
4083191c
CP
2484########################################
2485## <summary>
2486## Delete symbolic links in a user home directory.
2487## </summary>
2488## <param name="domain">
2489## <summary>
2490## Domain allowed access.
2491## </summary>
2492## </param>
2493#
2494interface(`userdom_delete_user_home_content_symlinks',`
2495 gen_require(`
2496 type user_home_t;
2497 ')
2498
2499 allow $1 user_home_t:lnk_file delete_lnk_file_perms;
2500')
2501
a6687c87
DG
2502########################################
2503## <summary>
2504## Delete all symbolic links in a user home directory.
2505## </summary>
2506## <param name="domain">
2507## <summary>
2508## Domain allowed access.
2509## </summary>
2510## </param>
2511#
2512interface(`userdom_delete_all_user_home_content_symlinks',`
2513 gen_require(`
2514 attribute user_home_type;
2515 ')
2516
2517 allow $1 user_home_type:lnk_file delete_lnk_file_perms;
2518')
2519
ae9e2716
CP
2520########################################
2521## <summary>
296273a7
CP
2522## Create, read, write, and delete named pipes
2523## in a user home subdirectory.
ae9e2716
CP
2524## </summary>
2525## <param name="domain">
885b83ec 2526## <summary>
296273a7 2527## Domain allowed access.
885b83ec 2528## </summary>
ae9e2716
CP
2529## </param>
2530#
296273a7
CP
2531interface(`userdom_manage_user_home_content_pipes',`
2532 gen_require(`
2533 type user_home_dir_t, user_home_t;
2534 ')
2535
2536 manage_fifo_files_pattern($1, user_home_t, user_home_t)
2537 allow $1 user_home_dir_t:dir search_dir_perms;
2538 files_search_home($1)
ae9e2716
CP
2539')
2540
2541########################################
2542## <summary>
296273a7
CP
2543## Create, read, write, and delete named sockets
2544## in a user home subdirectory.
ae9e2716
CP
2545## </summary>
2546## <param name="domain">
885b83ec 2547## <summary>
296273a7 2548## Domain allowed access.
885b83ec 2549## </summary>
ae9e2716
CP
2550## </param>
2551#
296273a7
CP
2552interface(`userdom_manage_user_home_content_sockets',`
2553 gen_require(`
2554 type user_home_dir_t, user_home_t;
2555 ')
2556
2557 allow $1 user_home_dir_t:dir search_dir_perms;
2558 manage_sock_files_pattern($1, user_home_t, user_home_t)
2559 files_search_home($1)
ae9e2716
CP
2560')
2561
725926c5
CP
2562########################################
2563## <summary>
296273a7
CP
2564## Create objects in a user home directory
2565## with an automatic type transition to
2566## a specified private type.
725926c5
CP
2567## </summary>
2568## <param name="domain">
885b83ec 2569## <summary>
725926c5 2570## Domain allowed access.
885b83ec 2571## </summary>
725926c5 2572## </param>
296273a7 2573## <param name="private_type">
885b83ec 2574## <summary>
296273a7 2575## The type of the object to create.
885b83ec 2576## </summary>
b11a75a5 2577## </param>
296273a7 2578## <param name="object_class">
885b83ec 2579## <summary>
296273a7 2580## The class of the object to be created.
885b83ec 2581## </summary>
e1c41428
CP
2582## </param>
2583#
296273a7
CP
2584interface(`userdom_user_home_dir_filetrans',`
2585 gen_require(`
2586 type user_home_dir_t;
2587 ')
2588
ae4832c7 2589 filetrans_pattern($1, user_home_dir_t, $2, $3, $4)
296273a7 2590 files_search_home($1)
e1c41428
CP
2591')
2592
10b1f324
CP
2593########################################
2594## <summary>
296273a7
CP
2595## Create objects in a user home directory
2596## with an automatic type transition to
2597## a specified private type.
10b1f324
CP
2598## </summary>
2599## <param name="domain">
885b83ec 2600## <summary>
10b1f324 2601## Domain allowed access.
885b83ec 2602## </summary>
10b1f324 2603## </param>
296273a7 2604## <param name="private_type">
885b83ec 2605## <summary>
296273a7 2606## The type of the object to create.
885b83ec 2607## </summary>
ee9500ec
CP
2608## </param>
2609## <param name="object_class">
885b83ec 2610## <summary>
10b1f324 2611## The class of the object to be created.
885b83ec 2612## </summary>
10b1f324
CP
2613## </param>
2614#
296273a7
CP
2615interface(`userdom_user_home_content_filetrans',`
2616 gen_require(`
2617 type user_home_dir_t, user_home_t;
2618 ')
2619
2620 filetrans_pattern($1, user_home_t, $2, $3)
2621 allow $1 user_home_dir_t:dir search_dir_perms;
2622 files_search_home($1)
10b1f324
CP
2623')
2624
2625########################################
2626## <summary>
296273a7
CP
2627## Create objects in a user home directory
2628## with an automatic type transition to
2629## the user home file type.
10b1f324
CP
2630## </summary>
2631## <param name="domain">
885b83ec 2632## <summary>
296273a7
CP
2633## Domain allowed access.
2634## </summary>
2635## </param>
2636## <param name="object_class">
2637## <summary>
2638## The class of the object to be created.
885b83ec 2639## </summary>
10b1f324
CP
2640## </param>
2641#
296273a7
CP
2642interface(`userdom_user_home_dir_filetrans_user_home_content',`
2643 gen_require(`
2644 type user_home_dir_t, user_home_t;
2645 ')
2646
2647 filetrans_pattern($1, user_home_dir_t, user_home_t, $2)
2648 files_search_home($1)
10b1f324
CP
2649')
2650
fd89e19f
CP
2651########################################
2652## <summary>
ff8f0a63 2653## Write to user temporary named sockets.
fd89e19f
CP
2654## </summary>
2655## <param name="domain">
885b83ec 2656## <summary>
ff8f0a63 2657## Domain allowed access.
885b83ec 2658## </summary>
fd89e19f
CP
2659## </param>
2660#
296273a7
CP
2661interface(`userdom_write_user_tmp_sockets',`
2662 gen_require(`
2663 type user_tmp_t;
2664 ')
2665
4cb24aed 2666 allow $1 user_tmp_t:sock_file write_sock_file_perms;
296273a7 2667 files_search_tmp($1)
ed38ca9f 2668')
fd89e19f 2669
ed38ca9f
CP
2670########################################
2671## <summary>
296273a7 2672## List user temporary directories.
ed38ca9f
CP
2673## </summary>
2674## <param name="domain">
2675## <summary>
2676## Domain allowed access.
2677## </summary>
2678## </param>
2679#
296273a7
CP
2680interface(`userdom_list_user_tmp',`
2681 gen_require(`
2682 type user_tmp_t;
2683 ')
2684
2685 allow $1 user_tmp_t:dir list_dir_perms;
2686 files_search_tmp($1)
fd89e19f
CP
2687')
2688
1786478c
CP
2689########################################
2690## <summary>
296273a7
CP
2691## Do not audit attempts to list user
2692## temporary directories.
1786478c
CP
2693## </summary>
2694## <param name="domain">
2695## <summary>
296273a7 2696## Domain to not audit.
1786478c
CP
2697## </summary>
2698## </param>
2699#
296273a7 2700interface(`userdom_dontaudit_list_user_tmp',`
1786478c 2701 gen_require(`
296273a7 2702 type user_tmp_t;
1786478c
CP
2703 ')
2704
296273a7 2705 dontaudit $1 user_tmp_t:dir list_dir_perms;
1786478c
CP
2706')
2707
9778406f
CP
2708########################################
2709## <summary>
296273a7
CP
2710## Do not audit attempts to manage users
2711## temporary directories.
9778406f
CP
2712## </summary>
2713## <param name="domain">
885b83ec 2714## <summary>
296273a7 2715## Domain to not audit.
885b83ec 2716## </summary>
9778406f
CP
2717## </param>
2718#
296273a7 2719interface(`userdom_dontaudit_manage_user_tmp_dirs',`
9778406f 2720 gen_require(`
296273a7 2721 type user_tmp_t;
9778406f
CP
2722 ')
2723
296273a7 2724 dontaudit $1 user_tmp_t:dir manage_dir_perms;
9778406f
CP
2725')
2726
4bf4ed9e 2727########################################
ab940a4c 2728## <summary>
296273a7 2729## Read user temporary files.
ab940a4c 2730## </summary>
414e4151 2731## <param name="domain">
885b83ec 2732## <summary>
725926c5 2733## Domain allowed access.
885b83ec 2734## </summary>
414e4151 2735## </param>
4bf4ed9e 2736#
296273a7 2737interface(`userdom_read_user_tmp_files',`
0404a390 2738 gen_require(`
296273a7 2739 type user_tmp_t;
0404a390 2740 ')
0c73cd25 2741
296273a7
CP
2742 read_files_pattern($1, user_tmp_t, user_tmp_t)
2743 allow $1 user_tmp_t:dir list_dir_perms;
2744 files_search_tmp($1)
4bf4ed9e
CP
2745')
2746
ae9e2716
CP
2747########################################
2748## <summary>
296273a7
CP
2749## Do not audit attempts to read users
2750## temporary files.
ae9e2716
CP
2751## </summary>
2752## <param name="domain">
885b83ec 2753## <summary>
ae9e2716 2754## Domain to not audit.
885b83ec 2755## </summary>
ae9e2716
CP
2756## </param>
2757#
296273a7 2758interface(`userdom_dontaudit_read_user_tmp_files',`
ae9e2716 2759 gen_require(`
296273a7 2760 type user_tmp_t;
ae9e2716
CP
2761 ')
2762
3eaa9939 2763 dontaudit $1 user_tmp_t:file read_inherited_file_perms;
ae9e2716
CP
2764')
2765
daa0e0b0 2766########################################
ab940a4c 2767## <summary>
296273a7
CP
2768## Do not audit attempts to append users
2769## temporary files.
ab940a4c 2770## </summary>
414e4151 2771## <param name="domain">
885b83ec 2772## <summary>
296273a7 2773## Domain to not audit.
885b83ec 2774## </summary>
414e4151 2775## </param>
daa0e0b0 2776#
296273a7 2777interface(`userdom_dontaudit_append_user_tmp_files',`
0404a390 2778 gen_require(`
296273a7 2779 type user_tmp_t;
0404a390 2780 ')
0c73cd25 2781
bf530f53 2782 dontaudit $1 user_tmp_t:file append_file_perms;
daa0e0b0
CP
2783')
2784
fc6524d7
CP
2785########################################
2786## <summary>
296273a7 2787## Read and write user temporary files.
fc6524d7
CP
2788## </summary>
2789## <param name="domain">
885b83ec 2790## <summary>
725926c5 2791## Domain allowed access.
885b83ec 2792## </summary>
fc6524d7
CP
2793## </param>
2794#
296273a7 2795interface(`userdom_rw_user_tmp_files',`
fc6524d7 2796 gen_require(`
296273a7 2797 type user_tmp_t;
fc6524d7
CP
2798 ')
2799
296273a7
CP
2800 allow $1 user_tmp_t:dir list_dir_perms;
2801 rw_files_pattern($1, user_tmp_t, user_tmp_t)
2802 files_search_tmp($1)
fc6524d7
CP
2803')
2804
2805########################################
2806## <summary>
296273a7
CP
2807## Do not audit attempts to manage users
2808## temporary files.
fc6524d7
CP
2809## </summary>
2810## <param name="domain">
885b83ec 2811## <summary>
296273a7 2812## Domain to not audit.
885b83ec 2813## </summary>
fc6524d7
CP
2814## </param>
2815#
296273a7 2816interface(`userdom_dontaudit_manage_user_tmp_files',`
fc6524d7 2817 gen_require(`
296273a7 2818 type user_tmp_t;
fc6524d7
CP
2819 ')
2820
296273a7 2821 dontaudit $1 user_tmp_t:file manage_file_perms;
fc6524d7
CP
2822')
2823
2824########################################
2825## <summary>
296273a7 2826## Read user temporary symbolic links.
fc6524d7
CP
2827## </summary>
2828## <param name="domain">
885b83ec 2829## <summary>
725926c5 2830## Domain allowed access.
885b83ec 2831## </summary>
fc6524d7
CP
2832## </param>
2833#
296273a7 2834interface(`userdom_read_user_tmp_symlinks',`
fc6524d7 2835 gen_require(`
296273a7 2836 type user_tmp_t;
fc6524d7
CP
2837 ')
2838
296273a7
CP
2839 read_lnk_files_pattern($1, user_tmp_t, user_tmp_t)
2840 allow $1 user_tmp_t:dir list_dir_perms;
2841 files_search_tmp($1)
fc6524d7
CP
2842')
2843
784a3bbc
CP
2844########################################
2845## <summary>
296273a7
CP
2846## Create, read, write, and delete user
2847## temporary directories.
784a3bbc 2848## </summary>
784a3bbc 2849## <param name="domain">
885b83ec 2850## <summary>
725926c5 2851## Domain allowed access.
885b83ec 2852## </summary>
784a3bbc
CP
2853## </param>
2854#
296273a7 2855interface(`userdom_manage_user_tmp_dirs',`
784a3bbc 2856 gen_require(`
296273a7 2857 type user_tmp_t;
784a3bbc
CP
2858 ')
2859
296273a7
CP
2860 manage_dirs_pattern($1, user_tmp_t, user_tmp_t)
2861 files_search_tmp($1)
784a3bbc
CP
2862')
2863
daa0e0b0 2864########################################
ab940a4c 2865## <summary>
296273a7
CP
2866## Create, read, write, and delete user
2867## temporary files.
ab940a4c
CP
2868## </summary>
2869## <param name="domain">
885b83ec 2870## <summary>
725926c5 2871## Domain allowed access.
885b83ec 2872## </summary>
ab940a4c
CP
2873## </param>
2874#
296273a7 2875interface(`userdom_manage_user_tmp_files',`
ab940a4c 2876 gen_require(`
296273a7 2877 type user_tmp_t;
ab940a4c
CP
2878 ')
2879
296273a7
CP
2880 manage_files_pattern($1, user_tmp_t, user_tmp_t)
2881 files_search_tmp($1)
ab940a4c
CP
2882')
2883
2884########################################
2885## <summary>
296273a7
CP
2886## Create, read, write, and delete user
2887## temporary symbolic links.
ab940a4c 2888## </summary>
414e4151 2889## <param name="domain">
885b83ec 2890## <summary>
725926c5 2891## Domain allowed access.
885b83ec 2892## </summary>
414e4151 2893## </param>
490639cd 2894#
296273a7 2895interface(`userdom_manage_user_tmp_symlinks',`
0404a390 2896 gen_require(`
296273a7 2897 type user_tmp_t;
0404a390 2898 ')
0c73cd25 2899
296273a7
CP
2900 manage_lnk_files_pattern($1, user_tmp_t, user_tmp_t)
2901 files_search_tmp($1)
490639cd
CP
2902')
2903
4bf4ed9e 2904########################################
ab940a4c 2905## <summary>
296273a7
CP
2906## Create, read, write, and delete user
2907## temporary named pipes.
ab940a4c 2908## </summary>
414e4151 2909## <param name="domain">
885b83ec 2910## <summary>
725926c5 2911## Domain allowed access.
885b83ec 2912## </summary>
414e4151 2913## </param>
4bf4ed9e 2914#
296273a7 2915interface(`userdom_manage_user_tmp_pipes',`
0404a390 2916 gen_require(`
296273a7 2917 type user_tmp_t;
0404a390 2918 ')
0c73cd25 2919
296273a7
CP
2920 manage_fifo_files_pattern($1, user_tmp_t, user_tmp_t)
2921 files_search_tmp($1)
4bf4ed9e
CP
2922')
2923
0404a390 2924########################################
ab940a4c 2925## <summary>
296273a7
CP
2926## Create, read, write, and delete user
2927## temporary named sockets.
ab940a4c 2928## </summary>
414e4151 2929## <param name="domain">
885b83ec 2930## <summary>
57a96cbd 2931## Domain allowed access.
885b83ec 2932## </summary>
414e4151 2933## </param>
0404a390 2934#
296273a7
CP
2935interface(`userdom_manage_user_tmp_sockets',`
2936 gen_require(`
2937 type user_tmp_t;
2938 ')
2939
2940 manage_sock_files_pattern($1, user_tmp_t, user_tmp_t)
2941 files_search_tmp($1)
4bf4ed9e
CP
2942')
2943
4614e83f
CP
2944########################################
2945## <summary>
296273a7
CP
2946## Create objects in a user temporary directory
2947## with an automatic type transition to
2948## a specified private type.
4614e83f
CP
2949## </summary>
2950## <param name="domain">
885b83ec 2951## <summary>
4614e83f 2952## Domain allowed access.
885b83ec 2953## </summary>
4614e83f 2954## </param>
296273a7
CP
2955## <param name="private_type">
2956## <summary>
2957## The type of the object to create.
2958## </summary>
2959## </param>
2960## <param name="object_class">
2961## <summary>
2962## The class of the object to be created.
2963## </summary>
2964## </param>
4614e83f 2965#
296273a7
CP
2966interface(`userdom_user_tmp_filetrans',`
2967 gen_require(`
2968 type user_tmp_t;
2969 ')
2970
2971 filetrans_pattern($1, user_tmp_t, $2, $3)
2972 files_search_tmp($1)
4614e83f
CP
2973')
2974
daa0e0b0 2975########################################
ab940a4c 2976## <summary>
296273a7
CP
2977## Create objects in the temporary directory
2978## with an automatic type transition to
2979## the user temporary type.
57a96cbd
CP
2980## </summary>
2981## <param name="domain">
885b83ec 2982## <summary>
57a96cbd 2983## Domain allowed access.
885b83ec 2984## </summary>
57a96cbd 2985## </param>
1c1ac67f 2986## <param name="object_class">
885b83ec 2987## <summary>
57a96cbd 2988## The class of the object to be created.
885b83ec 2989## </summary>
57a96cbd
CP
2990## </param>
2991#
296273a7
CP
2992interface(`userdom_tmp_filetrans_user_tmp',`
2993 gen_require(`
2994 type user_tmp_t;
2995 ')
2996
2997 files_tmp_filetrans($1, user_tmp_t, $2)
57a96cbd
CP
2998')
2999
a9e9678f
CP
3000########################################
3001## <summary>
3002## Read user tmpfs files.
3003## </summary>
3004## <param name="domain">
3005## <summary>
3006## Domain allowed access.
3007## </summary>
3008## </param>
3009#
3010interface(`userdom_read_user_tmpfs_files',`
3011 gen_require(`
3012 type user_tmpfs_t;
3013 ')
3014
3015 read_files_pattern($1, user_tmpfs_t, user_tmpfs_t)
3eaa9939 3016 read_lnk_files_pattern($1, user_tmpfs_t, user_tmpfs_t)
a9e9678f
CP
3017 allow $1 user_tmpfs_t:dir list_dir_perms;
3018 fs_search_tmpfs($1)
3019')
3020
d4dca585
CP
3021########################################
3022## <summary>
3eaa9939 3023## Read/Write user tmpfs files.
d4dca585
CP
3024## </summary>
3025## <param name="domain">
885b83ec 3026## <summary>
d4dca585 3027## Domain allowed access.
885b83ec 3028## </summary>
d4dca585
CP
3029## </param>
3030#
296273a7
CP
3031interface(`userdom_rw_user_tmpfs_files',`
3032 gen_require(`
3033 type user_tmpfs_t;
3034 ')
3035
3036 rw_files_pattern($1, user_tmpfs_t, user_tmpfs_t)
3037 read_lnk_files_pattern($1, user_tmpfs_t, user_tmpfs_t)
3038 allow $1 user_tmpfs_t:dir list_dir_perms;
3039 fs_search_tmpfs($1)
d4dca585
CP
3040')
3041
d9845ae9
CP
3042########################################
3043## <summary>
296273a7 3044## Get the attributes of a user domain tty.
d9845ae9
CP
3045## </summary>
3046## <param name="domain">
3047## <summary>
3048## Domain allowed access.
3049## </summary>
3050## </param>
3051#
296273a7
CP
3052interface(`userdom_getattr_user_ttys',`
3053 gen_require(`
3054 type user_tty_device_t;
3055 ')
3056
bf530f53 3057 allow $1 user_tty_device_t:chr_file getattr_chr_file_perms;
d9845ae9
CP
3058')
3059
57a96cbd
CP
3060########################################
3061## <summary>
296273a7 3062## Do not audit attempts to get the attributes of a user domain tty.
57a96cbd
CP
3063## </summary>
3064## <param name="domain">
885b83ec 3065## <summary>
a0546c9d 3066## Domain to not audit.
885b83ec 3067## </summary>
57a96cbd
CP
3068## </param>
3069#
296273a7
CP
3070interface(`userdom_dontaudit_getattr_user_ttys',`
3071 gen_require(`
3072 type user_tty_device_t;
3073 ')
3074
bf530f53 3075 dontaudit $1 user_tty_device_t:chr_file getattr_chr_file_perms;
57a96cbd
CP
3076')
3077
d6d16b97
CP
3078########################################
3079## <summary>
296273a7 3080## Set the attributes of a user domain tty.
d6d16b97
CP
3081## </summary>
3082## <param name="domain">
3083## <summary>
3084## Domain allowed access.
3085## </summary>
3086## </param>
3087#
296273a7
CP
3088interface(`userdom_setattr_user_ttys',`
3089 gen_require(`
3090 type user_tty_device_t;
3091 ')
3092
bf530f53 3093 allow $1 user_tty_device_t:chr_file setattr_chr_file_perms;
d6d16b97
CP
3094')
3095
165b42d2
CP
3096########################################
3097## <summary>
296273a7 3098## Do not audit attempts to set the attributes of a user domain tty.
165b42d2
CP
3099## </summary>
3100## <param name="domain">
3101## <summary>
a0546c9d 3102## Domain to not audit.
165b42d2
CP
3103## </summary>
3104## </param>
3105#
296273a7
CP
3106interface(`userdom_dontaudit_setattr_user_ttys',`
3107 gen_require(`
3108 type user_tty_device_t;
3109 ')
3110
bf530f53 3111 dontaudit $1 user_tty_device_t:chr_file setattr_chr_file_perms;
165b42d2
CP
3112')
3113
d6d16b97
CP
3114########################################
3115## <summary>
296273a7 3116## Read and write a user domain tty.
d6d16b97
CP
3117## </summary>
3118## <param name="domain">
3119## <summary>
3120## Domain allowed access.
3121## </summary>
3122## </param>
3123#
296273a7
CP
3124interface(`userdom_use_user_ttys',`
3125 gen_require(`
3126 type user_tty_device_t;
3127 ')
3128
3129 allow $1 user_tty_device_t:chr_file rw_term_perms;
d6d16b97
CP
3130')
3131
af2d8802
MG
3132########################################
3133## <summary>
3134## Read and write a inherited user domain tty.
3135## </summary>
3136## <param name="domain">
3137## <summary>
3138## Domain allowed access.
3139## </summary>
3140## </param>
3141#
3142interface(`userdom_use_inherited_user_ttys',`
3143 gen_require(`
3144 type user_tty_device_t;
3145 ')
3146
3147 allow $1 user_tty_device_t:chr_file rw_inherited_term_perms;
3148')
3149
57a96cbd
CP
3150########################################
3151## <summary>
296273a7 3152## Read and write a user domain pty.
57a96cbd
CP
3153## </summary>
3154## <param name="domain">
885b83ec 3155## <summary>
57a96cbd 3156## Domain allowed access.
885b83ec 3157## </summary>
57a96cbd
CP
3158## </param>
3159#
296273a7
CP
3160interface(`userdom_use_user_ptys',`
3161 gen_require(`
3162 type user_devpts_t;
3163 ')
3164
3165 allow $1 user_devpts_t:chr_file rw_term_perms;
57a96cbd
CP
3166')
3167
d6d16b97
CP
3168########################################
3169## <summary>
af2d8802
MG
3170## Read and write a inherited user domain pty.
3171## </summary>
3172## <param name="domain">
3173## <summary>
3174## Domain allowed access.
3175## </summary>
3176## </param>
3177#
3178interface(`userdom_use_inherited_user_ptys',`
3179 gen_require(`
3180 type user_devpts_t;
3181 ')
3182
3183 allow $1 user_devpts_t:chr_file rw_inherited_term_perms;
3184')
3185
57a96cbd 3186########################################
af2d8802
MG
3187## <summary>
3188## Read and write a inherited user TTYs and PTYs.
d6d16b97 3189## </summary>
c46376e6
CP
3190## <desc>
3191## <p>
af2d8802 3192## Allow the specified domain to read and write inherited user
c46376e6
CP
3193## TTYs and PTYs. This will allow the domain to
3194## interact with the user via the terminal. Typically
3195## all interactive applications will require this
3196## access.
3197## </p>
c46376e6 3198## </desc>
d6d16b97
CP
3199## <param name="domain">
3200## <summary>
3201## Domain allowed access.
3202## </summary>
3203## </param>
c46376e6 3204## <infoflow type="both" weight="10"/>
d6d16b97 3205#
af2d8802 3206interface(`userdom_use_inherited_user_terminals',`
296273a7
CP
3207 gen_require(`
3208 type user_tty_device_t, user_devpts_t;
3209 ')
3210
af2d8802
MG
3211 allow $1 user_tty_device_t:chr_file rw_inherited_term_perms;
3212 allow $1 user_devpts_t:chr_file rw_inherited_term_perms;
3213')
3214
35afb663
MG
3215#######################################
3216## <summary>
3217## Allow attempts to read and write
3218## a user domain tty and pty.
3219## </summary>
3220## <param name="domain">
3221## <summary>
3222## Domain to not audit.
3223## </summary>
3224## </param>
3225#
3226interface(`userdom_use_user_terminals',`
3227 gen_require(`
3228 type user_tty_device_t, user_devpts_t;
3229 ')
3230
3231 allow $1 user_tty_device_t:chr_file rw_term_perms;
3232 allow $1 user_devpts_t:chr_file rw_term_perms;
d6d16b97
CP
3233')
3234
57a96cbd
CP
3235########################################
3236## <summary>
296273a7
CP
3237## Do not audit attempts to read and write
3238## a user domain tty and pty.
57a96cbd
CP
3239## </summary>
3240## <param name="domain">
885b83ec 3241## <summary>
a0546c9d 3242## Domain to not audit.
885b83ec 3243## </summary>
57a96cbd
CP
3244## </param>
3245#
296273a7
CP
3246interface(`userdom_dontaudit_use_user_terminals',`
3247 gen_require(`
3248 type user_tty_device_t, user_devpts_t;
3249 ')
3250
3251 dontaudit $1 user_tty_device_t:chr_file rw_term_perms;
3252 dontaudit $1 user_devpts_t:chr_file rw_term_perms;
57a96cbd
CP
3253')
3254
8fc060c2
DG
3255
3256########################################
3257## <summary>
3258## Get attributes of user domain tty and pty.
3259## </summary>
3260## <param name="domain">
3261## <summary>
3262## Domain allowed access.
3263## </summary>
3264## </param>
3265#
3266interface(`userdom_getattr_user_terminals',`
3267 gen_require(`
3268 type user_tty_device_t, user_devpts_t;
3269 ')
3270
3271 allow $1 { user_tty_device_t user_devpts_t }:chr_file getattr_chr_file_perms;
3272')
3273
57a96cbd
CP
3274########################################
3275## <summary>
296273a7
CP
3276## Execute a shell in all user domains. This
3277## is an explicit transition, requiring the
3278## caller to use setexeccon().
57a96cbd
CP
3279## </summary>
3280## <param name="domain">
885b83ec 3281## <summary>
a0546c9d 3282## Domain allowed to transition.
885b83ec 3283## </summary>
57a96cbd
CP
3284## </param>
3285#
296273a7
CP
3286interface(`userdom_spec_domtrans_all_users',`
3287 gen_require(`
3288 attribute userdomain;
3289 ')
3290
3f67f722 3291 corecmd_shell_spec_domtrans($1, userdomain)
296273a7
CP
3292 allow userdomain $1:fd use;
3293 allow userdomain $1:fifo_file rw_file_perms;
3294 allow userdomain $1:process sigchld;
57a96cbd
CP
3295')
3296
3297########################################
3298## <summary>
296273a7
CP
3299## Execute an Xserver session in all unprivileged user domains. This
3300## is an explicit transition, requiring the
3301## caller to use setexeccon().
57a96cbd
CP
3302## </summary>
3303## <param name="domain">
885b83ec 3304## <summary>
a0546c9d 3305## Domain allowed to transition.
885b83ec 3306## </summary>
57a96cbd
CP
3307## </param>
3308#
296273a7
CP
3309interface(`userdom_xsession_spec_domtrans_all_users',`
3310 gen_require(`
3311 attribute userdomain;
3312 ')
3313
3f67f722 3314 xserver_xsession_spec_domtrans($1, userdomain)
296273a7
CP
3315 allow userdomain $1:fd use;
3316 allow userdomain $1:fifo_file rw_file_perms;
3317 allow userdomain $1:process sigchld;
57a96cbd
CP
3318')
3319
e08118a5
CP
3320########################################
3321## <summary>
296273a7
CP
3322## Execute a shell in all unprivileged user domains. This
3323## is an explicit transition, requiring the
3324## caller to use setexeccon().
e08118a5
CP
3325## </summary>
3326## <param name="domain">
885b83ec 3327## <summary>
a0546c9d 3328## Domain allowed to transition.
885b83ec 3329## </summary>
e08118a5
CP
3330## </param>
3331#
296273a7 3332interface(`userdom_spec_domtrans_unpriv_users',`
e08118a5 3333 gen_require(`
296273a7 3334 attribute unpriv_userdomain;
e08118a5
CP
3335 ')
3336
3f67f722 3337 corecmd_shell_spec_domtrans($1, unpriv_userdomain)
296273a7
CP
3338 allow unpriv_userdomain $1:fd use;
3339 allow unpriv_userdomain $1:fifo_file rw_file_perms;
3340 allow unpriv_userdomain $1:process sigchld;
e08118a5
CP
3341')
3342
d4dca585
CP
3343########################################
3344## <summary>
296273a7
CP
3345## Execute an Xserver session in all unprivileged user domains. This
3346## is an explicit transition, requiring the
3347## caller to use setexeccon().
d4dca585
CP
3348## </summary>
3349## <param name="domain">
885b83ec 3350## <summary>
a0546c9d 3351## Domain allowed to transition.
885b83ec 3352## </summary>
d4dca585
CP
3353## </param>
3354#
296273a7 3355interface(`userdom_xsession_spec_domtrans_unpriv_users',`
d4dca585 3356 gen_require(`
296273a7 3357 attribute unpriv_userdomain;
d4dca585
CP
3358 ')
3359
3f67f722 3360 xserver_xsession_spec_domtrans($1, unpriv_userdomain)
296273a7
CP
3361 allow unpriv_userdomain $1:fd use;
3362 allow unpriv_userdomain $1:fifo_file rw_file_perms;
3363 allow unpriv_userdomain $1:process sigchld;
d4dca585
CP
3364')
3365
6f8cda96
CP
3366########################################
3367## <summary>
296273a7 3368## Manage unpriviledged user SysV sempaphores.
6f8cda96
CP
3369## </summary>
3370## <param name="domain">
3371## <summary>
3372## Domain allowed access.
3373## </summary>
3374## </param>
3375#
296273a7 3376interface(`userdom_manage_unpriv_user_semaphores',`
6f8cda96 3377 gen_require(`
296273a7 3378 attribute unpriv_userdomain;
6f8cda96
CP
3379 ')
3380
296273a7 3381 allow $1 unpriv_userdomain:sem create_sem_perms;
6f8cda96
CP
3382')
3383
3384########################################
3385## <summary>
296273a7
CP
3386## Manage unpriviledged user SysV shared
3387## memory segments.
6f8cda96
CP
3388## </summary>
3389## <param name="domain">
3390## <summary>
3391## Domain allowed access.
3392## </summary>
3393## </param>
3394#
296273a7 3395interface(`userdom_manage_unpriv_user_shared_mem',`
6f8cda96 3396 gen_require(`
296273a7 3397 attribute unpriv_userdomain;
6f8cda96
CP
3398 ')
3399
296273a7 3400 allow $1 unpriv_userdomain:shm create_shm_perms;
6f8cda96
CP
3401')
3402
43989f82
CP
3403########################################
3404## <summary>
296273a7
CP
3405## Execute bin_t in the unprivileged user domains. This
3406## is an explicit transition, requiring the
3407## caller to use setexeccon().
43989f82
CP
3408## </summary>
3409## <param name="domain">
885b83ec 3410## <summary>
a0546c9d 3411## Domain allowed to transition.
885b83ec 3412## </summary>
43989f82
CP
3413## </param>
3414#
296273a7 3415interface(`userdom_bin_spec_domtrans_unpriv_users',`
43989f82 3416 gen_require(`
296273a7 3417 attribute unpriv_userdomain;
43989f82
CP
3418 ')
3419
3f67f722 3420 corecmd_bin_spec_domtrans($1, unpriv_userdomain)
296273a7
CP
3421 allow unpriv_userdomain $1:fd use;
3422 allow unpriv_userdomain $1:fifo_file rw_file_perms;
3423 allow unpriv_userdomain $1:process sigchld;
725926c5
CP
3424')
3425
6820a398
CP
3426########################################
3427## <summary>
296273a7
CP
3428## Execute all entrypoint files in unprivileged user
3429## domains. This is an explicit transition, requiring the
3430## caller to use setexeccon().
6820a398
CP
3431## </summary>
3432## <param name="domain">
885b83ec 3433## <summary>
6820a398 3434## Domain allowed access.
885b83ec 3435## </summary>
6820a398
CP
3436## </param>
3437#
296273a7 3438interface(`userdom_entry_spec_domtrans_unpriv_users',`
350b6ab7 3439 gen_require(`
296273a7 3440 attribute unpriv_userdomain;
6820a398 3441 ')
350b6ab7 3442
3f67f722 3443 domain_entry_file_spec_domtrans($1, unpriv_userdomain)
296273a7 3444 allow unpriv_userdomain $1:fd use;
3eaa9939 3445 allow unpriv_userdomain $1:fifo_file rw_fifo_file_perms;
296273a7 3446 allow unpriv_userdomain $1:process sigchld;
6820a398
CP
3447')
3448
1504ff3e
CP
3449########################################
3450## <summary>
296273a7 3451## Search users home directories.
1504ff3e
CP
3452## </summary>
3453## <param name="domain">
885b83ec 3454## <summary>
296273a7 3455## Domain allowed access.
885b83ec 3456## </summary>
1504ff3e
CP
3457## </param>
3458#
296273a7 3459interface(`userdom_search_user_home_content',`
350b6ab7 3460 gen_require(`
3eaa9939
DW
3461 type user_home_dir_t;
3462 attribute user_home_type;
1504ff3e 3463 ')
350b6ab7 3464
296273a7 3465 files_list_home($1)
3eaa9939
DW
3466 allow $1 { user_home_dir_t user_home_type }:dir search_dir_perms;
3467 allow $1 { user_home_dir_t user_home_type }:lnk_file read_lnk_file_perms;
1504ff3e
CP
3468')
3469
f6abfdb8
CP
3470########################################
3471## <summary>
296273a7 3472## Send general signals to unprivileged user domains.
f6abfdb8
CP
3473## </summary>
3474## <param name="domain">
885b83ec 3475## <summary>
f6abfdb8 3476## Domain allowed access.
885b83ec 3477## </summary>
f6abfdb8
CP
3478## </param>
3479#
296273a7 3480interface(`userdom_signal_unpriv_users',`
f6abfdb8 3481 gen_require(`
296273a7 3482 attribute unpriv_userdomain;
f6abfdb8
CP
3483 ')
3484
296273a7 3485 allow $1 unpriv_userdomain:process signal;
f6abfdb8
CP
3486')
3487
3488########################################
3489## <summary>
296273a7 3490## Inherit the file descriptors from unprivileged user domains.
f6abfdb8
CP
3491## </summary>
3492## <param name="domain">
885b83ec 3493## <summary>
f6abfdb8 3494## Domain allowed access.
885b83ec 3495## </summary>
f6abfdb8
CP
3496## </param>
3497#
296273a7 3498interface(`userdom_use_unpriv_users_fds',`
f6abfdb8 3499 gen_require(`
296273a7 3500 attribute unpriv_userdomain;
f6abfdb8
CP
3501 ')
3502
296273a7 3503 allow $1 unpriv_userdomain:fd use;
f6abfdb8
CP
3504')
3505
725926c5
CP
3506########################################
3507## <summary>
c46376e6
CP
3508## Do not audit attempts to inherit the file descriptors
3509## from unprivileged user domains.
725926c5 3510## </summary>
c46376e6
CP
3511## <desc>
3512## <p>
3513## Do not audit attempts to inherit the file descriptors
3514## from unprivileged user domains. This will supress
3515## SELinux denial messages when the specified domain is denied
3516## the permission to inherit these file descriptors.
3517## </p>
3518## </desc>
725926c5 3519## <param name="domain">
885b83ec 3520## <summary>
c46376e6 3521## Domain to not audit.
885b83ec 3522## </summary>
725926c5 3523## </param>
c46376e6 3524## <infoflow type="none"/>
725926c5 3525#
296273a7 3526interface(`userdom_dontaudit_use_unpriv_user_fds',`
350b6ab7 3527 gen_require(`
296273a7 3528 attribute unpriv_userdomain;
725926c5 3529 ')
350b6ab7 3530
296273a7 3531 dontaudit $1 unpriv_userdomain:fd use;
43989f82
CP
3532')
3533
3534########################################
3535## <summary>
296273a7 3536## Do not audit attempts to use user ptys.
43989f82
CP
3537## </summary>
3538## <param name="domain">
885b83ec 3539## <summary>
296273a7 3540## Domain to not audit.
885b83ec 3541## </summary>
43989f82
CP
3542## </param>
3543#
296273a7 3544interface(`userdom_dontaudit_use_user_ptys',`
350b6ab7 3545 gen_require(`
296273a7 3546 type user_devpts_t;
725926c5 3547 ')
350b6ab7 3548
f5b49a5e 3549 dontaudit $1 user_devpts_t:chr_file rw_inherited_file_perms;
43989f82
CP
3550')
3551
3552########################################
3553## <summary>
296273a7 3554## Relabel files to unprivileged user pty types.
43989f82
CP
3555## </summary>
3556## <param name="domain">
885b83ec 3557## <summary>
43989f82 3558## Domain allowed access.
885b83ec 3559## </summary>
43989f82
CP
3560## </param>
3561#
296273a7 3562interface(`userdom_relabelto_user_ptys',`
350b6ab7 3563 gen_require(`
296273a7 3564 type user_devpts_t;
725926c5 3565 ')
350b6ab7 3566
296273a7 3567 allow $1 user_devpts_t:chr_file relabelto;
43989f82
CP
3568')
3569
57a96cbd
CP
3570########################################
3571## <summary>
296273a7
CP
3572## Do not audit attempts to relabel files from
3573## user pty types.
ab940a4c 3574## </summary>
414e4151 3575## <param name="domain">
885b83ec 3576## <summary>
a0546c9d 3577## Domain to not audit.
885b83ec 3578## </summary>
414e4151 3579## </param>
daa0e0b0 3580#
296273a7 3581interface(`userdom_dontaudit_relabelfrom_user_ptys',`
0404a390 3582 gen_require(`
296273a7 3583 type user_devpts_t;
0404a390 3584 ')
0c73cd25 3585
296273a7 3586 dontaudit $1 user_devpts_t:chr_file relabelfrom;
daa0e0b0
CP
3587')
3588
693d4aed
CP
3589########################################
3590## <summary>
296273a7 3591## Write all users files in /tmp
693d4aed
CP
3592## </summary>
3593## <param name="domain">
3594## <summary>
3595## Domain allowed access.
3596## </summary>
3597## </param>
3598#
296273a7 3599interface(`userdom_write_user_tmp_files',`
350b6ab7 3600 gen_require(`
296273a7 3601 type user_tmp_t;
693d4aed 3602 ')
350b6ab7 3603
3eaa9939
DW
3604 write_files_pattern($1, user_tmp_t, user_tmp_t)
3605')
3606
3607########################################
3608## <summary>
3609## Do not audit attempts to write users
3610## temporary files.
3611## </summary>
3612## <param name="domain">
3613## <summary>
3614## Domain to not audit.
3615## </summary>
3616## </param>
3617#
3618interface(`userdom_dontaudit_write_user_tmp_files',`
3619 gen_require(`
3620 type user_tmp_t;
3621 ')
3622
3623 dontaudit $1 user_tmp_t:file write;
3624')
3625
3626########################################
3627## <summary>
3628## Do not audit attempts to read/write users
3629## temporary fifo files.
3630## </summary>
3631## <param name="domain">
3632## <summary>
3633## Domain to not audit.
3634## </summary>
3635## </param>
3636#
3637interface(`userdom_dontaudit_rw_user_tmp_pipes',`
3638 gen_require(`
3639 type user_tmp_t;
3640 ')
3641
3642 dontaudit $1 user_tmp_t:fifo_file rw_inherited_fifo_file_perms;
693d4aed
CP
3643')
3644
ebdc3b79
CP
3645########################################
3646## <summary>
296273a7 3647## Do not audit attempts to use user ttys.
ebdc3b79
CP
3648## </summary>
3649## <param name="domain">
885b83ec 3650## <summary>
a0546c9d 3651## Domain to not audit.
885b83ec 3652## </summary>
ebdc3b79
CP
3653## </param>
3654#
296273a7 3655interface(`userdom_dontaudit_use_user_ttys',`
350b6ab7 3656 gen_require(`
296273a7 3657 type user_tty_device_t;
9cc2ccc4 3658 ')
350b6ab7 3659
296273a7 3660 dontaudit $1 user_tty_device_t:chr_file rw_file_perms;
ebdc3b79 3661')
c98340cf 3662
2629c659
CP
3663########################################
3664## <summary>
3665## Read the process state of all user domains.
3666## </summary>
3667## <param name="domain">
885b83ec 3668## <summary>
2629c659 3669## Domain allowed access.
885b83ec 3670## </summary>
2629c659
CP
3671## </param>
3672#
1815bad1 3673interface(`userdom_read_all_users_state',`
2629c659
CP
3674 gen_require(`
3675 attribute userdomain;
3676 ')
3677
3f67f722 3678 read_files_pattern($1, userdomain, userdomain)
3eaa9939 3679 read_lnk_files_pattern($1,userdomain,userdomain)
2629c659
CP
3680 kernel_search_proc($1)
3681')
3682
3683########################################
3684## <summary>
3685## Get the attributes of all user domains.
3686## </summary>
3687## <param name="domain">
885b83ec 3688## <summary>
2629c659 3689## Domain allowed access.
885b83ec 3690## </summary>
2629c659
CP
3691## </param>
3692#
15722ec9 3693interface(`userdom_getattr_all_users',`
2629c659
CP
3694 gen_require(`
3695 attribute userdomain;
3696 ')
3697
3698 allow $1 userdomain:process getattr;
3699')
3700
57a96cbd
CP
3701########################################
3702## <summary>
3703## Inherit the file descriptors from all user domains
3704## </summary>
3705## <param name="domain">
885b83ec 3706## <summary>
725926c5 3707## Domain allowed access.
885b83ec 3708## </summary>
57a96cbd
CP
3709## </param>
3710#
15722ec9 3711interface(`userdom_use_all_users_fds',`
57a96cbd
CP
3712 gen_require(`
3713 attribute userdomain;
57a96cbd
CP
3714 ')
3715
3716 allow $1 userdomain:fd use;
3717')
3718
3719########################################
eb3cb682
CP
3720## <summary>
3721## Do not audit attempts to inherit the file
3722## descriptors from any user domains.
3723## </summary>
3724## <param name="domain">
885b83ec 3725## <summary>
eb3cb682 3726## Domain to not audit.
885b83ec 3727## </summary>
eb3cb682
CP
3728## </param>
3729#
15722ec9 3730interface(`userdom_dontaudit_use_all_users_fds',`
eb3cb682
CP
3731 gen_require(`
3732 attribute userdomain;
eb3cb682
CP
3733 ')
3734
3735 dontaudit $1 userdomain:fd use;
3736')
3737
3738########################################
57a96cbd
CP
3739## <summary>
3740## Send general signals to all user domains.
3741## </summary>
3742## <param name="domain">
885b83ec 3743## <summary>
725926c5 3744## Domain allowed access.
885b83ec 3745## </summary>
57a96cbd
CP
3746## </param>
3747#
3748interface(`userdom_signal_all_users',`
3749 gen_require(`
3750 attribute userdomain;
57a96cbd
CP
3751 ')
3752
3753 allow $1 userdomain:process signal;
3754')
3755
4f115e10
DW
3756########################################
3757## <summary>
3758## Send kill signals to all user domains.
3759## </summary>
3760## <param name="domain">
3761## <summary>
3762## Domain allowed access.
3763## </summary>
3764## </param>
3765#
3766interface(`userdom_kill_all_users',`
3767 gen_require(`
3768 attribute userdomain;
3769 ')
3770
3771 allow $1 userdomain:process sigkill;
3772')
3773
246839f3
CP
3774########################################
3775## <summary>
3776## Send a SIGCHLD signal to all user domains.
3777## </summary>
3778## <param name="domain">
885b83ec 3779## <summary>
246839f3 3780## Domain allowed access.
885b83ec 3781## </summary>
246839f3
CP
3782## </param>
3783#
9fd4b818 3784interface(`userdom_sigchld_all_users',`
246839f3
CP
3785 gen_require(`
3786 attribute userdomain;
246839f3
CP
3787 ')
3788
a1fcff33 3789 allow $1 userdomain:process sigchld;
246839f3
CP
3790')
3791
fe3a1eb8
CP
3792########################################
3793## <summary>
3794## Create keys for all user domains.
3795## </summary>
3796## <param name="domain">
3797## <summary>
3798## Domain allowed access.
3799## </summary>
3800## </param>
3801#
3802interface(`userdom_create_all_users_keys',`
350b6ab7
CP
3803 gen_require(`
3804 attribute userdomain;
fe3a1eb8 3805 ')
350b6ab7
CP
3806
3807 allow $1 userdomain:key create;
fe3a1eb8
CP
3808')
3809
9fd4b818
CP
3810########################################
3811## <summary>
3812## Send a dbus message to all user domains.
3813## </summary>
3814## <param name="domain">
885b83ec 3815## <summary>
9fd4b818 3816## Domain allowed access.
885b83ec 3817## </summary>
9fd4b818
CP
3818## </param>
3819#
3820interface(`userdom_dbus_send_all_users',`
3821 gen_require(`
3822 attribute userdomain;
3823 class dbus send_msg;
3824 ')
3825
3826 allow $1 userdomain:dbus send_msg;
3827')
3eaa9939
DW
3828
3829########################################
3830## <summary>
3831## Allow apps to set rlimits on userdomain
3832## </summary>
3833## <param name="domain">
3834## <summary>
3835## Domain allowed access.
3836## </summary>
3837## </param>
3838#
3839interface(`userdom_set_rlimitnh',`
3840 gen_require(`
3841 attribute userdomain;
3842 ')
3843
3844 allow $1 userdomain:process rlimitinh;
3845')
3846
3847########################################
3848## <summary>
3849## Define this type as a Allow apps to set rlimits on userdomain
3850## </summary>
3851## <param name="domain">
3852## <summary>
3853## Domain allowed access.
3854## </summary>
3855## </param>
3856## <param name="userdomain_prefix">
3857## <summary>
3858## The prefix of the user domain (e.g., user
3859## is the prefix for user_t).
3860## </summary>
3861## </param>
3862## <param name="domain">
3863## <summary>
3864## Domain allowed access.
3865## </summary>
3866## </param>
3867#
3868template(`userdom_unpriv_usertype',`
3869 gen_require(`
3870 attribute unpriv_userdomain, userdomain;
3871 attribute $1_usertype;
3872 ')
3873 typeattribute $2 $1_usertype;
3874 typeattribute $2 unpriv_userdomain;
3875 typeattribute $2 userdomain;
ae68f77d
DW
3876
3877 auth_use_nsswitch($2)
3eaa9939
DW
3878 ubac_constrained($2)
3879')
3880
3881########################################
3882## <summary>
3883## Connect to users over an unix stream socket.
3884## </summary>
3885## <param name="domain">
3886## <summary>
3887## Domain allowed access.
3888## </summary>
3889## </param>
3890#
3891interface(`userdom_stream_connect',`
3892 gen_require(`
3893 type user_tmp_t;
3894 attribute userdomain;
3895 ')
3896
3897 stream_connect_pattern($1, user_tmp_t, user_tmp_t, userdomain)
3898')
3899
3900########################################
3901## <summary>
3902## Ptrace user domains.
3903## </summary>
3904## <param name="domain">
3905## <summary>
3906## Domain allowed access.
3907## </summary>
3908## </param>
3909#
3910interface(`userdom_ptrace_all_users',`
3911 gen_require(`
3912 attribute userdomain;
3913 ')
3914
3915 allow $1 userdomain:process ptrace;
3916')
3917
3918########################################
3919## <summary>
3920## dontaudit Search /root
3921## </summary>
3922## <param name="domain">
3923## <summary>
24280f35 3924## Domain to not audit.
3eaa9939
DW
3925## </summary>
3926## </param>
3927#
3928interface(`userdom_dontaudit_search_admin_dir',`
3929 gen_require(`
3930 type admin_home_t;
3931 ')
3932
3933 dontaudit $1 admin_home_t:dir search_dir_perms;
3934')
3935
3936########################################
3937## <summary>
3938## dontaudit list /root
3939## </summary>
3940## <param name="domain">
3941## <summary>
24280f35 3942## Domain to not audit.
3eaa9939
DW
3943## </summary>
3944## </param>
3945#
3946interface(`userdom_dontaudit_list_admin_dir',`
3947 gen_require(`
3948 type admin_home_t;
3949 ')
3950
3951 dontaudit $1 admin_home_t:dir list_dir_perms;
3952')
3953
3954########################################
3955## <summary>
3956## Allow domain to list /root
3957## </summary>
3958## <param name="domain">
3959## <summary>
3960## Domain allowed access.
3961## </summary>
3962## </param>
3963#
3964interface(`userdom_list_admin_dir',`
3965 gen_require(`
3966 type admin_home_t;
3967 ')
3968
3969 allow $1 admin_home_t:dir list_dir_perms;
3970')
3971
3972########################################
3973## <summary>
3974## Allow Search /root
3975## </summary>
3976## <param name="domain">
3977## <summary>
3978## Domain allowed access.
3979## </summary>
3980## </param>
3981#
3982interface(`userdom_search_admin_dir',`
3983 gen_require(`
3984 type admin_home_t;
3985 ')
3986
3987 allow $1 admin_home_t:dir search_dir_perms;
3988')
3989
3990########################################
3991## <summary>
3992## RW unpriviledged user SysV sempaphores.
3993## </summary>
3994## <param name="domain">
3995## <summary>
3996## Domain allowed access.
3997## </summary>
3998## </param>
3999#
4000interface(`userdom_rw_semaphores',`
4001 gen_require(`
4002 attribute unpriv_userdomain;
4003 ')
4004
4005 allow $1 unpriv_userdomain:sem rw_sem_perms;
4006')
4007
4008########################################
4009## <summary>
4010## Send a message to unpriv users over a unix domain
4011## datagram socket.
4012## </summary>
4013## <param name="domain">
4014## <summary>
4015## Domain allowed access.
4016## </summary>
4017## </param>
4018#
4019interface(`userdom_dgram_send',`
4020 gen_require(`
4021 attribute unpriv_userdomain;
4022 ')
4023
4024 allow $1 unpriv_userdomain:unix_dgram_socket sendto;
4025')
4026
4027######################################
4028## <summary>
4029## Send a message to users over a unix domain
4030## datagram socket.
4031## </summary>
4032## <param name="domain">
4033## <summary>
4034## Domain allowed access.
4035## </summary>
4036## </param>
4037#
4038interface(`userdom_users_dgram_send',`
4039 gen_require(`
4040 attribute userdomain;
4041 ')
4042
4043 allow $1 userdomain:unix_dgram_socket sendto;
4044')
4045
4046#######################################
4047## <summary>
4048## Allow execmod on files in homedirectory
4049## </summary>
4050## <param name="domain">
4051## <summary>
4052## Domain allowed access.
4053## </summary>
4054## </param>
4055## <rolebase/>
4056#
4057interface(`userdom_execmod_user_home_files',`
4058 gen_require(`
4059 type user_home_type;
4060 ')
4061
4062 allow $1 user_home_type:file execmod;
4063')
4064
4065########################################
4066## <summary>
4067## Read admin home files.
4068## </summary>
4069## <param name="domain">
4070## <summary>
4071## Domain allowed access.
4072## </summary>
4073## </param>
4074## <rolecap/>
4075#
4076interface(`userdom_read_admin_home_files',`
4077 gen_require(`
4078 type admin_home_t;
4079 ')
4080
4081 read_files_pattern($1, admin_home_t, admin_home_t)
4082')
4083
4084########################################
4085## <summary>
4086## Execute admin home files.
4087## </summary>
4088## <param name="domain">
4089## <summary>
4090## Domain allowed access.
4091## </summary>
4092## </param>
4093## <rolecap/>
4094#
4095interface(`userdom_exec_admin_home_files',`
4096 gen_require(`
4097 type admin_home_t;
4098 ')
4099
4100 exec_files_pattern($1, admin_home_t, admin_home_t)
4101')
4102
4103########################################
4104## <summary>
4105## Append files inherited
4106## in the /root directory.
4107## </summary>
4108## <param name="domain">
4109## <summary>
4110## Domain allowed access.
4111## </summary>
4112## </param>
4113#
4114interface(`userdom_inherit_append_admin_home_files',`
4115 gen_require(`
4116 type admin_home_t;
4117 ')
4118
4119 allow $1 admin_home_t:file { getattr append };
4120')
4121
4122
4123#######################################
4124## <summary>
4125## Manage all files/directories in the homedir
4126## </summary>
4127## <param name="userdomain">
4128## <summary>
4129## The user domain
4130## </summary>
4131## </param>
4132## <rolebase/>
4133#
4134interface(`userdom_manage_user_home_content',`
4135 gen_require(`
4136 type user_home_dir_t, user_home_t;
4137 attribute user_home_type;
4138 ')
4139
4140 files_list_home($1)
4141 manage_dirs_pattern($1, { user_home_dir_t user_home_type }, user_home_type)
4142 manage_files_pattern($1, { user_home_dir_t user_home_type }, user_home_type)
4143 manage_lnk_files_pattern($1, { user_home_dir_t user_home_type }, user_home_type)
4144 manage_sock_files_pattern($1, { user_home_dir_t user_home_type }, user_home_type)
4145 manage_fifo_files_pattern($1, { user_home_dir_t user_home_type }, user_home_type)
4146 filetrans_pattern($1, user_home_dir_t, user_home_t, { dir file lnk_file sock_file fifo_file })
4147
4148')
4149
4150
4151########################################
4152## <summary>
4153## Create objects in a user home directory
4154## with an automatic type transition to
4155## the user home file type.
4156## </summary>
4157## <param name="domain">
4158## <summary>
4159## Domain allowed access.
4160## </summary>
4161## </param>
4162## <param name="object_class">
4163## <summary>
4164## The class of the object to be created.
4165## </summary>
4166## </param>
4167#
4168interface(`userdom_user_home_dir_filetrans_pattern',`
4169 gen_require(`
4170 type user_home_dir_t, user_home_t;
4171 ')
4172
4173 type_transition $1 user_home_dir_t:$2 user_home_t;
4174')
4175
4176########################################
4177## <summary>
4178## Create objects in the /root directory
4179## with an automatic type transition to
4180## a specified private type.
4181## </summary>
4182## <param name="domain">
4183## <summary>
4184## Domain allowed access.
4185## </summary>
4186## </param>
4187## <param name="private_type">
4188## <summary>
4189## The type of the object to create.
4190## </summary>
4191## </param>
4192## <param name="object_class">
4193## <summary>
4194## The class of the object to be created.
4195## </summary>
4196## </param>
4197#
4198interface(`userdom_admin_home_dir_filetrans',`
4199 gen_require(`
4200 type admin_home_t;
4201 ')
4202
ae4832c7 4203 filetrans_pattern($1, admin_home_t, $2, $3, $4)
3eaa9939
DW
4204')
4205
4206########################################
4207## <summary>
4208## Send signull to unprivileged user domains.
4209## </summary>
4210## <param name="domain">
4211## <summary>
4212## Domain allowed access.
4213## </summary>
4214## </param>
4215#
4216interface(`userdom_signull_unpriv_users',`
4217 gen_require(`
4218 attribute unpriv_userdomain;
4219 ')
4220
4221 allow $1 unpriv_userdomain:process signull;
4222')
4223
4224########################################
4225## <summary>
4226## Write all users files in /tmp
4227## </summary>
4228## <param name="domain">
4229## <summary>
4230## Domain allowed access.
4231## </summary>
4232## </param>
4233#
4234interface(`userdom_write_user_tmp_dirs',`
4235 gen_require(`
4236 type user_tmp_t;
4237 ')
4238
4239 write_files_pattern($1, user_tmp_t, user_tmp_t)
4240')
4241
4242########################################
4243## <summary>
4244## Manage keys for all user domains.
4245## </summary>
4246## <param name="domain">
4247## <summary>
4248## Domain allowed access.
4249## </summary>
4250## </param>
4251#
4252interface(`userdom_manage_all_users_keys',`
4253 gen_require(`
4254 attribute userdomain;
4255 ')
4256
4257 allow $1 userdomain:key manage_key_perms;
4258')
4259
4260
4261########################################
4262## <summary>
4263## Do not audit attempts to read and write
4264## unserdomain stream.
4265## </summary>
4266## <param name="domain">
4267## <summary>
4268## Domain to not audit.
4269## </summary>
4270## </param>
4271#
4272interface(`userdom_dontaudit_rw_stream',`
4273 gen_require(`
4274 attribute userdomain;
4275 ')
4276
4277 dontaudit $1 userdomain:unix_stream_socket rw_socket_perms;
4278')
4279
3d3d47e4
DW
4280########################################
4281## <summary>
4282## Do not audit attempts to read and write
4283## unserdomain datagram socket.
4284## </summary>
4285## <param name="domain">
4286## <summary>
4287## Domain to not audit.
4288## </summary>
4289## </param>
4290#
4291interface(`userdom_dontaudit_rw_dgram_socket',`
4292 gen_require(`
4293 attribute userdomain;
4294 ')
4295
6a074ab5 4296 dontaudit $1 userdomain:unix_dgram_socket { read write };
3d3d47e4
DW
4297')
4298
3eaa9939
DW
4299########################################
4300## <summary>
4301## Append files
4302## in a user home subdirectory.
4303## </summary>
4304## <param name="domain">
4305## <summary>
4306## Domain allowed access.
4307## </summary>
4308## </param>
4309#
4310interface(`userdom_append_user_home_content_files',`
4311 gen_require(`
4312 type user_home_dir_t, user_home_t;
4313 ')
4314
4315 append_files_pattern($1, user_home_t, user_home_t)
4316 allow $1 user_home_dir_t:dir search_dir_perms;
4317 files_search_home($1)
4318')
4319
4320########################################
4321## <summary>
4322## Read files inherited
4323## in a user home subdirectory.
4324## </summary>
4325## <param name="domain">
4326## <summary>
4327## Domain allowed access.
4328## </summary>
4329## </param>
4330#
4331interface(`userdom_read_inherited_user_home_content_files',`
4332 gen_require(`
4333 attribute user_home_type;
4334 ')
4335
4336 allow $1 user_home_type:file { getattr read };
4337')
4338
4339########################################
4340## <summary>
4341## Append files inherited
4342## in a user home subdirectory.
4343## </summary>
4344## <param name="domain">
4345## <summary>
4346## Domain allowed access.
4347## </summary>
4348## </param>
4349#
4350interface(`userdom_inherit_append_user_home_content_files',`
4351 gen_require(`
4352 type user_home_t;
4353 ')
4354
4355 allow $1 user_home_t:file { getattr append };
4356')
4357
4358########################################
4359## <summary>
4360## Append files inherited
4361## in a user tmp files.
4362## </summary>
4363## <param name="domain">
4364## <summary>
4365## Domain allowed access.
4366## </summary>
4367## </param>
4368#
4369interface(`userdom_inherit_append_user_tmp_files',`
4370 gen_require(`
4371 type user_tmp_t;
4372 ')
4373
4374 allow $1 user_tmp_t:file { getattr append };
4375')
4376
4377######################################
4378## <summary>
4379## Read audio files in the users homedir.
4380## </summary>
4381## <param name="domain">
4382## <summary>
4383## Domain allowed access.
4384## </summary>
4385## </param>
4386## <rolecap/>
4387#
4388interface(`userdom_read_home_audio_files',`
4389 gen_require(`
4390 type audio_home_t;
4391 ')
4392
4393 userdom_search_user_home_dirs($1)
4394 allow $1 audio_home_t:dir list_dir_perms;
4395 read_files_pattern($1, audio_home_t, audio_home_t)
4396 read_lnk_files_pattern($1, audio_home_t, audio_home_t)
4397')
4398
ca9e8850
DW
4399########################################
4400## <summary>
4401## Do not audit attempts to write all user home content files.
4402## </summary>
4403## <param name="domain">
4404## <summary>
4405## Domain to not audit.
4406## </summary>
4407## </param>
4408#
4409interface(`userdom_dontaudit_write_all_user_home_content_files',`
4410 gen_require(`
4411 attribute user_home_type;
4412 ')
4413
4414 dontaudit $1 user_home_type:file write_file_perms;
4415')
4416
4417########################################
4418## <summary>
4419## Do not audit attempts to write all user tmp content files.
4420## </summary>
4421## <param name="domain">
4422## <summary>
4423## Domain to not audit.
4424## </summary>
4425## </param>
4426#
4427interface(`userdom_dontaudit_write_all_user_tmp_content_files',`
4428 gen_require(`
4429 attribute user_tmp_type;
4430 ')
4431
4432 dontaudit $1 user_tmp_type:file write_file_perms;
4433')
4434
4435########################################
4436## <summary>
4437## Manage all user temporary content.
4438## </summary>
4439## <param name="domain">
4440## <summary>
4441## Domain allowed access.
4442## </summary>
4443## </param>
4444#
4445interface(`userdom_manage_all_user_tmp_content',`
4446 gen_require(`
4447 attribute user_tmp_type;
4448 ')
4449
4450 manage_dirs_pattern($1, user_tmp_type, user_tmp_type)
4451 manage_files_pattern($1, user_tmp_type, user_tmp_type)
4452 manage_lnk_files_pattern($1, user_tmp_type, user_tmp_type)
4453 manage_sock_files_pattern($1, user_tmp_type, user_tmp_type)
4454 manage_fifo_files_pattern($1, user_tmp_type, user_tmp_type)
4455 files_search_tmp($1)
4456')
4457
4458########################################
4459## <summary>
4460## List all user temporary content.
4461## </summary>
4462## <param name="domain">
4463## <summary>
4464## Domain allowed access.
4465## </summary>
4466## </param>
4467#
4468interface(`userdom_list_all_user_tmp_content',`
4469 gen_require(`
4470 attribute user_tmp_type;
4471 ')
4472
4473 list_dirs_pattern($1, user_tmp_type, user_tmp_type)
4474 getattr_files_pattern($1, user_tmp_type, user_tmp_type)
4475 read_lnk_files_pattern($1, user_tmp_type, user_tmp_type)
4476 getattr_sock_files_pattern($1, user_tmp_type, user_tmp_type)
4477 getattr_fifo_files_pattern($1, user_tmp_type, user_tmp_type)
4478 files_search_var($1)
4479 files_search_tmp($1)
4480')
4481
4482########################################
4483## <summary>
4484## Manage all user tmpfs content.
4485## </summary>
4486## <param name="domain">
4487## <summary>
4488## Domain allowed access.
4489## </summary>
4490## </param>
4491#
4492interface(`userdom_manage_all_user_tmpfs_content',`
4493 gen_require(`
4494 attribute user_tmpfs_type;
4495 ')
4496
4497 manage_dirs_pattern($1, user_tmpfs_type, user_tmpfs_type)
4498 manage_files_pattern($1, user_tmpfs_type, user_tmpfs_type)
4499 manage_lnk_files_pattern($1, user_tmpfs_type, user_tmpfs_type)
4500 manage_sock_files_pattern($1, user_tmpfs_type, user_tmpfs_type)
4501 manage_fifo_files_pattern($1, user_tmpfs_type, user_tmpfs_type)
4502 fs_search_tmpfs($1)
4503')
4504
4505########################################
4506## <summary>
4507## Delete all user temporary content.
4508## </summary>
4509## <param name="domain">
4510## <summary>
4511## Domain allowed access.
4512## </summary>
4513## </param>
4514#
4515interface(`userdom_delete_all_user_tmp_content',`
4516 gen_require(`
4517 attribute user_tmp_type;
4518 ')
4519
4520 delete_dirs_pattern($1, user_tmp_type, user_tmp_type)
4521 delete_files_pattern($1, user_tmp_type, user_tmp_type)
4522 delete_lnk_files_pattern($1, user_tmp_type, user_tmp_type)
4523 delete_sock_files_pattern($1, user_tmp_type, user_tmp_type)
4524 delete_fifo_files_pattern($1, user_tmp_type, user_tmp_type)
4525 # /var/tmp
4526 files_search_var($1)
4527 files_delete_tmp_dir_entry($1)
4528')
4529
3eaa9939
DW
4530########################################
4531## <summary>
4532## Read system SSL certificates in the users homedir.
4533## </summary>
4534## <param name="domain">
4535## <summary>
4536## Domain allowed access.
4537## </summary>
4538## </param>
3eaa9939
DW
4539#
4540interface(`userdom_read_home_certs',`
4541 gen_require(`
4542 type home_cert_t;
4543 ')
4544
4982766c 4545 userdom_search_user_home_content($1)
3eaa9939
DW
4546 allow $1 home_cert_t:dir list_dir_perms;
4547 read_files_pattern($1, home_cert_t, home_cert_t)
4548 read_lnk_files_pattern($1, home_cert_t, home_cert_t)
4549')
4550
f06e4c22
MG
4551#######################################
4552## <summary>
4553## Dontaudit Write system SSL certificates in the users homedir.
4554## </summary>
4555## <param name="domain">
4556## <summary>
24280f35 4557## Domain to not audit.
f06e4c22
MG
4558## </summary>
4559## </param>
4560#
4561interface(`userdom_dontaudit_write_home_certs',`
4562 gen_require(`
4563 type home_cert_t;
4564 ')
4565
4566 dontaudit $1 home_cert_t:file write;
4567')
4568
3eaa9939
DW
4569########################################
4570## <summary>
4571## dontaudit Search getatrr /root files
4572## </summary>
4573## <param name="domain">
4574## <summary>
24280f35 4575## Domain to not audit.
3eaa9939
DW
4576## </summary>
4577## </param>
4578#
4579interface(`userdom_dontaudit_getattr_admin_home_files',`
4580 gen_require(`
4581 type admin_home_t;
4582 ')
4583
4584 dontaudit $1 admin_home_t:file getattr;
4585')
4586
4587########################################
4588## <summary>
4589## dontaudit read /root lnk files
4590## </summary>
4591## <param name="domain">
4592## <summary>
24280f35 4593## Domain to not audit.
3eaa9939
DW
4594## </summary>
4595## </param>
4596#
4597interface(`userdom_dontaudit_read_admin_home_lnk_files',`
4598 gen_require(`
4599 type admin_home_t;
4600 ')
4601
4602 dontaudit $1 admin_home_t:lnk_file read;
4603')
4604
4605########################################
4606## <summary>
4607## dontaudit read /root files
4608## </summary>
4609## <param name="domain">
4610## <summary>
24280f35 4611## Domain to not audit.
3eaa9939
DW
4612## </summary>
4613## </param>
4614#
4615interface(`userdom_dontaudit_read_admin_home_files',`
4616 gen_require(`
4617 type admin_home_t;
4618 ')
4619
4620 dontaudit $1 admin_home_t:file read_file_perms;
4621')
4622
4623########################################
4624## <summary>
4625## Create, read, write, and delete user
4626## temporary chr files.
4627## </summary>
4628## <param name="domain">
4629## <summary>
4630## Domain allowed access.
4631## </summary>
4632## </param>
4633#
4634interface(`userdom_manage_user_tmp_chr_files',`
4635 gen_require(`
4636 type user_tmp_t;
4637 ')
4638
4639 manage_chr_files_pattern($1, user_tmp_t, user_tmp_t)
4640 files_search_tmp($1)
4641')
4642
4643########################################
4644## <summary>
4645## Create, read, write, and delete user
4646## temporary blk files.
4647## </summary>
4648## <param name="domain">
4649## <summary>
4650## Domain allowed access.
4651## </summary>
4652## </param>
4653#
4654interface(`userdom_manage_user_tmp_blk_files',`
4655 gen_require(`
4656 type user_tmp_t;
4657 ')
4658
4659 manage_blk_files_pattern($1, user_tmp_t, user_tmp_t)
4660 files_search_tmp($1)
4661')
4662
4663########################################
4664## <summary>
4665## Dontaudit attempt to set attributes on user temporary directories.
4666## </summary>
4667## <param name="domain">
4668## <summary>
24280f35 4669## Domain to not audit.
3eaa9939
DW
4670## </summary>
4671## </param>
4672#
4673interface(`userdom_dontaudit_setattr_user_tmp',`
4674 gen_require(`
4675 type user_tmp_t;
4676 ')
4677
4678 dontaudit $1 user_tmp_t:dir setattr;
4679')
4680
4681########################################
4682## <summary>
4683## Write all inherited users files in /tmp
4684## </summary>
4685## <param name="domain">
4686## <summary>
4687## Domain allowed access.
4688## </summary>
4689## </param>
4690#
4691interface(`userdom_write_inherited_user_tmp_files',`
4692 gen_require(`
4693 type user_tmp_t;
4694 ')
4695
4696 allow $1 user_tmp_t:file write;
4697')
4698
4699########################################
4700## <summary>
4701## Delete all users files in /tmp
4702## </summary>
4703## <param name="domain">
4704## <summary>
4705## Domain allowed access.
4706## </summary>
4707## </param>
4708#
4709interface(`userdom_delete_user_tmp_files',`
4710 gen_require(`
4711 type user_tmp_t;
4712 ')
4713
4714 allow $1 user_tmp_t:file delete_file_perms;
4715')
4716
4717########################################
4718## <summary>
4719## Delete user tmpfs files.
4720## </summary>
4721## <param name="domain">
4722## <summary>
4723## Domain allowed access.
4724## </summary>
4725## </param>
4726#
4727interface(`userdom_delete_user_tmpfs_files',`
4728 gen_require(`
4729 type user_tmpfs_t;
4730 ')
4731
4732 allow $1 user_tmpfs_t:file delete_file_perms;
4733')
4734
4735########################################
4736## <summary>
4737## Read/Write unpriviledged user SysV shared
4738## memory segments.
4739## </summary>
4740## <param name="domain">
4741## <summary>
4742## Domain allowed access.
4743## </summary>
4744## </param>
4745#
4746interface(`userdom_rw_unpriv_user_shared_mem',`
4747 gen_require(`
4748 attribute unpriv_userdomain;
4749 ')
4750
4751 allow $1 unpriv_userdomain:shm rw_shm_perms;
4752')
4753
4754########################################
4755## <summary>
4756## Do not audit attempts to search user
4757## temporary directories.
4758## </summary>
4759## <param name="domain">
4760## <summary>
4761## Domain to not audit.
4762## </summary>
4763## </param>
4764#
4765interface(`userdom_dontaudit_search_user_tmp',`
4766 gen_require(`
4767 type user_tmp_t;
4768 ')
4769
4770 dontaudit $1 user_tmp_t:dir search_dir_perms;
4771')
4772
4773########################################
4774## <summary>
4775## Execute a file in a user home directory
4776## in the specified domain.
4777## </summary>
4778## <desc>
4779## <p>
4780## Execute a file in a user home directory
4781## in the specified domain.
4782## </p>
4783## <p>
4784## No interprocess communication (signals, pipes,
4785## etc.) is provided by this interface since
4786## the domains are not owned by this module.
4787## </p>
4788## </desc>
4789## <param name="domain">
4790## <summary>
4791## Domain allowed access.
4792## </summary>
4793## </param>
4794## <param name="target_domain">
4795## <summary>
4796## The type of the new process.
4797## </summary>
4798## </param>
4799#
4800interface(`userdom_domtrans_user_home',`
4801 gen_require(`
4802 type user_home_t;
4803 ')
4804
4805 read_lnk_files_pattern($1, user_home_t, user_home_t)
4806 domain_transition_pattern($1, user_home_t, $2)
4807 type_transition $1 user_home_t:process $2;
4808')
4809
4810########################################
4811## <summary>
4812## Execute a file in a user tmp directory
4813## in the specified domain.
4814## </summary>
4815## <desc>
4816## <p>
4817## Execute a file in a user tmp directory
4818## in the specified domain.
4819## </p>
4820## <p>
4821## No interprocess communication (signals, pipes,
4822## etc.) is provided by this interface since
4823## the domains are not owned by this module.
4824## </p>
4825## </desc>
4826## <param name="domain">
4827## <summary>
4828## Domain allowed access.
4829## </summary>
4830## </param>
4831## <param name="target_domain">
4832## <summary>
4833## The type of the new process.
4834## </summary>
4835## </param>
4836#
4837interface(`userdom_domtrans_user_tmp',`
4838 gen_require(`
4839 type user_tmp_t;
4840 ')
4841
4842 files_search_tmp($1)
4843 read_lnk_files_pattern($1, user_tmp_t, user_tmp_t)
4844 domain_transition_pattern($1, user_tmp_t, $2)
4845 type_transition $1 user_tmp_t:process $2;
4846')
ca9e8850
DW
4847
4848########################################
4849## <summary>
4850## Do not audit attempts to read all user home content files.
4851## </summary>
4852## <param name="domain">
4853## <summary>
4854## Domain to not audit.
4855## </summary>
4856## </param>
4857#
4858interface(`userdom_dontaudit_read_all_user_home_content_files',`
4859 gen_require(`
4860 attribute user_home_type;
4861 ')
4862
4863 dontaudit $1 user_home_type:file read_file_perms;
4864')
4865
4866########################################
4867## <summary>
4868## Do not audit attempts to read all user tmp content files.
4869## </summary>
4870## <param name="domain">
4871## <summary>
4872## Domain to not audit.
4873## </summary>
4874## </param>
4875#
4876interface(`userdom_dontaudit_read_all_user_tmp_content_files',`
4877 gen_require(`
4878 attribute user_tmp_type;
4879 ')
4880
4881 dontaudit $1 user_tmp_type:file read_file_perms;
4882')
4883
2aa4540b
MG
4884#######################################
4885## <summary>
4886## Read and write unpriviledged user SysV sempaphores.
4887## </summary>
4888## <param name="domain">
4889## <summary>
4890## Domain allowed access.
4891## </summary>
4892## </param>
4893#
4894interface(`userdom_rw_unpriv_user_semaphores',`
4895 gen_require(`
4896 attribute unpriv_userdomain;
4897 ')
4898
4899 allow $1 unpriv_userdomain:sem rw_sem_perms;
4900')