selinux-policy/refpolicy/policy/modules/system/userdomain.if

2556 lines
60 KiB
Plaintext
Raw Normal View History

2005-05-18 21:00:30 +00:00
## <summary>Policy for user domains</summary>
#######################################
## <summary>
## The template containing rules common to unprivileged
## users and administrative users.
## </summary>
## <desc>
## <p>
## This template creates a user domain, types, and
## rules for the user's tty, pty, home directories,
## tmp, and tmpfs files.
## </p>
## <p>
## This generally should not be used, rather the
## unpriv_user_template or admin_user_template should
## be used.
## </p>
## </desc>
## <param name="userdomain_prefix">
## The prefix of the user domain (e.g., user
## is the prefix for user_t).
## </param>
#
template(`base_user_template',`
attribute $1_file_type;
type $1_t, userdomain;
2005-06-13 17:35:46 +00:00
domain_type($1_t)
corecmd_shell_entry_type($1_t)
domain_user_exemption_target($1_t)
role $1_r types $1_t;
allow system_r $1_r;
# user pseudoterminal
type $1_devpts_t;
2005-06-10 01:01:13 +00:00
term_user_pty($1_t,$1_devpts_t)
2005-09-05 18:17:17 +00:00
files_type($1_devpts_t)
# type for contents of home directory
type $1_home_t, $1_file_type, home_type;
files_type($1_home_t)
2005-09-19 21:17:45 +00:00
files_associate_tmp($1_home_t)
2005-09-16 19:36:10 +00:00
fs_associate_tmpfs($1_home_t)
# type of home directory
type $1_home_dir_t, home_dir_type, home_type;
2005-09-05 18:17:17 +00:00
files_type($1_home_dir_t)
2005-09-19 21:17:45 +00:00
files_associate_tmp($1_home_dir_t)
2005-09-16 19:36:10 +00:00
fs_associate_tmpfs($1_home_dir_t)
type $1_tmp_t, $1_file_type;
2005-06-13 17:35:46 +00:00
files_tmp_file($1_tmp_t)
type $1_tmpfs_t;
2005-06-13 17:35:46 +00:00
files_tmpfs_file($1_tmpfs_t)
2005-09-19 21:17:45 +00:00
# types for network-obtained content
type $1_untrusted_content_t, $1_file_type; #, customizable
files_type($1_untrusted_content_t)
files_poly_member($1_untrusted_content_t)
type $1_untrusted_content_tmp_t, $1_file_type; # customizable
files_tmp_file($1_untrusted_content_tmp_t)
type $1_tty_device_t;
2005-06-10 01:01:13 +00:00
term_tty($1_t,$1_tty_device_t)
##############################
#
# Local policy
#
allow $1_t self:capability { setgid chown fowner };
dontaudit $1_t self:capability { sys_nice fsetid };
2005-09-01 20:13:42 +00:00
allow $1_t self:process ~{ ptrace setcurrent setexec setfscreate setrlimit execmem execstack execheap };
allow $1_t self:process { ptrace setfscreate };
allow $1_t self:fd use;
2005-06-09 18:08:26 +00:00
allow $1_t self:fifo_file rw_file_perms;
allow $1_t self:unix_dgram_socket create_socket_perms;
2005-06-10 01:01:13 +00:00
allow $1_t self:unix_stream_socket create_stream_socket_perms;
allow $1_t self:unix_dgram_socket sendto;
allow $1_t self:unix_stream_socket connectto;
2005-06-09 18:08:26 +00:00
allow $1_t self:shm create_shm_perms;
allow $1_t self:sem create_sem_perms;
allow $1_t self:msgq create_msgq_perms;
allow $1_t self:msg { send receive };
dontaudit $1_t self:socket create;
2005-09-19 21:17:45 +00:00
allow $1_t self:udp_socket { sendto recvfrom };
# evolution and gnome-session try to create a netlink socket
dontaudit $1_t self:netlink_socket { create ioctl read getattr write setattr append bind connect getopt setopt shutdown };
dontaudit $1_t self:netlink_route_socket { create ioctl read getattr write setattr append bind connect getopt setopt shutdown nlmsg_read nlmsg_write };
# execute files in the home directory
2005-08-25 20:27:20 +00:00
can_exec($1_t,$1_home_t)
# full control of the home directory
2005-06-09 18:08:26 +00:00
allow $1_t $1_home_t:file { create_file_perms relabelfrom relabelto };
allow $1_t $1_home_t:lnk_file { create_lnk_perms relabelfrom relabelto };
allow $1_t $1_home_t:dir { create_dir_perms relabelfrom relabelto };
allow $1_t $1_home_t:sock_file { create_file_perms relabelfrom relabelto };
allow $1_t $1_home_t:fifo_file { create_file_perms relabelfrom relabelto };
2005-09-19 21:17:45 +00:00
allow $1_t $1_home_dir_t:dir { create_dir_perms relabelfrom relabelto };
2005-06-09 18:08:26 +00:00
type_transition $1_t $1_home_dir_t:{ dir notdevfile_class_set } $1_home_t;
2005-08-25 20:27:20 +00:00
can_exec($1_t,$1_tmp_t)
2005-09-19 21:17:45 +00:00
# user temporary files
allow $1_t $1_tmp_t:file create_file_perms;
allow $1_t $1_tmp_t:lnk_file create_lnk_perms;
allow $1_t $1_tmp_t:dir create_dir_perms;
allow $1_t $1_tmp_t:sock_file create_file_perms;
allow $1_t $1_tmp_t:fifo_file create_file_perms;
files_create_tmp_files($1_t, $1_tmp_t, { dir notdevfile_class_set })
# Bind to a Unix domain socket in /tmp.
# cjp: this is combination is not checked and should be removed
allow $1_t $1_tmp_t:unix_stream_socket name_bind;
2005-06-09 18:08:26 +00:00
allow $1_t $1_tmpfs_t:dir rw_dir_perms;
allow $1_t $1_tmpfs_t:file create_file_perms;
allow $1_t $1_tmpfs_t:lnk_file create_lnk_perms;
allow $1_t $1_tmpfs_t:sock_file create_file_perms;
allow $1_t $1_tmpfs_t:fifo_file create_file_perms;
2005-06-10 01:01:13 +00:00
fs_create_tmpfs_data($1_t,$1_tmpfs_t, { dir notdevfile_class_set } )
2005-06-09 18:08:26 +00:00
allow $1_t $1_tty_device_t:chr_file { setattr rw_file_perms };
2005-09-19 21:17:45 +00:00
# Allow user to relabel untrusted content
allow $1_t { $1_untrusted_content_t $1_untrusted_content_tmp_t }:dir { create_dir_perms relabelto relabelfrom };
allow $1_t { $1_untrusted_content_t $1_untrusted_content_tmp_t }:file { getattr unlink relabelto relabelfrom rename };
allow $1_t unpriv_userdomain:fd use;
# Instantiate derived domains for a number of programs.
# These derived domains encode both information about the calling
# user domain and the program, and allow us to maintain separation
# between different instances of the program being run by different
# user domains.
per_userdomain_templates($1,$1_t,$1_r)
kernel_read_kernel_sysctl($1_t)
selinux_get_fs_mount($1_t)
# Very permissive allowing every domain to see every type:
kernel_get_sysvipc_info($1_t)
# Find CDROM devices:
kernel_read_device_sysctl($1_t)
2005-06-29 20:53:53 +00:00
dev_rw_power_management($1_t)
# GNOME checks for usb and other devices:
dev_rw_usbfs($1_t)
2005-06-10 01:01:13 +00:00
corenet_tcp_sendrecv_all_if($1_t)
corenet_raw_sendrecv_all_if($1_t)
corenet_udp_sendrecv_all_if($1_t)
corenet_tcp_sendrecv_all_nodes($1_t)
corenet_raw_sendrecv_all_nodes($1_t)
corenet_udp_sendrecv_all_nodes($1_t)
corenet_tcp_sendrecv_all_ports($1_t)
corenet_udp_sendrecv_all_ports($1_t)
corenet_tcp_bind_all_nodes($1_t)
corenet_udp_bind_all_nodes($1_t)
corenet_udp_bind_generic_port($1_t)
2005-09-15 21:03:29 +00:00
corenet_tcp_connect_all_ports($1_t)
2005-06-13 16:22:32 +00:00
dev_read_input($1_t)
dev_read_misc($1_t)
dev_write_misc($1_t)
dev_write_snd_dev($1_t)
dev_read_snd_dev($1_t)
dev_read_snd_mixer_dev($1_t)
dev_write_snd_mixer_dev($1_t)
dev_read_rand($1_t)
dev_read_urand($1_t)
# open office is looking for the following
2005-06-13 16:22:32 +00:00
dev_getattr_agp_dev($1_t)
dev_dontaudit_rw_dri_dev($1_t)
2005-06-08 13:12:00 +00:00
fs_get_all_fs_quotas($1_t)
2005-06-10 01:01:13 +00:00
fs_getattr_all_fs($1_t)
2005-06-27 16:30:55 +00:00
fs_search_auto_mountpoints($1_t)
2005-09-19 21:17:45 +00:00
# cjp: some of this probably can be removed
selinux_get_fs_mount($1_t)
selinux_validate_context($1_t)
selinux_compute_access_vector($1_t)
selinux_compute_create_context($1_t)
selinux_compute_relabel_context($1_t)
selinux_compute_user_contexts($1_t)
# for eject
2005-06-10 01:01:13 +00:00
storage_getattr_fixed_disk($1_t)
2005-06-13 17:35:46 +00:00
auth_read_login_records($1_t)
auth_dontaudit_write_login_records($1_t)
auth_run_pam($1_t,$1_r,{ $1_tty_device_t $1_devpts_t })
auth_run_utempter($1_t,$1_r,{ $1_tty_device_t $1_devpts_t })
2005-06-13 17:35:46 +00:00
corecmd_exec_bin($1_t)
corecmd_exec_sbin($1_t)
corecmd_exec_ls($1_t)
2005-06-13 17:35:46 +00:00
domain_exec_all_entry_files($1_t)
domain_use_wide_inherit_fd($1_t)
2005-07-19 18:40:31 +00:00
# When the user domain runs ps, there will be a number of access
# denials when ps tries to search /proc. Do not audit these denials.
domain_dontaudit_read_all_domains_state($1_t)
domain_dontaudit_getsession_all_domains($1_t)
files_exec_etc_files($1_t)
files_search_locks($1_t)
# old broswer_domain():
files_dontaudit_list_non_security($1_t)
files_dontaudit_getattr_non_security_files($1_t)
files_dontaudit_getattr_non_security_symlinks($1_t)
files_dontaudit_getattr_non_security_pipes($1_t)
files_dontaudit_getattr_non_security_sockets($1_t)
files_dontaudit_getattr_non_security_blk_dev($1_t)
files_dontaudit_getattr_non_security_chr_dev($1_t)
# Caused by su - init scripts
2005-06-13 17:35:46 +00:00
init_dontaudit_use_script_pty($1_t)
2005-06-13 17:35:46 +00:00
libs_use_ld_so($1_t)
libs_use_shared_libs($1_t)
libs_exec_ld_so($1_t)
libs_exec_lib_files($1_t)
2005-06-13 17:35:46 +00:00
logging_dontaudit_getattr_all_logs($1_t)
miscfiles_read_localization($1_t)
2005-09-19 21:17:45 +00:00
miscfiles_read_fonts($1_t)
2005-07-19 18:40:31 +00:00
# for running TeX programs
miscfiles_read_tetex_data($1_t)
miscfiles_exec_tetex_data($1_t)
2005-09-19 21:17:45 +00:00
seutil_read_file_contexts($1_t)
seutil_read_default_contexts($1_t)
seutil_run_newrole($1_t,$1_r,{ $1_devpts_t $1_tty_device_t })
2005-06-13 17:35:46 +00:00
mta_rw_spool($1_t)
2005-06-13 20:44:23 +00:00
tunable_policy(`allow_execmem',`
# Allow loading DSOs that require executable stack.
allow $1_t self:process execmem;
2005-06-13 20:44:23 +00:00
')
2005-09-19 21:17:45 +00:00
tunable_policy(`allow_execmem && allow_execstack',`
# Allow making the stack executable via mprotect.
allow $1_t self:process execstack;
')
2005-07-19 18:40:31 +00:00
tunable_policy(`read_default_t',`
files_list_default($1_t)
files_read_default_files($1_t)
files_read_default_symlinks($1_t)
files_read_default_sockets($1_t)
files_read_default_pipes($1_t)
2005-09-19 21:17:45 +00:00
',`
files_dontaudit_list_default($1_t)
files_dontaudit_read_default_files($1_t)
')
tunable_policy(`read_untrusted_content',`
allow $1_t { $1_untrusted_content_t $1_untrusted_content_tmp_t }:dir r_dir_perms;
allow $1_t { $1_untrusted_content_t $1_untrusted_content_tmp_t }:file r_file_perms;
allow $1_t { $1_untrusted_content_t $1_untrusted_content_tmp_t }:lnk_file { getattr read };
',`
dontaudit $1_t { $1_untrusted_content_t $1_untrusted_content_tmp_t }:dir r_dir_perms;
dontaudit $1_t { $1_untrusted_content_t $1_untrusted_content_tmp_t }:file r_file_perms;
2005-07-19 18:40:31 +00:00
')
2005-06-13 20:44:23 +00:00
tunable_policy(`use_nfs_home_dirs',`
2005-06-10 01:01:13 +00:00
fs_manage_nfs_dirs($1_t)
2005-06-08 13:12:00 +00:00
fs_manage_nfs_files($1_t)
2005-06-10 01:01:13 +00:00
fs_manage_nfs_symlinks($1_t)
2005-06-08 13:12:00 +00:00
fs_manage_nfs_named_sockets($1_t)
fs_manage_nfs_named_pipes($1_t)
fs_execute_nfs_files($1_t)
2005-09-19 21:17:45 +00:00
',`
fs_dontaudit_manage_nfs_dirs($1_t)
fs_dontaudit_manage_nfs_files($1_t)
2005-06-13 20:44:23 +00:00
')
2005-06-13 20:44:23 +00:00
tunable_policy(`use_samba_home_dirs',`
2005-06-10 01:01:13 +00:00
fs_manage_cifs_dirs($1_t)
fs_manage_cifs_files($1_t)
fs_manage_cifs_symlinks($1_t)
fs_manage_cifs_named_sockets($1_t)
fs_manage_cifs_named_pipes($1_t)
fs_execute_cifs_files($1_t)
2005-09-19 21:17:45 +00:00
',`
fs_dontaudit_manage_cifs_dirs($1_t)
fs_dontaudit_manage_cifs_files($1_t)
2005-06-13 20:44:23 +00:00
')
2005-06-13 20:44:23 +00:00
tunable_policy(`user_direct_mouse',`
2005-06-13 16:22:32 +00:00
dev_read_mouse($1_t)
2005-06-13 20:44:23 +00:00
')
2005-06-13 20:44:23 +00:00
tunable_policy(`user_ttyfile_stat',`
2005-06-10 01:01:13 +00:00
term_getattr_all_user_ttys($1_t)
2005-06-13 20:44:23 +00:00
')
2005-10-21 16:39:28 +00:00
optional_policy(`canna.te',`
canna_stream_connect($1_t)
')
2005-08-31 20:58:12 +00:00
optional_policy(`dbus.te',`
dbus_system_bus_client_template($1,$1_t)
')
2005-09-02 20:50:54 +00:00
optional_policy(`dictd.te',`
dictd_use($1_t)
')
2005-10-05 19:52:53 +00:00
optional_policy(`ftp.te',`
tunable_policy(`ftpd_is_daemon',`
ftp_tcp_connect($1_t)
')
')
2005-10-07 21:45:04 +00:00
optional_policy(`finger.te',`
finger_tcp_connect($1_t)
')
2005-07-12 20:34:24 +00:00
optional_policy(`inetd.te',`
inetd_tcp_connect($1_t)
2005-07-12 20:34:24 +00:00
')
optional_policy(`inn.te',`
inn_read_config($1_t)
inn_read_news_lib($1_t)
inn_read_news_spool($1_t)
')
2005-06-27 16:30:55 +00:00
optional_policy(`nis.te',`
nis_use_ypbind($1_t)
')
2005-08-03 17:56:26 +00:00
optional_policy(`mysql.te',`
ifdef(`targeted_policy',`',`
tunable_policy(`allow_user_mysql_connect',`
mysql_stream_connect($1_t)
')
')
')
2005-07-13 20:48:51 +00:00
optional_policy(`nscd.te',`
nscd_use_socket($1_t)
')
2005-07-19 18:40:31 +00:00
optional_policy(`pcmcia.te',`
# to allow monitoring of pcmcia status
pcmcia_read_pid($1_t)
')
2005-08-11 14:49:58 +00:00
optional_policy(`quota.te',`
quota_dontaudit_getattr_db($1_t)
')
2005-07-12 20:34:24 +00:00
optional_policy(`rpm.te',`
files_getattr_var_lib_dir($1_t)
files_search_var_lib($1_t)
')
2005-09-02 19:11:07 +00:00
optional_policy(`squid.te',`
squid_use($1_t)
')
optional_policy(`usermanage.te',`
2005-06-13 17:35:46 +00:00
usermanage_run_chfn($1_t,$1_r,{ $1_devpts_t $1_tty_device_t })
usermanage_run_passwd($1_t,$1_r,{ $1_devpts_t $1_tty_device_t })
')
ifdef(`TODO',`
2005-09-15 21:03:29 +00:00
can_winbind($1_t)
#
# Cups daemon running as user tries to write /etc/printcap
#
dontaudit $1_t usr_t:file setattr;
# Check to see if cdrom is mounted
allow $1_t mnt_t:dir { getattr search };
#
# Added to allow reading of cdrom
#
allow $1_t rpc_pipefs_t:dir getattr;
allow $1_t nfsd_fs_t:dir getattr;
allow $1_t binfmt_misc_fs_t:dir getattr;
# /initrd is left mounted, various programs try to look at it
dontaudit $1_t ramfs_t:dir getattr;
#
# Running ifconfig as a user generates the following
#
dontaudit $1_t sysctl_net_t:dir search;
r_dir_file($1_t, usercanread)
allow $1_t fs_type:dir getattr;
# old browser_domain():
2005-09-19 21:17:45 +00:00
dontaudit $1 unlabeled_t:dir_file_class_set getattr;
dontaudit $1 unlabeled_t:dir search;
dontaudit $1 unlabeled_t:dir read;
dontaudit $1 { fs_type proc_fs dev_fs sysctl_type }:dir_file_class_set getattr;
dontaudit $1 { fs_type proc_fs dev_fs sysctl_type }:dir search;
dontaudit $1 { fs_type proc_fs dev_fs sysctl_type }:dir read;
allow $1_t usbtty_device_t:chr_file read;
can_resmgrd_connect($1_t)
# Grant permissions to access the system DBus
ifdef(`dbusd.te', `
ifdef(`hald.te', `
allow $1_t hald_t:dbus send_msg;
allow hald_t $1_t:dbus send_msg;
')
')
# Gnome pannel binds to the following
ifdef(`cups.te', `
2005-06-09 18:08:26 +00:00
allow $1_t { cupsd_etc_t cupsd_rw_etc_t }:file r_file_perms;
')
ifdef(`inetd.te', `
2005-07-19 18:40:31 +00:00
# Connect to inetd.
2005-08-17 17:31:57 +00:00
inetd_tcp_connect($1_t)
can_udp_send($1_t, inetd_t)
can_udp_send(inetd_t, $1_t)
2005-07-19 18:40:31 +00:00
# Inherit and use sockets from inetd
2005-08-17 17:31:57 +00:00
inetd_use_fd($1_t)
2005-07-19 18:40:31 +00:00
allow $1_t inetd_t:tcp_socket rw_stream_socket_perms;
')
# Connect to portmap.
ifdef(`portmap.te', `can_tcp_connect($1_t, portmap_t)')
2005-09-19 21:17:45 +00:00
# Use X
x_client_domain($1, $1)
ifdef(`xserver.te', `
allow $1_t xserver_misc_device_t:{ chr_file blk_file } rw_file_perms;
')
ifdef(`xdm.te', `
# Connect to the X server run by the X Display Manager.
can_unix_connect($1_t, xdm_t)
# certain apps want to read xdm.pid file
r_dir_file($1_t, xdm_var_run_t)
2005-06-09 18:08:26 +00:00
allow $1_t xdm_var_lib_t:file r_file_perms;
allow xdm_t $1_home_dir_t:dir getattr;
ifdef(`xauth.te', `
file_type_auto_trans(xdm_t, $1_home_dir_t, $1_xauth_home_t, file)
')
2005-09-19 21:17:45 +00:00
')
# start read_fonts()
# cjp: this macro is unconditional, though
# its in a conditional file.
2005-09-19 21:17:45 +00:00
# Manipulate the global font cache
create_dir_file($1, $1_fonts_cache_t)
2005-09-19 21:17:45 +00:00
# Read per user fonts and font config
r_dir_file($1, $1_fonts_t)
r_dir_file($1, $1_fonts_config_t)
# There are some fonts in .gnome2
ifdef(`gnome.te', `
allow $1 $2_gnome_settings_t:dir { getattr search };
')
2005-09-19 21:17:45 +00:00
# end read_fonts()
ifdef(`rpcd.te', `
create_dir_file($1_t, nfsd_rw_t)
')
#
# Allow graphical boot to check battery lifespan
#
ifdef(`apmd.te', `
allow $1_t apmd_t:unix_stream_socket connectto;
allow $1_t apmd_var_run_t:sock_file write;
')
ifdef(`pamconsole.te', `
allow $1_t pam_var_console_t:dir search;
')
') dnl endif TODO
2005-07-19 18:40:31 +00:00
')
#######################################
## <summary>
## The template for creating a unprivileged user.
## </summary>
## <desc>
## <p>
## This template creates a user domain, types, and
## rules for the user's tty, pty, home directories,
## tmp, and tmpfs files.
## </p>
## </desc>
## <param name="userdomain_prefix">
## The prefix of the user domain (e.g., user
## is the prefix for user_t).
## </param>
#
template(`unpriv_user_template', `
##############################
#
# Declarations
#
# Inherit rules for ordinary users.
base_user_template($1)
2005-09-02 19:11:07 +00:00
typeattribute $1_t unpriv_userdomain;
2005-06-13 17:35:46 +00:00
domain_wide_inherit_fd($1_t)
2005-08-17 17:31:57 +00:00
typeattribute $1_devpts_t user_ptynode;
2005-09-19 21:17:45 +00:00
2005-08-17 17:31:57 +00:00
typeattribute $1_home_dir_t user_home_dir_type;
2005-09-19 21:17:45 +00:00
files_poly($1_home_dir_t)
2005-08-17 17:31:57 +00:00
typeattribute $1_home_t user_home_type;
2005-09-19 21:17:45 +00:00
files_poly_member($1_home_t)
2005-06-27 16:30:55 +00:00
typeattribute $1_tmp_t user_tmpfile;
2005-06-29 20:53:53 +00:00
typeattribute $1_tty_device_t user_ttynode;
##############################
#
# Local policy
#
allow $1_t $1_devpts_t:chr_file { setattr ioctl read getattr lock write append };
2005-06-10 01:01:13 +00:00
term_create_pty($1_t,$1_devpts_t)
# Rules used to associate a homedir as a mountpoint
allow $1_home_t self:filesystem associate;
allow $1_file_type $1_home_t:filesystem associate;
# privileged home directory writers
2005-06-09 18:08:26 +00:00
allow privhome $1_home_t:file create_file_perms;
allow privhome $1_home_t:lnk_file create_lnk_perms;
allow privhome $1_home_t:dir create_dir_perms;
allow privhome $1_home_t:sock_file create_file_perms;
allow privhome $1_home_t:fifo_file create_file_perms;
type_transition privhome $1_home_dir_t:{ dir notdevfile_class_set } $1_home_t;
kernel_read_system_state($1_t)
kernel_read_network_state($1_t)
dev_read_sysfs($1_t)
# cjp: why?
bootloader_read_kernel_symbol_table($1_t)
# port access is audited even if dac would not have allowed it, so dontaudit it here
2005-06-10 01:01:13 +00:00
corenet_dontaudit_tcp_bind_all_reserved_ports($1_t)
files_read_etc_files($1_t)
2005-06-13 17:35:46 +00:00
files_list_home($1_t)
files_read_usr_files($1_t)
2005-07-19 18:40:31 +00:00
files_exec_usr_files($1_t)
# Read directories and files with the readable_t type.
# This type is a general type for "world"-readable files.
files_list_world_readable($1_t)
files_read_world_readable_files($1_t)
files_read_world_readable_symlinks($1_t)
files_read_world_readable_pipes($1_t)
files_read_world_readable_sockets($1_t)
2005-06-13 17:35:46 +00:00
init_read_script_pid($1_t)
# The library functions always try to open read-write first,
# then fall back to read-only if it fails.
2005-06-13 17:35:46 +00:00
init_dontaudit_write_script_pid($1_t)
# Stop warnings about access to /dev/console
2005-06-13 17:35:46 +00:00
init_dontaudit_use_fd($1_t)
init_dontaudit_use_script_fd($1_t)
miscfiles_read_man_pages($1_t)
seutil_read_config($1_t)
# Allow users to execute checkpolicy without a domain transition
# so it can be used without privilege to write real binary policy file
seutil_exec_checkpol($1_t)
2005-09-19 21:17:45 +00:00
ifdef(`enable_polyinstantiation',`
type_member $1_t $1_home_dir_t:dir $1_home_t;
files_poly_member_tmp($1_t)
')
2005-06-13 20:44:23 +00:00
tunable_policy(`user_dmesg',`
kernel_read_ring_buffer($1_t)
2005-06-13 20:44:23 +00:00
',`
2005-06-10 01:01:13 +00:00
kernel_dontaudit_read_ring_buffer($1_t)
2005-06-13 20:44:23 +00:00
')
# Allow users to run TCP servers (bind to ports and accept connection from
# the same domain and outside users) disabling this forces FTP passive mode
# and may change other protocols
2005-06-13 20:44:23 +00:00
tunable_policy(`user_tcp_server',`
2005-06-10 01:01:13 +00:00
corenet_tcp_bind_generic_port($1_t)
2005-06-13 20:44:23 +00:00
')
2005-07-01 13:31:34 +00:00
optional_policy(`kerberos.te',`
kerberos_use($1_t)
')
2005-08-15 14:46:17 +00:00
optional_policy(`loadkeys.te',`
loadkeys_run($1_t,$1_r,$1_tty_device_t)
')
# for running depmod as part of the kernel packaging process
optional_policy(`modutils.te',`
2005-06-13 17:35:46 +00:00
modutils_read_module_conf($1_t)
')
2005-09-27 19:40:44 +00:00
optional_policy(`netutils.te',`
netutils_run_ping_cond($1_t,$1_r,{ $1_tty_device_t $1_devpts_t })
netutils_run_traceroute_cond($1_t,$1_r,{ $1_tty_device_t $1_devpts_t })
')
2005-10-14 20:00:07 +00:00
# Run pppd in pppd_t by default for user
optional_policy(`ppp.te', `
ppp_run_cond($1_t,$1_r,{ $1_tty_device_t $1_devpts_t })
')
optional_policy(`selinuxutil.te',`
# for when the network connection is killed
seutil_dontaudit_signal_newrole($1_t)
')
# Need the following rule to allow users to run vpnc
optional_policy(`xserver.te', `
2005-10-18 18:25:33 +00:00
corenet_tcp_bind_xserver_port($1_t)
')
ifdef(`TODO',`
2005-09-19 21:17:45 +00:00
ifdef(`enable_mls',`',`
fs_exec_noxattr($1_t)
tunable_policy(`user_rw_noexattrfile',`
create_dir_file($1_t, noexattrfile)
# Write floppies
storage_raw_read_removable_device($1_t)
storage_raw_write_removable_device($1_t)
# cjp: what does this have to do with removable devices?
allow $1_t usbtty_device_t:chr_file write;
',`
r_dir_file($1_t, noexattrfile)
r_dir_file($1_t, removable_t)
allow $1_t removable_device_t:blk_file r_file_perms;
')
')
dontaudit $1_t boot_t:lnk_file read;
dontaudit $1_t boot_t:file read;
# do not audit read on disk devices
dontaudit $1_t { removable_device_t fixed_disk_device_t }:blk_file read;
ifdef(`xdm.te', `
allow xdm_t $1_home_t:lnk_file read;
allow xdm_t $1_home_t:dir search;
#
# Changing this to dontaudit should cause the .xsession-errors file to be written to /tmp
#
dontaudit xdm_t $1_home_t:file rw_file_perms;
')
ifdef(`ftpd.te', `
tunable_policy(`ftp_home_dir',`
file_type_auto_trans(ftpd_t, $1_home_dir_t, $1_home_t)
')
')
2005-09-19 21:17:45 +00:00
ifdef(`useradd.te', `
# Useradd relabels /etc/skel files so needs these privs
allow useradd_t $1_file_type:dir create_dir_perms;
allow useradd_t $1_file_type:notdevfile_class_set create_file_perms;
')
# Stat lost+found.
allow $1_t lost_found_t:dir getattr;
# Read /var, /var/spool, /var/run.
2005-09-19 21:17:45 +00:00
r_dir_file($1_t, var_t)
# what about pipes and sockets under /var/spool?
r_dir_file($1_t, var_spool_t)
r_dir_file($1_t, var_run_t)
allow $1_t var_lib_t:dir r_dir_perms;
allow $1_t var_lib_t:file { getattr read };
# Allow users to rw usb devices
tunable_policy(`user_rw_usb',`
rw_dir_create_file($1_t,usbdevfs_t)
',`
r_dir_file($1_t,usbdevfs_t)
')
# Do not audit write denials to /etc/ld.so.cache.
dontaudit $1_t ld_so_cache_t:file write;
dontaudit $1_t sysadm_home_t:file { read append };
ifdef(`syslogd.te', `
# Some programs that are left in $1_t will try to connect
# to syslogd, but we do not want to let them generate log messages.
# Do not audit.
dontaudit $1_t devlog_t:sock_file { read write };
dontaudit $1_t syslogd_t:unix_dgram_socket sendto;
')
allow $1_t initrc_t:fifo_file write;
') dnl end TODO
')
2005-05-18 13:18:49 +00:00
#######################################
## <summary>
## The template for creating an administrative user.
## </summary>
## <desc>
## <p>
## This template creates a user domain, types, and
## rules for the user's tty, pty, home directories,
## tmp, and tmpfs files.
## </p>
2005-07-19 18:40:31 +00:00
## <p>
## The privileges given to administrative users are:
## <ul>
## <li>Raw disk access</li>
## <li>Set all sysctls</li>
## <li>All kernel ring buffer controls</li>
## <li>Set SELinux enforcement mode (enforcing/permissive)</li>
## <li>Set SELinux booleans</li>
## <li>Relabel all files but shadow</li>
## <li>Create, read, write, and delete all files but shadow</li>
## <li>Manage source and binary format SELinux policy</li>
## <li>Run insmod</li>
## </ul>
2005-07-19 18:40:31 +00:00
## </p>
## </desc>
## <param name="userdomain_prefix">
## The prefix of the user domain (e.g., sysadm
## is the prefix for sysadm_t).
## </param>
2005-05-18 13:18:49 +00:00
#
template(`admin_user_template',`
2005-09-21 14:49:41 +00:00
gen_require(`
class passwd { passwd chfn chsh rootok crontab };
')
##############################
#
# Declarations
#
# Inherit rules for ordinary users.
base_user_template($1)
2005-09-02 19:11:07 +00:00
typeattribute $1_t privhome;
domain_obj_id_change_exempt($1_t)
role system_r types $1_t;
2005-09-21 14:49:41 +00:00
ifdef(`direct_sysadm_daemon',`
domain_system_change_exempt($1_t)
')
typeattribute $1_devpts_t admin_terminal;
typeattribute $1_tty_device_t admin_terminal;
##############################
#
# $1_t local policy
#
allow $1_t self:capability ~sys_module;
allow $1_t self:process { setexec setfscreate };
# Set password information for other users.
allow $1_t self:passwd { passwd chfn chsh };
# Skip authentication when pam_rootok is specified.
allow $1_t self:passwd rootok;
# Manipulate other users crontab.
allow $1_t self:passwd crontab;
# for the administrator to run TCP servers directly
allow $1_t self:tcp_socket { acceptfrom connectto recvfrom };
2005-09-19 21:17:45 +00:00
allow $1_t self:netlink_audit_socket nlmsg_readpriv;
allow $1_t $1_devpts_t:chr_file { setattr ioctl read getattr lock write append };
2005-06-10 01:01:13 +00:00
term_create_pty($1_t,$1_devpts_t)
kernel_read_system_state($1_t)
kernel_read_network_state($1_t)
kernel_read_software_raid_state($1_t)
2005-06-10 01:01:13 +00:00
kernel_getattr_core($1_t)
kernel_getattr_message_if($1_t)
kernel_change_ring_buffer_level($1_t)
kernel_clear_ring_buffer($1_t)
kernel_read_ring_buffer($1_t)
kernel_get_sysvipc_info($1_t)
2005-06-10 01:01:13 +00:00
kernel_rw_all_sysctl($1_t)
# signal unlabeled processes:
kernel_kill_unlabeled($1_t)
kernel_signal_unlabeled($1_t)
kernel_sigstop_unlabeled($1_t)
kernel_signull_unlabeled($1_t)
kernel_sigchld_unlabeled($1_t)
2005-07-19 18:40:31 +00:00
# for the administrator to run TCP servers directly
kernel_tcp_recvfrom($1_t)
corenet_tcp_bind_generic_port($1_t)
# allow setting up tunnels
corenet_use_tun_tap_device($1_t)
dev_getattr_generic_blk_file($1_t)
dev_getattr_generic_chr_file($1_t)
dev_getattr_all_blk_files($1_t)
dev_getattr_all_chr_files($1_t)
fs_getattr_all_fs($1_t)
fs_set_all_quotas($1_t)
2005-09-19 21:17:45 +00:00
fs_exec_noxattr($1_t)
selinux_set_enforce_mode($1_t)
selinux_set_boolean($1_t)
selinux_set_parameters($1_t)
# Get security policy decisions:
selinux_get_fs_mount($1_t)
selinux_validate_context($1_t)
selinux_compute_access_vector($1_t)
selinux_compute_create_context($1_t)
selinux_compute_relabel_context($1_t)
selinux_compute_user_contexts($1_t)
storage_raw_read_removable_device($1_t)
storage_raw_write_removable_device($1_t)
2005-06-10 01:01:13 +00:00
term_use_console($1_t)
term_use_unallocated_tty($1_t)
term_use_all_user_ptys($1_t)
term_use_all_user_ttys($1_t)
2005-07-19 18:40:31 +00:00
auth_getattr_shadow($1_t)
# Manage almost all files
2005-06-13 17:35:46 +00:00
auth_manage_all_files_except_shadow($1_t)
# Relabel almost all files
2005-06-13 17:35:46 +00:00
auth_relabel_all_files_except_shadow($1_t)
2005-06-13 17:35:46 +00:00
domain_setpriority_all_domains($1_t)
domain_read_all_domains_state($1_t)
2005-09-16 14:54:36 +00:00
domain_getattr_all_domains($1_t)
domain_dontaudit_ptrace_all_domains($1_t)
# signal all domains:
domain_kill_all_domains($1_t)
domain_signal_all_domains($1_t)
domain_signull_all_domains($1_t)
domain_sigstop_all_domains($1_t)
domain_sigstop_all_domains($1_t)
domain_sigchld_all_domains($1_t)
2005-07-19 18:40:31 +00:00
# for lsof
domain_getattr_all_sockets($1_t)
2005-10-07 18:48:43 +00:00
files_exec_usr_src_files($1_t)
2005-06-13 17:35:46 +00:00
init_use_initctl($1_t)
2005-06-13 17:35:46 +00:00
logging_send_syslog_msg($1_t)
2005-06-13 17:35:46 +00:00
modutils_domtrans_insmod($1_t)
seutil_read_config($1_t)
# The following rule is temporary until such time that a complete
# policy management infrastructure is in place so that an administrator
# cannot directly manipulate policy files with arbitrary programs.
seutil_manage_src_pol($1_t)
# Violates the goal of limiting write access to checkpolicy.
# But presently necessary for installing the file_contexts file.
seutil_manage_binary_pol($1_t)
optional_policy(`cron.te',`
cron_admin_template($1)
')
ifdef(`TODO',`
# for lsof
allow $1_t mtrr_device_t:file getattr;
2005-07-19 18:40:31 +00:00
allow $1_t eventpollfs_t:file getattr;
2005-07-19 18:40:31 +00:00
allow $1_t serial_device:chr_file setattr;
allow $1_t ptyfile:chr_file getattr;
# Run admin programs that require different permissions in their own domain.
# These rules were moved into the appropriate program domain file.
2005-07-19 18:40:31 +00:00
ifdef(`xserver.te', `
# Create files in /tmp/.X11-unix with our X servers derived
# tmp type rather than user_xserver_tmp_t.
file_type_auto_trans($1_xserver_t, xserver_tmpfile, $1_xserver_tmp_t, sock_file)
')
2005-07-19 18:40:31 +00:00
ifdef(`xdm.te', `
2005-07-19 18:40:31 +00:00
tunable_policy(`xdm_sysadm_login',`
allow xdm_t $1_home_t:lnk_file read;
allow xdm_t $1_home_t:dir search;
')
2005-09-19 21:17:45 +00:00
can_pipe_xdm($1_t)
')
2005-07-19 18:40:31 +00:00
# Connect data port to ftpd.
ifdef(`ftpd.te', `can_tcp_connect(ftpd_t, $1_t)')
# Connect second port to rshd.
ifdef(`rshd.te', `can_tcp_connect(rshd_t, $1_t)')
# Allow MAKEDEV to work
allow $1_t device_t:dir rw_dir_perms;
allow $1_t device_type:{ blk_file chr_file } { create unlink rename };
allow $1_t device_t:lnk_file { create read };
#
# A user who is authorized for sysadm_t may nonetheless have
# a home directory labeled with user_home_t if the user is expected
# to login in either user_t or sysadm_t. Hence, the derived domains
# for programs need to be able to access user_home_t.
#
2005-05-18 13:18:49 +00:00
# Allow our gph domain to write to .xsession-errors.
ifdef(`gnome-pty-helper.te', `
allow $1_gph_t user_home_dir_type:dir rw_dir_perms;
allow $1_gph_t user_home_type:file create_file_perms;
')
2005-05-18 13:18:49 +00:00
2005-07-19 18:40:31 +00:00
# Run programs from staff home directories.
# Not ideal, but typical if users want to login as both sysadm_t or staff_t.
can_exec($1_t, staff_home_t)
2005-09-19 21:17:45 +00:00
tunable_policy(`user_rw_noexattrfile',`
create_dir_file($1_t, noexattrfile)
# Write floppies
storage_raw_read_removable_device($1_t)
storage_raw_write_removable_device($1_t)
# cjp: what does this have to do with removable devices?
allow $1_t usbtty_device_t:chr_file write;
',`
r_dir_file($1_t, noexattrfile)
r_dir_file($1_t, removable_t)
allow $1_t removable_device_t:blk_file r_file_perms;
')
allow $1 removable_t:filesystem getattr;
') dnl endif TODO
2005-05-18 13:18:49 +00:00
')
2005-05-18 21:00:30 +00:00
2005-09-29 20:59:00 +00:00
########################################
## <summary>
## Search user home directories.
## </summary>
## <desc>
## <p>
## Search user home directories.
## </p>
## <p>
## This is a templated interface, and should only
## be called from a per-userdomain template.
## </p>
## </desc>
## <param name="userdomain_prefix">
## The prefix of the user domain (e.g., user
## is the prefix for user_t).
## </param>
## <param name="domain">
2005-11-08 22:00:30 +00:00
## Domain allowed access.
2005-09-29 20:59:00 +00:00
## </param>
#
template(`userdom_search_user_home',`
gen_require(`
2005-10-19 13:11:49 +00:00
type $1_home_dir_t;
2005-09-29 20:59:00 +00:00
')
files_search_home($2)
allow $2 $1_home_dir_t:dir { getattr search };
')
2005-10-25 00:00:50 +00:00
########################################
## <summary>
## Create, read, write, and delete symbolic links
## in a user home subdirectory.
## </summary>
## <desc>
## <p>
## Create, read, write, and delete symbolic links
## in a user home subdirectory.
## </p>
## <p>
## This is a templated interface, and should only
## be called from a per-userdomain template.
## </p>
## </desc>
## <param name="userdomain_prefix">
## The prefix of the user domain (e.g., user
## is the prefix for user_t).
## </param>
## <param name="domain">
2005-11-08 22:00:30 +00:00
## Domain allowed access.
2005-10-25 00:00:50 +00:00
## </param>
#
template(`userdom_manage_user_home_subdirs',`
gen_require(`
type $1_home_dir_t, $1_home_t;
')
files_search_home($2)
allow $2 $1_home_dir_t:dir rw_dir_perms;
allow $2 $1_home_t:dir manage_dir_perms;
')
2005-08-25 20:27:20 +00:00
########################################
## <summary>
## Read user home files.
2005-08-25 20:27:20 +00:00
## </summary>
## <desc>
## <p>
## Read user home files.
2005-08-25 20:27:20 +00:00
## </p>
## <p>
## This is a templated interface, and should only
## be called from a per-userdomain template.
## </p>
## </desc>
## <param name="userdomain_prefix">
## The prefix of the user domain (e.g., user
## is the prefix for user_t).
## </param>
2005-08-25 20:27:20 +00:00
## <param name="domain">
2005-11-08 22:00:30 +00:00
## Domain allowed access.
2005-08-25 20:27:20 +00:00
## </param>
#
template(`userdom_read_user_home_files',`
gen_require(`
2005-10-19 13:11:49 +00:00
type $1_home_dir_t, $1_home_t;
')
files_search_home($2)
allow $2 $1_home_dir_t:dir search;
allow $2 $1_home_t:dir search;
allow $2 $1_home_t:file r_file_perms;
')
########################################
## <summary>
## Execute user home files.
## </summary>
## <desc>
## <p>
## Execute user home files.
## </p>
## <p>
## This is a templated interface, and should only
## be called from a per-userdomain template.
## </p>
## </desc>
2005-08-25 20:27:20 +00:00
## <param name="userdomain_prefix">
## The prefix of the user domain (e.g., user
## is the prefix for user_t).
## </param>
## <param name="domain">
2005-11-08 22:00:30 +00:00
## Domain allowed access.
## </param>
2005-08-25 20:27:20 +00:00
#
template(`userdom_exec_user_home_files',`
gen_require(`
2005-10-19 13:11:49 +00:00
type $1_home_dir_t, $1_home_t;
2005-08-25 20:27:20 +00:00
')
files_search_home($2)
allow $2 $1_home_dir_t:dir search;
allow $2 $1_home_t:dir search;
can_exec($2,$1_home_t)
2005-08-25 20:27:20 +00:00
')
########################################
## <summary>
## Create, read, write, and delete files
## in a user home subdirectory.
## </summary>
## <desc>
## <p>
## Create, read, write, and delete files
## in a user home subdirectory.
## </p>
## <p>
## This is a templated interface, and should only
## be called from a per-userdomain template.
## </p>
## </desc>
## <param name="userdomain_prefix">
## The prefix of the user domain (e.g., user
## is the prefix for user_t).
## </param>
## <param name="domain">
2005-11-08 22:00:30 +00:00
## Domain allowed access.
## </param>
2005-08-25 20:27:20 +00:00
#
template(`userdom_manage_user_home_subdir_files',`
gen_require(`
2005-10-19 13:11:49 +00:00
type $1_home_dir_t, $1_home_t;
2005-08-25 20:27:20 +00:00
')
files_search_home($2)
allow $2 $1_home_dir_t:dir search;
allow $2 $1_home_t:dir rw_dir_perms;
allow $2 $1_home_t:file create_file_perms;
2005-08-25 20:27:20 +00:00
')
########################################
## <summary>
## Create, read, write, and delete symbolic links
## in a user home subdirectory.
## </summary>
## <desc>
## <p>
## Create, read, write, and delete symbolic links
## in a user home subdirectory.
## </p>
## <p>
## This is a templated interface, and should only
## be called from a per-userdomain template.
## </p>
## </desc>
## <param name="userdomain_prefix">
## The prefix of the user domain (e.g., user
## is the prefix for user_t).
## </param>
## <param name="domain">
2005-11-08 22:00:30 +00:00
## Domain allowed access.
## </param>
2005-08-25 20:27:20 +00:00
#
template(`userdom_manage_user_home_subdir_symlinks',`
gen_require(`
2005-10-19 13:11:49 +00:00
type $1_home_dir_t, $1_home_t;
2005-08-25 20:27:20 +00:00
')
files_search_home($2)
allow $2 $1_home_dir_t:dir search;
allow $2 $1_home_t:dir rw_dir_perms;
allow $2 $1_home_t:lnk_file create_lnk_perms;
2005-08-25 20:27:20 +00:00
')
2005-09-14 18:33:53 +00:00
########################################
## <summary>
## Create, read, write, and delete named pipes
## in a user home subdirectory.
## </summary>
## <desc>
## <p>
## Create, read, write, and delete named pipes
## in a user home subdirectory.
## </p>
## <p>
## This is a templated interface, and should only
## be called from a per-userdomain template.
## </p>
## </desc>
## <param name="userdomain_prefix">
## The prefix of the user domain (e.g., user
## is the prefix for user_t).
## </param>
## <param name="domain">
2005-11-08 22:00:30 +00:00
## Domain allowed access.
2005-09-14 18:33:53 +00:00
## </param>
#
template(`userdom_manage_user_home_subdir_pipes',`
gen_require(`
2005-10-19 13:11:49 +00:00
type $1_home_dir_t, $1_home_t;
2005-09-14 18:33:53 +00:00
')
files_search_home($2)
allow $2 $1_home_dir_t:dir search;
allow $2 $1_home_t:dir rw_dir_perms;
allow $2 $1_home_t:fifo_file create_file_perms;
')
########################################
## <summary>
## Create, read, write, and delete named sockets
## in a user home subdirectory.
## </summary>
## <desc>
## <p>
## Create, read, write, and delete named sockets
## in a user home subdirectory.
## </p>
## <p>
## This is a templated interface, and should only
## be called from a per-userdomain template.
## </p>
## </desc>
## <param name="userdomain_prefix">
## The prefix of the user domain (e.g., user
## is the prefix for user_t).
## </param>
## <param name="domain">
2005-11-08 22:00:30 +00:00
## Domain allowed access.
2005-09-14 18:33:53 +00:00
## </param>
#
template(`userdom_manage_user_home_subdir_sockets',`
gen_require(`
2005-10-19 13:11:49 +00:00
type $1_home_dir_t, $1_home_t;
2005-09-14 18:33:53 +00:00
')
files_search_home($2)
allow $2 $1_home_dir_t:dir search;
allow $2 $1_home_t:dir rw_dir_perms;
allow $2 $1_home_t:sock_file create_file_perms;
')
########################################
## <summary>
##
## </summary>
## <desc>
## <p>
## Create, read, write, and delete named sockets
## in a user home subdirectory.
## </p>
## <p>
## This is a templated interface, and should only
## be called from a per-userdomain template.
## </p>
## </desc>
## <param name="userdomain_prefix">
## The prefix of the user domain (e.g., user
## is the prefix for user_t).
## </param>
## <param name="domain">
2005-11-08 22:00:30 +00:00
## Domain allowed access.
2005-09-14 18:33:53 +00:00
## </param>
## <param name="object_class" optional="true">
## The class of the object to be created. If not
## specified, file is used.
## </param>
#
template(`userdom_create_user_home',`
gen_require(`
2005-10-19 13:11:49 +00:00
type $1_home_dir_t, $1_home_t;
2005-09-14 18:33:53 +00:00
')
files_search_home($2)
allow $2 $1_home_dir_t:dir rw_dir_perms;
ifelse(`$3',`',`
type_transition $2 $1_home_dir_t:file $1_home_t;
',`
type_transition $2 $1_home_dir_t:$3 $1_home_t;
')
')
2005-08-25 20:27:20 +00:00
########################################
## <summary>
## Create, read, write, and delete user
## temporary directories.
## </summary>
## <desc>
## <p>
## Create, read, write, and delete user
## temporary directories.
## </p>
## <p>
## This is a templated interface, and should only
## be called from a per-userdomain template.
## </p>
## </desc>
## <param name="userdomain_prefix">
## The prefix of the user domain (e.g., user
## is the prefix for user_t).
## </param>
## <param name="domain">
2005-11-08 22:00:30 +00:00
## Domain allowed access.
## </param>
2005-08-25 20:27:20 +00:00
#
template(`userdom_manage_user_tmp_dirs',`
gen_require(`
2005-10-19 13:11:49 +00:00
type $1_tmp_t;
2005-08-25 20:27:20 +00:00
')
files_search_tmp($2)
allow $2 $1_tmp_t:dir create_dir_perms;
2005-08-25 20:27:20 +00:00
')
########################################
## <summary>
## Create, read, write, and delete user
## temporary files.
## </summary>
## <desc>
## <p>
## Create, read, write, and delete user
## temporary files.
## </p>
## <p>
## This is a templated interface, and should only
## be called from a per-userdomain template.
## </p>
## </desc>
## <param name="userdomain_prefix">
## The prefix of the user domain (e.g., user
## is the prefix for user_t).
## </param>
## <param name="domain">
2005-11-08 22:00:30 +00:00
## Domain allowed access.
## </param>
2005-08-25 20:27:20 +00:00
#
template(`userdom_manage_user_tmp_files',`
gen_require(`
2005-10-19 13:11:49 +00:00
type $1_tmp_t;
2005-08-25 20:27:20 +00:00
')
files_search_tmp($2)
allow $2 $1_tmp_t:dir rw_dir_perms;
allow $2 $1_tmp_t:file create_file_perms;
2005-08-25 20:27:20 +00:00
')
########################################
## <summary>
## Create, read, write, and delete user
## temporary symbolic links.
## </summary>
## <desc>
## <p>
## Create, read, write, and delete user
## temporary symbolic links.
## </p>
## <p>
## This is a templated interface, and should only
## be called from a per-userdomain template.
## </p>
## </desc>
## <param name="userdomain_prefix">
## The prefix of the user domain (e.g., user
## is the prefix for user_t).
## </param>
## <param name="domain">
2005-11-08 22:00:30 +00:00
## Domain allowed access.
## </param>
2005-08-25 20:27:20 +00:00
#
template(`userdom_manage_user_tmp_symlinks',`
gen_require(`
2005-10-19 13:11:49 +00:00
type $1_tmp_t;
2005-08-25 20:27:20 +00:00
')
files_search_tmp($2)
allow $2 $1_tmp_t:dir rw_dir_perms;
allow $2 $1_tmp_t:lnk_file create_lnk_perms;
2005-08-25 20:27:20 +00:00
')
########################################
## <summary>
## Create, read, write, and delete user
## temporary named pipes.
## </summary>
## <desc>
## <p>
## Create, read, write, and delete user
## temporary named pipes.
## </p>
## <p>
## This is a templated interface, and should only
## be called from a per-userdomain template.
## </p>
## </desc>
## <param name="userdomain_prefix">
## The prefix of the user domain (e.g., user
## is the prefix for user_t).
## </param>
## <param name="domain">
2005-11-08 22:00:30 +00:00
## Domain allowed access.
## </param>
2005-08-25 20:27:20 +00:00
#
template(`userdom_manage_user_tmp_pipes',`
gen_require(`
2005-10-19 13:11:49 +00:00
type $1_tmp_t;
2005-08-25 20:27:20 +00:00
')
files_search_tmp($2)
allow $2 $1_tmp_t:dir rw_dir_perms;
allow $2 $1_tmp_t:fifo_file create_file_perms;
2005-08-25 20:27:20 +00:00
')
########################################
## <summary>
## Create, read, write, and delete user
## temporary named sockets.
## </summary>
## <desc>
## <p>
## Create, read, write, and delete user
## temporary named sockets.
## </p>
## <p>
## This is a templated interface, and should only
## be called from a per-userdomain template.
## </p>
## </desc>
## <param name="userdomain_prefix">
## The prefix of the user domain (e.g., user
## is the prefix for user_t).
## </param>
## <param name="domain">
2005-11-08 22:00:30 +00:00
## Domain allowed access.
## </param>
2005-08-25 20:27:20 +00:00
#
template(`userdom_manage_user_tmp_sockets',`
gen_require(`
2005-10-19 13:11:49 +00:00
type $1_tmp_t;
2005-08-25 20:27:20 +00:00
')
files_search_tmp($2)
allow $2 $1_tmp_t:dir rw_dir_perms;
allow $2 $1_tmp_t:sock_file create_file_perms;
2005-08-25 20:27:20 +00:00
')
########################################
## <summary>
## Read and write a user domain tty and pty.
## </summary>
## <desc>
## <p>
## Read and write a user domain tty and pty.
## </p>
## <p>
## This is a templated interface, and should only
## be called from a per-userdomain template.
## </p>
## </desc>
## <param name="userdomain_prefix">
## The prefix of the user domain (e.g., user
## is the prefix for user_t).
## </param>
## <param name="domain">
2005-11-08 22:00:30 +00:00
## Domain allowed access.
## </param>
2005-08-25 20:27:20 +00:00
#
template(`userdom_use_user_terminals',`
2005-10-24 12:38:45 +00:00
ifdef(`targeted_policy',`
term_use_unallocated_tty($2)
term_use_generic_pty($2)
',`
gen_require(`
type $1_tty_device_t, $1_devpts_t;
')
2005-08-25 20:27:20 +00:00
2005-10-24 12:38:45 +00:00
allow $2 $1_tty_device_t:chr_file rw_term_perms;
allow $2 $1_devpts_t:chr_file rw_term_perms;
term_list_ptys($2)
')
2005-08-25 20:27:20 +00:00
')
########################################
2005-06-27 16:30:55 +00:00
## <summary>
2005-06-23 21:30:57 +00:00
## Execute a shell in all user domains. This
## is an explicit transition, requiring the
## caller to use setexeccon().
2005-06-27 16:30:55 +00:00
## </summary>
2005-06-23 21:30:57 +00:00
## <param name="domain">
2005-11-08 22:00:30 +00:00
## Domain allowed access.
2005-06-23 21:30:57 +00:00
## </param>
#
interface(`userdom_spec_domtrans_all_users',`
2005-06-21 17:01:45 +00:00
gen_require(`
attribute userdomain;
')
2005-06-13 17:35:46 +00:00
corecmd_shell_spec_domtrans($1,userdomain)
')
2005-06-21 17:01:45 +00:00
########################################
2005-06-27 16:30:55 +00:00
## <summary>
2005-06-23 21:30:57 +00:00
## Execute a shell in all unprivileged user domains. This
## is an explicit transition, requiring the
## caller to use setexeccon().
2005-06-27 16:30:55 +00:00
## </summary>
2005-06-23 21:30:57 +00:00
## <param name="domain">
2005-11-08 22:00:30 +00:00
## Domain allowed access.
2005-06-23 21:30:57 +00:00
## </param>
2005-06-21 17:01:45 +00:00
#
interface(`userdom_spec_domtrans_unpriv_users',`
2005-06-21 17:01:45 +00:00
gen_require(`
attribute unpriv_userdomain;
')
corecmd_shell_spec_domtrans($1,unpriv_userdomain)
')
2005-05-26 20:38:45 +00:00
########################################
2005-06-27 16:30:55 +00:00
## <summary>
2005-06-23 21:30:57 +00:00
## Execute a shell in the sysadm domain.
2005-06-27 16:30:55 +00:00
## </summary>
2005-06-23 21:30:57 +00:00
## <param name="domain">
2005-11-08 22:00:30 +00:00
## Domain allowed access.
2005-06-23 21:30:57 +00:00
## </param>
2005-05-26 20:38:45 +00:00
#
interface(`userdom_shell_domtrans_sysadm',`
2005-07-06 20:28:29 +00:00
ifdef(`targeted_policy',`
#cjp: need to doublecheck this one
2005-07-08 20:44:57 +00:00
unconfined_shell_domtrans($1)
2005-07-06 20:28:29 +00:00
',`
gen_require(`
type sysadm_t;
')
corecmd_shell_domtrans($1,sysadm_t)
allow $1 sysadm_t:fd use;
allow sysadm_t $1:fd use;
allow sysadm_t $1:fifo_file rw_file_perms;
allow sysadm_t $1:process sigchld;
2005-07-06 20:28:29 +00:00
')
2005-05-26 20:38:45 +00:00
')
########################################
## <summary>
## Search the staff users home directory.
## </summary>
## <param name="domain">
## Domain to not audit.
## </param>
#
interface(`userdom_search_staff_home_dir',`
gen_require(`
type staff_home_dir_t;
')
files_search_home($1)
allow $1 staff_home_dir_t:dir search;
')
########################################
## <summary>
## Do not audit attempts to search the staff
## users home directory.
## </summary>
## <param name="domain">
## Domain to not audit.
## </param>
#
interface(`userdom_dontaudit_search_staff_home_dir',`
gen_require(`
type staff_home_dir_t;
')
dontaudit $1 staff_home_dir_t:dir search;
')
2005-06-30 18:54:08 +00:00
########################################
## <summary>
## Read files in the staff users home directory.
## </summary>
## <param name="domain">
2005-11-08 22:00:30 +00:00
## Domain allowed access.
2005-06-30 18:54:08 +00:00
## </param>
#
interface(`userdom_read_staff_home_files',`
gen_require(`
type staff_home_dir_t, staff_home_t;
')
files_search_home($1)
allow $1 { staff_home_dir_t staff_home_t }:dir r_dir_perms;
allow $1 staff_home_t:{ file lnk_file } r_file_perms;
')
2005-09-27 19:40:44 +00:00
########################################
## <summary>
## Send a SIGCHLD signal to sysadm users.
## </summary>
## <param name="domain">
2005-11-08 22:00:30 +00:00
## Domain allowed access.
2005-09-27 19:40:44 +00:00
## </param>
#
interface(`userdom_sigchld_sysadm',`
ifdef(`targeted_policy',`
unconfined_sigchld($1)
',`
gen_require(`
type sysadm_t;
')
2005-09-27 19:40:44 +00:00
allow $1 sysadm_t:process sigchld;
')
2005-09-27 19:40:44 +00:00
')
2005-11-08 22:00:30 +00:00
########################################
## <summary>
## Do not audit attepts to get the attributes
## of sysadm ttys.
## </summary>
## <param name="domain">
## Domain allowed access.
## </param>
#
interface(`userdom_dontaudit_getattr_sysadm_tty',`
ifdef(`targeted_policy',`
term_dontaudit_getattr_unallocated_ttys($1)
',`
gen_require(`
type sysadm_tty_device_t;
')
dontaudit $1 sysadm_tty_device_t:chr_file getattr;
')
')
########################################
2005-06-27 16:30:55 +00:00
## <summary>
2005-06-23 21:30:57 +00:00
## Read and write sysadm ttys.
2005-06-27 16:30:55 +00:00
## </summary>
2005-06-23 21:30:57 +00:00
## <param name="domain">
2005-11-08 22:00:30 +00:00
## Domain allowed access.
2005-06-23 21:30:57 +00:00
## </param>
2005-05-18 21:00:30 +00:00
#
interface(`userdom_use_sysadm_tty',`
2005-07-06 20:28:29 +00:00
ifdef(`targeted_policy',`
term_use_unallocated_tty($1)
',`
gen_require(`
type sysadm_tty_device_t;
')
2005-06-30 18:54:08 +00:00
2005-07-06 20:28:29 +00:00
dev_list_all_dev_nodes($1)
term_list_ptys($1)
allow $1 sysadm_tty_device_t:chr_file rw_term_perms;
')
2005-06-30 18:54:08 +00:00
')
2005-07-15 20:45:26 +00:00
########################################
## <summary>
## Do not audit attempts to use sysadm ttys.
## </summary>
## <param name="domain">
## Domain to not audit.
## </param>
#
interface(`userdom_dontaudit_use_sysadm_tty',`
ifdef(`targeted_policy',`
term_dontaudit_use_unallocated_tty($1)
',`
gen_require(`
2005-09-15 21:03:29 +00:00
type sysadm_tty_device_t;
2005-07-15 20:45:26 +00:00
')
dontaudit $1 sysadm_tty_device_t:chr_file { read write };
')
')
2005-06-30 18:54:08 +00:00
########################################
## <summary>
## Read and write sysadm ptys.
## </summary>
## <param name="domain">
2005-11-08 22:00:30 +00:00
## Domain allowed access.
2005-06-30 18:54:08 +00:00
## </param>
#
interface(`userdom_use_sysadm_pty',`
2005-07-06 20:28:29 +00:00
ifdef(`targeted_policy',`
term_use_generic_pty($1)
',`
gen_require(`
type sysadm_devpts_t;
')
2005-07-06 20:28:29 +00:00
dev_list_all_dev_nodes($1)
term_list_ptys($1)
allow $1 sysadm_devpts_t:chr_file rw_term_perms;
')
')
2005-10-07 21:45:04 +00:00
########################################
## <summary>
## Dont audit attempts to read and write sysadm ptys.
## </summary>
## <param name="domain">
## Domain to not audit.
## </param>
#
interface(`userdom_dontaudit_use_sysadm_pty',`
ifdef(`targeted_policy',`
term_dontaudit_use_generic_pty($1)
',`
gen_require(`
type sysadm_devpts_t;
')
dontaudit $1 sysadm_devpts_t:chr_file { read write };
')
')
2005-06-21 21:07:46 +00:00
########################################
2005-06-27 16:30:55 +00:00
## <summary>
2005-06-23 21:30:57 +00:00
## Read and write sysadm ttys and ptys.
2005-06-27 16:30:55 +00:00
## </summary>
2005-06-23 21:30:57 +00:00
## <param name="domain">
2005-11-08 22:00:30 +00:00
## Domain allowed access.
2005-06-23 21:30:57 +00:00
## </param>
2005-06-21 21:07:46 +00:00
#
interface(`userdom_use_sysadm_terms',`
2005-07-06 20:28:29 +00:00
userdom_use_sysadm_tty($1)
userdom_use_sysadm_pty($1)
')
2005-06-08 13:12:00 +00:00
########################################
2005-06-27 16:30:55 +00:00
## <summary>
2005-07-15 20:45:26 +00:00
## Do not audit attempts to use sysadm ttys and ptys.
2005-06-27 16:30:55 +00:00
## </summary>
2005-06-23 21:30:57 +00:00
## <param name="domain">
2005-07-15 20:45:26 +00:00
## Domain to not audit.
2005-06-23 21:30:57 +00:00
## </param>
2005-06-08 13:12:00 +00:00
#
interface(`userdom_dontaudit_use_sysadm_terms',`
2005-07-06 20:28:29 +00:00
ifdef(`targeted_policy',`
term_dontaudit_use_generic_pty($1)
',`
gen_require(`
attribute admin_terminal;
')
2005-06-08 13:12:00 +00:00
2005-07-06 20:28:29 +00:00
dontaudit $1 admin_terminal:chr_file { read write };
')
2005-06-08 13:12:00 +00:00
')
2005-06-30 18:54:08 +00:00
########################################
## <summary>
## Inherit and use sysadm file descriptors
## </summary>
## <param name="domain">
2005-11-08 22:00:30 +00:00
## Domain allowed access.
2005-06-30 18:54:08 +00:00
## </param>
#
interface(`userdom_use_sysadm_fd',`
2005-07-06 20:28:29 +00:00
ifdef(`targeted_policy',`
#cjp: need to doublecheck this one
unconfined_use_fd($1)
',`
gen_require(`
type sysadm_t;
')
2005-06-30 18:54:08 +00:00
2005-07-06 20:28:29 +00:00
allow $1 sysadm_t:fd use;
')
2005-06-30 18:54:08 +00:00
')
########################################
## <summary>
## Read and write sysadm user unnamed pipes.
## </summary>
## <param name="domain">
2005-11-08 22:00:30 +00:00
## Domain allowed access.
2005-06-30 18:54:08 +00:00
## </param>
#
interface(`userdom_rw_sysadm_pipe',`
2005-07-06 20:28:29 +00:00
ifdef(`targeted_policy',`
#cjp: need to doublecheck this one
unconfined_rw_pipe($1)
',`
gen_require(`
type sysadm_t;
')
2005-06-30 18:54:08 +00:00
2005-07-06 20:28:29 +00:00
allow $1 sysadm_t:fifo_file rw_file_perms;
')
2005-06-30 18:54:08 +00:00
')
2005-10-11 15:36:53 +00:00
########################################
## <summary>
## Get the attributes of the sysadm users
## home directory.
## </summary>
## <param name="domain">
## Domain allowed access.
2005-10-11 15:36:53 +00:00
## </param>
#
interface(`userdom_getattr_sysadm_home_dir',`
gen_require(`
type sysadm_home_dir_t;
')
allow $1 sysadm_home_dir_t:dir getattr;
')
########################################
## <summary>
## Do not audit attempts to get the
## attributes of the sysadm users
## home directory.
## </summary>
## <param name="domain">
## Domain to not audit.
## </param>
#
interface(`userdom_dontaudit_getattr_sysadm_home_dir',`
gen_require(`
type sysadm_home_dir_t;
')
dontaudit $1 sysadm_home_dir_t:dir getattr;
')
########################################
## <summary>
## Search the sysadm users home directory.
## </summary>
## <param name="domain">
## Domain to not audit.
## </param>
#
interface(`userdom_search_sysadm_home_dir',`
gen_require(`
type sysadm_home_dir_t;
')
allow $1 sysadm_home_dir_t:dir search;
')
########################################
## <summary>
## Do not audit attempts to search the sysadm
## users home directory.
## </summary>
## <param name="domain">
## Domain to not audit.
## </param>
#
interface(`userdom_dontaudit_search_sysadm_home_dir',`
gen_require(`
type sysadm_home_dir_t;
')
2005-10-22 23:50:23 +00:00
dontaudit $1 sysadm_home_dir_t:dir search_dir_perms;
')
2005-11-08 22:00:30 +00:00
########################################
## <summary>
## List the sysadm users home directory.
## </summary>
## <param name="domain">
## Domain allowed access.
## </param>
#
interface(`userdom_list_sysadm_home_dir',`
gen_require(`
type sysadm_home_dir_t;
')
allow $1 sysadm_home_dir_t:dir list_dir_perms;
')
2005-09-05 16:47:19 +00:00
########################################
## <summary>
## Do not audit attempts to list the sysadm
## users home directory.
## </summary>
## <param name="domain">
## Domain to not audit.
## </param>
#
interface(`userdom_dontaudit_list_sysadm_home_dir',`
gen_require(`
type sysadm_home_dir_t;
')
2005-11-08 22:00:30 +00:00
dontaudit $1 sysadm_home_dir_t:dir list_dir_perms;
2005-09-05 16:47:19 +00:00
')
2005-10-22 19:58:58 +00:00
########################################
## <summary>
## Create objects in sysadm home directories
## with automatic file type transition.
## </summary>
## <param name="domain">
## Domain allowed access.
## </param>
## <param name="object_class" optional="true">
## The class of the object to be created.
## If not specified, file is used.
## </param>
#
interface(`userdom_create_sysadm_home',`
2005-10-22 20:06:51 +00:00
gen_require(`
type sysadm_home_dir_t, sysadm_home_t;
')
2005-10-22 19:58:58 +00:00
2005-10-22 20:06:51 +00:00
allow $1 sysadm_home_dir_t:dir rw_dir_perms;
ifelse(`$2',`',`
ifelse(`$3',`',`
type_transition $1 sysadm_home_dir_t:file sysadm_home_t;
2005-10-22 19:58:58 +00:00
',`
2005-10-22 20:06:51 +00:00
type_transition $1 sysadm_home_dir_t:$3 sysadm_home_t;
2005-10-22 19:58:58 +00:00
')
',`
2005-10-22 20:06:51 +00:00
ifelse(`$3',`',`
type_transition $1 sysadm_home_dir_t:file $2;
2005-10-22 19:58:58 +00:00
',`
2005-10-22 20:06:51 +00:00
type_transition $1 sysadm_home_dir_t:$3 $2;
2005-10-22 19:58:58 +00:00
')
')
')
########################################
## <summary>
## Search the sysadm users home sub directories.
## </summary>
## <param name="domain">
## Domain to not audit.
## </param>
#
interface(`userdom_search_sysadm_home_subdirs',`
2005-10-22 20:06:51 +00:00
gen_require(`
type sysadm_home_dir_t, sysadm_home_t;
2005-10-22 19:58:58 +00:00
')
2005-10-22 20:06:51 +00:00
allow $1 { sysadm_home_dir_t sysadm_home_t }:dir search_dir_perms;
2005-10-22 19:58:58 +00:00
')
2005-06-30 18:54:08 +00:00
########################################
## <summary>
## Read files in the sysadm users home directory.
## </summary>
## <param name="domain">
2005-11-08 22:00:30 +00:00
## Domain allowed access.
2005-06-30 18:54:08 +00:00
## </param>
#
interface(`userdom_read_sysadm_home_files',`
gen_require(`
type sysadm_home_dir_t, sysadm_home_t;
')
files_search_home($1)
allow $1 { sysadm_home_dir_t sysadm_home_t }:dir r_dir_perms;
allow $1 sysadm_home_t:{ file lnk_file } r_file_perms;
')
########################################
2005-06-27 16:30:55 +00:00
## <summary>
2005-06-23 21:30:57 +00:00
## Search all users home directories.
2005-06-27 16:30:55 +00:00
## </summary>
2005-06-23 21:30:57 +00:00
## <param name="domain">
2005-11-08 22:00:30 +00:00
## Domain allowed access.
2005-06-23 21:30:57 +00:00
## </param>
#
interface(`userdom_search_all_users_home',`
2005-06-21 21:07:46 +00:00
gen_require(`
attribute home_dir_type, home_type;
')
2005-06-13 17:35:46 +00:00
files_list_home($1)
allow $1 { home_dir_type home_type }:dir search;
')
########################################
## <summary>
## Do not audit attempts to search all users home directories.
## </summary>
## <param name="domain">
## Domain to not audit.
## </param>
#
interface(`userdom_dontaudit_search_all_users_home',`
gen_require(`
attribute home_dir_type, home_type;
')
2005-10-21 21:35:25 +00:00
dontaudit $1 { home_dir_type home_type }:dir search_dir_perms;
')
########################################
2005-06-27 16:30:55 +00:00
## <summary>
2005-06-23 21:30:57 +00:00
## Read all files in all users home directories.
2005-06-27 16:30:55 +00:00
## </summary>
2005-06-23 21:30:57 +00:00
## <param name="domain">
2005-11-08 22:00:30 +00:00
## Domain allowed access.
2005-06-23 21:30:57 +00:00
## </param>
#
2005-06-30 18:54:08 +00:00
interface(`userdom_read_all_user_files',`
2005-06-21 21:07:46 +00:00
gen_require(`
attribute home_type;
')
2005-06-13 17:35:46 +00:00
files_list_home($1)
2005-06-09 18:08:26 +00:00
allow $1 home_type:dir r_dir_perms;
2005-06-10 01:01:13 +00:00
allow $1 home_type:file r_file_perms;
')
2005-10-05 19:52:53 +00:00
########################################
## <summary>
## Create, read, write, and delete all directories
## in all users home directories.
## </summary>
## <param name="domain">
2005-11-08 22:00:30 +00:00
## Domain allowed access.
2005-10-05 19:52:53 +00:00
## </param>
#
interface(`userdom_manage_all_user_dirs',`
gen_require(`
attribute home_type;
')
files_list_home($1)
allow $1 home_type:dir create_dir_perms;
')
########################################
## <summary>
## Create, read, write, and delete all files
## in all users home directories.
## </summary>
## <param name="domain">
2005-11-08 22:00:30 +00:00
## Domain allowed access.
2005-10-05 19:52:53 +00:00
## </param>
#
interface(`userdom_manage_all_user_files',`
gen_require(`
attribute home_type;
')
files_list_home($1)
allow $1 home_type:dir rw_dir_perms;
allow $1 home_type:file create_file_perms;
')
########################################
## <summary>
## Create, read, write, and delete all symlinks
## in all users home directories.
## </summary>
## <param name="domain">
2005-11-08 22:00:30 +00:00
## Domain allowed access.
2005-10-05 19:52:53 +00:00
## </param>
#
interface(`userdom_manage_all_user_symlinks',`
gen_require(`
attribute home_type;
')
files_list_home($1)
allow $1 home_type:dir rw_dir_perms;
allow $1 home_type:lnk_file create_lnk_perms;
')
2005-10-25 17:50:00 +00:00
########################################
## <summary>
## Make the specified domain a privileged
## home directory manager.
## </summary>
## <desc>
## <p>
## Make the specified domain a privileged
## home directory manager. This domain will be
## able to manage the contents of all users
## general home directory content, and create
## files with the correct context.
## </p>
## </desc>
## <param name="domain">
2005-11-08 22:00:30 +00:00
## Domain allowed access.
2005-10-25 17:50:00 +00:00
## </param>
#
interface(`userdom_priveleged_home_dir_manager',`
gen_require(`
attribute privhome;
')
files_list_home($1)
typeattribute $1 privhome;
')
########################################
2005-06-27 16:30:55 +00:00
## <summary>
2005-08-17 14:14:07 +00:00
## Send general signals to unprivileged user domains.
2005-06-27 16:30:55 +00:00
## </summary>
## <param name="domain">
2005-11-08 22:00:30 +00:00
## Domain allowed access.
2005-06-27 16:30:55 +00:00
## </param>
#
2005-08-17 14:14:07 +00:00
interface(`userdom_signal_unpriv_users',`
2005-06-27 16:30:55 +00:00
gen_require(`
2005-08-17 14:14:07 +00:00
attribute unpriv_userdomain;
2005-06-27 16:30:55 +00:00
')
2005-08-17 14:14:07 +00:00
allow $1 unpriv_userdomain:process signal;
2005-06-27 16:30:55 +00:00
')
########################################
## <summary>
2005-08-17 14:14:07 +00:00
## Inherit the file descriptors from unprivileged user domains.
2005-06-27 16:30:55 +00:00
## </summary>
2005-06-23 21:30:57 +00:00
## <param name="domain">
2005-11-08 22:00:30 +00:00
## Domain allowed access.
2005-06-23 21:30:57 +00:00
## </param>
2005-05-18 21:00:30 +00:00
#
2005-08-17 14:14:07 +00:00
interface(`userdom_use_unpriv_users_fd',`
2005-06-21 21:07:46 +00:00
gen_require(`
2005-08-17 14:14:07 +00:00
attribute unpriv_userdomain;
2005-06-21 21:07:46 +00:00
')
2005-08-17 14:14:07 +00:00
allow $1 unpriv_userdomain:fd use;
2005-05-18 21:00:30 +00:00
')
########################################
2005-06-27 16:30:55 +00:00
## <summary>
2005-08-17 14:14:07 +00:00
## Do not audit attempts to inherit the
## file descriptors from all user domains.
2005-06-27 16:30:55 +00:00
## </summary>
2005-06-23 21:30:57 +00:00
## <param name="domain">
2005-11-08 22:00:30 +00:00
## Domain allowed access.
2005-06-23 21:30:57 +00:00
## </param>
#
2005-08-17 14:14:07 +00:00
interface(`userdom_dontaudit_use_unpriv_user_fd',`
2005-06-21 21:07:46 +00:00
gen_require(`
2005-08-17 14:14:07 +00:00
attribute unpriv_userdomain;
2005-06-21 21:07:46 +00:00
')
2005-08-17 14:14:07 +00:00
dontaudit $1 unpriv_userdomain:fd use;
')
2005-06-21 21:07:46 +00:00
########################################
2005-06-27 16:30:55 +00:00
## <summary>
2005-08-17 14:14:07 +00:00
## Create generic user home directories
## with automatic file type transition.
2005-06-27 16:30:55 +00:00
## </summary>
2005-06-23 21:30:57 +00:00
## <param name="domain">
2005-08-17 14:14:07 +00:00
## Domain allowed access.
2005-06-23 21:30:57 +00:00
## </param>
2005-06-21 21:07:46 +00:00
#
2005-10-24 21:33:46 +00:00
interface(`userdom_create_generic_user_home_dir',`
2005-06-21 21:07:46 +00:00
gen_require(`
2005-08-17 14:14:07 +00:00
type user_home_dir_t;
2005-06-21 21:07:46 +00:00
')
2005-08-17 14:14:07 +00:00
files_create_home_dirs($1,user_home_dir_t)
')
2005-10-26 21:03:19 +00:00
########################################
## <summary>
## Search generic user home directories.
## </summary>
## <param name="domain">
## Domain allowed access.
## </param>
#
interface(`userdom_search_generic_user_home_dir',`
gen_require(`
type user_home_dir_t;
')
allow $1 user_home_dir_t:dir search_dir_perms;
')
########################################
2005-06-27 16:30:55 +00:00
## <summary>
2005-08-17 14:14:07 +00:00
## Create, read, write, and delete
## generic user home directories.
2005-06-27 16:30:55 +00:00
## </summary>
2005-06-23 21:30:57 +00:00
## <param name="domain">
2005-08-17 14:14:07 +00:00
## Domain allowed access.
2005-06-23 21:30:57 +00:00
## </param>
#
2005-10-24 21:33:46 +00:00
interface(`userdom_manage_generic_user_home_dir',`
2005-06-21 21:07:46 +00:00
gen_require(`
2005-08-17 14:14:07 +00:00
type user_home_dir_t;
2005-06-21 21:07:46 +00:00
')
2005-08-17 14:14:07 +00:00
allow $1 user_home_dir_t:dir create_dir_perms;
')
########################################
2005-06-27 16:30:55 +00:00
## <summary>
2005-08-17 14:14:07 +00:00
## Create objects in generic user home directories
## with automatic file type transition.
## </summary>
## <param name="domain">
## Domain allowed access.
## </param>
## <param name="object_class" optional="true">
## The class of the object to be created.
## If not specified, file is used.
## </param>
#
2005-10-24 21:33:46 +00:00
interface(`userdom_create_generic_user_home',`
2005-08-17 14:14:07 +00:00
gen_require(`
type user_home_dir_t, user_home_t;
')
2005-09-29 20:59:00 +00:00
allow $1 user_home_dir_t:dir rw_dir_perms;
2005-08-17 14:14:07 +00:00
ifelse(`$2',`',`
type_transition $1 user_home_dir_t:file user_home_t;
',`
type_transition $1 user_home_dir_t:$2 user_home_t;
')
')
2005-10-07 21:45:04 +00:00
########################################
## <summary>
## Don't audit search on the user home subdirectory.
## </summary>
## <param name="domain">
## Domain allowed access.
## </param>
#
interface(`userdom_dontaudit_search_user_home_dirs',`
gen_require(`
type user_home_t;
')
dontaudit $1 user_home_t:dir search;
')
2005-08-17 14:14:07 +00:00
########################################
## <summary>
## Create, read, write, and delete
## subdirectories of generic user
## home directories.
## </summary>
## <param name="domain">
## Domain allowed access.
## </param>
#
2005-10-24 21:33:46 +00:00
interface(`userdom_manage_generic_user_home_dirs',`
2005-08-17 14:14:07 +00:00
gen_require(`
type user_home_t;
')
allow $1 user_home_t:dir create_dir_perms;
')
########################################
## <summary>
## Create, read, write, and delete files
## in generic user home directories.
## </summary>
## <param name="domain">
## Domain allowed access.
## </param>
#
2005-10-24 21:33:46 +00:00
interface(`userdom_manage_generic_user_home_files',`
2005-08-17 14:14:07 +00:00
gen_require(`
type user_home_t;
')
allow $1 user_home_t:dir rw_dir_perms;
allow $1 user_home_t:file create_file_perms;
')
########################################
## <summary>
## Create, read, write, and delete symbolic
## links in generic user home directories.
## </summary>
## <param name="domain">
## Domain allowed access.
## </param>
#
2005-10-24 21:33:46 +00:00
interface(`userdom_manage_generic_user_home_symlinks',`
2005-08-17 14:14:07 +00:00
gen_require(`
type user_home_t;
')
allow $1 user_home_t:dir rw_dir_perms;
allow $1 user_home_t:lnk_file create_lnk_perms;
')
########################################
## <summary>
## Create, read, write, and delete named
## pipes in generic user home directories.
## </summary>
## <param name="domain">
## Domain allowed access.
## </param>
#
2005-10-24 21:33:46 +00:00
interface(`userdom_manage_generic_user_home_pipes',`
2005-08-17 14:14:07 +00:00
gen_require(`
type user_home_t;
')
allow $1 user_home_t:dir rw_dir_perms;
allow $1 user_home_t:fifo_file create_file_perms;
')
########################################
## <summary>
## Create, read, write, and delete named
## sockets in generic user home directories.
## </summary>
## <param name="domain">
## Domain allowed access.
## </param>
#
2005-10-24 21:33:46 +00:00
interface(`userdom_manage_generic_user_home_sockets',`
2005-08-17 14:14:07 +00:00
gen_require(`
type user_home_t;
')
allow $1 user_home_t:dir rw_dir_perms;
allow $1 user_home_t:sock_file create_file_perms;
')
2005-10-14 20:00:07 +00:00
########################################
## <summary>
## Search all unprivileged users home directories.
## </summary>
## <param name="domain">
## Domain allowed access.
## </param>
#
interface(`userdom_search_unpriv_user_home_dirs',`
gen_require(`
attribute user_home_dir_type;
')
2005-10-22 23:50:23 +00:00
files_search_home($1)
allow $1 user_home_dir_type:dir search_dir_perms;
2005-10-14 20:00:07 +00:00
')
2005-10-07 21:45:04 +00:00
########################################
## <summary>
## Read all unprivileged users home directory
## files.
## </summary>
## <param name="domain">
## Domain allowed access.
## </param>
#
interface(`userdom_read_unpriv_user_home_files',`
gen_require(`
2005-10-19 13:11:49 +00:00
attribute user_home_dir_type, user_home_type;
2005-10-07 21:45:04 +00:00
')
allow $1 user_home_dir_type:dir search;
allow $1 user_home_type:file r_file_perms;
')
2005-10-24 01:53:13 +00:00
########################################
## <summary>
2005-11-08 22:00:30 +00:00
## Set the attributes of user ptys.
2005-10-24 01:53:13 +00:00
## </summary>
## <param name="domain">
## Domain allowed access.
## </param>
#
2005-11-08 22:00:30 +00:00
interface(`userdom_setattr_unpriv_user_pty',`
2005-10-24 01:53:13 +00:00
gen_require(`
2005-11-08 22:00:30 +00:00
attribute user_ptynode;
2005-10-24 01:53:13 +00:00
')
2005-11-08 22:00:30 +00:00
allow $1 user_ptynode:chr_file setattr;
')
########################################
## <summary>
## Read all unprivileged users temporary directories.
## </summary>
## <param name="domain">
## Domain allowed access.
## </param>
#
interface(`userdom_list_unpriv_user_tmp',`
ifdef(`targeted_policy',`
files_list_tmp($1)
',`
gen_require(`
attribute user_tmpfile;
')
allow $1 user_tmpfile:dir list_dir_perms;
')
2005-10-24 01:53:13 +00:00
')
########################################
## <summary>
## Read all unprivileged users temporary files.
## </summary>
## <param name="domain">
## Domain allowed access.
## </param>
#
interface(`userdom_read_unpriv_user_tmp_files',`
2005-11-08 22:00:30 +00:00
ifdef(`targeted_policy',`
files_read_generic_tmp_files($1)
',`
gen_require(`
attribute user_tmpfile;
')
2005-10-24 01:53:13 +00:00
2005-11-08 22:00:30 +00:00
allow $1 user_tmpfile:file { read getattr };
')
2005-10-24 01:53:13 +00:00
')
########################################
## <summary>
## Read all unprivileged users temporary symbolic links.
## </summary>
## <param name="domain">
## Domain allowed access.
## </param>
#
interface(`userdom_read_unpriv_user_tmp_symlinks',`
2005-11-08 22:00:30 +00:00
ifdef(`targeted_policy',`
files_read_generic_tmp_symlinks($1)
',`
gen_require(`
attribute user_tmpfile;
')
2005-10-24 01:53:13 +00:00
2005-11-08 22:00:30 +00:00
allow $1 user_tmpfile:lnk_file { getattr read };
')
2005-10-24 01:53:13 +00:00
')
2005-08-17 14:14:07 +00:00
########################################
## <summary>
## Write all unprivileged users files in /tmp
2005-06-27 16:30:55 +00:00
## </summary>
2005-06-23 21:30:57 +00:00
## <param name="domain">
2005-11-08 22:00:30 +00:00
## Domain allowed access.
2005-06-23 21:30:57 +00:00
## </param>
#
2005-08-17 14:14:07 +00:00
interface(`userdom_write_unpriv_user_tmp',`
2005-06-21 21:07:46 +00:00
gen_require(`
2005-08-17 14:14:07 +00:00
attribute user_tmpfile;
2005-06-21 21:07:46 +00:00
')
2005-08-17 14:14:07 +00:00
allow $1 user_tmpfile:file { getattr write append };
')
2005-06-29 20:53:53 +00:00
########################################
## <summary>
## Do not audit attempts to use unprivileged
## user ttys.
## </summary>
## <param name="domain">
2005-11-08 22:00:30 +00:00
## Domain allowed access.
2005-06-29 20:53:53 +00:00
## </param>
#
interface(`userdom_dontaudit_use_unpriv_user_tty',`
gen_require(`
attribute user_ttynode;
')
dontaudit $1 user_ttynode:chr_file rw_file_perms;
')
2005-07-06 20:28:29 +00:00
2005-08-17 14:14:07 +00:00
########################################
## <summary>
## Inherit the file descriptors from all user domains
## </summary>
## <param name="domain">
2005-11-08 22:00:30 +00:00
## Domain allowed access.
2005-08-17 14:14:07 +00:00
## </param>
#
interface(`userdom_use_all_user_fd',`
gen_require(`
attribute userdomain;
')
allow $1 userdomain:fd use;
')
########################################
2005-09-08 17:12:38 +00:00
## <summary>
## Do not audit attempts to inherit the file
## descriptors from any user domains.
## </summary>
## <param name="domain">
## Domain to not audit.
## </param>
#
interface(`userdom_dontaudit_use_all_user_fd',`
gen_require(`
attribute userdomain;
')
dontaudit $1 userdomain:fd use;
')
########################################
2005-08-17 14:14:07 +00:00
## <summary>
## Send general signals to all user domains.
## </summary>
## <param name="domain">
2005-11-08 22:00:30 +00:00
## Domain allowed access.
2005-08-17 14:14:07 +00:00
## </param>
#
interface(`userdom_signal_all_users',`
gen_require(`
attribute userdomain;
')
allow $1 userdomain:process signal;
')
2005-08-30 20:47:41 +00:00
########################################
## <summary>
## Send a SIGCHLD signal to all user domains.
## </summary>
## <param name="domain">
## Domain allowed access.
## </param>
#
interface(`userdom_sigcld_all_users',`
gen_require(`
attribute userdomain;
')
2005-09-19 21:17:45 +00:00
allow $1 userdomain:process sigchld;
2005-08-30 20:47:41 +00:00
')
2005-07-06 20:28:29 +00:00
########################################
## <summary>
## Unconfined access to user domains.
## </summary>
## <param name="domain">
## Domain allowed access.
## </param>
#
interface(`userdom_unconfined',`
gen_require(`
type user_home_dir_t;
')
allow $1 user_home_dir_t:dir create_dir_perms;
files_create_home_dirs($1,user_home_dir_t)
')