Chris PeBenito c8ba68
## <summary>GNU terminal multiplexer</summary>
Chris PeBenito c8ba68
Chris PeBenito c8ba68
#######################################
Chris PeBenito c8ba68
## <summary>
Chris PeBenito bbcd3c
##	The per role template for the screen module.
Chris PeBenito c8ba68
## </summary>
Chris PeBenito c8ba68
## <desc>
Chris PeBenito c8ba68
##	

Chris PeBenito c8ba68
##	This template creates a derived domains which are used
Chris PeBenito c8ba68
##	for screen sessions.
Chris PeBenito c8ba68
##	

Chris PeBenito c8ba68
##	

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

Chris PeBenito c8ba68
## </desc>
Chris PeBenito c8ba68
## <param name="userdomain_prefix">
Chris PeBenito 885b83
##	<summary>
Chris PeBenito c8ba68
##	The prefix of the user domain (e.g., user
Chris PeBenito c8ba68
##	is the prefix for user_t).
Chris PeBenito 885b83
##	</summary>
Chris PeBenito c8ba68
## </param>
Chris PeBenito c8ba68
## <param name="user_domain">
Chris PeBenito 885b83
##	<summary>
Chris PeBenito c8ba68
##	The type of the user domain.
Chris PeBenito 885b83
##	</summary>
Chris PeBenito c8ba68
## </param>
Chris PeBenito c8ba68
## <param name="user_role">
Chris PeBenito 885b83
##	<summary>
Chris PeBenito c8ba68
##	The role associated with the user domain.
Chris PeBenito 885b83
##	</summary>
Chris PeBenito c8ba68
## </param>
Chris PeBenito c8ba68
#
Chris PeBenito bbcd3c
template(`screen_per_role_template',`
Chris PeBenito c8ba68
	gen_require(`
Chris PeBenito c8ba68
		type screen_dir_t, screen_exec_t;
Chris PeBenito c8ba68
	')
Chris PeBenito c8ba68
Chris PeBenito c8ba68
	########################################
Chris PeBenito c8ba68
	#
Chris PeBenito c8ba68
	# Declarations
Chris PeBenito c8ba68
	#
Chris PeBenito c8ba68
Chris PeBenito c8ba68
	type $1_screen_t;
Chris PeBenito d46cfe
	application_domain($1_screen_t,screen_exec_t)
Chris PeBenito 15722e
	domain_interactive_fd($1_screen_t)
Chris PeBenito e831e4
	role $3 types $1_screen_t;
Chris PeBenito c8ba68
Chris PeBenito c8ba68
	type $1_screen_tmp_t;
Chris PeBenito c8ba68
	files_tmp_file($1_screen_tmp_t)
Chris PeBenito c8ba68
Chris PeBenito c8ba68
	type $1_screen_ro_home_t;
Chris PeBenito c8ba68
	files_type($1_screen_ro_home_t)
Chris PeBenito c8ba68
Chris PeBenito f76d07
	type $1_screen_var_run_t;
Chris PeBenito c8ba68
	files_pid_file($1_screen_var_run_t)
Chris PeBenito c8ba68
	
Chris PeBenito c8ba68
	########################################
Chris PeBenito c8ba68
	#
Chris PeBenito c8ba68
	# Local policy
Chris PeBenito c8ba68
	#
Chris PeBenito c8ba68
Chris PeBenito c8ba68
	allow $1_screen_t self:capability { setuid setgid fsetid };
Chris PeBenito c8ba68
	allow $1_screen_t self:process signal_perms;
Chris PeBenito c8ba68
	allow $1_screen_t self:tcp_socket create_stream_socket_perms;
Chris PeBenito c8ba68
	allow $1_screen_t self:udp_socket create_socket_perms;
Chris PeBenito c8ba68
	# Internal screen networking
Chris PeBenito c8ba68
	allow $1_screen_t self:fd use;
Chris PeBenito c8ba68
	allow $1_screen_t self:unix_stream_socket create_socket_perms;
Chris PeBenito c8ba68
	allow $1_screen_t self:unix_dgram_socket create_socket_perms;
Chris PeBenito c8ba68
Chris PeBenito c0868a
	manage_dirs_pattern($1_screen_t,$1_screen_tmp_t,$1_screen_tmp_t)
Chris PeBenito c0868a
	manage_files_pattern($1_screen_t,$1_screen_tmp_t,$1_screen_tmp_t)
Chris PeBenito c0868a
	manage_fifo_files_pattern($1_screen_t,$1_screen_tmp_t,$1_screen_tmp_t)
Chris PeBenito 103fe2
	files_tmp_filetrans($1_screen_t, $1_screen_tmp_t, { file dir })
Chris PeBenito c8ba68
Chris PeBenito c8ba68
	# Create fifo
Chris PeBenito c0868a
	manage_fifo_files_pattern($1_screen_t,screen_dir_t,$1_screen_var_run_t)
Chris PeBenito c0868a
	manage_dirs_pattern($1_screen_t,screen_dir_t,screen_dir_t)
Chris PeBenito c0868a
	filetrans_pattern($1_screen_t,screen_dir_t,$1_screen_var_run_t,fifo_file)
Chris PeBenito 103fe2
	files_pid_filetrans($1_screen_t,screen_dir_t,dir)
Chris PeBenito c8ba68
Chris PeBenito c0868a
	allow $1_screen_t $1_screen_ro_home_t:dir list_dir_perms;
Chris PeBenito c0868a
	read_files_pattern($1_screen_t,$1_screen_ro_home_t,$1_screen_ro_home_t)
Chris PeBenito c0868a
	read_lnk_files_pattern($1_screen_t,$1_screen_ro_home_t,$1_screen_ro_home_t)
Chris PeBenito c8ba68
Chris PeBenito c0868a
	allow $1_screen_t $2:process signal;
Chris PeBenito c0868a
Chris PeBenito c0868a
	domtrans_pattern($2, screen_exec_t, $1_screen_t)
Chris PeBenito c8ba68
	allow $2 $1_screen_t:process signal;
Chris PeBenito c0868a
	allow $1_screen_t $2:process signal;
Chris PeBenito c0868a
Chris PeBenito c0868a
	manage_dirs_pattern($2,$1_screen_ro_home_t,$1_screen_ro_home_t)
Chris PeBenito c0868a
	manage_files_pattern($2,$1_screen_ro_home_t,$1_screen_ro_home_t)
Chris PeBenito c0868a
	manage_lnk_files_pattern($2,$1_screen_ro_home_t,$1_screen_ro_home_t)
Chris PeBenito c0868a
	relabel_dirs_pattern($2,$1_screen_ro_home_t,$1_screen_ro_home_t)
Chris PeBenito c0868a
	relabel_files_pattern($2,$1_screen_ro_home_t,$1_screen_ro_home_t)
Chris PeBenito c0868a
	relabel_lnk_files_pattern($2,$1_screen_ro_home_t,$1_screen_ro_home_t)
Chris PeBenito c8ba68
	
Chris PeBenito c8ba68
	kernel_read_system_state($1_screen_t)
Chris PeBenito 445522
	kernel_read_kernel_sysctls($1_screen_t)
Chris PeBenito c8ba68
Chris PeBenito c8ba68
	corecmd_list_bin($1_screen_t)
Chris PeBenito 1815ba
	corecmd_read_bin_files($1_screen_t)
Chris PeBenito 1815ba
	corecmd_read_bin_symlinks($1_screen_t)
Chris PeBenito 1815ba
	corecmd_read_bin_pipes($1_screen_t)
Chris PeBenito 1815ba
	corecmd_read_bin_sockets($1_screen_t)
Chris PeBenito c8ba68
	# Revert to the user domain when a shell is executed.
Chris PeBenito c8ba68
	corecmd_shell_domtrans($1_screen_t,$2)
Chris PeBenito c8ba68
	corecmd_bin_domtrans($1_screen_t,$2)
Chris PeBenito c8ba68
Chris PeBenito 190066
	corenet_all_recvfrom_unlabeled($1_screen_t)
Chris PeBenito 190066
	corenet_all_recvfrom_netlabel($1_screen_t)
Chris PeBenito c8ba68
	corenet_tcp_sendrecv_generic_if($1_screen_t)
Chris PeBenito c8ba68
	corenet_udp_sendrecv_generic_if($1_screen_t)
Chris PeBenito c8ba68
	corenet_tcp_sendrecv_all_nodes($1_screen_t)
Chris PeBenito c8ba68
	corenet_udp_sendrecv_all_nodes($1_screen_t)
Chris PeBenito c8ba68
	corenet_tcp_sendrecv_all_ports($1_screen_t)
Chris PeBenito c8ba68
	corenet_udp_sendrecv_all_ports($1_screen_t)
Chris PeBenito c8ba68
	corenet_tcp_connect_all_ports($1_screen_t)
Chris PeBenito c8ba68
Chris PeBenito c8ba68
	dev_dontaudit_getattr_all_chr_files($1_screen_t)
Chris PeBenito c8ba68
	dev_dontaudit_getattr_all_blk_files($1_screen_t)
Chris PeBenito c8ba68
	# for SSP
Chris PeBenito c8ba68
	dev_read_urand($1_screen_t)
Chris PeBenito c8ba68
Chris PeBenito 15722e
	domain_use_interactive_fds($1_screen_t)
Chris PeBenito c8ba68
Chris PeBenito c8ba68
	files_search_tmp($1_screen_t)
Chris PeBenito c8ba68
	files_search_home($1_screen_t)
Chris PeBenito c8ba68
	files_list_home($1_screen_t)
Chris PeBenito c8ba68
	files_read_usr_files($1_screen_t)
Chris PeBenito c8ba68
	files_read_etc_files($1_screen_t)
Chris PeBenito c8ba68
Chris PeBenito c8ba68
	fs_search_auto_mountpoints($1_screen_t)
Chris PeBenito c8ba68
	fs_getattr_xattr_fs($1_screen_t)
Chris PeBenito c8ba68
Chris PeBenito 7c1011
	auth_dontaudit_read_shadow($1_screen_t)
Chris PeBenito c8ba68
	auth_dontaudit_exec_utempter($1_screen_t)
Chris PeBenito c8ba68
Chris PeBenito c8ba68
	# Write to utmp.
Chris PeBenito 68228b
	init_rw_utmp($1_screen_t)
Chris PeBenito c8ba68
Chris PeBenito c8ba68
	libs_use_ld_so($1_screen_t)
Chris PeBenito c8ba68
	libs_use_shared_libs($1_screen_t)
Chris PeBenito c8ba68
Chris PeBenito c8ba68
	logging_send_syslog_msg($1_screen_t)
Chris PeBenito c8ba68
Chris PeBenito c8ba68
	miscfiles_read_localization($1_screen_t)
Chris PeBenito c8ba68
Chris PeBenito c8ba68
	seutil_read_config($1_screen_t)
Chris PeBenito c8ba68
Chris PeBenito c8ba68
	sysnet_read_config($1_screen_t)
Chris PeBenito c8ba68
Chris PeBenito c8ba68
	userdom_use_user_terminals($1,$1_screen_t)
Chris PeBenito c8ba68
	userdom_create_user_pty($1,$1_screen_t)
Chris PeBenito c8ba68
	userdom_user_home_domtrans($1,$1_screen_t,$2)
Chris PeBenito 15722e
	userdom_setattr_user_ptys($1,$1_screen_t)
Chris PeBenito c8ba68
Chris PeBenito c8ba68
	tunable_policy(`read_default_t',`
Chris PeBenito c8ba68
		files_list_default($1_screen_t)
Chris PeBenito c8ba68
		files_read_default_files($1_screen_t)
Chris PeBenito c8ba68
		files_read_default_symlinks($1_screen_t)
Chris PeBenito c8ba68
		files_read_default_sockets($1_screen_t)
Chris PeBenito c8ba68
		files_read_default_pipes($1_screen_t)
Chris PeBenito c8ba68
	')
Chris PeBenito c8ba68
Chris PeBenito c8ba68
	tunable_policy(`use_samba_home_dirs',`
Chris PeBenito c8ba68
		fs_cifs_domtrans($1_screen_t,$2)
Chris PeBenito c8ba68
		fs_read_cifs_symlinks($1_screen_t)
Chris PeBenito c8ba68
		fs_list_cifs($1_screen_t)
Chris PeBenito c8ba68
	')
Chris PeBenito c8ba68
Chris PeBenito c8ba68
	tunable_policy(`use_nfs_home_dirs',`
Chris PeBenito c8ba68
		fs_nfs_domtrans($1_screen_t,$2)
Chris PeBenito c8ba68
		fs_list_nfs($1_screen_t)
Chris PeBenito c8ba68
		fs_read_nfs_symlinks($1_screen_t)
Chris PeBenito c8ba68
	')
Chris PeBenito c8ba68
Chris PeBenito bb7170
	optional_policy(`
Chris PeBenito c8ba68
		nis_use_ypbind($1_screen_t)
Chris PeBenito c8ba68
	')
Chris PeBenito c8ba68
Chris PeBenito bb7170
	optional_policy(`
Chris PeBenito 1815ba
		nscd_socket_use($1_screen_t)
Chris PeBenito c8ba68
	')
Chris PeBenito c8ba68
')