Chris PeBenito b77d01
## <summary> tvtime - a high quality television application </summary>
Chris PeBenito b77d01
Chris PeBenito b77d01
#######################################
Chris PeBenito b77d01
## <summary>
Chris PeBenito bbcd3c
##	The per role template for the tvtime module.
Chris PeBenito b77d01
## </summary>
Chris PeBenito b77d01
## <desc>
Chris PeBenito b77d01
##	

Chris PeBenito b77d01
##	This template creates a derived domains which are used
Chris PeBenito b77d01
##	for tvtime.
Chris PeBenito b77d01
##	

Chris PeBenito b77d01
##	

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

Chris PeBenito b77d01
## </desc>
Chris PeBenito b77d01
## <param name="userdomain_prefix">
Chris PeBenito 885b83
##	<summary>
Chris PeBenito b77d01
##	The prefix of the user domain (e.g., user
Chris PeBenito b77d01
##	is the prefix for user_t).
Chris PeBenito 885b83
##	</summary>
Chris PeBenito b77d01
## </param>
Chris PeBenito b77d01
## <param name="user_domain">
Chris PeBenito 885b83
##	<summary>
Chris PeBenito b77d01
##	The type of the user domain.
Chris PeBenito 885b83
##	</summary>
Chris PeBenito b77d01
## </param>
Chris PeBenito b77d01
## <param name="user_role">
Chris PeBenito 885b83
##	<summary>
Chris PeBenito b77d01
##	The role associated with the user domain.
Chris PeBenito 885b83
##	</summary>
Chris PeBenito b77d01
## </param>
Chris PeBenito b77d01
#
Chris PeBenito bbcd3c
template(`tvtime_per_role_template',`
Chris PeBenito 6b19be
	gen_require(`
Chris PeBenito 6b19be
		type tvtime_exec_t;
Chris PeBenito 6b19be
	')
Chris PeBenito b77d01
Chris PeBenito b77d01
	########################################
Chris PeBenito b77d01
	#
Chris PeBenito b77d01
	# Declarations
Chris PeBenito b77d01
	#
Chris PeBenito b77d01
Chris PeBenito b77d01
	type $1_tvtime_t;
Chris PeBenito d46cfe
	application_domain($1_tvtime_t,tvtime_exec_t)
Chris PeBenito b77d01
	role $3 types $1_tvtime_t;
Chris PeBenito b77d01
Chris PeBenito b77d01
	type $1_tvtime_home_t alias $1_tvtime_rw_t;
Chris PeBenito 103fe2
	userdom_user_home_content($1,$1_tvtime_home_t)
Chris PeBenito b77d01
	files_poly_member($1_tvtime_home_t)
Chris PeBenito b77d01
Chris PeBenito b77d01
	type $1_tvtime_tmp_t;
Chris PeBenito b77d01
	files_tmp_file($1_tvtime_tmp_t)
Chris PeBenito 24a637
Chris PeBenito 24a637
	type $1_tvtime_tmpfs_t;
Chris PeBenito 24a637
	files_tmpfs_file($1_tvtime_tmpfs_t)
Chris PeBenito b77d01
	
Chris PeBenito b77d01
	########################################
Chris PeBenito b77d01
	#
Chris PeBenito b77d01
	# Local policy
Chris PeBenito b77d01
	#
Chris PeBenito b77d01
Chris PeBenito b77d01
	allow $1_tvtime_t self:capability { setuid sys_nice sys_resource };
Chris PeBenito b77d01
	allow $1_tvtime_t self:process setsched;
Chris PeBenito b77d01
	allow $1_tvtime_t self:unix_dgram_socket rw_socket_perms;
Chris PeBenito b77d01
	allow $1_tvtime_t self:unix_stream_socket rw_stream_socket_perms;
Chris PeBenito b77d01
Chris PeBenito b77d01
	# X access, Home files
Chris PeBenito c0868a
	manage_dirs_pattern($1_tvtime_t,$1_tvtime_home_t,$1_tvtime_home_t)
Chris PeBenito c0868a
	manage_files_pattern($1_tvtime_t,$1_tvtime_home_t,$1_tvtime_home_t)
Chris PeBenito c0868a
	manage_lnk_files_pattern($1_tvtime_t,$1_tvtime_home_t,$1_tvtime_home_t)
Chris PeBenito 103fe2
	userdom_user_home_dir_filetrans($1,$1_tvtime_t,$1_tvtime_home_t,dir)
Chris PeBenito b77d01
Chris PeBenito c0868a
	manage_dirs_pattern($1_tvtime_t,$1_tvtime_tmp_t,$1_tvtime_tmp_t)
Chris PeBenito c0868a
	manage_files_pattern($1_tvtime_t,$1_tvtime_tmp_t,$1_tvtime_tmp_t)
Chris PeBenito c0868a
	files_tmp_filetrans($1_tvtime_t, $1_tvtime_tmp_t,{ file dir })
Chris PeBenito 24a637
Chris PeBenito c0868a
	manage_files_pattern($1_tvtime_t,$1_tvtime_tmpfs_t,$1_tvtime_tmpfs_t)
Chris PeBenito c0868a
	manage_lnk_files_pattern($1_tvtime_t,$1_tvtime_tmpfs_t,$1_tvtime_tmpfs_t)
Chris PeBenito c0868a
	manage_fifo_files_pattern($1_tvtime_t,$1_tvtime_tmpfs_t,$1_tvtime_tmpfs_t)
Chris PeBenito c0868a
	manage_sock_files_pattern($1_tvtime_t,$1_tvtime_tmpfs_t,$1_tvtime_tmpfs_t)
Chris PeBenito c0868a
	fs_tmpfs_filetrans($1_tvtime_t,$1_tvtime_tmpfs_t,{ file lnk_file sock_file fifo_file })
Chris PeBenito b77d01
Chris PeBenito b77d01
	# Type transition
Chris PeBenito c0868a
	domtrans_pattern($2, tvtime_exec_t, $1_tvtime_t)
Chris PeBenito b77d01
Chris PeBenito b77d01
	# X access, Home files
Chris PeBenito c0868a
	manage_dirs_pattern($2,$1_tvtime_home_t,$1_tvtime_home_t)
Chris PeBenito c0868a
	manage_files_pattern($2,$1_tvtime_home_t,$1_tvtime_home_t)
Chris PeBenito c0868a
	manage_lnk_files_pattern($2,$1_tvtime_home_t,$1_tvtime_home_t)
Chris PeBenito c0868a
	relabel_dirs_pattern($2,$1_tvtime_home_t,$1_tvtime_home_t)
Chris PeBenito c0868a
	relabel_files_pattern($2,$1_tvtime_home_t,$1_tvtime_home_t)
Chris PeBenito c0868a
	relabel_lnk_files_pattern($2,$1_tvtime_home_t,$1_tvtime_home_t)
Chris PeBenito b77d01
Chris PeBenito b77d01
	# Allow the user domain to signal/ps.
Chris PeBenito c0868a
	ps_process_pattern($2,$1_tvtime_t)
Chris PeBenito b77d01
	allow $2 $1_tvtime_t:process signal_perms;
Chris PeBenito b77d01
	
Chris PeBenito 3284fb
	kernel_read_all_sysctls($1_tvtime_t)
Chris PeBenito b77d01
	kernel_get_sysvipc_info($1_tvtime_t)
Chris PeBenito b77d01
Chris PeBenito b77d01
	dev_read_urand($1_tvtime_t)
Chris PeBenito b77d01
	dev_read_realtime_clock($1_tvtime_t)
Chris PeBenito 3284fb
	dev_read_sound($1_tvtime_t)
Chris PeBenito b77d01
Chris PeBenito b77d01
	files_read_usr_files($1_tvtime_t)
Chris PeBenito b77d01
	files_search_pids($1_tvtime_t)
Chris PeBenito b77d01
	# Read /etc/tvtime
Chris PeBenito b77d01
	files_read_etc_files($1_tvtime_t)
Chris PeBenito b77d01
Chris PeBenito b77d01
	# X access, Home files
Chris PeBenito b77d01
	fs_search_auto_mountpoints($1_tvtime_t)
Chris PeBenito b77d01
	
Chris PeBenito b77d01
	libs_use_ld_so($1_tvtime_t)
Chris PeBenito b77d01
	libs_use_shared_libs($1_tvtime_t)
Chris PeBenito b77d01
Chris PeBenito b77d01
	miscfiles_read_localization($1_tvtime_t)
Chris PeBenito b77d01
	miscfiles_read_fonts($1_tvtime_t)
Chris PeBenito b77d01
Chris PeBenito b77d01
	userdom_use_user_terminals($1,$1_tvtime_t)
Chris PeBenito 103fe2
	userdom_read_user_home_content_files($1,$1_tvtime_t)
Chris PeBenito b77d01
	
Chris PeBenito b77d01
	# X access, Home files
Chris PeBenito b77d01
	tunable_policy(`use_nfs_home_dirs',`
Chris PeBenito b77d01
		fs_manage_nfs_dirs($1_tvtime_t)
Chris PeBenito b77d01
		fs_manage_nfs_files($1_tvtime_t)
Chris PeBenito b77d01
		fs_manage_nfs_symlinks($1_tvtime_t)
Chris PeBenito b77d01
	')
Chris PeBenito b77d01
	tunable_policy(`use_samba_home_dirs',`
Chris PeBenito b77d01
		fs_manage_cifs_dirs($1_tvtime_t)
Chris PeBenito b77d01
		fs_manage_cifs_files($1_tvtime_t)
Chris PeBenito b77d01
		fs_manage_cifs_symlinks($1_tvtime_t)
Chris PeBenito b77d01
	')
Chris PeBenito b77d01
Chris PeBenito bb7170
	optional_policy(`
Chris PeBenito 24a637
		xserver_user_client_template($1,$1_tvtime_t,$1_tvtime_tmpfs_t)
Chris PeBenito b77d01
	')
Chris PeBenito b77d01
')