Chris PeBenito b77d01
## <summary> tvtime - a high quality television application </summary>
Chris PeBenito b77d01
Chris PeBenito b77d01
#######################################
Chris PeBenito b77d01
## <summary>
Chris PeBenito b77d01
##	The per user domain 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 b77d01
template(`tvtime_per_userdomain_template',`
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 b77d01
	domain_type($1_tvtime_t)
Chris PeBenito b77d01
	domain_entry_file($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 b77d01
	allow $1_tvtime_t $1_tvtime_home_t:dir manage_dir_perms;
Chris PeBenito b77d01
	allow $1_tvtime_t $1_tvtime_home_t:file manage_file_perms;
Chris PeBenito b77d01
	allow $1_tvtime_t $1_tvtime_home_t:lnk_file create_lnk_perms;
Chris PeBenito b77d01
	type_transition $1_tvtime_t $1_home_dir_t:dir $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 b77d01
	allow $1_tvtime_t $1_tvtime_tmp_t:dir create_dir_perms;
Chris PeBenito b77d01
	allow $1_tvtime_t $1_tvtime_tmp_t:file create_file_perms;
Chris PeBenito 103fe2
	files_tmp_filetrans($1_tvtime_t, $1_tvtime_tmp_t, { file dir fifo_file })
Chris PeBenito 24a637
Chris PeBenito 24a637
	allow $1_tvtime_t $1_tvtime_tmpfs_t:dir { read getattr lock search ioctl add_name remove_name write };
Chris PeBenito 24a637
	allow $1_tvtime_t $1_tvtime_tmpfs_t:file { create ioctl read getattr lock write setattr append link unlink rename };
Chris PeBenito 24a637
	allow $1_tvtime_t $1_tvtime_tmpfs_t:lnk_file { create read getattr setattr link unlink rename };
Chris PeBenito 24a637
	allow $1_tvtime_t $1_tvtime_tmpfs_t:sock_file { create ioctl read getattr lock write setattr append link unlink rename };
Chris PeBenito 24a637
	allow $1_tvtime_t $1_tvtime_tmpfs_t:fifo_file { create ioctl read getattr lock write setattr append link unlink rename };
Chris PeBenito 103fe2
	fs_tmpfs_filetrans($1_tvtime_t,$1_tvtime_tmpfs_t,{ dir file lnk_file sock_file fifo_file })
Chris PeBenito b77d01
Chris PeBenito b77d01
	# Type transition
Chris PeBenito b77d01
	domain_auto_trans($2, tvtime_exec_t, $1_tvtime_t)
Chris PeBenito b77d01
	allow $2 $1_tvtime_t:fd use;
Chris PeBenito b77d01
	allow $1_tvtime_t $2:fd use;
Chris PeBenito b77d01
	allow $1_tvtime_t $2:fifo_file rw_file_perms;
Chris PeBenito b77d01
	allow $1_tvtime_t $2:process sigchld;
Chris PeBenito b77d01
Chris PeBenito b77d01
	# X access, Home files
Chris PeBenito b77d01
	allow $2 $1_tvtime_home_t:dir manage_dir_perms;
Chris PeBenito b77d01
	allow $2 $1_tvtime_home_t:file manage_file_perms;
Chris PeBenito b77d01
	allow $2 $1_tvtime_home_t:lnk_file create_lnk_perms;
Chris PeBenito b77d01
	allow $2 $1_tvtime_home_t:{ dir file lnk_file } { relabelfrom relabelto };
Chris PeBenito b77d01
Chris PeBenito b77d01
	# Allow the user domain to signal/ps.
Chris PeBenito b77d01
	allow $2 $1_tvtime_t:dir { search getattr read };
Chris PeBenito b77d01
	allow $2 $1_tvtime_t:{ file lnk_file } { read getattr };
Chris PeBenito b77d01
	allow $2 $1_tvtime_t:process getattr;
Chris PeBenito b77d01
	# We need to suppress this denial because procps tries to access
Chris PeBenito b77d01
	# /proc/pid/environ and this now triggers a ptrace check in recent kernels
Chris PeBenito b77d01
	# (2.4 and 2.6).  Might want to change procps to not do this, or only if
Chris PeBenito b77d01
	# running in a privileged domain.
Chris PeBenito b77d01
	dontaudit $2 $1_tvtime_t:process ptrace;
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 24a637
	optional_policy(`xserver',`
Chris PeBenito 24a637
		xserver_user_client_template($1,$1_tvtime_t,$1_tvtime_tmpfs_t)
Chris PeBenito b77d01
	')
Chris PeBenito b77d01
')