Chris PeBenito 5540e7
## <summary>Restricted (scp/sftp) only shell</summary>
Chris PeBenito 5540e7
Chris PeBenito 5540e7
#######################################
Chris PeBenito 5540e7
## <summary>
Chris PeBenito bbcd3c
##	The per role template for the rssh module.
Chris PeBenito 5540e7
## </summary>
Chris PeBenito 5540e7
## <desc>
Chris PeBenito 5540e7
##	

Chris PeBenito 5540e7
##	This template creates a derived domains which are used
Chris PeBenito 5540e7
##	for rssh client sessions.  Derived types are also created
Chris PeBenito 5540e7
##	for read-only and read-write file access.
Chris PeBenito 5540e7
##	

Chris PeBenito 5540e7
##	

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

Chris PeBenito 5540e7
## </desc>
Chris PeBenito 5540e7
## <param name="userdomain_prefix">
Chris PeBenito 5540e7
##	<summary>
Chris PeBenito 5540e7
##	The prefix of the user domain (e.g., user
Chris PeBenito 5540e7
##	is the prefix for user_t).
Chris PeBenito 5540e7
##	</summary>
Chris PeBenito 5540e7
## </param>
Chris PeBenito 5540e7
#
Chris PeBenito bbcd3c
template(`rssh_per_role_template',`
Chris PeBenito 5540e7
Chris PeBenito 5540e7
	##############################
Chris PeBenito 5540e7
	#
Chris PeBenito 5540e7
	# Declarations
Chris PeBenito 5540e7
	#
Chris PeBenito 5540e7
Chris PeBenito 5540e7
	type $1_rssh_t alias rssh_$1_t, rssh_domain_type;
Chris PeBenito d46cfe
	application_domain($1_rssh_t,rssh_exec_t)
Chris PeBenito 5540e7
	domain_user_exemption_target($1_t)
Chris PeBenito 5540e7
	domain_interactive_fd($1_rssh_t)
Chris PeBenito 5540e7
	role system_r types $1_rssh_t;
Chris PeBenito 5540e7
Chris PeBenito 5540e7
	type $1_rssh_devpts_t alias rssh_$1_devpts_t;
Chris PeBenito 5540e7
	term_user_pty($1_rssh_t,$1_rssh_devpts_t)
Chris PeBenito 5540e7
Chris PeBenito 5540e7
	type $1_rssh_ro_t alias rssh_$1_ro_t, rssh_ro_content_type;
Chris PeBenito 5540e7
	userdom_user_home_content($1,$1_rssh_ro_t)
Chris PeBenito 5540e7
Chris PeBenito 5540e7
	type $1_rssh_rw_t alias rssh_$1_rw_t;
Chris PeBenito 5540e7
	userdom_user_home_content($1,$1_rssh_rw_t)
Chris PeBenito 5540e7
Chris PeBenito 5540e7
	##############################
Chris PeBenito 5540e7
	#
Chris PeBenito 5540e7
	# Local policy
Chris PeBenito 5540e7
	#
Chris PeBenito 5540e7
Chris PeBenito 5540e7
	allow $1_rssh_t self:process ~{ ptrace setcurrent setexec setfscreate setrlimit execmem execstack execheap };
Chris PeBenito 5540e7
	allow $1_rssh_t self:fd use;
Chris PeBenito c0868a
	allow $1_rssh_t self:fifo_file rw_fifo_file_perms;
Chris PeBenito 5540e7
	allow $1_rssh_t self:unix_dgram_socket create_socket_perms;
Chris PeBenito 5540e7
	allow $1_rssh_t self:unix_stream_socket create_stream_socket_perms;
Chris PeBenito 5540e7
	allow $1_rssh_t self:unix_dgram_socket sendto;
Chris PeBenito 5540e7
	allow $1_rssh_t self:unix_stream_socket connectto;
Chris PeBenito 5540e7
	allow $1_rssh_t self:shm create_shm_perms;
Chris PeBenito 5540e7
	allow $1_rssh_t self:sem create_sem_perms;
Chris PeBenito 5540e7
	allow $1_rssh_t self:msgq create_msgq_perms;
Chris PeBenito 5540e7
	allow $1_rssh_t self:msg { send receive };
Chris PeBenito 5540e7
Chris PeBenito 5540e7
	allow $1_rssh_t $1_rssh_devpts_t:chr_file { rw_file_perms setattr };
Chris PeBenito 5540e7
	term_create_pty($1_rssh_t,$1_rssh_devpts_t)
Chris PeBenito 5540e7
Chris PeBenito 5540e7
	allow $1_rssh_t $1_rssh_ro_t:dir list_dir_perms;
Chris PeBenito c0868a
	read_files_pattern($1_rssh_t,$1_rssh_ro_t,$1_rssh_ro_t)
Chris PeBenito 5540e7
Chris PeBenito c0868a
	manage_dirs_pattern($1_rssh_t,$1_rssh_rw_t,$1_rssh_rw_t)
Chris PeBenito c0868a
	manage_files_pattern($1_rssh_t,$1_rssh_rw_t,$1_rssh_rw_t)
Chris PeBenito 5540e7
Chris PeBenito 5540e7
	kernel_read_system_state($1_rssh_t)
Chris PeBenito 5540e7
	kernel_read_kernel_sysctls($1_rssh_t)
Chris PeBenito 5540e7
Chris PeBenito 5540e7
	files_read_etc_files($1_rssh_t)
Chris PeBenito 5540e7
	files_read_etc_runtime_files($1_rssh_t)
Chris PeBenito 5540e7
	files_list_home($1_rssh_t)
Chris PeBenito 5540e7
	files_read_usr_files($1_rssh_t)
Chris PeBenito 5540e7
	files_list_var($1_rssh_t)
Chris PeBenito 5540e7
Chris PeBenito 5540e7
	fs_search_auto_mountpoints($1_rssh_t)
Chris PeBenito 5540e7
Chris PeBenito 5540e7
	libs_use_ld_so($1_rssh_t)
Chris PeBenito 5540e7
	libs_use_shared_libs($1_rssh_t)
Chris PeBenito 5540e7
Chris PeBenito 5540e7
	logging_send_syslog_msg($1_rssh_t)
Chris PeBenito 5540e7
Chris PeBenito 5540e7
	miscfiles_read_localization($1_rssh_t)
Chris PeBenito 5540e7
Chris PeBenito 5540e7
	userdom_use_unpriv_users_fds($1_rssh_t)
Chris PeBenito 5540e7
Chris PeBenito 5540e7
	ssh_rw_tcp_sockets($1_rssh_t)
Chris PeBenito 5540e7
	ssh_rw_stream_sockets($1_rssh_t)
Chris PeBenito 5540e7
Chris PeBenito 5540e7
	optional_policy(`
Chris PeBenito 5540e7
		nis_use_ypbind($1_rssh_t)
Chris PeBenito 5540e7
	')
Chris PeBenito 5540e7
')
Chris PeBenito 5540e7
Chris PeBenito 5540e7
########################################
Chris PeBenito 5540e7
## <summary>
Chris PeBenito 5540e7
##	Transition to all user rssh domains.
Chris PeBenito 5540e7
## </summary>
Chris PeBenito 5540e7
## <param name="domain">
Chris PeBenito 5540e7
##	<summary>
Chris PeBenito 5540e7
##	Domain allowed access.
Chris PeBenito 5540e7
##	</summary>
Chris PeBenito 5540e7
## </param>
Chris PeBenito 5540e7
#
Chris PeBenito 5540e7
interface(`rssh_spec_domtrans_all_users',`
Chris PeBenito 5540e7
	gen_require(`
Chris PeBenito 5540e7
		attribute rssh_domain_type;
Chris PeBenito 5540e7
		type rssh_exec_t;
Chris PeBenito 5540e7
	')
Chris PeBenito 5540e7
Chris PeBenito c0868a
	spec_domtrans_pattern($1,rssh_exec_t,rssh_domain_type)
Chris PeBenito 5540e7
')
Chris PeBenito 5540e7
Chris PeBenito 5540e7
########################################
Chris PeBenito 5540e7
## <summary>
Chris PeBenito 5540e7
##	Read all users rssh read-only content.
Chris PeBenito 5540e7
## </summary>
Chris PeBenito 5540e7
## <param name="domain">
Chris PeBenito 5540e7
##	<summary>
Chris PeBenito 5540e7
##	Domain allowed access.
Chris PeBenito 5540e7
##	</summary>
Chris PeBenito 5540e7
## </param>
Chris PeBenito 5540e7
#
Chris PeBenito 5540e7
interface(`rssh_read_all_users_ro_content',`
Chris PeBenito 5540e7
	gen_require(`
Chris PeBenito 5540e7
		attribute rssh_ro_content_type;
Chris PeBenito 5540e7
	')
Chris PeBenito 5540e7
Chris PeBenito c0868a
	allow $1 rssh_ro_content_type:dir list_dir_perms;
Chris PeBenito c0868a
	read_files_pattern($1,rssh_ro_content_type,rssh_ro_content_type)
Chris PeBenito c0868a
	read_lnk_files_pattern($1,rssh_ro_content_type,rssh_ro_content_type)
Chris PeBenito 5540e7
')