Chris PeBenito 1ae2c3
## <summary>device locking policy for lockdev</summary>
Chris PeBenito 1ae2c3
Chris PeBenito 1ae2c3
#######################################
Chris PeBenito 1ae2c3
## <summary>
Chris PeBenito 1ae2c3
##	The per user domain template for the lockdev module.
Chris PeBenito 1ae2c3
## </summary>
Chris PeBenito 1ae2c3
## <desc>
Chris PeBenito 1ae2c3
##	

Chris PeBenito 1ae2c3
##	This template creates derived domains which are used
Chris PeBenito 1ae2c3
##	for lockdev. A derived type is also created to protect
Chris PeBenito 1ae2c3
##	the user's device locks.
Chris PeBenito 1ae2c3
##	

Chris PeBenito 1ae2c3
##	

Chris PeBenito 1ae2c3
##	This template is invoked automatically for each user, and
Chris PeBenito 1ae2c3
##	generally does not need to be invoked directly
Chris PeBenito 1ae2c3
##	by policy writers.
Chris PeBenito 1ae2c3
##	

Chris PeBenito 1ae2c3
## </desc>
Chris PeBenito 1ae2c3
## <param name="userdomain_prefix">
Chris PeBenito 885b83
##	<summary>
Chris PeBenito 1ae2c3
##	The prefix of the user domain (e.g., user
Chris PeBenito 1ae2c3
##	is the prefix for user_t).
Chris PeBenito 885b83
##	</summary>
Chris PeBenito 1ae2c3
## </param>
Chris PeBenito 1ae2c3
## <param name="user_domain">
Chris PeBenito 885b83
##	<summary>
Chris PeBenito 1ae2c3
##	The type of the user domain.
Chris PeBenito 885b83
##	</summary>
Chris PeBenito 1ae2c3
## </param>
Chris PeBenito 1ae2c3
## <param name="user_role">
Chris PeBenito 885b83
##	<summary>
Chris PeBenito 1ae2c3
##	The role associated with the user domain.
Chris PeBenito 885b83
##	</summary>
Chris PeBenito 1ae2c3
## </param>
Chris PeBenito 1ae2c3
#
Chris PeBenito 1ae2c3
template(`lockdev_per_userdomain_template',`
Chris PeBenito 1ae2c3
	gen_require(`
Chris PeBenito 1ae2c3
		type lockdev_exec_t;
Chris PeBenito 1ae2c3
	')
Chris PeBenito 1ae2c3
Chris PeBenito 1ae2c3
	########################################
Chris PeBenito 1ae2c3
	#
Chris PeBenito 1ae2c3
	# Declarations
Chris PeBenito 1ae2c3
	#
Chris PeBenito 1ae2c3
Chris PeBenito 1ae2c3
	type $1_lockdev_t;
Chris PeBenito 1ae2c3
	domain_type($1_lockdev_t)
Chris PeBenito 1ae2c3
	domain_entry_file($1_lockdev_t,lockdev_exec_t)
Chris PeBenito 1ae2c3
	role $3 types $1_lockdev_t;
Chris PeBenito 1ae2c3
Chris PeBenito 1ae2c3
	type $1_lockdev_lock_t;
Chris PeBenito 1ae2c3
	files_lock_file($1_lockdev_lock_t)
Chris PeBenito 1ae2c3
Chris PeBenito 1ae2c3
	########################################
Chris PeBenito 1ae2c3
	#
Chris PeBenito 1ae2c3
	# Local policy
Chris PeBenito 1ae2c3
	#
Chris PeBenito 1ae2c3
Chris PeBenito 1ae2c3
	# Use capabilities.
Chris PeBenito 1ae2c3
	allow $1_lockdev_t self:capability setgid;
Chris PeBenito 1ae2c3
	allow $1_lockdev_t $2:process signull;
Chris PeBenito 1ae2c3
Chris PeBenito 1ae2c3
	# Transition from the user domain to the derived domain.
Chris PeBenito 1ae2c3
	domain_auto_trans($2, lockdev_exec_t, $1_lockdev_t)
Chris PeBenito 1ae2c3
	allow $2 $1_lockdev_t:fd use;
Chris PeBenito 1ae2c3
	allow $1_lockdev_t $2:fd use;
Chris PeBenito 1ae2c3
	allow $1_lockdev_t $2:fifo_file rw_file_perms;
Chris PeBenito 1ae2c3
	allow $1_lockdev_t $2:process sigchld;
Chris PeBenito 1ae2c3
Chris PeBenito 1ae2c3
	allow $1_lockdev_t $1_lockdev_lock_t:file create_file_perms;
Chris PeBenito 1c1ac6
	files_lock_filetrans($1_lockdev_t,$1_lockdev_lock_t,file)
Chris PeBenito 1ae2c3
Chris PeBenito 1ae2c3
	files_read_all_locks($1_lockdev_t)
Chris PeBenito 1ae2c3
Chris PeBenito 1ae2c3
	fs_getattr_xattr_fs($1_lockdev_t)
Chris PeBenito 1ae2c3
	
Chris PeBenito 1ae2c3
	libs_use_ld_so($1_lockdev_t)
Chris PeBenito 1ae2c3
	libs_use_shared_libs($1_lockdev_t)
Chris PeBenito 1ae2c3
Chris PeBenito 1ae2c3
	logging_send_syslog_msg($1_lockdev_t)
Chris PeBenito 1ae2c3
Chris PeBenito 1ae2c3
	userdom_use_user_terminals($1, $1_lockdev_t)
Chris PeBenito 1ae2c3
	
Chris PeBenito bb7170
	optional_policy(`
Chris PeBenito 1ae2c3
		logging_send_syslog_msg($1_t)
Chris PeBenito 1ae2c3
	')
Chris PeBenito 1ae2c3
')