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 ab940a
# all unprivileged users tmp files
Chris PeBenito ab940a
attribute user_tmpfile;
Chris PeBenito ab940a
Chris PeBenito ebdc3b
# all unprivileged users ttys
Chris PeBenito ebdc3b
attribute user_ttynode;
Chris PeBenito ebdc3b
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 8fd367
admin_user_template(sysadm)
Chris PeBenito 8fd367
unpriv_user_template(staff)
Chris PeBenito 8fd367
unpriv_user_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 0c73cd
	allow $1_r $2_r;
Chris PeBenito 0c73cd
	type_change $2_t $1_devpts_t:chr_file $2_devpts_t;
Chris PeBenito 0c73cd
	type_change $2_t $1_tty_device_t:chr_file $2_tty_device_t;
Chris PeBenito 0c73cd
	# avoid annoying messages on terminal hangup
Chris PeBenito 0c73cd
	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 254bbc
# this should be tunable_policy, but
Chris PeBenito 254bbc
# currently type_change and RBAC allow
Chris PeBenito 254bbc
# do not work in conditionals
Chris PeBenito 254bbc
ifdef(`user_canbe_sysadm',`
Chris PeBenito 0c73cd
	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 0fd9dc
	bootloader_run(sysadm_t,sysadm_r,admin_terminal)
Chris PeBenito dc771f
')
Chris PeBenito dc771f
Chris PeBenito 32e53a
optional_policy(`clock.te',`
Chris PeBenito c9428d
	clock_run(sysadm_t,sysadm_r,admin_terminal)
Chris PeBenito 32e53a
')
Chris PeBenito 32e53a
Chris PeBenito 58c3da
optional_policy(`fstools.te',`
Chris PeBenito 58c3da
	fstools_run(sysadm_t,sysadm_r,admin_terminal)
Chris PeBenito 58c3da
')
Chris PeBenito 58c3da
Chris PeBenito 32e53a
optional_policy(`hostname.te',`
Chris PeBenito c9428d
	hostname_run(sysadm_t,sysadm_r,admin_terminal)
Chris PeBenito 32e53a
')
Chris PeBenito 32e53a
Chris PeBenito daa0e0
optional_policy(`iptables.te',`
Chris PeBenito c9428d
	iptables_run(sysadm_t,sysadm_r,admin_terminal)
Chris PeBenito daa0e0
')
Chris PeBenito daa0e0
Chris PeBenito 15a961
optional_policy(`libraries.te',`
Chris PeBenito c9428d
	libs_run_ldconfig(sysadm_t,sysadm_r,admin_terminal)
Chris PeBenito 15a961
')
Chris PeBenito 15a961
Chris PeBenito daa0e0
optional_policy(`lvm.te',`
Chris PeBenito c9428d
	lvm_run(sysadm_t,sysadm_r,admin_terminal)
Chris PeBenito daa0e0
')
Chris PeBenito daa0e0
Chris PeBenito daa0e0
optional_policy(`modutils.te',`
Chris PeBenito c9428d
	modutils_run_depmod(sysadm_t,sysadm_r,admin_terminal)
Chris PeBenito c9428d
	modutils_run_insmod(sysadm_t,sysadm_r,admin_terminal)
Chris PeBenito c9428d
	modutils_run_update_mods(sysadm_t,sysadm_r,admin_terminal)
Chris PeBenito daa0e0
')
Chris PeBenito daa0e0
Chris PeBenito 96ce00
optional_policy(`logrotate.te',`
Chris PeBenito 96ce00
	logrotate_run(sysadm_t,sysadm_r,admin_terminal)
Chris PeBenito 96ce00
')
Chris PeBenito 96ce00
Chris PeBenito daa0e0
optional_policy(`mount.te',`
Chris PeBenito c9428d
	mount_run(sysadm_t,sysadm_r,admin_terminal)
Chris PeBenito daa0e0
')
Chris PeBenito daa0e0
Chris PeBenito ab940a
optional_policy(`netutils.te',`
Chris PeBenito ab940a
	netutils_run(sysadm_t,sysadm_r,admin_terminal)
Chris PeBenito ab940a
	netutils_run_ping(sysadm_t,sysadm_r,admin_terminal)
Chris PeBenito ab940a
	netutils_run_traceroute(sysadm_t,sysadm_r,admin_terminal)
Chris PeBenito ab940a
')
Chris PeBenito ab940a
Chris PeBenito 15a961
optional_policy(`rpm.te',`
Chris PeBenito c9428d
	rpm_run(sysadm_t,sysadm_r,admin_terminal)
Chris PeBenito 15a961
')
Chris PeBenito 15a961
Chris PeBenito daa0e0
optional_policy(`selinux.te',`
Chris PeBenito 5e0da6
	seutil_run_checkpol(sysadm_t,sysadm_r,admin_terminal)
Chris PeBenito 5e0da6
	seutil_run_loadpol(sysadm_t,sysadm_r,admin_terminal)
Chris PeBenito 5e0da6
	seutil_run_restorecon(sysadm_t,sysadm_r,admin_terminal)
Chris PeBenito 5e0da6
	seutil_run_setfiles(sysadm_t,sysadm_r,admin_terminal)
Chris PeBenito 0c73cd
	optional_policy(`targeted_policy',`',`
Chris PeBenito 5e0da6
		seutil_run_runinit(sysadm_t,sysadm_r,admin_terminal)
Chris PeBenito 0c73cd
	')
Chris PeBenito daa0e0
')
Chris PeBenito daa0e0
Chris PeBenito daa0e0
optional_policy(`sysnetwork.te',`
Chris PeBenito c9428d
	sysnet_run_ifconfig(sysadm_t,sysadm_r,admin_terminal)
Chris PeBenito daa0e0
')
Chris PeBenito daa0e0
Chris PeBenito 32e53a
optional_policy(`usermanage.te',`
Chris PeBenito c9428d
	usermanage_run_groupadd(sysadm_t,sysadm_r,admin_terminal)
Chris PeBenito c9428d
	usermanage_run_useradd(sysadm_t,sysadm_r,admin_terminal)
Chris PeBenito daa0e0
')