|
Chris PeBenito |
490639 |
## <summary>Policy for user domains</summary>
|
|
Chris PeBenito |
b16c6b |
|
|
Chris PeBenito |
8fd367 |
#######################################
|
|
Chris PeBenito |
8fd367 |
## <summary>
|
|
Chris PeBenito |
8fd367 |
## The template containing rules common to unprivileged
|
|
Chris PeBenito |
8fd367 |
## users and administrative users.
|
|
Chris PeBenito |
8fd367 |
## </summary>
|
|
Chris PeBenito |
8fd367 |
## <desc>
|
|
Chris PeBenito |
8fd367 |
##
|
|
Chris PeBenito |
8fd367 |
## This template creates a user domain, types, and
|
|
Chris PeBenito |
8fd367 |
## rules for the user's tty, pty, home directories,
|
|
Chris PeBenito |
8fd367 |
## tmp, and tmpfs files.
|
|
Chris PeBenito |
8fd367 |
##
|
|
Chris PeBenito |
8fd367 |
##
|
|
Chris PeBenito |
8fd367 |
## This generally should not be used, rather the
|
|
Chris PeBenito |
8fd367 |
## unpriv_user_template or admin_user_template should
|
|
Chris PeBenito |
8fd367 |
## be used.
|
|
Chris PeBenito |
8fd367 |
##
|
|
Chris PeBenito |
8fd367 |
## </desc>
|
|
Chris PeBenito |
8fd367 |
## <param name="userdomain_prefix">
|
|
Chris PeBenito |
8fd367 |
## The prefix of the user domain (e.g., user
|
|
Chris PeBenito |
8fd367 |
## is the prefix for user_t).
|
|
Chris PeBenito |
8fd367 |
## </param>
|
|
Chris PeBenito |
b16c6b |
#
|
|
Chris PeBenito |
8fd367 |
template(`base_user_template',`
|
|
Chris PeBenito |
b16c6b |
|
|
Chris PeBenito |
0c73cd |
attribute $1_file_type;
|
|
Chris PeBenito |
0c73cd |
|
|
Chris PeBenito |
0c73cd |
type $1_t, userdomain;
|
|
Chris PeBenito |
c9428d |
domain_type($1_t)
|
|
Chris PeBenito |
c9428d |
corecmd_shell_entry_type($1_t)
|
|
Chris PeBenito |
0c73cd |
role $1_r types $1_t;
|
|
Chris PeBenito |
0c73cd |
allow system_r $1_r;
|
|
Chris PeBenito |
0c73cd |
|
|
Chris PeBenito |
0c73cd |
# user pseudoterminal
|
|
Chris PeBenito |
0c73cd |
type $1_devpts_t;
|
|
Chris PeBenito |
0fd9dc |
term_user_pty($1_t,$1_devpts_t)
|
|
Chris PeBenito |
0c73cd |
|
|
Chris PeBenito |
0c73cd |
# type for contents of home directory
|
|
Chris PeBenito |
0c73cd |
type $1_home_t, $1_file_type, home_type;
|
|
Chris PeBenito |
8fd367 |
files_type($1_home_t)
|
|
Chris PeBenito |
0c73cd |
|
|
Chris PeBenito |
0c73cd |
# type of home directory
|
|
Chris PeBenito |
0c73cd |
type $1_home_dir_t, home_dir_type, home_type;
|
|
Chris PeBenito |
8fd367 |
files_type($1_home_t)
|
|
Chris PeBenito |
0c73cd |
|
|
Chris PeBenito |
0c73cd |
type $1_tmp_t, $1_file_type;
|
|
Chris PeBenito |
c9428d |
files_tmp_file($1_tmp_t)
|
|
Chris PeBenito |
0c73cd |
|
|
Chris PeBenito |
0c73cd |
type $1_tmpfs_t;
|
|
Chris PeBenito |
c9428d |
files_tmpfs_file($1_tmpfs_t)
|
|
Chris PeBenito |
0c73cd |
|
|
Chris PeBenito |
0c73cd |
type $1_tty_device_t;
|
|
Chris PeBenito |
0fd9dc |
term_tty($1_t,$1_tty_device_t)
|
|
Chris PeBenito |
0c73cd |
|
|
Chris PeBenito |
0c73cd |
##############################
|
|
Chris PeBenito |
0c73cd |
#
|
|
Chris PeBenito |
0c73cd |
# Local policy
|
|
Chris PeBenito |
0c73cd |
#
|
|
Chris PeBenito |
0c73cd |
|
|
Chris PeBenito |
0c73cd |
allow $1_t self:capability { setgid chown fowner };
|
|
Chris PeBenito |
0c73cd |
dontaudit $1_t self:capability { sys_nice fsetid };
|
|
Chris PeBenito |
0c73cd |
allow $1_t self:process ~{ ptrace setcurrent setexec setfscreate setrlimit execmem dyntransition };
|
|
Chris PeBenito |
0c73cd |
allow $1_t self:process { ptrace setfscreate };
|
|
Chris PeBenito |
0c73cd |
allow $1_t self:fd use;
|
|
Chris PeBenito |
cc41a9 |
allow $1_t self:fifo_file rw_file_perms;
|
|
Chris PeBenito |
cc41a9 |
allow $1_t self:unix_dgram_socket create_socket_perms;
|
|
Chris PeBenito |
0fd9dc |
allow $1_t self:unix_stream_socket create_stream_socket_perms;
|
|
Chris PeBenito |
0c73cd |
allow $1_t self:unix_dgram_socket sendto;
|
|
Chris PeBenito |
0c73cd |
allow $1_t self:unix_stream_socket connectto;
|
|
Chris PeBenito |
cc41a9 |
allow $1_t self:shm create_shm_perms;
|
|
Chris PeBenito |
cc41a9 |
allow $1_t self:sem create_sem_perms;
|
|
Chris PeBenito |
cc41a9 |
allow $1_t self:msgq create_msgq_perms;
|
|
Chris PeBenito |
0c73cd |
allow $1_t self:msg { send receive };
|
|
Chris PeBenito |
0c73cd |
dontaudit $1_t self:socket create;
|
|
Chris PeBenito |
0c73cd |
# Irrelevant until we have labeled networking.
|
|
Chris PeBenito |
0c73cd |
#allow $1_t self:udp_socket { sendto recvfrom };
|
|
Chris PeBenito |
0c73cd |
|
|
Chris PeBenito |
0c73cd |
# evolution and gnome-session try to create a netlink socket
|
|
Chris PeBenito |
0c73cd |
dontaudit $1_t self:netlink_socket { create ioctl read getattr write setattr append bind connect getopt setopt shutdown };
|
|
Chris PeBenito |
0c73cd |
dontaudit $1_t self:netlink_route_socket { create ioctl read getattr write setattr append bind connect getopt setopt shutdown nlmsg_read nlmsg_write };
|
|
Chris PeBenito |
0c73cd |
|
|
Chris PeBenito |
0c73cd |
# execute files in the home directory
|
|
Chris PeBenito |
cc41a9 |
allow $1_t $1_home_t:file { rx_file_perms execute_no_trans };
|
|
Chris PeBenito |
0c73cd |
|
|
Chris PeBenito |
0c73cd |
# full control of the home directory
|
|
Chris PeBenito |
cc41a9 |
allow $1_t $1_home_t:file { create_file_perms relabelfrom relabelto };
|
|
Chris PeBenito |
cc41a9 |
allow $1_t $1_home_t:lnk_file { create_lnk_perms relabelfrom relabelto };
|
|
Chris PeBenito |
cc41a9 |
allow $1_t $1_home_t:dir { create_dir_perms relabelfrom relabelto };
|
|
Chris PeBenito |
cc41a9 |
allow $1_t $1_home_t:sock_file { create_file_perms relabelfrom relabelto };
|
|
Chris PeBenito |
cc41a9 |
allow $1_t $1_home_t:fifo_file { create_file_perms relabelfrom relabelto };
|
|
Chris PeBenito |
cc41a9 |
allow $1_t $1_home_dir_t:dir create_dir_perms;
|
|
Chris PeBenito |
cc41a9 |
type_transition $1_t $1_home_dir_t:{ dir notdevfile_class_set } $1_home_t;
|
|
Chris PeBenito |
0c73cd |
|
|
Chris PeBenito |
cc41a9 |
allow $1_t $1_tmp_t:file { rx_file_perms execute_no_trans };
|
|
Chris PeBenito |
0c73cd |
|
|
Chris PeBenito |
0c73cd |
# Bind to a Unix domain socket in /tmp.
|
|
Chris PeBenito |
0c73cd |
# cjp: this is combination is not checked and should be removed
|
|
Chris PeBenito |
0c73cd |
allow $1_t $1_tmp_t:unix_stream_socket name_bind;
|
|
Chris PeBenito |
0c73cd |
|
|
Chris PeBenito |
cc41a9 |
allow $1_t $1_tmpfs_t:dir rw_dir_perms;
|
|
Chris PeBenito |
cc41a9 |
allow $1_t $1_tmpfs_t:file create_file_perms;
|
|
Chris PeBenito |
cc41a9 |
allow $1_t $1_tmpfs_t:lnk_file create_lnk_perms;
|
|
Chris PeBenito |
cc41a9 |
allow $1_t $1_tmpfs_t:sock_file create_file_perms;
|
|
Chris PeBenito |
cc41a9 |
allow $1_t $1_tmpfs_t:fifo_file create_file_perms;
|
|
Chris PeBenito |
0fd9dc |
fs_create_tmpfs_data($1_t,$1_tmpfs_t, { dir notdevfile_class_set } )
|
|
Chris PeBenito |
0c73cd |
|
|
Chris PeBenito |
cc41a9 |
allow $1_t $1_tty_device_t:chr_file { setattr rw_file_perms };
|
|
Chris PeBenito |
0c73cd |
|
|
Chris PeBenito |
0c73cd |
allow $1_t unpriv_userdomain:fd use;
|
|
Chris PeBenito |
0c73cd |
|
|
Chris PeBenito |
0c73cd |
# Instantiate derived domains for a number of programs.
|
|
Chris PeBenito |
0c73cd |
# These derived domains encode both information about the calling
|
|
Chris PeBenito |
0c73cd |
# user domain and the program, and allow us to maintain separation
|
|
Chris PeBenito |
0c73cd |
# between different instances of the program being run by different
|
|
Chris PeBenito |
0c73cd |
# user domains.
|
|
Chris PeBenito |
0c73cd |
per_userdomain_templates($1)
|
|
Chris PeBenito |
0c73cd |
|
|
Chris PeBenito |
0c73cd |
kernel_read_kernel_sysctl($1_t)
|
|
Chris PeBenito |
5e0da6 |
selinux_get_fs_mount($1_t)
|
|
Chris PeBenito |
0c73cd |
# Very permissive allowing every domain to see every type:
|
|
Chris PeBenito |
0c73cd |
kernel_get_sysvipc_info($1_t)
|
|
Chris PeBenito |
0c73cd |
# Find CDROM devices:
|
|
Chris PeBenito |
0c73cd |
kernel_read_device_sysctl($1_t)
|
|
Chris PeBenito |
ebdc3b |
|
|
Chris PeBenito |
ebdc3b |
dev_rw_power_management($1_t)
|
|
Chris PeBenito |
0c73cd |
# GNOME checks for usb and other devices:
|
|
Chris PeBenito |
8bd678 |
dev_rw_usbfs($1_t)
|
|
Chris PeBenito |
0fd9dc |
|
|
Chris PeBenito |
0fd9dc |
corenet_tcp_sendrecv_all_if($1_t)
|
|
Chris PeBenito |
0fd9dc |
corenet_raw_sendrecv_all_if($1_t)
|
|
Chris PeBenito |
0fd9dc |
corenet_udp_sendrecv_all_if($1_t)
|
|
Chris PeBenito |
0fd9dc |
corenet_tcp_sendrecv_all_nodes($1_t)
|
|
Chris PeBenito |
0fd9dc |
corenet_raw_sendrecv_all_nodes($1_t)
|
|
Chris PeBenito |
0fd9dc |
corenet_udp_sendrecv_all_nodes($1_t)
|
|
Chris PeBenito |
0fd9dc |
corenet_tcp_sendrecv_all_ports($1_t)
|
|
Chris PeBenito |
0fd9dc |
corenet_udp_sendrecv_all_ports($1_t)
|
|
Chris PeBenito |
0fd9dc |
corenet_tcp_bind_all_nodes($1_t)
|
|
Chris PeBenito |
0fd9dc |
corenet_udp_bind_all_nodes($1_t)
|
|
Chris PeBenito |
0c73cd |
# allow port_t name binding for UDP because it is not very usable otherwise
|
|
Chris PeBenito |
0fd9dc |
corenet_udp_bind_generic_port($1_t)
|
|
Chris PeBenito |
0c73cd |
|
|
Karl MacMillan |
f0c985 |
dev_read_input($1_t)
|
|
Karl MacMillan |
f0c985 |
dev_read_misc($1_t)
|
|
Karl MacMillan |
f0c985 |
dev_write_misc($1_t)
|
|
Karl MacMillan |
f0c985 |
dev_write_snd_dev($1_t)
|
|
Karl MacMillan |
f0c985 |
dev_read_snd_dev($1_t)
|
|
Karl MacMillan |
f0c985 |
dev_read_snd_mixer_dev($1_t)
|
|
Karl MacMillan |
f0c985 |
dev_write_snd_mixer_dev($1_t)
|
|
Karl MacMillan |
f0c985 |
dev_read_rand($1_t)
|
|
Karl MacMillan |
f0c985 |
dev_read_urand($1_t)
|
|
Chris PeBenito |
0c73cd |
# open office is looking for the following
|
|
Karl MacMillan |
f0c985 |
dev_getattr_agp_dev($1_t)
|
|
Karl MacMillan |
f0c985 |
dev_dontaudit_rw_dri_dev($1_t)
|
|
Chris PeBenito |
0c73cd |
|
|
Chris PeBenito |
763c44 |
fs_get_all_fs_quotas($1_t)
|
|
Chris PeBenito |
0fd9dc |
fs_getattr_all_fs($1_t)
|
|
Chris PeBenito |
ab940a |
fs_search_auto_mountpoints($1_t)
|
|
Chris PeBenito |
0c73cd |
|
|
Chris PeBenito |
0c73cd |
# for eject
|
|
Chris PeBenito |
0fd9dc |
storage_getattr_fixed_disk($1_t)
|
|
Chris PeBenito |
0c73cd |
|
|
Chris PeBenito |
c9428d |
auth_read_login_records($1_t)
|
|
Chris PeBenito |
c9428d |
auth_dontaudit_write_login_records($1_t)
|
|
Chris PeBenito |
c9428d |
auth_run_pam($1_t,$1_r,{ $1_tty_device_t $1_devpts_t })
|
|
Chris PeBenito |
c9428d |
auth_run_utempter($1_t,$1_r,{ $1_tty_device_t $1_devpts_t })
|
|
Chris PeBenito |
0c73cd |
|
|
Chris PeBenito |
c9428d |
corecmd_exec_bin($1_t)
|
|
Chris PeBenito |
c9428d |
corecmd_exec_sbin($1_t)
|
|
Chris PeBenito |
c9428d |
corecmd_exec_ls($1_t)
|
|
Chris PeBenito |
0c73cd |
|
|
Chris PeBenito |
c9428d |
domain_exec_all_entry_files($1_t)
|
|
Chris PeBenito |
c9428d |
domain_use_wide_inherit_fd($1_t)
|
|
Chris PeBenito |
0c73cd |
|
|
Chris PeBenito |
8fd367 |
files_exec_etc_files($1_t)
|
|
Chris PeBenito |
8fd367 |
files_read_usr_src_files($1_t)
|
|
Chris PeBenito |
ebdc3b |
files_search_generic_locks($1_t)
|
|
Chris PeBenito |
0c73cd |
|
|
Chris PeBenito |
0c73cd |
# Caused by su - init scripts
|
|
Chris PeBenito |
c9428d |
init_dontaudit_use_script_pty($1_t)
|
|
Chris PeBenito |
0c73cd |
|
|
Chris PeBenito |
c9428d |
libs_use_ld_so($1_t)
|
|
Chris PeBenito |
c9428d |
libs_use_shared_libs($1_t)
|
|
Chris PeBenito |
c9428d |
libs_exec_ld_so($1_t)
|
|
Chris PeBenito |
c9428d |
libs_exec_lib_files($1_t)
|
|
Chris PeBenito |
0c73cd |
|
|
Chris PeBenito |
c9428d |
logging_dontaudit_getattr_all_logs($1_t)
|
|
Chris PeBenito |
0c73cd |
|
|
Chris PeBenito |
0c73cd |
miscfiles_read_localization($1_t)
|
|
Chris PeBenito |
c9428d |
miscfiles_rw_man_cache($1_t)
|
|
Chris PeBenito |
0c73cd |
|
|
Chris PeBenito |
5e0da6 |
seutil_run_newrole($1_t,$1_r,{ $1_devpts_t $1_tty_device_t })
|
|
Chris PeBenito |
0c73cd |
|
|
Chris PeBenito |
c9428d |
mta_rw_spool($1_t)
|
|
Chris PeBenito |
0c73cd |
|
|
Chris PeBenito |
34c8fa |
tunable_policy(`allow_execmem',`
|
|
Chris PeBenito |
0c73cd |
# Allow loading DSOs that require executable stack.
|
|
Chris PeBenito |
0c73cd |
allow $1_t self:process execmem;
|
|
Chris PeBenito |
34c8fa |
')
|
|
Chris PeBenito |
0c73cd |
|
|
Chris PeBenito |
34c8fa |
tunable_policy(`use_nfs_home_dirs',`
|
|
Chris PeBenito |
0fd9dc |
fs_manage_nfs_dirs($1_t)
|
|
Chris PeBenito |
763c44 |
fs_manage_nfs_files($1_t)
|
|
Chris PeBenito |
0fd9dc |
fs_manage_nfs_symlinks($1_t)
|
|
Chris PeBenito |
763c44 |
fs_manage_nfs_named_sockets($1_t)
|
|
Chris PeBenito |
763c44 |
fs_manage_nfs_named_pipes($1_t)
|
|
Chris PeBenito |
763c44 |
fs_execute_nfs_files($1_t)
|
|
Chris PeBenito |
34c8fa |
')
|
|
Chris PeBenito |
0c73cd |
|
|
Chris PeBenito |
34c8fa |
tunable_policy(`use_samba_home_dirs',`
|
|
Chris PeBenito |
0fd9dc |
fs_manage_cifs_dirs($1_t)
|
|
Chris PeBenito |
0fd9dc |
fs_manage_cifs_files($1_t)
|
|
Chris PeBenito |
0fd9dc |
fs_manage_cifs_symlinks($1_t)
|
|
Chris PeBenito |
0fd9dc |
fs_manage_cifs_named_sockets($1_t)
|
|
Chris PeBenito |
0fd9dc |
fs_manage_cifs_named_pipes($1_t)
|
|
Chris PeBenito |
0fd9dc |
fs_execute_cifs_files($1_t)
|
|
Chris PeBenito |
34c8fa |
')
|
|
Chris PeBenito |
0c73cd |
|
|
Chris PeBenito |
34c8fa |
tunable_policy(`user_direct_mouse',`
|
|
Karl MacMillan |
f0c985 |
dev_read_mouse($1_t)
|
|
Chris PeBenito |
34c8fa |
')
|
|
Chris PeBenito |
0c73cd |
|
|
Chris PeBenito |
34c8fa |
tunable_policy(`user_ttyfile_stat',`
|
|
Chris PeBenito |
0fd9dc |
term_getattr_all_user_ttys($1_t)
|
|
Chris PeBenito |
34c8fa |
')
|
|
Chris PeBenito |
0c73cd |
|
|
Chris PeBenito |
ab940a |
optional_policy(`nis.te',`
|
|
Chris PeBenito |
ab940a |
nis_use_ypbind($1_t)
|
|
Chris PeBenito |
ab940a |
')
|
|
Chris PeBenito |
ab940a |
|
|
Chris PeBenito |
0c73cd |
optional_policy(`usermanage.te',`
|
|
Chris PeBenito |
c9428d |
usermanage_run_chfn($1_t,$1_r,{ $1_devpts_t $1_tty_device_t })
|
|
Chris PeBenito |
c9428d |
usermanage_run_passwd($1_t,$1_r,{ $1_devpts_t $1_tty_device_t })
|
|
Chris PeBenito |
0c73cd |
')
|
|
Chris PeBenito |
0c73cd |
|
|
Chris PeBenito |
0c73cd |
ifdef(`TODO',`
|
|
Chris PeBenito |
0c73cd |
|
|
Chris PeBenito |
0c73cd |
# When the user domain runs ps, there will be a number of access
|
|
Chris PeBenito |
0c73cd |
# denials when ps tries to search /proc. Do not audit these denials.
|
|
Chris PeBenito |
0c73cd |
dontaudit $1_t domain:dir r_dir_perms;
|
|
Chris PeBenito |
0c73cd |
dontaudit $1_t domain:notdevfile_class_set r_file_perms;
|
|
Chris PeBenito |
0c73cd |
dontaudit $1_t domain:process { getattr getsession };
|
|
Chris PeBenito |
0c73cd |
#
|
|
Chris PeBenito |
0c73cd |
# Cups daemon running as user tries to write /etc/printcap
|
|
Chris PeBenito |
0c73cd |
#
|
|
Chris PeBenito |
0c73cd |
dontaudit $1_t usr_t:file setattr;
|
|
Chris PeBenito |
0c73cd |
|
|
Chris PeBenito |
0c73cd |
# Check to see if cdrom is mounted
|
|
Chris PeBenito |
0c73cd |
allow $1_t mnt_t:dir { getattr search };
|
|
Chris PeBenito |
0c73cd |
|
|
Chris PeBenito |
0c73cd |
#
|
|
Chris PeBenito |
0c73cd |
# Added to allow reading of cdrom
|
|
Chris PeBenito |
0c73cd |
#
|
|
Chris PeBenito |
0c73cd |
allow $1_t rpc_pipefs_t:dir getattr;
|
|
Chris PeBenito |
0c73cd |
allow $1_t nfsd_fs_t:dir getattr;
|
|
Chris PeBenito |
0c73cd |
allow $1_t binfmt_misc_fs_t:dir getattr;
|
|
Chris PeBenito |
0c73cd |
|
|
Chris PeBenito |
0c73cd |
# /initrd is left mounted, various programs try to look at it
|
|
Chris PeBenito |
0c73cd |
dontaudit $1_t ramfs_t:dir getattr;
|
|
Chris PeBenito |
0c73cd |
|
|
Chris PeBenito |
3eed10 |
tunable_policy(`read_default_t',`
|
|
Chris PeBenito |
0c73cd |
allow $1_t default_t:dir r_dir_perms;
|
|
Chris PeBenito |
0c73cd |
allow $1_t default_t:notdevfile_class_set r_file_perms;
|
|
Chris PeBenito |
3eed10 |
')
|
|
Chris PeBenito |
0c73cd |
|
|
Chris PeBenito |
0c73cd |
#
|
|
Chris PeBenito |
0c73cd |
# Running ifconfig as a user generates the following
|
|
Chris PeBenito |
0c73cd |
#
|
|
Chris PeBenito |
0c73cd |
dontaudit $1_t sysctl_net_t:dir search;
|
|
Chris PeBenito |
0c73cd |
|
|
Chris PeBenito |
0c73cd |
dontaudit $1_t default_context_t:dir search;
|
|
Chris PeBenito |
0c73cd |
|
|
Chris PeBenito |
0c73cd |
r_dir_file($1_t, usercanread)
|
|
Chris PeBenito |
0c73cd |
|
|
Chris PeBenito |
3eed10 |
tunable_policy(`allow_execmod',`
|
|
Chris PeBenito |
0c73cd |
# Allow text relocations on system shared libraries, e.g. libGL.
|
|
Chris PeBenito |
0c73cd |
allow $1_t texrel_shlib_t:file execmod;
|
|
Chris PeBenito |
3eed10 |
')
|
|
Chris PeBenito |
0c73cd |
|
|
Chris PeBenito |
0c73cd |
allow $1_t fs_type:dir getattr;
|
|
Chris PeBenito |
0c73cd |
|
|
Chris PeBenito |
0c73cd |
# old "file_browse_domain":
|
|
Chris PeBenito |
0c73cd |
# Regular files/directories that are not security sensitive
|
|
Chris PeBenito |
0c73cd |
dontaudit $1_t file_type - secure_file_type:dir_file_class_set getattr;
|
|
Chris PeBenito |
0c73cd |
dontaudit $1_t file_type - secure_file_type:dir { read search };
|
|
Chris PeBenito |
0c73cd |
# /dev
|
|
Chris PeBenito |
0c73cd |
dontaudit $1_t dev_fs:dir_file_class_set getattr;
|
|
Chris PeBenito |
0c73cd |
dontaudit $1_t dev_fs:dir { read search };
|
|
Chris PeBenito |
0c73cd |
# /proc
|
|
Chris PeBenito |
0c73cd |
dontaudit $1_t sysctl_t:dir_file_class_set getattr;
|
|
Chris PeBenito |
0c73cd |
dontaudit $1_t proc_fs:dir { read search };
|
|
Chris PeBenito |
0c73cd |
|
|
Chris PeBenito |
0c73cd |
can_exec($1_t, { removable_t noexattrfile } )
|
|
Chris PeBenito |
3eed10 |
|
|
Chris PeBenito |
3eed10 |
tunable_policy(`user_rw_noexattrfile',`
|
|
Chris PeBenito |
0c73cd |
create_dir_file($1_t, noexattrfile)
|
|
Chris PeBenito |
0c73cd |
create_dir_file($1_t, removable_t)
|
|
Chris PeBenito |
0c73cd |
# Write floppies
|
|
Chris PeBenito |
ebdc3b |
storage_raw_read_removable_device($1_t)
|
|
Chris PeBenito |
ebdc3b |
storage_raw_write_removable_device($1_t)
|
|
Chris PeBenito |
ebdc3b |
# cjp: what does this have to do with removable devices?
|
|
Chris PeBenito |
0c73cd |
allow $1_t usbtty_device_t:chr_file write;
|
|
Chris PeBenito |
3eed10 |
',`
|
|
Chris PeBenito |
0c73cd |
r_dir_file($1_t, noexattrfile)
|
|
Chris PeBenito |
0c73cd |
r_dir_file($1_t, removable_t)
|
|
Chris PeBenito |
0c73cd |
allow $1_t removable_device_t:blk_file r_file_perms;
|
|
Chris PeBenito |
3eed10 |
')
|
|
Chris PeBenito |
3eed10 |
|
|
Chris PeBenito |
0c73cd |
allow $1_t usbtty_device_t:chr_file read;
|
|
Chris PeBenito |
0c73cd |
|
|
Chris PeBenito |
0c73cd |
can_exec($1_t, noexattrfile)
|
|
Chris PeBenito |
0c73cd |
|
|
Chris PeBenito |
0c73cd |
# for running TeX programs
|
|
Chris PeBenito |
0c73cd |
r_dir_file($1_t, tetex_data_t)
|
|
Chris PeBenito |
0c73cd |
can_exec($1_t, tetex_data_t)
|
|
Chris PeBenito |
0c73cd |
|
|
Chris PeBenito |
0c73cd |
can_resmgrd_connect($1_t)
|
|
Chris PeBenito |
0c73cd |
|
|
Chris PeBenito |
0c73cd |
# Grant permissions to access the system DBus
|
|
Chris PeBenito |
0c73cd |
ifdef(`dbusd.te', `
|
|
Chris PeBenito |
0c73cd |
dbusd_client(system, $1)
|
|
Chris PeBenito |
0c73cd |
can_network_server_tcp($1_dbusd_t)
|
|
Chris PeBenito |
0c73cd |
allow $1_dbusd_t reserved_port_t:tcp_socket name_bind;
|
|
Chris PeBenito |
0c73cd |
|
|
Chris PeBenito |
0c73cd |
allow $1_t system_dbusd_t:dbus { send_msg acquire_svc };
|
|
Chris PeBenito |
0c73cd |
dbusd_client($1, $1)
|
|
Chris PeBenito |
0c73cd |
allow $1_t $1_dbusd_t:dbus { send_msg acquire_svc };
|
|
Chris PeBenito |
0c73cd |
dbusd_domain($1)
|
|
Chris PeBenito |
0c73cd |
ifdef(`hald.te', `
|
|
Chris PeBenito |
0c73cd |
allow $1_t hald_t:dbus send_msg;
|
|
Chris PeBenito |
0c73cd |
allow hald_t $1_t:dbus send_msg;
|
|
Chris PeBenito |
0c73cd |
')
|
|
Chris PeBenito |
0c73cd |
')
|
|
Chris PeBenito |
0c73cd |
|
|
Chris PeBenito |
0c73cd |
# Gnome pannel binds to the following
|
|
Chris PeBenito |
0c73cd |
ifdef(`cups.te', `
|
|
Chris PeBenito |
cc41a9 |
allow $1_t { cupsd_etc_t cupsd_rw_etc_t }:file r_file_perms;
|
|
Chris PeBenito |
0c73cd |
')
|
|
Chris PeBenito |
0c73cd |
|
|
Chris PeBenito |
0c73cd |
# Connect to inetd.
|
|
Chris PeBenito |
0c73cd |
ifdef(`inetd.te', `
|
|
Chris PeBenito |
0c73cd |
can_tcp_connect($1_t, inetd_t)
|
|
Chris PeBenito |
0c73cd |
can_udp_send($1_t, inetd_t)
|
|
Chris PeBenito |
0c73cd |
can_udp_send(inetd_t, $1_t)
|
|
Chris PeBenito |
0c73cd |
')
|
|
Chris PeBenito |
0c73cd |
|
|
Chris PeBenito |
0c73cd |
# Connect to portmap.
|
|
Chris PeBenito |
0c73cd |
ifdef(`portmap.te', `can_tcp_connect($1_t, portmap_t)')
|
|
Chris PeBenito |
0c73cd |
|
|
Chris PeBenito |
0c73cd |
# Inherit and use sockets from inetd
|
|
Chris PeBenito |
0c73cd |
ifdef(`inetd.te', `
|
|
Chris PeBenito |
0c73cd |
allow $1_t inetd_t:fd use;
|
|
Chris PeBenito |
0c73cd |
allow $1_t inetd_t:tcp_socket rw_stream_socket_perms;
|
|
Chris PeBenito |
0c73cd |
')
|
|
Chris PeBenito |
0c73cd |
|
|
Chris PeBenito |
0c73cd |
ifdef(`xserver.te', `
|
|
Chris PeBenito |
0c73cd |
# for /tmp/.ICE-unix
|
|
Chris PeBenito |
0c73cd |
file_type_auto_trans($1_t, xdm_xserver_tmp_t, $1_tmp_t, sock_file)
|
|
Chris PeBenito |
0c73cd |
allow $1_t xserver_misc_device_t:{ chr_file blk_file } rw_file_perms;
|
|
Chris PeBenito |
0c73cd |
')
|
|
Chris PeBenito |
0c73cd |
|
|
Chris PeBenito |
0c73cd |
ifdef(`xdm.te', `
|
|
Chris PeBenito |
0c73cd |
# Connect to the X server run by the X Display Manager.
|
|
Chris PeBenito |
0c73cd |
can_unix_connect($1_t, xdm_t)
|
|
Chris PeBenito |
0c73cd |
allow $1_t xdm_tmp_t:sock_file rw_file_perms;
|
|
Chris PeBenito |
0c73cd |
allow $1_t xdm_tmp_t:dir r_dir_perms;
|
|
Chris PeBenito |
cc41a9 |
allow $1_t xdm_tmp_t:file r_file_perms;
|
|
Chris PeBenito |
0c73cd |
allow $1_t xdm_xserver_tmp_t:sock_file { read write };
|
|
Chris PeBenito |
0c73cd |
allow $1_t xdm_xserver_tmp_t:dir search;
|
|
Chris PeBenito |
0c73cd |
allow $1_t xdm_xserver_t:unix_stream_socket connectto;
|
|
Chris PeBenito |
0c73cd |
# certain apps want to read xdm.pid file
|
|
Chris PeBenito |
0c73cd |
r_dir_file($1_t, xdm_var_run_t)
|
|
Chris PeBenito |
cc41a9 |
allow $1_t xdm_var_lib_t:file r_file_perms;
|
|
Chris PeBenito |
0c73cd |
allow xdm_t $1_home_dir_t:dir getattr;
|
|
Chris PeBenito |
0c73cd |
ifdef(`xauth.te', `
|
|
Chris PeBenito |
0c73cd |
file_type_auto_trans(xdm_t, $1_home_dir_t, $1_xauth_home_t, file)
|
|
Chris PeBenito |
0c73cd |
')
|
|
Chris PeBenito |
0c73cd |
|
|
Chris PeBenito |
0c73cd |
# for shared memory
|
|
Chris PeBenito |
0c73cd |
allow xdm_xserver_t $1_tmpfs_t:file { read write };
|
|
Chris PeBenito |
0c73cd |
|
|
Chris PeBenito |
0c73cd |
')
|
|
Chris PeBenito |
0c73cd |
|
|
Chris PeBenito |
0c73cd |
ifdef(`rpcd.te', `
|
|
Chris PeBenito |
0c73cd |
create_dir_file($1_t, nfsd_rw_t)
|
|
Chris PeBenito |
0c73cd |
')
|
|
Chris PeBenito |
0c73cd |
|
|
Chris PeBenito |
0c73cd |
ifdef(`cardmgr.te', `
|
|
Chris PeBenito |
0c73cd |
# to allow monitoring of pcmcia status
|
|
Chris PeBenito |
cc41a9 |
allow $1_t cardmgr_var_run_t:file r_file_perms;
|
|
Chris PeBenito |
0c73cd |
')
|
|
Chris PeBenito |
0c73cd |
|
|
Chris PeBenito |
0c73cd |
#
|
|
Chris PeBenito |
0c73cd |
# Allow graphical boot to check battery lifespan
|
|
Chris PeBenito |
0c73cd |
#
|
|
Chris PeBenito |
0c73cd |
ifdef(`apmd.te', `
|
|
Chris PeBenito |
0c73cd |
allow $1_t apmd_t:unix_stream_socket connectto;
|
|
Chris PeBenito |
0c73cd |
allow $1_t apmd_var_run_t:sock_file write;
|
|
Chris PeBenito |
0c73cd |
')
|
|
Chris PeBenito |
0c73cd |
|
|
Chris PeBenito |
0c73cd |
ifdef(`pamconsole.te', `
|
|
Chris PeBenito |
0c73cd |
allow $1_t pam_var_console_t:dir search;
|
|
Chris PeBenito |
0c73cd |
')
|
|
Chris PeBenito |
0c73cd |
|
|
Chris PeBenito |
0c73cd |
') dnl endif TODO
|
|
Chris PeBenito |
b16c6b |
|
|
Chris PeBenito |
b16c6b |
')dnl end base_user_domain macro
|
|
Chris PeBenito |
b16c6b |
|
|
Chris PeBenito |
8fd367 |
#######################################
|
|
Chris PeBenito |
8fd367 |
## <summary>
|
|
Chris PeBenito |
8fd367 |
## The template for creating a unprivileged user.
|
|
Chris PeBenito |
8fd367 |
## </summary>
|
|
Chris PeBenito |
8fd367 |
## <desc>
|
|
Chris PeBenito |
8fd367 |
##
|
|
Chris PeBenito |
8fd367 |
## This template creates a user domain, types, and
|
|
Chris PeBenito |
8fd367 |
## rules for the user's tty, pty, home directories,
|
|
Chris PeBenito |
8fd367 |
## tmp, and tmpfs files.
|
|
Chris PeBenito |
8fd367 |
##
|
|
Chris PeBenito |
8fd367 |
## </desc>
|
|
Chris PeBenito |
8fd367 |
## <param name="userdomain_prefix">
|
|
Chris PeBenito |
8fd367 |
## The prefix of the user domain (e.g., user
|
|
Chris PeBenito |
8fd367 |
## is the prefix for user_t).
|
|
Chris PeBenito |
8fd367 |
## </param>
|
|
Chris PeBenito |
b16c6b |
#
|
|
Chris PeBenito |
8fd367 |
template(`unpriv_user_template', `
|
|
Chris PeBenito |
0c73cd |
##############################
|
|
Chris PeBenito |
0c73cd |
#
|
|
Chris PeBenito |
0c73cd |
# Declarations
|
|
Chris PeBenito |
0c73cd |
#
|
|
Chris PeBenito |
b16c6b |
|
|
Chris PeBenito |
0c73cd |
# Inherit rules for ordinary users.
|
|
Chris PeBenito |
8fd367 |
base_user_template($1)
|
|
Chris PeBenito |
b16c6b |
|
|
Chris PeBenito |
0c73cd |
typeattribute $1_t unpriv_userdomain; #, web_client_domain, nscd_client_domain;
|
|
Chris PeBenito |
c9428d |
domain_wide_inherit_fd($1_t)
|
|
Chris PeBenito |
b16c6b |
|
|
Chris PeBenito |
0c73cd |
#typeattribute $1_devpts_t userpty_type, user_tty_type;
|
|
Chris PeBenito |
0c73cd |
#typeattribute $1_home_dir_t user_home_dir_type;
|
|
Chris PeBenito |
0c73cd |
#typeattribute $1_home_t user_home_type;
|
|
Chris PeBenito |
b16c6b |
|
|
Chris PeBenito |
ab940a |
typeattribute $1_tmp_t user_tmpfile;
|
|
Chris PeBenito |
b16c6b |
|
|
Chris PeBenito |
ebdc3b |
typeattribute $1_tty_device_t user_ttynode;
|
|
Chris PeBenito |
b16c6b |
|
|
Chris PeBenito |
0c73cd |
##############################
|
|
Chris PeBenito |
0c73cd |
#
|
|
Chris PeBenito |
0c73cd |
# Local policy
|
|
Chris PeBenito |
0c73cd |
#
|
|
Chris PeBenito |
0c73cd |
|
|
Chris PeBenito |
0c73cd |
allow $1_t $1_devpts_t:chr_file { setattr ioctl read getattr lock write append };
|
|
Chris PeBenito |
0fd9dc |
term_create_pty($1_t,$1_devpts_t)
|
|
Chris PeBenito |
0c73cd |
|
|
Chris PeBenito |
0c73cd |
# Rules used to associate a homedir as a mountpoint
|
|
Chris PeBenito |
0c73cd |
allow $1_home_t self:filesystem associate;
|
|
Chris PeBenito |
0c73cd |
allow $1_file_type $1_home_t:filesystem associate;
|
|
Chris PeBenito |
0c73cd |
|
|
Chris PeBenito |
0c73cd |
# user temporary files
|
|
Chris PeBenito |
cc41a9 |
allow $1_t $1_tmp_t:file create_file_perms;
|
|
Chris PeBenito |
cc41a9 |
allow $1_t $1_tmp_t:lnk_file create_lnk_perms;
|
|
Chris PeBenito |
cc41a9 |
allow $1_t $1_tmp_t:dir create_dir_perms;
|
|
Chris PeBenito |
cc41a9 |
allow $1_t $1_tmp_t:sock_file create_file_perms;
|
|
Chris PeBenito |
cc41a9 |
allow $1_t $1_tmp_t:fifo_file create_file_perms;
|
|
Chris PeBenito |
c9428d |
files_create_tmp_files($1_t, $1_tmp_t, { dir notdevfile_class_set })
|
|
Chris PeBenito |
0c73cd |
|
|
Chris PeBenito |
0c73cd |
# privileged home directory writers
|
|
Chris PeBenito |
cc41a9 |
allow privhome $1_home_t:file create_file_perms;
|
|
Chris PeBenito |
cc41a9 |
allow privhome $1_home_t:lnk_file create_lnk_perms;
|
|
Chris PeBenito |
cc41a9 |
allow privhome $1_home_t:dir create_dir_perms;
|
|
Chris PeBenito |
cc41a9 |
allow privhome $1_home_t:sock_file create_file_perms;
|
|
Chris PeBenito |
cc41a9 |
allow privhome $1_home_t:fifo_file create_file_perms;
|
|
Chris PeBenito |
cc41a9 |
type_transition privhome $1_home_dir_t:{ dir notdevfile_class_set } $1_home_t;
|
|
Chris PeBenito |
0c73cd |
|
|
Chris PeBenito |
0c73cd |
kernel_read_system_state($1_t)
|
|
Chris PeBenito |
0c73cd |
kernel_read_network_state($1_t)
|
|
Chris PeBenito |
8bd678 |
dev_read_sysfs($1_t)
|
|
Chris PeBenito |
0c73cd |
|
|
Chris PeBenito |
0c73cd |
# cjp: why?
|
|
Chris PeBenito |
0c73cd |
bootloader_read_kernel_symbol_table($1_t)
|
|
Chris PeBenito |
0c73cd |
|
|
Chris PeBenito |
0c73cd |
# port access is audited even if dac would not have allowed it, so dontaudit it here
|
|
Chris PeBenito |
0fd9dc |
corenet_dontaudit_tcp_bind_all_reserved_ports($1_t)
|
|
Chris PeBenito |
0c73cd |
|
|
Chris PeBenito |
8fd367 |
files_read_etc_files($1_t)
|
|
Chris PeBenito |
c9428d |
files_list_home($1_t)
|
|
Chris PeBenito |
c9428d |
files_read_usr_files($1_t)
|
|
Chris PeBenito |
0c73cd |
|
|
Chris PeBenito |
c9428d |
init_read_script_pid($1_t)
|
|
Chris PeBenito |
0c73cd |
# The library functions always try to open read-write first,
|
|
Chris PeBenito |
0c73cd |
# then fall back to read-only if it fails.
|
|
Chris PeBenito |
c9428d |
init_dontaudit_write_script_pid($1_t)
|
|
Chris PeBenito |
0c73cd |
# Stop warnings about access to /dev/console
|
|
Chris PeBenito |
c9428d |
init_dontaudit_use_fd($1_t)
|
|
Chris PeBenito |
c9428d |
init_dontaudit_use_script_fd($1_t)
|
|
Chris PeBenito |
0c73cd |
|
|
Chris PeBenito |
0c73cd |
miscfiles_read_man_pages($1_t)
|
|
Chris PeBenito |
0c73cd |
|
|
Chris PeBenito |
5e0da6 |
seutil_read_config($1_t)
|
|
Chris PeBenito |
0c73cd |
# Allow users to execute checkpolicy without a domain transition
|
|
Chris PeBenito |
0c73cd |
# so it can be used without privilege to write real binary policy file
|
|
Chris PeBenito |
5e0da6 |
seutil_exec_checkpol($1_t)
|
|
Chris PeBenito |
0c73cd |
|
|
Chris PeBenito |
34c8fa |
tunable_policy(`user_dmesg',`
|
|
Chris PeBenito |
0c73cd |
kernel_read_ring_buffer($1_t)
|
|
Chris PeBenito |
34c8fa |
',`
|
|
Chris PeBenito |
0fd9dc |
kernel_dontaudit_read_ring_buffer($1_t)
|
|
Chris PeBenito |
34c8fa |
')
|
|
Chris PeBenito |
0c73cd |
|
|
Chris PeBenito |
0c73cd |
# Allow users to run TCP servers (bind to ports and accept connection from
|
|
Chris PeBenito |
0c73cd |
# the same domain and outside users) disabling this forces FTP passive mode
|
|
Chris PeBenito |
0c73cd |
# and may change other protocols
|
|
Chris PeBenito |
34c8fa |
tunable_policy(`user_tcp_server',`
|
|
Chris PeBenito |
0fd9dc |
corenet_tcp_bind_generic_port($1_t)
|
|
Chris PeBenito |
34c8fa |
')
|
|
Chris PeBenito |
0c73cd |
|
|
Chris PeBenito |
a7a979 |
optional_policy(`kerberos.te',`
|
|
Chris PeBenito |
a7a979 |
kerberos_use($1_t)
|
|
Chris PeBenito |
a7a979 |
')
|
|
Chris PeBenito |
a7a979 |
|
|
Chris PeBenito |
0c73cd |
# for running depmod as part of the kernel packaging process
|
|
Chris PeBenito |
0c73cd |
optional_policy(`modutils.te',`
|
|
Chris PeBenito |
c9428d |
modutils_read_module_conf($1_t)
|
|
Chris PeBenito |
0c73cd |
')
|
|
Chris PeBenito |
0c73cd |
|
|
Chris PeBenito |
0c73cd |
optional_policy(`selinux.te',`
|
|
Chris PeBenito |
0c73cd |
# for when the network connection is killed
|
|
Chris PeBenito |
8fd367 |
seutil_dontaudit_signal_newrole($1_t)
|
|
Chris PeBenito |
0c73cd |
')
|
|
Chris PeBenito |
0c73cd |
|
|
Chris PeBenito |
0c73cd |
# Need the following rule to allow users to run vpnc
|
|
Chris PeBenito |
0c73cd |
optional_policy(`xserver.te', `
|
|
Chris PeBenito |
0c73cd |
corenetwork_bind_tcp_on_xserver_port($1_t)
|
|
Chris PeBenito |
0c73cd |
')
|
|
Chris PeBenito |
0c73cd |
|
|
Chris PeBenito |
0c73cd |
ifdef(`TODO',`
|
|
Chris PeBenito |
0c73cd |
|
|
Chris PeBenito |
0c73cd |
dontaudit $1_t boot_t:lnk_file read;
|
|
Chris PeBenito |
0c73cd |
dontaudit $1_t boot_t:file read;
|
|
Chris PeBenito |
0c73cd |
|
|
Chris PeBenito |
0c73cd |
# do not audit read on disk devices
|
|
Chris PeBenito |
0c73cd |
dontaudit $1_t { removable_device_t fixed_disk_device_t }:blk_file read;
|
|
Chris PeBenito |
0c73cd |
|
|
Chris PeBenito |
0c73cd |
ifdef(`xdm.te', `
|
|
Chris PeBenito |
0c73cd |
allow xdm_t $1_home_t:lnk_file read;
|
|
Chris PeBenito |
0c73cd |
allow xdm_t $1_home_t:dir search;
|
|
Chris PeBenito |
0c73cd |
#
|
|
Chris PeBenito |
0c73cd |
# Changing this to dontaudit should cause the .xsession-errors file to be written to /tmp
|
|
Chris PeBenito |
0c73cd |
#
|
|
Chris PeBenito |
0c73cd |
dontaudit xdm_t $1_home_t:file rw_file_perms;
|
|
Chris PeBenito |
0c73cd |
')
|
|
Chris PeBenito |
0c73cd |
|
|
Chris PeBenito |
0c73cd |
ifdef(`ftpd.te', `
|
|
Chris PeBenito |
3eed10 |
tunable_policy(`ftp_home_dir',`
|
|
Chris PeBenito |
0c73cd |
file_type_auto_trans(ftpd_t, $1_home_dir_t, $1_home_t)
|
|
Chris PeBenito |
3eed10 |
')
|
|
Chris PeBenito |
0c73cd |
')
|
|
Chris PeBenito |
0c73cd |
|
|
Chris PeBenito |
3eed10 |
tunable_policy(`read_default_t',`
|
|
Chris PeBenito |
0c73cd |
allow $1 default_t:dir r_dir_perms;
|
|
Chris PeBenito |
0c73cd |
allow $1 default_t:notdevfile_class_set r_file_perms;
|
|
Chris PeBenito |
3eed10 |
')
|
|
Chris PeBenito |
0c73cd |
|
|
Chris PeBenito |
0c73cd |
can_exec($1_t, usr_t)
|
|
Chris PeBenito |
0c73cd |
|
|
Chris PeBenito |
0c73cd |
# Read directories and files with the readable_t type.
|
|
Chris PeBenito |
0c73cd |
# This type is a general type for "world"-readable files.
|
|
Chris PeBenito |
0c73cd |
allow $1_t readable_t:dir r_dir_perms;
|
|
Chris PeBenito |
0c73cd |
allow $1_t readable_t:notdevfile_class_set r_file_perms;
|
|
Chris PeBenito |
0c73cd |
|
|
Chris PeBenito |
0c73cd |
# Stat lost+found.
|
|
Chris PeBenito |
0c73cd |
allow $1_t lost_found_t:dir getattr;
|
|
Chris PeBenito |
0c73cd |
|
|
Chris PeBenito |
0c73cd |
# Read /var, /var/spool, /var/run.
|
|
Chris PeBenito |
0c73cd |
allow $1_t var_t:dir r_dir_perms;
|
|
Chris PeBenito |
0c73cd |
allow $1_t var_t:notdevfile_class_set r_file_perms;
|
|
Chris PeBenito |
0c73cd |
allow $1_t var_spool_t:dir r_dir_perms;
|
|
Chris PeBenito |
0c73cd |
allow $1_t var_spool_t:notdevfile_class_set r_file_perms;
|
|
Chris PeBenito |
0c73cd |
allow $1_t var_run_t:dir r_dir_perms;
|
|
Chris PeBenito |
0c73cd |
allow $1_t var_run_t:{ file lnk_file } r_file_perms;
|
|
Chris PeBenito |
0c73cd |
allow $1_t var_lib_t:dir r_dir_perms;
|
|
Chris PeBenito |
0c73cd |
allow $1_t var_lib_t:file { getattr read };
|
|
Chris PeBenito |
0c73cd |
|
|
Chris PeBenito |
0c73cd |
# Allow users to rw usb devices
|
|
Chris PeBenito |
3eed10 |
tunable_policy(`user_rw_usb',`
|
|
Chris PeBenito |
0c73cd |
rw_dir_create_file($1_t,usbdevfs_t)
|
|
Chris PeBenito |
3eed10 |
',`
|
|
Chris PeBenito |
0c73cd |
r_dir_file($1_t,usbdevfs_t)
|
|
Chris PeBenito |
3eed10 |
')
|
|
Chris PeBenito |
0c73cd |
|
|
Chris PeBenito |
0c73cd |
# Do not audit write denials to /etc/ld.so.cache.
|
|
Chris PeBenito |
0c73cd |
dontaudit $1_t ld_so_cache_t:file write;
|
|
Chris PeBenito |
0c73cd |
|
|
Chris PeBenito |
0c73cd |
dontaudit $1_t sysadm_home_t:file { read append };
|
|
Chris PeBenito |
0c73cd |
|
|
Chris PeBenito |
0c73cd |
ifdef(`syslogd.te', `
|
|
Chris PeBenito |
0c73cd |
# Some programs that are left in $1_t will try to connect
|
|
Chris PeBenito |
0c73cd |
# to syslogd, but we do not want to let them generate log messages.
|
|
Chris PeBenito |
0c73cd |
# Do not audit.
|
|
Chris PeBenito |
0c73cd |
dontaudit $1_t devlog_t:sock_file { read write };
|
|
Chris PeBenito |
0c73cd |
dontaudit $1_t syslogd_t:unix_dgram_socket sendto;
|
|
Chris PeBenito |
0c73cd |
')
|
|
Chris PeBenito |
0c73cd |
|
|
Chris PeBenito |
0c73cd |
allow $1_t initrc_t:fifo_file write;
|
|
Chris PeBenito |
0c73cd |
|
|
Chris PeBenito |
0c73cd |
ifdef(`user_can_mount', `
|
|
Chris PeBenito |
0c73cd |
#
|
|
Chris PeBenito |
0c73cd |
# Allow users to mount file systems like floppies and cdrom
|
|
Chris PeBenito |
0c73cd |
#
|
|
Chris PeBenito |
0c73cd |
mount_domain($1, $1_mount, `, fs_domain')
|
|
Chris PeBenito |
0c73cd |
r_dir_file($1_t, mnt_t)
|
|
Chris PeBenito |
0c73cd |
allow $1_mount_t device_t:lnk_file read;
|
|
Chris PeBenito |
0c73cd |
allow $1_mount_t removable_device_t:blk_file read;
|
|
Chris PeBenito |
0c73cd |
allow $1_mount_t iso9660_t:filesystem relabelfrom;
|
|
Chris PeBenito |
0c73cd |
allow $1_mount_t removable_t:filesystem { mount relabelto };
|
|
Chris PeBenito |
0c73cd |
allow $1_mount_t removable_t:dir mounton;
|
|
Chris PeBenito |
0c73cd |
ifdef(`xdm.te', `
|
|
Chris PeBenito |
0c73cd |
allow $1_mount_t xdm_t:fd use;
|
|
Chris PeBenito |
0c73cd |
allow $1_mount_t xdm_t:fifo_file { read write };
|
|
Chris PeBenito |
0c73cd |
')
|
|
Chris PeBenito |
0c73cd |
')
|
|
Chris PeBenito |
0c73cd |
|
|
Chris PeBenito |
0c73cd |
') dnl end TODO
|
|
Chris PeBenito |
b16c6b |
')
|
|
Chris PeBenito |
4d8ddf |
|
|
Chris PeBenito |
8fd367 |
#######################################
|
|
Chris PeBenito |
8fd367 |
## <summary>
|
|
Chris PeBenito |
8fd367 |
## The template for creating an administrative user.
|
|
Chris PeBenito |
8fd367 |
## </summary>
|
|
Chris PeBenito |
8fd367 |
## <desc>
|
|
Chris PeBenito |
8fd367 |
##
|
|
Chris PeBenito |
8fd367 |
## This template creates a user domain, types, and
|
|
Chris PeBenito |
8fd367 |
## rules for the user's tty, pty, home directories,
|
|
Chris PeBenito |
8fd367 |
## tmp, and tmpfs files.
|
|
Chris PeBenito |
8fd367 |
##
|
|
Chris PeBenito |
8fd367 |
## </desc>
|
|
Chris PeBenito |
8fd367 |
## <secdesc>
|
|
Chris PeBenito |
8fd367 |
## The privileges given to administrative users are:
|
|
Chris PeBenito |
8fd367 |
##
|
|
Chris PeBenito |
8fd367 |
## Raw disk access
|
|
Chris PeBenito |
8fd367 |
## Set all sysctls
|
|
Chris PeBenito |
8fd367 |
## All kernel ring buffer controls
|
|
Chris PeBenito |
8fd367 |
## Set SELinux enforcement mode (enforcing/permissive)
|
|
Chris PeBenito |
8fd367 |
## Set SELinux booleans
|
|
Chris PeBenito |
8fd367 |
## Relabel all files but shadow
|
|
Chris PeBenito |
8fd367 |
## Create, read, write, and delete all files but shadow
|
|
Chris PeBenito |
8fd367 |
## Manage source and binary format SELinux policy
|
|
Chris PeBenito |
8fd367 |
## Run insmod
|
|
Chris PeBenito |
8fd367 |
##
|
|
Chris PeBenito |
8fd367 |
## </secdesc>
|
|
Chris PeBenito |
8fd367 |
## <param name="userdomain_prefix">
|
|
Chris PeBenito |
8fd367 |
## The prefix of the user domain (e.g., sysadm
|
|
Chris PeBenito |
8fd367 |
## is the prefix for sysadm_t).
|
|
Chris PeBenito |
8fd367 |
## </param>
|
|
Chris PeBenito |
4d8ddf |
#
|
|
Chris PeBenito |
8fd367 |
template(`admin_user_template',`
|
|
Chris PeBenito |
0c73cd |
##############################
|
|
Chris PeBenito |
0c73cd |
#
|
|
Chris PeBenito |
0c73cd |
# Declarations
|
|
Chris PeBenito |
0c73cd |
#
|
|
Chris PeBenito |
0c73cd |
|
|
Chris PeBenito |
0c73cd |
# Inherit rules for ordinary users.
|
|
Chris PeBenito |
8fd367 |
base_user_template($1)
|
|
Chris PeBenito |
0c73cd |
|
|
Chris PeBenito |
0c73cd |
typeattribute $1_t privhome; #, admin, web_client_domain, nscd_client_domain;
|
|
Chris PeBenito |
8bd678 |
domain_obj_id_change_exempt($1_t)
|
|
Chris PeBenito |
0c73cd |
role system_r types $1_t;
|
|
Chris PeBenito |
0c73cd |
|
|
Chris PeBenito |
0c73cd |
#ifdef(`direct_sysadm_daemon', `, priv_system_role')
|
|
Chris PeBenito |
0c73cd |
#; dnl end of sysadm_t type declaration
|
|
Chris PeBenito |
0c73cd |
|
|
Chris PeBenito |
0c73cd |
typeattribute $1_devpts_t admin_terminal;
|
|
Chris PeBenito |
0c73cd |
|
|
Chris PeBenito |
0c73cd |
typeattribute $1_tty_device_t admin_terminal;
|
|
Chris PeBenito |
0c73cd |
|
|
Chris PeBenito |
0c73cd |
##############################
|
|
Chris PeBenito |
0c73cd |
#
|
|
Chris PeBenito |
0c73cd |
# $1_t local policy
|
|
Chris PeBenito |
0c73cd |
#
|
|
Chris PeBenito |
0c73cd |
|
|
Chris PeBenito |
0c73cd |
allow $1_t self:capability ~sys_module;
|
|
Chris PeBenito |
0c73cd |
allow $1_t self:process { setexec setfscreate };
|
|
Chris PeBenito |
0c73cd |
|
|
Chris PeBenito |
0c73cd |
# Set password information for other users.
|
|
Chris PeBenito |
0c73cd |
allow $1_t self:passwd { passwd chfn chsh };
|
|
Chris PeBenito |
0c73cd |
|
|
Chris PeBenito |
0c73cd |
# Skip authentication when pam_rootok is specified.
|
|
Chris PeBenito |
0c73cd |
allow $1_t self:passwd rootok;
|
|
Chris PeBenito |
0c73cd |
|
|
Chris PeBenito |
0c73cd |
# Manipulate other users crontab.
|
|
Chris PeBenito |
0c73cd |
allow $1_t self:passwd crontab;
|
|
Chris PeBenito |
0c73cd |
|
|
Chris PeBenito |
0c73cd |
# for the administrator to run TCP servers directly
|
|
Chris PeBenito |
0c73cd |
allow $1_t self:tcp_socket { acceptfrom connectto recvfrom };
|
|
Chris PeBenito |
0c73cd |
|
|
Chris PeBenito |
0c73cd |
allow $1_t $1_devpts_t:chr_file { setattr ioctl read getattr lock write append };
|
|
Chris PeBenito |
0fd9dc |
term_create_pty($1_t,$1_devpts_t)
|
|
Chris PeBenito |
0c73cd |
|
|
Chris PeBenito |
cc41a9 |
allow $1_t $1_tmp_t:dir create_dir_perms;
|
|
Chris PeBenito |
cc41a9 |
allow $1_t $1_tmp_t:file create_file_perms;
|
|
Chris PeBenito |
cc41a9 |
allow $1_t $1_tmp_t:lnk_file create_file_perms;
|
|
Chris PeBenito |
cc41a9 |
allow $1_t $1_tmp_t:fifo_file create_file_perms;
|
|
Chris PeBenito |
cc41a9 |
allow $1_t $1_tmp_t:sock_file create_file_perms;
|
|
Chris PeBenito |
c9428d |
files_create_tmp_files($1_t, $1_tmp_t, { dir notdevfile_class_set })
|
|
Chris PeBenito |
0c73cd |
|
|
Chris PeBenito |
0c73cd |
kernel_read_system_state($1_t)
|
|
Chris PeBenito |
0c73cd |
kernel_read_network_state($1_t)
|
|
Chris PeBenito |
0c73cd |
kernel_read_software_raid_state($1_t)
|
|
Chris PeBenito |
0fd9dc |
kernel_getattr_core($1_t)
|
|
Chris PeBenito |
0fd9dc |
kernel_getattr_message_if($1_t)
|
|
Chris PeBenito |
0c73cd |
kernel_change_ring_buffer_level($1_t)
|
|
Chris PeBenito |
0c73cd |
kernel_clear_ring_buffer($1_t)
|
|
Chris PeBenito |
0c73cd |
kernel_read_ring_buffer($1_t)
|
|
Chris PeBenito |
0c73cd |
kernel_get_sysvipc_info($1_t)
|
|
Chris PeBenito |
0fd9dc |
kernel_rw_all_sysctl($1_t)
|
|
Chris PeBenito |
8fd367 |
|
|
Chris PeBenito |
8fd367 |
# signal unlabeled processes:
|
|
Chris PeBenito |
8fd367 |
kernel_kill_unlabeled($1_t)
|
|
Chris PeBenito |
8fd367 |
kernel_signal_unlabeled($1_t)
|
|
Chris PeBenito |
8fd367 |
kernel_sigstop_unlabeled($1_t)
|
|
Chris PeBenito |
8fd367 |
kernel_signull_unlabeled($1_t)
|
|
Chris PeBenito |
8fd367 |
kernel_sigchld_unlabeled($1_t)
|
|
Chris PeBenito |
8fd367 |
|
|
Chris PeBenito |
5e0da6 |
selinux_set_enforce_mode($1_t)
|
|
Chris PeBenito |
5e0da6 |
selinux_set_boolean($1_t)
|
|
Chris PeBenito |
5e0da6 |
selinux_set_parameters($1_t)
|
|
Chris PeBenito |
0c73cd |
# Get security policy decisions:
|
|
Chris PeBenito |
5e0da6 |
selinux_get_fs_mount($1_t)
|
|
Chris PeBenito |
5e0da6 |
selinux_validate_context($1_t)
|
|
Chris PeBenito |
5e0da6 |
selinux_compute_access_vector($1_t)
|
|
Chris PeBenito |
5e0da6 |
selinux_compute_create_context($1_t)
|
|
Chris PeBenito |
5e0da6 |
selinux_compute_relabel_context($1_t)
|
|
Chris PeBenito |
5e0da6 |
selinux_compute_user_contexts($1_t)
|
|
Chris PeBenito |
0c73cd |
|
|
Chris PeBenito |
0fd9dc |
corenet_tcp_bind_generic_port($1_t)
|
|
Chris PeBenito |
0c73cd |
|
|
Karl MacMillan |
f0c985 |
dev_getattr_generic_blk_file($1_t)
|
|
Karl MacMillan |
f0c985 |
dev_getattr_generic_chr_file($1_t)
|
|
Karl MacMillan |
f0c985 |
dev_getattr_all_blk_files($1_t)
|
|
Karl MacMillan |
f0c985 |
dev_getattr_all_chr_files($1_t)
|
|
Chris PeBenito |
0c73cd |
|
|
Chris PeBenito |
0fd9dc |
fs_getattr_all_fs($1_t)
|
|
Chris PeBenito |
0fd9dc |
fs_set_all_quotas($1_t)
|
|
Chris PeBenito |
0c73cd |
|
|
Chris PeBenito |
0c73cd |
storage_raw_read_removable_device($1_t)
|
|
Chris PeBenito |
0c73cd |
storage_raw_write_removable_device($1_t)
|
|
Chris PeBenito |
0c73cd |
|
|
Chris PeBenito |
0fd9dc |
term_use_console($1_t)
|
|
Chris PeBenito |
0fd9dc |
term_use_unallocated_tty($1_t)
|
|
Chris PeBenito |
0fd9dc |
term_use_all_user_ptys($1_t)
|
|
Chris PeBenito |
0fd9dc |
term_use_all_user_ttys($1_t)
|
|
Chris PeBenito |
0c73cd |
|
|
Chris PeBenito |
0c73cd |
# Manage almost all files
|
|
Chris PeBenito |
c9428d |
auth_manage_all_files_except_shadow($1_t)
|
|
Chris PeBenito |
0c73cd |
# Relabel almost all files
|
|
Chris PeBenito |
c9428d |
auth_relabel_all_files_except_shadow($1_t)
|
|
Chris PeBenito |
0c73cd |
|
|
Chris PeBenito |
c9428d |
domain_setpriority_all_domains($1_t)
|
|
Chris PeBenito |
c9428d |
domain_read_all_domains_state($1_t)
|
|
Chris PeBenito |
0c73cd |
# signal all domains:
|
|
Chris PeBenito |
0c73cd |
domain_kill_all_domains($1_t)
|
|
Chris PeBenito |
0c73cd |
domain_signal_all_domains($1_t)
|
|
Chris PeBenito |
0c73cd |
domain_signull_all_domains($1_t)
|
|
Chris PeBenito |
0c73cd |
domain_sigstop_all_domains($1_t)
|
|
Chris PeBenito |
0c73cd |
domain_sigstop_all_domains($1_t)
|
|
Chris PeBenito |
0c73cd |
domain_sigchld_all_domains($1_t)
|
|
Chris PeBenito |
0c73cd |
|
|
Chris PeBenito |
c9428d |
files_exec_usr_files($1_t)
|
|
Chris PeBenito |
0c73cd |
|
|
Chris PeBenito |
c9428d |
init_use_initctl($1_t)
|
|
Chris PeBenito |
0c73cd |
|
|
Chris PeBenito |
c9428d |
logging_send_syslog_msg($1_t)
|
|
Chris PeBenito |
0c73cd |
|
|
Chris PeBenito |
c9428d |
modutils_domtrans_insmod($1_t)
|
|
Chris PeBenito |
0c73cd |
|
|
Chris PeBenito |
5e0da6 |
seutil_read_config($1_t)
|
|
Chris PeBenito |
0c73cd |
# The following rule is temporary until such time that a complete
|
|
Chris PeBenito |
0c73cd |
# policy management infrastructure is in place so that an administrator
|
|
Chris PeBenito |
0c73cd |
# cannot directly manipulate policy files with arbitrary programs.
|
|
Chris PeBenito |
5e0da6 |
seutil_manage_src_pol($1_t)
|
|
Chris PeBenito |
0c73cd |
# Violates the goal of limiting write access to checkpolicy.
|
|
Chris PeBenito |
0c73cd |
# But presently necessary for installing the file_contexts file.
|
|
Chris PeBenito |
5e0da6 |
seutil_manage_binary_pol($1_t)
|
|
Chris PeBenito |
0c73cd |
|
|
Chris PeBenito |
0c73cd |
optional_policy(`cron.te',`
|
|
Chris PeBenito |
0c73cd |
cron_admin_template($1)
|
|
Chris PeBenito |
0c73cd |
')
|
|
Chris PeBenito |
0c73cd |
|
|
Chris PeBenito |
0c73cd |
ifdef(`TODO',`
|
|
Chris PeBenito |
0c73cd |
|
|
Chris PeBenito |
0c73cd |
# Let admin stat the shadow file.
|
|
Chris PeBenito |
0c73cd |
allow $1_t shadow_t:file getattr;
|
|
Chris PeBenito |
0c73cd |
|
|
Chris PeBenito |
0c73cd |
# for lsof
|
|
Chris PeBenito |
0c73cd |
allow $1_t mtrr_device_t:file getattr;
|
|
Chris PeBenito |
0c73cd |
|
|
Chris PeBenito |
0c73cd |
allow $1_t serial_device:chr_file setattr;
|
|
Chris PeBenito |
0c73cd |
|
|
Chris PeBenito |
0c73cd |
# allow setting up tunnels
|
|
Chris PeBenito |
0c73cd |
allow $1_t tun_tap_device_t:chr_file rw_file_perms;
|
|
Chris PeBenito |
0c73cd |
|
|
Chris PeBenito |
0c73cd |
allow $1_t ptyfile:chr_file getattr;
|
|
Chris PeBenito |
0c73cd |
|
|
Chris PeBenito |
0c73cd |
# Run programs from staff home directories.
|
|
Chris PeBenito |
0c73cd |
# Not ideal, but typical if users want to login as both sysadm_t or staff_t.
|
|
Chris PeBenito |
0c73cd |
can_exec($1_t, staff_home_t)
|
|
Chris PeBenito |
0c73cd |
|
|
Chris PeBenito |
0c73cd |
# Run admin programs that require different permissions in their own domain.
|
|
Chris PeBenito |
0c73cd |
# These rules were moved into the appropriate program domain file.
|
|
Chris PeBenito |
0c73cd |
|
|
Chris PeBenito |
0c73cd |
ifdef(`startx.te', `
|
|
Chris PeBenito |
0c73cd |
ifdef(`xserver.te', `
|
|
Chris PeBenito |
0c73cd |
# Create files in /tmp/.X11-unix with our X servers derived
|
|
Chris PeBenito |
0c73cd |
# tmp type rather than user_xserver_tmp_t.
|
|
Chris PeBenito |
0c73cd |
file_type_auto_trans($1_xserver_t, xserver_tmpfile, $1_xserver_tmp_t, sock_file)
|
|
Chris PeBenito |
0c73cd |
')
|
|
Chris PeBenito |
0c73cd |
')
|
|
Chris PeBenito |
0c73cd |
|
|
Chris PeBenito |
0c73cd |
ifdef(`xdm.te', `
|
|
Chris PeBenito |
0c73cd |
ifdef(`xauth.te', `
|
|
Chris PeBenito |
3eed10 |
tunable_policy(`xdm_sysadm_login',`
|
|
Chris PeBenito |
0c73cd |
allow xdm_t $1_home_t:lnk_file read;
|
|
Chris PeBenito |
0c73cd |
allow xdm_t $1_home_t:dir search;
|
|
Chris PeBenito |
3eed10 |
')
|
|
Chris PeBenito |
0c73cd |
allow $1_t xdm_t:fifo_file rw_file_perms;
|
|
Chris PeBenito |
0c73cd |
')
|
|
Chris PeBenito |
0c73cd |
')
|
|
Chris PeBenito |
0c73cd |
|
|
Chris PeBenito |
0c73cd |
#
|
|
Chris PeBenito |
0c73cd |
# A user who is authorized for sysadm_t may nonetheless have
|
|
Chris PeBenito |
0c73cd |
# a home directory labeled with user_home_t if the user is expected
|
|
Chris PeBenito |
0c73cd |
# to login in either user_t or sysadm_t. Hence, the derived domains
|
|
Chris PeBenito |
0c73cd |
# for programs need to be able to access user_home_t.
|
|
Chris PeBenito |
0c73cd |
#
|
|
Chris PeBenito |
4d8ddf |
|
|
Chris PeBenito |
0c73cd |
# Allow our gph domain to write to .xsession-errors.
|
|
Chris PeBenito |
0c73cd |
ifdef(`gnome-pty-helper.te', `
|
|
Chris PeBenito |
0c73cd |
allow $1_gph_t user_home_dir_type:dir rw_dir_perms;
|
|
Chris PeBenito |
0c73cd |
allow $1_gph_t user_home_type:file create_file_perms;
|
|
Chris PeBenito |
0c73cd |
')
|
|
Chris PeBenito |
4d8ddf |
|
|
Chris PeBenito |
0c73cd |
# for the administrator to run TCP servers directly
|
|
Chris PeBenito |
0c73cd |
allow $1_t kernel_t:tcp_socket recvfrom;
|
|
Chris PeBenito |
4d8ddf |
|
|
Chris PeBenito |
0c73cd |
# Connect data port to ftpd.
|
|
Chris PeBenito |
0c73cd |
ifdef(`ftpd.te', `can_tcp_connect(ftpd_t, $1_t)')
|
|
Chris PeBenito |
4d8ddf |
|
|
Chris PeBenito |
0c73cd |
# Connect second port to rshd.
|
|
Chris PeBenito |
0c73cd |
ifdef(`rshd.te', `can_tcp_connect(rshd_t, $1_t)')
|
|
Chris PeBenito |
0c73cd |
|
|
Chris PeBenito |
0c73cd |
# Allow MAKEDEV to work
|
|
Chris PeBenito |
0c73cd |
allow $1_t device_t:dir rw_dir_perms;
|
|
Chris PeBenito |
0c73cd |
allow $1_t device_type:{ blk_file chr_file } { create unlink rename };
|
|
Chris PeBenito |
0c73cd |
allow $1_t device_t:lnk_file { create read };
|
|
Chris PeBenito |
4d8ddf |
|
|
Chris PeBenito |
0c73cd |
# for lsof
|
|
Chris PeBenito |
0c73cd |
allow $1_t domain:socket_class_set getattr;
|
|
Chris PeBenito |
0c73cd |
allow $1_t eventpollfs_t:file getattr;
|
|
Chris PeBenito |
0c73cd |
') dnl endif TODO
|
|
Chris PeBenito |
4d8ddf |
')
|
|
Chris PeBenito |
490639 |
|
|
Chris PeBenito |
daa0e0 |
########################################
|
|
Chris PeBenito |
ab940a |
## <summary>
|
|
Chris PeBenito |
414e41 |
## Execute a shell in all user domains. This
|
|
Chris PeBenito |
414e41 |
## is an explicit transition, requiring the
|
|
Chris PeBenito |
414e41 |
## caller to use setexeccon().
|
|
Chris PeBenito |
ab940a |
## </summary>
|
|
Chris PeBenito |
414e41 |
## <param name="domain">
|
|
Chris PeBenito |
414e41 |
## The type of the process performing this action.
|
|
Chris PeBenito |
414e41 |
## </param>
|
|
Chris PeBenito |
4bf4ed |
#
|
|
Chris PeBenito |
199895 |
interface(`userdom_spec_domtrans_all_users',`
|
|
Chris PeBenito |
21871a |
gen_require(`
|
|
Chris PeBenito |
21871a |
attribute userdomain;
|
|
Chris PeBenito |
21871a |
')
|
|
Chris PeBenito |
21871a |
|
|
Chris PeBenito |
c9428d |
corecmd_shell_spec_domtrans($1,userdomain)
|
|
Chris PeBenito |
4bf4ed |
')
|
|
Chris PeBenito |
4bf4ed |
|
|
Chris PeBenito |
21871a |
########################################
|
|
Chris PeBenito |
ab940a |
## <summary>
|
|
Chris PeBenito |
414e41 |
## Execute a shell in all unprivileged user domains. This
|
|
Chris PeBenito |
414e41 |
## is an explicit transition, requiring the
|
|
Chris PeBenito |
414e41 |
## caller to use setexeccon().
|
|
Chris PeBenito |
ab940a |
## </summary>
|
|
Chris PeBenito |
414e41 |
## <param name="domain">
|
|
Chris PeBenito |
414e41 |
## The type of the process performing this action.
|
|
Chris PeBenito |
414e41 |
## </param>
|
|
Chris PeBenito |
21871a |
#
|
|
Chris PeBenito |
199895 |
interface(`userdom_spec_domtrans_unpriv_users',`
|
|
Chris PeBenito |
21871a |
gen_require(`
|
|
Chris PeBenito |
21871a |
attribute unpriv_userdomain;
|
|
Chris PeBenito |
21871a |
')
|
|
Chris PeBenito |
21871a |
|
|
Chris PeBenito |
21871a |
corecmd_shell_spec_domtrans($1,unpriv_userdomain)
|
|
Chris PeBenito |
4bf4ed |
')
|
|
Chris PeBenito |
4bf4ed |
|
|
Chris PeBenito |
4bf4ed |
########################################
|
|
Chris PeBenito |
ab940a |
## <summary>
|
|
Chris PeBenito |
414e41 |
## Execute a shell in the sysadm domain.
|
|
Chris PeBenito |
ab940a |
## </summary>
|
|
Chris PeBenito |
414e41 |
## <param name="domain">
|
|
Chris PeBenito |
414e41 |
## The type of the process performing this action.
|
|
Chris PeBenito |
414e41 |
## </param>
|
|
Chris PeBenito |
d490eb |
#
|
|
Chris PeBenito |
199895 |
interface(`userdom_shell_domtrans_sysadm',`
|
|
Chris PeBenito |
cbc9d6 |
gen_require(`
|
|
Chris PeBenito |
cbc9d6 |
type sysadm_t;
|
|
Chris PeBenito |
cbc9d6 |
')
|
|
Chris PeBenito |
0c73cd |
|
|
Chris PeBenito |
c9428d |
corecmd_domtrans_shell($1,sysadm_t)
|
|
Chris PeBenito |
d490eb |
')
|
|
Chris PeBenito |
d490eb |
|
|
Chris PeBenito |
d490eb |
########################################
|
|
Chris PeBenito |
ab940a |
## <summary>
|
|
Chris PeBenito |
fd89e1 |
## Read files in the staff users home directory.
|
|
Chris PeBenito |
fd89e1 |
## </summary>
|
|
Chris PeBenito |
fd89e1 |
## <param name="domain">
|
|
Chris PeBenito |
fd89e1 |
## The type of the process performing this action.
|
|
Chris PeBenito |
fd89e1 |
## </param>
|
|
Chris PeBenito |
fd89e1 |
#
|
|
Chris PeBenito |
fd89e1 |
interface(`userdom_read_staff_home_files',`
|
|
Chris PeBenito |
fd89e1 |
gen_require(`
|
|
Chris PeBenito |
fd89e1 |
type staff_home_dir_t, staff_home_t;
|
|
Chris PeBenito |
fd89e1 |
class dir r_dir_perms;
|
|
Chris PeBenito |
fd89e1 |
class file r_file_perms;
|
|
Chris PeBenito |
fd89e1 |
class lnk_file r_file_perms;
|
|
Chris PeBenito |
fd89e1 |
')
|
|
Chris PeBenito |
fd89e1 |
|
|
Chris PeBenito |
fd89e1 |
files_search_home($1)
|
|
Chris PeBenito |
fd89e1 |
allow $1 { staff_home_dir_t staff_home_t }:dir r_dir_perms;
|
|
Chris PeBenito |
fd89e1 |
allow $1 staff_home_t:{ file lnk_file } r_file_perms;
|
|
Chris PeBenito |
fd89e1 |
')
|
|
Chris PeBenito |
fd89e1 |
|
|
Chris PeBenito |
fd89e1 |
########################################
|
|
Chris PeBenito |
fd89e1 |
## <summary>
|
|
Chris PeBenito |
414e41 |
## Read and write sysadm ttys.
|
|
Chris PeBenito |
ab940a |
## </summary>
|
|
Chris PeBenito |
414e41 |
## <param name="domain">
|
|
Chris PeBenito |
414e41 |
## The type of the process performing this action.
|
|
Chris PeBenito |
414e41 |
## </param>
|
|
Chris PeBenito |
490639 |
#
|
|
Chris PeBenito |
199895 |
interface(`userdom_use_sysadm_tty',`
|
|
Chris PeBenito |
0404a3 |
gen_require(`
|
|
Chris PeBenito |
0404a3 |
type sysadm_tty_device_t;
|
|
Chris PeBenito |
fd89e1 |
class chr_file rw_term_perms;
|
|
Chris PeBenito |
fd89e1 |
')
|
|
Chris PeBenito |
fd89e1 |
|
|
Chris PeBenito |
fd89e1 |
dev_list_all_dev_nodes($1)
|
|
Chris PeBenito |
fd89e1 |
term_list_ptys($1)
|
|
Chris PeBenito |
fd89e1 |
allow $1 sysadm_tty_device_t:chr_file rw_term_perms;
|
|
Chris PeBenito |
fd89e1 |
')
|
|
Chris PeBenito |
fd89e1 |
|
|
Chris PeBenito |
fd89e1 |
########################################
|
|
Chris PeBenito |
fd89e1 |
## <summary>
|
|
Chris PeBenito |
fd89e1 |
## Read and write sysadm ptys.
|
|
Chris PeBenito |
fd89e1 |
## </summary>
|
|
Chris PeBenito |
fd89e1 |
## <param name="domain">
|
|
Chris PeBenito |
fd89e1 |
## The type of the process performing this action.
|
|
Chris PeBenito |
fd89e1 |
## </param>
|
|
Chris PeBenito |
fd89e1 |
#
|
|
Chris PeBenito |
fd89e1 |
interface(`userdom_use_sysadm_pty',`
|
|
Chris PeBenito |
fd89e1 |
gen_require(`
|
|
Chris PeBenito |
fd89e1 |
type sysadm_devpts_t;
|
|
Chris PeBenito |
fd89e1 |
class chr_file rw_term_perms;
|
|
Chris PeBenito |
0404a3 |
')
|
|
Chris PeBenito |
0c73cd |
|
|
Karl MacMillan |
f0c985 |
dev_list_all_dev_nodes($1)
|
|
Chris PeBenito |
0fd9dc |
term_list_ptys($1)
|
|
Chris PeBenito |
fd89e1 |
allow $1 sysadm_devpts_t:chr_file rw_term_perms;
|
|
Chris PeBenito |
daa0e0 |
')
|
|
Chris PeBenito |
daa0e0 |
|
|
Chris PeBenito |
0404a3 |
########################################
|
|
Chris PeBenito |
ab940a |
## <summary>
|
|
Chris PeBenito |
414e41 |
## Read and write sysadm ttys and ptys.
|
|
Chris PeBenito |
ab940a |
## </summary>
|
|
Chris PeBenito |
414e41 |
## <param name="domain">
|
|
Chris PeBenito |
414e41 |
## The type of the process performing this action.
|
|
Chris PeBenito |
414e41 |
## </param>
|
|
Chris PeBenito |
0404a3 |
#
|
|
Chris PeBenito |
199895 |
interface(`userdom_use_sysadm_terms',`
|
|
Chris PeBenito |
0404a3 |
gen_require(`
|
|
Chris PeBenito |
0404a3 |
attribute admin_terminal;
|
|
Chris PeBenito |
fd89e1 |
class chr_file rw_term_perms;
|
|
Chris PeBenito |
0404a3 |
')
|
|
Chris PeBenito |
0c73cd |
|
|
Chris PeBenito |
0404a3 |
dev_list_all_dev_nodes($1)
|
|
Chris PeBenito |
0404a3 |
term_list_ptys($1)
|
|
Chris PeBenito |
fd89e1 |
allow $1 admin_terminal:chr_file rw_term_perms;
|
|
Chris PeBenito |
daa0e0 |
')
|
|
Chris PeBenito |
daa0e0 |
|
|
Chris PeBenito |
daa0e0 |
########################################
|
|
Chris PeBenito |
ab940a |
## <summary>
|
|
Chris PeBenito |
414e41 |
## Do not audit attempts to use admin ttys and ptys.
|
|
Chris PeBenito |
ab940a |
## </summary>
|
|
Chris PeBenito |
414e41 |
## <param name="domain">
|
|
Chris PeBenito |
414e41 |
## The type of the process performing this action.
|
|
Chris PeBenito |
414e41 |
## </param>
|
|
Chris PeBenito |
763c44 |
#
|
|
Chris PeBenito |
199895 |
interface(`userdom_dontaudit_use_sysadm_terms',`
|
|
Chris PeBenito |
0404a3 |
gen_require(`
|
|
Chris PeBenito |
0404a3 |
attribute admin_terminal;
|
|
Chris PeBenito |
0404a3 |
class chr_file { read write };
|
|
Chris PeBenito |
0404a3 |
')
|
|
Chris PeBenito |
763c44 |
|
|
Chris PeBenito |
763c44 |
dontaudit $1 admin_terminal:chr_file { read write };
|
|
Chris PeBenito |
763c44 |
')
|
|
Chris PeBenito |
763c44 |
|
|
Chris PeBenito |
763c44 |
########################################
|
|
Chris PeBenito |
ab940a |
## <summary>
|
|
Chris PeBenito |
fd89e1 |
## Inherit and use sysadm file descriptors
|
|
Chris PeBenito |
fd89e1 |
## </summary>
|
|
Chris PeBenito |
fd89e1 |
## <param name="domain">
|
|
Chris PeBenito |
fd89e1 |
## The type of the process performing this action.
|
|
Chris PeBenito |
fd89e1 |
## </param>
|
|
Chris PeBenito |
fd89e1 |
#
|
|
Chris PeBenito |
fd89e1 |
interface(`userdom_use_sysadm_fd',`
|
|
Chris PeBenito |
fd89e1 |
gen_require(`
|
|
Chris PeBenito |
fd89e1 |
type sysadm_t;
|
|
Chris PeBenito |
fd89e1 |
class fd use;
|
|
Chris PeBenito |
fd89e1 |
')
|
|
Chris PeBenito |
fd89e1 |
|
|
Chris PeBenito |
fd89e1 |
allow $1 sysadm_t:fd use;
|
|
Chris PeBenito |
fd89e1 |
')
|
|
Chris PeBenito |
fd89e1 |
|
|
Chris PeBenito |
fd89e1 |
########################################
|
|
Chris PeBenito |
fd89e1 |
## <summary>
|
|
Chris PeBenito |
fd89e1 |
## Read and write sysadm user unnamed pipes.
|
|
Chris PeBenito |
fd89e1 |
## </summary>
|
|
Chris PeBenito |
fd89e1 |
## <param name="domain">
|
|
Chris PeBenito |
fd89e1 |
## The type of the process performing this action.
|
|
Chris PeBenito |
fd89e1 |
## </param>
|
|
Chris PeBenito |
fd89e1 |
#
|
|
Chris PeBenito |
fd89e1 |
interface(`userdom_rw_sysadm_pipe',`
|
|
Chris PeBenito |
fd89e1 |
gen_require(`
|
|
Chris PeBenito |
fd89e1 |
type sysadm_t;
|
|
Chris PeBenito |
fd89e1 |
class fd use;
|
|
Chris PeBenito |
fd89e1 |
')
|
|
Chris PeBenito |
fd89e1 |
|
|
Chris PeBenito |
fd89e1 |
allow $1 sysadm_t:fd use;
|
|
Chris PeBenito |
fd89e1 |
')
|
|
Chris PeBenito |
fd89e1 |
|
|
Chris PeBenito |
fd89e1 |
########################################
|
|
Chris PeBenito |
fd89e1 |
## <summary>
|
|
Chris PeBenito |
fd89e1 |
## Read files in the sysadm users home directory.
|
|
Chris PeBenito |
fd89e1 |
## </summary>
|
|
Chris PeBenito |
fd89e1 |
## <param name="domain">
|
|
Chris PeBenito |
fd89e1 |
## The type of the process performing this action.
|
|
Chris PeBenito |
fd89e1 |
## </param>
|
|
Chris PeBenito |
fd89e1 |
#
|
|
Chris PeBenito |
fd89e1 |
interface(`userdom_read_sysadm_home_files',`
|
|
Chris PeBenito |
fd89e1 |
gen_require(`
|
|
Chris PeBenito |
fd89e1 |
type sysadm_home_dir_t, sysadm_home_t;
|
|
Chris PeBenito |
fd89e1 |
class dir r_dir_perms;
|
|
Chris PeBenito |
fd89e1 |
class file r_file_perms;
|
|
Chris PeBenito |
fd89e1 |
class lnk_file r_file_perms;
|
|
Chris PeBenito |
fd89e1 |
')
|
|
Chris PeBenito |
fd89e1 |
|
|
Chris PeBenito |
fd89e1 |
files_search_home($1)
|
|
Chris PeBenito |
fd89e1 |
allow $1 { sysadm_home_dir_t sysadm_home_t }:dir r_dir_perms;
|
|
Chris PeBenito |
fd89e1 |
allow $1 sysadm_home_t:{ file lnk_file } r_file_perms;
|
|
Chris PeBenito |
fd89e1 |
')
|
|
Chris PeBenito |
fd89e1 |
|
|
Chris PeBenito |
fd89e1 |
########################################
|
|
Chris PeBenito |
fd89e1 |
## <summary>
|
|
Chris PeBenito |
414e41 |
## Search all users home directories.
|
|
Chris PeBenito |
ab940a |
## </summary>
|
|
Chris PeBenito |
414e41 |
## <param name="domain">
|
|
Chris PeBenito |
414e41 |
## The type of the process performing this action.
|
|
Chris PeBenito |
414e41 |
## </param>
|
|
Chris PeBenito |
4bf4ed |
#
|
|
Chris PeBenito |
199895 |
interface(`userdom_search_all_users_home',`
|
|
Chris PeBenito |
0404a3 |
gen_require(`
|
|
Chris PeBenito |
0404a3 |
attribute home_dir_type, home_type;
|
|
Chris PeBenito |
0404a3 |
class dir search;
|
|
Chris PeBenito |
0404a3 |
')
|
|
Chris PeBenito |
0c73cd |
|
|
Chris PeBenito |
c9428d |
files_list_home($1)
|
|
Chris PeBenito |
0c73cd |
allow $1 { home_dir_type home_type }:dir search;
|
|
Chris PeBenito |
4bf4ed |
')
|
|
Chris PeBenito |
4bf4ed |
|
|
Chris PeBenito |
4bf4ed |
########################################
|
|
Chris PeBenito |
ab940a |
## <summary>
|
|
Chris PeBenito |
414e41 |
## Read all files in all users home directories.
|
|
Chris PeBenito |
ab940a |
## </summary>
|
|
Chris PeBenito |
414e41 |
## <param name="domain">
|
|
Chris PeBenito |
414e41 |
## The type of the process performing this action.
|
|
Chris PeBenito |
414e41 |
## </param>
|
|
Chris PeBenito |
daa0e0 |
#
|
|
Chris PeBenito |
fd89e1 |
interface(`userdom_read_all_user_files',`
|
|
Chris PeBenito |
0404a3 |
gen_require(`
|
|
Chris PeBenito |
0404a3 |
attribute home_type;
|
|
Chris PeBenito |
0404a3 |
class dir r_dir_perms;
|
|
Chris PeBenito |
0404a3 |
class file r_file_perms;
|
|
Chris PeBenito |
0404a3 |
')
|
|
Chris PeBenito |
0c73cd |
|
|
Chris PeBenito |
c9428d |
files_list_home($1)
|
|
Chris PeBenito |
cc41a9 |
allow $1 home_type:dir r_dir_perms;
|
|
Chris PeBenito |
0fd9dc |
allow $1 home_type:file r_file_perms;
|
|
Chris PeBenito |
daa0e0 |
')
|
|
Chris PeBenito |
daa0e0 |
|
|
Chris PeBenito |
daa0e0 |
########################################
|
|
Chris PeBenito |
ab940a |
## <summary>
|
|
Chris PeBenito |
ab940a |
## Write all unprivileged users files in /tmp
|
|
Chris PeBenito |
ab940a |
## </summary>
|
|
Chris PeBenito |
ab940a |
## <param name="domain">
|
|
Chris PeBenito |
ab940a |
## The type of the process performing this action.
|
|
Chris PeBenito |
ab940a |
## </param>
|
|
Chris PeBenito |
ab940a |
#
|
|
Chris PeBenito |
ab940a |
interface(`userdom_write_unpriv_user_tmp',`
|
|
Chris PeBenito |
ab940a |
gen_require(`
|
|
Chris PeBenito |
ab940a |
attribute user_tmpfile;
|
|
Chris PeBenito |
ab940a |
class file { getattr write append };
|
|
Chris PeBenito |
ab940a |
')
|
|
Chris PeBenito |
ab940a |
|
|
Chris PeBenito |
ab940a |
allow $1 user_tmpfile:file { getattr write append };
|
|
Chris PeBenito |
ab940a |
')
|
|
Chris PeBenito |
ab940a |
|
|
Chris PeBenito |
ab940a |
########################################
|
|
Chris PeBenito |
ab940a |
## <summary>
|
|
Chris PeBenito |
414e41 |
## Inherit the file descriptors from all user domains
|
|
Chris PeBenito |
ab940a |
## </summary>
|
|
Chris PeBenito |
414e41 |
## <param name="domain">
|
|
Chris PeBenito |
414e41 |
## The type of the process performing this action.
|
|
Chris PeBenito |
414e41 |
## </param>
|
|
Chris PeBenito |
490639 |
#
|
|
Chris PeBenito |
199895 |
interface(`userdom_use_all_user_fd',`
|
|
Chris PeBenito |
0404a3 |
gen_require(`
|
|
Chris PeBenito |
0404a3 |
attribute userdomain;
|
|
Chris PeBenito |
0404a3 |
class fd use;
|
|
Chris PeBenito |
0404a3 |
')
|
|
Chris PeBenito |
0c73cd |
|
|
Chris PeBenito |
0c73cd |
allow $1 userdomain:fd use;
|
|
Chris PeBenito |
490639 |
')
|
|
Chris PeBenito |
490639 |
|
|
Chris PeBenito |
daa0e0 |
########################################
|
|
Chris PeBenito |
ab940a |
## <summary>
|
|
Chris PeBenito |
414e41 |
## Send general signals to all user domains.
|
|
Chris PeBenito |
ab940a |
## </summary>
|
|
Chris PeBenito |
414e41 |
## <param name="domain">
|
|
Chris PeBenito |
414e41 |
## The type of the process performing this action.
|
|
Chris PeBenito |
414e41 |
## </param>
|
|
Chris PeBenito |
4bf4ed |
#
|
|
Chris PeBenito |
199895 |
interface(`userdom_signal_all_users',`
|
|
Chris PeBenito |
0404a3 |
gen_require(`
|
|
Chris PeBenito |
0404a3 |
attribute userdomain;
|
|
Chris PeBenito |
0404a3 |
class process signal;
|
|
Chris PeBenito |
0404a3 |
')
|
|
Chris PeBenito |
0c73cd |
|
|
Chris PeBenito |
0c73cd |
allow $1 userdomain:process signal;
|
|
Chris PeBenito |
4bf4ed |
')
|
|
Chris PeBenito |
4bf4ed |
|
|
Chris PeBenito |
0404a3 |
########################################
|
|
Chris PeBenito |
ab940a |
## <summary>
|
|
Chris PeBenito |
414e41 |
## Send general signals to unprivileged user domains.
|
|
Chris PeBenito |
ab940a |
## </summary>
|
|
Chris PeBenito |
414e41 |
## <param name="domain">
|
|
Chris PeBenito |
414e41 |
## The type of the process performing this action.
|
|
Chris PeBenito |
414e41 |
## </param>
|
|
Chris PeBenito |
0404a3 |
#
|
|
Chris PeBenito |
199895 |
interface(`userdom_signal_unpriv_users',`
|
|
Chris PeBenito |
0404a3 |
gen_require(`
|
|
Chris PeBenito |
0404a3 |
attribute unpriv_userdomain;
|
|
Chris PeBenito |
0404a3 |
class process signal;
|
|
Chris PeBenito |
0404a3 |
')
|
|
Chris PeBenito |
0c73cd |
|
|
Chris PeBenito |
0404a3 |
allow $1 unpriv_userdomain:process signal;
|
|
Chris PeBenito |
4bf4ed |
')
|
|
Chris PeBenito |
4bf4ed |
|
|
Chris PeBenito |
4bf4ed |
########################################
|
|
Chris PeBenito |
ab940a |
## <summary>
|
|
Chris PeBenito |
ab940a |
## Inherit the file descriptors from unprivileged user domains.
|
|
Chris PeBenito |
ab940a |
## </summary>
|
|
Chris PeBenito |
414e41 |
## <param name="domain">
|
|
Chris PeBenito |
414e41 |
## The type of the process performing this action.
|
|
Chris PeBenito |
414e41 |
## </param>
|
|
Chris PeBenito |
daa0e0 |
#
|
|
Chris PeBenito |
199895 |
interface(`userdom_use_unpriv_users_fd',`
|
|
Chris PeBenito |
0404a3 |
gen_require(`
|
|
Chris PeBenito |
0404a3 |
attribute unpriv_userdomain;
|
|
Chris PeBenito |
0404a3 |
class fd use;
|
|
Chris PeBenito |
0404a3 |
')
|
|
Chris PeBenito |
0c73cd |
|
|
Chris PeBenito |
0c73cd |
allow $1 unpriv_userdomain:fd use;
|
|
Chris PeBenito |
daa0e0 |
')
|
|
Chris PeBenito |
daa0e0 |
|
|
Chris PeBenito |
daa0e0 |
########################################
|
|
Chris PeBenito |
ab940a |
## <summary>
|
|
Chris PeBenito |
414e41 |
## Do not audit attempts to inherit the
|
|
Chris PeBenito |
414e41 |
## file descriptors from all user domains.
|
|
Chris PeBenito |
ab940a |
## </summary>
|
|
Chris PeBenito |
414e41 |
## <param name="domain">
|
|
Chris PeBenito |
414e41 |
## The type of the process performing this action.
|
|
Chris PeBenito |
414e41 |
## </param>
|
|
Chris PeBenito |
daa0e0 |
#
|
|
Chris PeBenito |
199895 |
interface(`userdom_dontaudit_use_unpriv_user_fd',`
|
|
Chris PeBenito |
0404a3 |
gen_require(`
|
|
Chris PeBenito |
0404a3 |
attribute unpriv_userdomain;
|
|
Chris PeBenito |
0404a3 |
class fd use;
|
|
Chris PeBenito |
0404a3 |
')
|
|
Chris PeBenito |
0c73cd |
|
|
Chris PeBenito |
0c73cd |
dontaudit $1 unpriv_userdomain:fd use;
|
|
Chris PeBenito |
daa0e0 |
')
|
|
Chris PeBenito |
daa0e0 |
|
|
Chris PeBenito |
ebdc3b |
########################################
|
|
Chris PeBenito |
ebdc3b |
## <summary>
|
|
Chris PeBenito |
ebdc3b |
## Do not audit attempts to use unprivileged
|
|
Chris PeBenito |
ebdc3b |
## user ttys.
|
|
Chris PeBenito |
ebdc3b |
## </summary>
|
|
Chris PeBenito |
ebdc3b |
## <param name="domain">
|
|
Chris PeBenito |
ebdc3b |
## The type of the process performing this action.
|
|
Chris PeBenito |
ebdc3b |
## </param>
|
|
Chris PeBenito |
ebdc3b |
#
|
|
Chris PeBenito |
ebdc3b |
interface(`userdom_dontaudit_use_unpriv_user_tty',`
|
|
Chris PeBenito |
ebdc3b |
gen_require(`
|
|
Chris PeBenito |
ebdc3b |
attribute user_ttynode;
|
|
Chris PeBenito |
ebdc3b |
class chr_file rw_file_perms;
|
|
Chris PeBenito |
ebdc3b |
')
|
|
Chris PeBenito |
ebdc3b |
|
|
Chris PeBenito |
ebdc3b |
dontaudit $1 user_ttynode:chr_file rw_file_perms;
|
|
Chris PeBenito |
ebdc3b |
')
|