Chris PeBenito b16c6b
Chris PeBenito b16c6b
policy_module(userdomain,1.0)
Chris PeBenito b16c6b
Chris PeBenito b16c6b
########################################
Chris PeBenito b16c6b
#
Chris PeBenito b16c6b
# Declarations
Chris PeBenito b16c6b
#
Chris PeBenito b16c6b
Chris PeBenito daa0e0
# admin users terminals (tty and pty)
Chris PeBenito daa0e0
attribute admin_terminal;
Chris PeBenito daa0e0
Chris PeBenito daa0e0
# users home directory
Chris PeBenito daa0e0
attribute home_dir_type;
Chris PeBenito daa0e0
Chris PeBenito daa0e0
# users home directory contents
Chris PeBenito daa0e0
attribute home_type;
Chris PeBenito daa0e0
Chris PeBenito b16c6b
# The privhome attribute identifies every domain that can create files under
Chris PeBenito b16c6b
# regular user home directories in the regular context (IE act on behalf of
Chris PeBenito b16c6b
# a user in writing regular files)
Chris PeBenito b16c6b
attribute privhome;
Chris PeBenito b16c6b
Chris PeBenito b16c6b
# all user domains
Chris PeBenito b16c6b
attribute userdomain;
Chris PeBenito b16c6b
Chris PeBenito b16c6b
# unprivileged user domains
Chris PeBenito b16c6b
attribute unpriv_userdomain;
Chris PeBenito b16c6b
Chris PeBenito b16c6b
# Allow execution of anonymous mappings, e.g. executable stack.
Chris PeBenito b16c6b
bool allow_execmem false;
Chris PeBenito b16c6b
Chris PeBenito b16c6b
# Support Share libraries with Text Relocation
Chris PeBenito b16c6b
bool allow_execmod false;
Chris PeBenito b16c6b
Chris PeBenito b16c6b
# Allow system to run with kerberos
Chris PeBenito b16c6b
bool allow_kerberos false;
Chris PeBenito b16c6b
Chris PeBenito b16c6b
# Allow system to run with NIS
Chris PeBenito b16c6b
bool allow_ypbind false;
Chris PeBenito b16c6b
Chris PeBenito b16c6b
# Allow reading of default_t files.
Chris PeBenito b16c6b
bool read_default_t false;
Chris PeBenito b16c6b
Chris PeBenito b16c6b
# Allow staff_r users to search the sysadm home dir and read
Chris PeBenito b16c6b
# files (such as ~/.bashrc)
Chris PeBenito b16c6b
bool staff_read_sysadm_file false;
Chris PeBenito b16c6b
Chris PeBenito b16c6b
# Support NFS home directories
Chris PeBenito b16c6b
bool use_nfs_home_dirs false;
Chris PeBenito b16c6b
Chris PeBenito b16c6b
# Support SAMBA home directories
Chris PeBenito b16c6b
bool use_samba_home_dirs false;
Chris PeBenito b16c6b
Chris PeBenito b16c6b
# Allow regular users direct mouse access 
Chris PeBenito b16c6b
bool user_direct_mouse false;
Chris PeBenito b16c6b
Chris PeBenito b16c6b
# Allow users to read system messages.
Chris PeBenito b16c6b
bool user_dmesg false;
Chris PeBenito b16c6b
Chris PeBenito b16c6b
# Allow users to control network interfaces (also needs USERCTL=true)
Chris PeBenito b16c6b
bool user_net_control false;
Chris PeBenito b16c6b
Chris PeBenito b16c6b
# Allow user to r/w noextattrfile (FAT, CDROM, FLOPPY)
Chris PeBenito b16c6b
bool user_rw_noexattrfile false;
Chris PeBenito b16c6b
Chris PeBenito b16c6b
# Allow users to rw usb devices
Chris PeBenito b16c6b
bool user_rw_usb false;
Chris PeBenito b16c6b
Chris PeBenito b16c6b
# Allow users to run TCP servers (bind to ports and accept connection from
Chris PeBenito b16c6b
# the same domain and outside users)  disabling this forces FTP passive mode
Chris PeBenito b16c6b
# and may change other protocols 
Chris PeBenito b16c6b
bool user_tcp_server false;
Chris PeBenito b16c6b
Chris PeBenito b16c6b
# Allow w to display everyone
Chris PeBenito b16c6b
bool user_ttyfile_stat false;
Chris PeBenito b16c6b
Chris PeBenito 32e53a
admin_domain_template(sysadm)
Chris PeBenito b16c6b
user_domain_template(staff)
Chris PeBenito b16c6b
user_domain_template(user)
Chris PeBenito b16c6b
Chris PeBenito b16c6b
########################################
Chris PeBenito b16c6b
#
Chris PeBenito b16c6b
# Local policy
Chris PeBenito b16c6b
#
Chris PeBenito 76bff3
Chris PeBenito 32e53a
# user role change rules:
Chris PeBenito 32e53a
define(`role_change',`
Chris PeBenito 32e53a
allow $1_r $2_r;
Chris PeBenito 32e53a
type_change $2_t $1_devpts_t:chr_file $2_devpts_t;
Chris PeBenito 32e53a
type_change $2_t $1_tty_device_t:chr_file $2_tty_device_t;
Chris PeBenito 32e53a
# avoid annoying messages on terminal hangup
Chris PeBenito 32e53a
dontaudit $1_t { $2_devpts_t $2_tty_device_t }:chr_file ioctl;
Chris PeBenito 32e53a
')
Chris PeBenito 32e53a
Chris PeBenito 32e53a
# sysadm_r can change to user roles
Chris PeBenito 32e53a
role_change(sysadm, user)
Chris PeBenito 32e53a
role_change(sysadm, staff)
Chris PeBenito 32e53a
Chris PeBenito 32e53a
# only staff_r can change to sysadm_r
Chris PeBenito 32e53a
role_change(staff, sysadm)
Chris PeBenito 32e53a
Chris PeBenito 32e53a
tunable_policy(`user_canbe_sysadm',`
Chris PeBenito 32e53a
role_change(user,sysadm)
Chris PeBenito 32e53a
')
Chris PeBenito 32e53a
Chris PeBenito 32e53a
ifdef(`TODO',`
Chris PeBenito 32e53a
allow privhome home_root_t:dir { getattr search };
Chris PeBenito 76bff3
Chris PeBenito daa0e0
# Add/remove user home directories
Chris PeBenito 32e53a
file_type_auto_trans(sysadm_t, home_root_t, user_home_dir_t, dir)
Chris PeBenito 32e53a
')
Chris PeBenito daa0e0
Chris PeBenito daa0e0
########################################
Chris PeBenito daa0e0
#
Chris PeBenito daa0e0
# Sysadm local policy
Chris PeBenito daa0e0
#
Chris PeBenito daa0e0
Chris PeBenito 76bff3
# for su
Chris PeBenito 76bff3
allow sysadm_t userdomain:fd use;
Chris PeBenito 76bff3
Chris PeBenito dc771f
optional_policy(`bootloader.te',`
Chris PeBenito dc771f
bootloader_transition_add_role_use_terminal(sysadm_t,sysadm_r,admin_terminal)
Chris PeBenito dc771f
')
Chris PeBenito dc771f
Chris PeBenito 32e53a
optional_policy(`clock.te',`
Chris PeBenito 32e53a
clock_transition_add_role_use_terminal(sysadm_t,sysadm_r,admin_terminal)
Chris PeBenito 32e53a
')
Chris PeBenito 32e53a
Chris PeBenito 32e53a
optional_policy(`hostname.te',`
Chris PeBenito 32e53a
hostname_transition_add_role_use_terminal(sysadm_t,sysadm_r,admin_terminal)
Chris PeBenito 32e53a
')
Chris PeBenito 32e53a
Chris PeBenito daa0e0
optional_policy(`iptables.te',`
Chris PeBenito daa0e0
iptables_transition_add_role_use_terminal(sysadm_t,sysadm_r,admin_terminal)
Chris PeBenito daa0e0
')
Chris PeBenito daa0e0
Chris PeBenito 15a961
optional_policy(`libraries.te',`
Chris PeBenito 15a961
libraries_ldconfig_transition_add_role_use_terminal(sysadm_t,sysadm_r,admin_terminal)
Chris PeBenito 15a961
')
Chris PeBenito 15a961
Chris PeBenito daa0e0
optional_policy(`lvm.te',`
Chris PeBenito daa0e0
lvm_transition_add_role_use_terminal(sysadm_t,sysadm_r,admin_terminal)
Chris PeBenito daa0e0
')
Chris PeBenito daa0e0
Chris PeBenito daa0e0
optional_policy(`modutils.te',`
Chris PeBenito daa0e0
modutils_depmod_transition_add_role_use_terminal(sysadm_t,sysadm_r,admin_terminal)
Chris PeBenito daa0e0
modutils_insmod_transition_add_role_use_terminal(sysadm_t,sysadm_r,admin_terminal)
Chris PeBenito daa0e0
modutils_update_modules_transition_add_role_use_terminal(sysadm_t,sysadm_r,admin_terminal)
Chris PeBenito daa0e0
')
Chris PeBenito daa0e0
Chris PeBenito daa0e0
optional_policy(`mount.te',`
Chris PeBenito daa0e0
mount_transition_add_role_use_terminal(sysadm_t,sysadm_r,admin_terminal)
Chris PeBenito daa0e0
')
Chris PeBenito daa0e0
Chris PeBenito 15a961
optional_policy(`rpm.te',`
Chris PeBenito 15a961
rpm_transition_add_role_use_terminal(sysadm_t,sysadm_r,admin_terminal)
Chris PeBenito 15a961
')
Chris PeBenito 15a961
Chris PeBenito daa0e0
optional_policy(`selinux.te',`
Chris PeBenito daa0e0
selinux_checkpolicy_transition_add_role_use_terminal(sysadm_t,sysadm_r,admin_terminal)
Chris PeBenito daa0e0
selinux_load_policy_transition_add_role_use_terminal(sysadm_t,sysadm_r,admin_terminal)
Chris PeBenito daa0e0
selinux_restorecon_transition_add_role_use_terminal(sysadm_t,sysadm_r,admin_terminal)
Chris PeBenito daa0e0
selinux_setfiles_transition_add_role_use_terminal(sysadm_t,sysadm_r,admin_terminal)
Chris PeBenito daa0e0
optional_policy(`targeted_policy',`',`
Chris PeBenito daa0e0
selinux_run_init_transition_add_role_use_terminal(sysadm_t,sysadm_r,admin_terminal)
Chris PeBenito daa0e0
')
Chris PeBenito daa0e0
')
Chris PeBenito daa0e0
Chris PeBenito daa0e0
optional_policy(`sysnetwork.te',`
Chris PeBenito daa0e0
sysnetwork_ifconfig_transition_add_role_use_terminal(sysadm_t,sysadm_r,admin_terminal)
Chris PeBenito daa0e0
')
Chris PeBenito daa0e0
Chris PeBenito 32e53a
optional_policy(`usermanage.te',`
Chris PeBenito 32e53a
usermanage_groupadd_transition_add_role_use_terminal(sysadm_t,sysadm_r,admin_terminal)
Chris PeBenito 32e53a
usermanage_useradd_transition_add_role_use_terminal(sysadm_t,sysadm_r,admin_terminal)
Chris PeBenito daa0e0
')