Chris PeBenito 3ffe29
## <summary>Java virtual machine</summary>
Chris PeBenito 3ffe29
Chris PeBenito 3ffe29
#######################################
Chris PeBenito 3ffe29
## <summary>
Chris PeBenito bbcd3c
##	The per role template for the java module.
Chris PeBenito 3ffe29
## </summary>
Chris PeBenito 3ffe29
## <desc>
Chris PeBenito 3ffe29
##	

Chris PeBenito 3ffe29
##	This template creates a derived domains which are used
Chris PeBenito 3ffe29
##	for java plugins that are executed by a browser.
Chris PeBenito 3ffe29
##	

Chris PeBenito 3ffe29
##	

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

Chris PeBenito 3ffe29
## </desc>
Chris PeBenito 3ffe29
## <param name="userdomain_prefix">
Chris PeBenito 885b83
##	<summary>
Chris PeBenito 3ffe29
##	The prefix of the user domain (e.g., user
Chris PeBenito 3ffe29
##	is the prefix for user_t).
Chris PeBenito 885b83
##	</summary>
Chris PeBenito 3ffe29
## </param>
Chris PeBenito 3ffe29
## <param name="user_domain">
Chris PeBenito 885b83
##	<summary>
Chris PeBenito 3ffe29
##	The type of the user domain.
Chris PeBenito 885b83
##	</summary>
Chris PeBenito 3ffe29
## </param>
Chris PeBenito 3ffe29
## <param name="user_role">
Chris PeBenito 885b83
##	<summary>
Chris PeBenito 3ffe29
##	The role associated with the user domain.
Chris PeBenito 885b83
##	</summary>
Chris PeBenito 3ffe29
## </param>
Chris PeBenito 3ffe29
#
Chris PeBenito bbcd3c
template(`java_per_role_template',`
Chris PeBenito 3ffe29
	gen_require(`
Chris PeBenito 3ffe29
		type java_exec_t;
Chris PeBenito 3ffe29
	')
Chris PeBenito 3ffe29
	
Chris PeBenito 3ffe29
	########################################
Chris PeBenito 3ffe29
	#
Chris PeBenito 3ffe29
	# Declarations
Chris PeBenito 3ffe29
	#
Chris PeBenito 3ffe29
Chris PeBenito 3ffe29
	type $1_javaplugin_t;
Chris PeBenito d46cfe
	application_domain($1_javaplugin_t,java_exec_t)
Chris PeBenito 3ffe29
	role $3 types $1_javaplugin_t;
Chris PeBenito 3ffe29
	
Chris PeBenito 3ffe29
	type $1_javaplugin_tmp_t;
Chris PeBenito 3ffe29
	files_tmp_file($1_javaplugin_tmp_t)
Chris PeBenito 24a637
Chris PeBenito 24a637
	type $1_javaplugin_tmpfs_t;
Chris PeBenito 24a637
	files_tmpfs_file($1_javaplugin_tmpfs_t)
Chris PeBenito 3ffe29
	
Chris PeBenito 3ffe29
	########################################
Chris PeBenito 3ffe29
	#
Chris PeBenito 3ffe29
	# Local policy
Chris PeBenito 3ffe29
	#
Chris PeBenito 3ffe29
Chris PeBenito 0f27d9
	allow $1_javaplugin_t self:process { signal_perms getsched setsched execmem };
Chris PeBenito c0868a
	allow $1_javaplugin_t self:fifo_file rw_fifo_file_perms;
Chris PeBenito 3ffe29
	allow $1_javaplugin_t self:tcp_socket create_socket_perms;
Chris PeBenito 3ffe29
	allow $1_javaplugin_t self:udp_socket create_socket_perms;
Chris PeBenito 3ffe29
	
Chris PeBenito 3ffe29
	allow $1_javaplugin_t $2:unix_stream_socket connectto;
Chris PeBenito 3ffe29
	allow $1_javaplugin_t $2:unix_stream_socket { read write };
Chris PeBenito 3ffe29
	userdom_write_user_tmp_sockets($1,$1_javaplugin_t)
Chris PeBenito 3ffe29
Chris PeBenito c0868a
	manage_dirs_pattern($1_javaplugin_t,$1_javaplugin_tmp_t,$1_javaplugin_tmp_t)
Chris PeBenito c0868a
	manage_files_pattern($1_javaplugin_t,$1_javaplugin_tmp_t,$1_javaplugin_tmp_t)
Chris PeBenito 103fe2
	files_tmp_filetrans($1_javaplugin_t,$1_javaplugin_tmp_t,{ file dir })
Chris PeBenito 3ffe29
Chris PeBenito c0868a
	manage_files_pattern($1_javaplugin_t,$1_javaplugin_tmpfs_t,$1_javaplugin_tmpfs_t)
Chris PeBenito c0868a
	manage_lnk_files_pattern($1_javaplugin_t,$1_javaplugin_tmpfs_t,$1_javaplugin_tmpfs_t)
Chris PeBenito c0868a
	manage_fifo_files_pattern($1_javaplugin_t,$1_javaplugin_tmpfs_t,$1_javaplugin_tmpfs_t)
Chris PeBenito c0868a
	manage_sock_files_pattern($1_javaplugin_t,$1_javaplugin_tmpfs_t,$1_javaplugin_tmpfs_t)
Chris PeBenito c0868a
	fs_tmpfs_filetrans($1_javaplugin_t,$1_javaplugin_tmpfs_t,{ file lnk_file sock_file fifo_file })
Chris PeBenito 24a637
Chris PeBenito c0868a
	rw_files_pattern($1_javaplugin_t,$1_home_t,$1_home_t)
Chris PeBenito c0868a
	read_files_pattern($1_javaplugin_t,$1_home_t,$1_home_t)
Chris PeBenito 3ffe29
Chris PeBenito 3ffe29
	can_exec($1_javaplugin_t, java_exec_t)
Chris PeBenito 3ffe29
	
Chris PeBenito 3ffe29
	# The user role is authorized for this domain.
Chris PeBenito 3ffe29
	domain_auto_trans($1_t, java_exec_t, $1_javaplugin_t)
Chris PeBenito 3ffe29
	allow $1_javaplugin_t $2:fd use;
Chris PeBenito 3ffe29
	# Unrestricted inheritance from the caller.
Chris PeBenito 3ffe29
	allow $2 $1_javaplugin_t:process { noatsecure siginh rlimitinh };
Chris PeBenito 3ffe29
	allow $1_javaplugin_t $2:process signull;
Chris PeBenito 3ffe29
	
Chris PeBenito 445522
	kernel_read_all_sysctls($1_javaplugin_t)
Chris PeBenito 3ffe29
	kernel_search_vm_sysctl($1_javaplugin_t)
Chris PeBenito 3ffe29
	kernel_read_network_state($1_javaplugin_t)
Chris PeBenito 3ffe29
	kernel_read_system_state($1_javaplugin_t)
Chris PeBenito 3ffe29
Chris PeBenito 3ffe29
	# Search bin directory under javaplugin for javaplugin executable
Chris PeBenito 3ffe29
	corecmd_search_bin($1_javaplugin_t)
Chris PeBenito 3ffe29
Chris PeBenito 190066
	corenet_all_recvfrom_unlabeled($1_javaplugin_t)
Chris PeBenito 190066
	corenet_all_recvfrom_netlabel($1_javaplugin_t)
Chris PeBenito 3ffe29
	corenet_tcp_sendrecv_generic_if($1_javaplugin_t)
Chris PeBenito 3ffe29
	corenet_udp_sendrecv_generic_if($1_javaplugin_t)
Chris PeBenito 3ffe29
	corenet_tcp_sendrecv_all_nodes($1_javaplugin_t)
Chris PeBenito 3ffe29
	corenet_udp_sendrecv_all_nodes($1_javaplugin_t)
Chris PeBenito 3ffe29
	corenet_tcp_sendrecv_all_ports($1_javaplugin_t)
Chris PeBenito 3ffe29
	corenet_udp_sendrecv_all_ports($1_javaplugin_t)
Chris PeBenito 3ffe29
	corenet_tcp_connect_all_ports($1_javaplugin_t)
Chris PeBenito c0d8c4
	corenet_sendrecv_all_client_packets($1_javaplugin_t)
Chris PeBenito 3ffe29
Chris PeBenito 207c47
	dev_read_sound($1_javaplugin_t)
Chris PeBenito 207c47
	dev_write_sound($1_javaplugin_t)
Chris PeBenito 3ffe29
	dev_read_urand($1_javaplugin_t)
Chris PeBenito 3ffe29
	dev_read_rand($1_javaplugin_t)
Chris PeBenito 3ffe29
Chris PeBenito 3ffe29
	files_read_etc_files($1_javaplugin_t)
Chris PeBenito 3ffe29
	files_read_usr_files($1_javaplugin_t)
Chris PeBenito 3ffe29
	files_search_home($1_javaplugin_t)
Chris PeBenito 3ffe29
	files_search_var_lib($1_javaplugin_t)
Chris PeBenito 3ffe29
	files_read_etc_runtime_files($1_javaplugin_t)
Chris PeBenito 3ffe29
	# Read global fonts and font config
Chris PeBenito 3ffe29
	files_read_etc_files($1_javaplugin_t)
Chris PeBenito 3ffe29
Chris PeBenito 3ffe29
	fs_getattr_xattr_fs($1_javaplugin_t)
Chris PeBenito 3ffe29
	fs_dontaudit_rw_tmpfs_files($1_javaplugin_t)
Chris PeBenito 3ffe29
Chris PeBenito 3ffe29
	libs_use_ld_so($1_javaplugin_t)
Chris PeBenito 3ffe29
	libs_use_shared_libs($1_javaplugin_t)
Chris PeBenito 3ffe29
Chris PeBenito 3ffe29
	logging_send_syslog_msg($1_javaplugin_t)
Chris PeBenito 3ffe29
Chris PeBenito 3ffe29
	miscfiles_read_localization($1_javaplugin_t)
Chris PeBenito 3ffe29
	# Read global fonts and font config
Chris PeBenito 3ffe29
	miscfiles_read_fonts($1_javaplugin_t)
Chris PeBenito 3ffe29
Chris PeBenito 3ffe29
	sysnet_read_config($1_javaplugin_t)
Chris PeBenito 3ffe29
Chris PeBenito 3ffe29
	userdom_dontaudit_use_user_terminals($1,$1_javaplugin_t)
Chris PeBenito 103fe2
	userdom_dontaudit_setattr_user_home_content_files($1,$1_javaplugin_t)
Chris PeBenito 103fe2
	userdom_dontaudit_exec_user_home_content_files($1,$1_javaplugin_t)
Chris PeBenito 103fe2
	userdom_manage_user_home_content_dirs($1,$1_javaplugin_t)
Chris PeBenito 103fe2
	userdom_manage_user_home_content_files($1,$1_javaplugin_t)
Chris PeBenito 103fe2
	userdom_manage_user_home_content_symlinks($1,$1_javaplugin_t)
Chris PeBenito 103fe2
	userdom_manage_user_home_content_pipes($1,$1_javaplugin_t)
Chris PeBenito 103fe2
	userdom_manage_user_home_content_sockets($1,$1_javaplugin_t)
Chris PeBenito 103fe2
	userdom_user_home_dir_filetrans_user_home_content($1,$1_javaplugin_t,{ file lnk_file sock_file fifo_file })
Chris PeBenito 3ffe29
Chris PeBenito 3ffe29
	tunable_policy(`allow_java_execstack',`
Chris PeBenito 0f27d9
		allow $1_javaplugin_t self:process execstack;
Chris PeBenito 3ffe29
Chris PeBenito 3ffe29
		allow $1_javaplugin_t $1_javaplugin_tmp_t:file execute;
Chris PeBenito 3ffe29
Chris PeBenito 3ffe29
		libs_legacy_use_shared_libs($1_javaplugin_t)
Chris PeBenito 3ffe29
		libs_legacy_use_ld_so($1_javaplugin_t)
Chris PeBenito 3ffe29
Chris PeBenito 3ffe29
		miscfiles_legacy_read_localization($1_javaplugin_t)
Chris PeBenito 3ffe29
	')
Chris PeBenito 3ffe29
Chris PeBenito bb7170
	optional_policy(`
Chris PeBenito 3ffe29
		nis_use_ypbind($1_javaplugin_t)
Chris PeBenito 3ffe29
	')
Chris PeBenito 3ffe29
Chris PeBenito bb7170
	optional_policy(`
Chris PeBenito 1815ba
		nscd_socket_use($1_javaplugin_t)
Chris PeBenito 3ffe29
	')
Chris PeBenito 3ffe29
Chris PeBenito bb7170
	optional_policy(`
Chris PeBenito 24a637
		xserver_user_client_template($1,$1_javaplugin_t,$1_javaplugin_tmpfs_t)
Chris PeBenito 3ffe29
	')
Chris PeBenito 3ffe29
')
Chris PeBenito 46c69c
Chris PeBenito 46c69c
########################################
Chris PeBenito 46c69c
## <summary>
Chris PeBenito 6b19be
##	Run java in javaplugin domain.
Chris PeBenito 6b19be
## </summary>
Chris PeBenito 6b19be
## <desc>
Chris PeBenito 6b19be
##	

Chris PeBenito 6b19be
##	Run java in javaplugin domain.
Chris PeBenito 6b19be
##	

Chris PeBenito 6b19be
##	

Chris PeBenito 6b19be
##	This is a templated interface, and should only
Chris PeBenito 6b19be
##	be called from a per-userdomain template.
Chris PeBenito 6b19be
##	

Chris PeBenito 6b19be
## </desc>
Chris PeBenito 6b19be
## <param name="userdomain_prefix">
Chris PeBenito 6b19be
##	<summary>
Chris PeBenito 6b19be
##	The prefix of the user domain (e.g., user
Chris PeBenito 6b19be
##	is the prefix for user_t).
Chris PeBenito 6b19be
##	</summary>
Chris PeBenito 6b19be
## </param>
Chris PeBenito 6b19be
## <param name="domain">
Chris PeBenito 6b19be
##	<summary>
Chris PeBenito 6b19be
##	Domain allowed access.
Chris PeBenito 6b19be
##	</summary>
Chris PeBenito 6b19be
## </param>
Chris PeBenito 6b19be
#
Chris PeBenito 6b19be
template(`java_domtrans_user_javaplugin',`
Chris PeBenito 6b19be
	gen_require(`
Chris PeBenito 6b19be
		type $1_javaplugin_t, java_exec_t;
Chris PeBenito 6b19be
	')
Chris PeBenito 6b19be
Chris PeBenito 6b19be
	domtrans_pattern($2,java_exec_t,$1_javaplugin_t)
Chris PeBenito 6b19be
')
Chris PeBenito 6b19be
Chris PeBenito 6b19be
########################################
Chris PeBenito 6b19be
## <summary>
Chris PeBenito 46c69c
##	Execute the java program in the java domain.
Chris PeBenito 46c69c
## </summary>
Chris PeBenito 46c69c
## <param name="domain">
Chris PeBenito 46c69c
##	<summary>
Chris PeBenito 46c69c
##	Domain allowed access.
Chris PeBenito 46c69c
##	</summary>
Chris PeBenito 46c69c
## </param>
Chris PeBenito 46c69c
#
Chris PeBenito 46c69c
interface(`java_domtrans',`
Chris PeBenito 350b6a
	gen_require(`
Chris PeBenito 350b6a
		type java_t, java_exec_t;
Chris PeBenito 46c69c
	')
Chris PeBenito 350b6a
Chris PeBenito 350b6a
	corecmd_search_bin($1)
Chris PeBenito 350b6a
	domtrans_pattern($1, java_exec_t, java_t)
Chris PeBenito 46c69c
')