Chris PeBenito 0fbfa5
#DESC User - Domains for ordinary users.
Chris PeBenito 0fbfa5
#
Chris PeBenito 0fbfa5
#################################
Chris PeBenito 0fbfa5
Chris PeBenito 0fbfa5
# Booleans for user domains.
Chris PeBenito 0fbfa5
Chris PeBenito 0fbfa5
# Allow users to read system messages.
Chris PeBenito 0fbfa5
bool user_dmesg false;
Chris PeBenito 0fbfa5
Chris PeBenito 0fbfa5
# Support NFS home directories
Chris PeBenito 0fbfa5
bool use_nfs_home_dirs false;
Chris PeBenito 0fbfa5
Chris PeBenito 0fbfa5
# Allow execution of anonymous mappings, e.g. executable stack.
Chris PeBenito 0fbfa5
bool allow_execmem false;
Chris PeBenito 0fbfa5
Chris PeBenito 0fbfa5
# Support Share libraries with Text Relocation
Chris PeBenito 0fbfa5
bool allow_execmod false;
Chris PeBenito 0fbfa5
Chris PeBenito 0fbfa5
# Support SAMBA home directories
Chris PeBenito 0fbfa5
bool use_samba_home_dirs false;
Chris PeBenito 0fbfa5
Chris PeBenito 0fbfa5
# Allow users to run TCP servers (bind to ports and accept connection from
Chris PeBenito 0fbfa5
# the same domain and outside users)  disabling this forces FTP passive mode
Chris PeBenito 0fbfa5
# and may change other protocols 
Chris PeBenito 0fbfa5
bool user_tcp_server false;
Chris PeBenito 0fbfa5
Chris PeBenito 0fbfa5
# Allow system to run with NIS
Chris PeBenito 0fbfa5
bool allow_ypbind false;
Chris PeBenito 0fbfa5
Chris PeBenito 0fbfa5
# Allow system to run with kerberos
Chris PeBenito 0fbfa5
bool allow_kerberos false;
Chris PeBenito 0fbfa5
Chris PeBenito 0fbfa5
# Allow users to rw usb devices
Chris PeBenito 0fbfa5
bool user_rw_usb false;
Chris PeBenito 0fbfa5
Chris PeBenito 0fbfa5
# Allow users to control network interfaces (also needs USERCTL=true)
Chris PeBenito 0fbfa5
bool user_net_control false;
Chris PeBenito 0fbfa5
Chris PeBenito 0fbfa5
# Allow regular users direct mouse access 
Chris PeBenito 0fbfa5
bool user_direct_mouse false;
Chris PeBenito 0fbfa5
Chris PeBenito 0fbfa5
# Allow user to r/w noextattrfile (FAT, CDROM, FLOPPY)
Chris PeBenito 0fbfa5
bool user_rw_noexattrfile false;
Chris PeBenito 0fbfa5
Chris PeBenito 0fbfa5
# Allow reading of default_t files.
Chris PeBenito 0fbfa5
bool read_default_t false;
Chris PeBenito 0fbfa5
Chris PeBenito 0fbfa5
# Allow staff_r users to search the sysadm home dir and read
Chris PeBenito 0fbfa5
# files (such as ~/.bashrc)
Chris PeBenito 0fbfa5
bool staff_read_sysadm_file false;
Chris PeBenito 0fbfa5
Chris PeBenito 0fbfa5
# change from role $1_r to $2_r and relabel tty appropriately
Chris PeBenito 0fbfa5
define(`role_tty_type_change', `
Chris PeBenito 0fbfa5
allow $1_r $2_r;
Chris PeBenito 0fbfa5
type_change $2_t $1_devpts_t:chr_file $2_devpts_t;
Chris PeBenito 0fbfa5
type_change $2_t $1_tty_device_t:chr_file $2_tty_device_t;
Chris PeBenito 0fbfa5
# avoid annoying messages on terminal hangup
Chris PeBenito 0fbfa5
dontaudit $1_t { $2_devpts_t $2_tty_device_t }:chr_file ioctl;
Chris PeBenito 0fbfa5
')
Chris PeBenito 0fbfa5
Chris PeBenito 0fbfa5
# Reach sysadm_t via programs like userhelper/sudo/su
Chris PeBenito 0fbfa5
undefine(`reach_sysadm')
Chris PeBenito 0fbfa5
define(`reach_sysadm', `
Chris PeBenito 0fbfa5
ifdef(`userhelper.te', `userhelper_domain($1)')
Chris PeBenito 0fbfa5
ifdef(`sudo.te', `sudo_domain($1)')
Chris PeBenito 0fbfa5
ifdef(`su.te', `
Chris PeBenito 0fbfa5
su_domain($1)
Chris PeBenito 0fbfa5
# When an ordinary user domain runs su, su may try to
Chris PeBenito 0fbfa5
# update the /root/.Xauthority file, and the user shell may
Chris PeBenito 0fbfa5
# try to update the shell history. This is not allowed, but 
Chris PeBenito 0fbfa5
# we dont need to audit it.
Chris PeBenito 0fbfa5
dontaudit $1_su_t { sysadm_home_dir_t staff_home_dir_t }:dir search;
Chris PeBenito 0fbfa5
dontaudit $1_su_t { sysadm_home_t staff_home_t }:dir rw_dir_perms;
Chris PeBenito 0fbfa5
dontaudit $1_su_t { sysadm_home_t staff_home_t }:file create_file_perms;
Chris PeBenito 0fbfa5
') dnl ifdef su.te
Chris PeBenito 0fbfa5
')
Chris PeBenito 0fbfa5
Chris PeBenito 0fbfa5
# Privileged user domain
Chris PeBenito 0fbfa5
undefine(`priv_user')
Chris PeBenito 0fbfa5
define(`priv_user', `
Chris PeBenito 0fbfa5
# Reach sysadm_t
Chris PeBenito 0fbfa5
reach_sysadm($1)
Chris PeBenito 0fbfa5
Chris PeBenito 0fbfa5
# Read file_contexts for rpm and get security decisions. 
Chris PeBenito 0fbfa5
r_dir_file($1_t, file_context_t)
Chris PeBenito 0fbfa5
can_getsecurity($1_t)
Chris PeBenito 0fbfa5
Chris PeBenito 0fbfa5
# Signal and see information about unprivileged user domains.
Chris PeBenito 0fbfa5
allow $1_t unpriv_userdomain:process signal_perms;
Chris PeBenito 0fbfa5
can_ps($1_t, unpriv_userdomain)
Chris PeBenito 0fbfa5
allow $1_t { ttyfile ptyfile tty_device_t }:chr_file getattr;
Chris PeBenito 0fbfa5
Chris PeBenito 0fbfa5
# Read /root files if boolean is enabled.
Chris PeBenito 0fbfa5
if (staff_read_sysadm_file) {
Chris PeBenito 0fbfa5
allow $1_t sysadm_home_dir_t:dir { getattr search };
Chris PeBenito 0fbfa5
allow $1_t sysadm_home_t:file { getattr read };
Chris PeBenito 0fbfa5
}
Chris PeBenito 0fbfa5
Chris PeBenito 0fbfa5
') dnl priv_user
Chris PeBenito 0fbfa5
Chris PeBenito 0fbfa5
full_user_role(user)
Chris PeBenito 0fbfa5
Chris PeBenito 0fbfa5
ifdef(`user_canbe_sysadm', `
Chris PeBenito 0fbfa5
reach_sysadm(user)
Chris PeBenito 0fbfa5
role_tty_type_change(user, sysadm)
Chris PeBenito 0fbfa5
')
Chris PeBenito 0fbfa5
Chris PeBenito 0fbfa5
#  Do not add any rules referring to user_t to this file!  That will break
Chris PeBenito 0fbfa5
#  support for multiple user roles.
Chris PeBenito 0fbfa5
Chris PeBenito 0fbfa5
# a role for staff that allows seeing all domains and control over the user_t
Chris PeBenito 0fbfa5
# domain
Chris PeBenito 0fbfa5
full_user_role(staff)
Chris PeBenito 0fbfa5
Chris PeBenito 0fbfa5
priv_user(staff)
Chris PeBenito 0fbfa5
# if adding new user roles make sure you edit the in_user_role macro in
Chris PeBenito 0fbfa5
# macros/user_macros.te to match
Chris PeBenito 0fbfa5
Chris PeBenito 0fbfa5
# lots of user programs accidentally search /root, and also the admin often
Chris PeBenito 0fbfa5
# logs in as UID=0 domain=user_t...
Chris PeBenito 0fbfa5
dontaudit unpriv_userdomain { sysadm_home_dir_t staff_home_dir_t }:dir { getattr search };
Chris PeBenito 0fbfa5
Chris PeBenito 0fbfa5
#
Chris PeBenito 0fbfa5
# Allow the user roles to transition
Chris PeBenito 0fbfa5
# into each other.
Chris PeBenito 0fbfa5
role_tty_type_change(sysadm, user)
Chris PeBenito 0fbfa5
role_tty_type_change(staff, sysadm)
Chris PeBenito 0fbfa5
role_tty_type_change(sysadm, staff)
Chris PeBenito 0fbfa5
Chris PeBenito 0fbfa5
# "ps aux" and "ls -l /dev/pts" make too much noise without this
Chris PeBenito 0fbfa5
dontaudit unpriv_userdomain ptyfile:chr_file getattr;
Chris PeBenito 0fbfa5