Chris PeBenito 3ffe29
## <summary>Java virtual machine</summary>
Chris PeBenito 3ffe29
Chris PeBenito 296273
########################################
Chris PeBenito 3ffe29
## <summary>
Chris PeBenito 296273
##	Role access for java
Chris PeBenito 3ffe29
## </summary>
Chris PeBenito 296273
## <param name="role">
Chris PeBenito 885b83
##	<summary>
Chris PeBenito 296273
##	Role allowed access
Chris PeBenito 885b83
##	</summary>
Chris PeBenito 3ffe29
## </param>
Chris PeBenito 296273
## <param name="domain">
Chris PeBenito 885b83
##	<summary>
Chris PeBenito 296273
##	User domain for the role
Chris PeBenito 885b83
##	</summary>
Chris PeBenito 3ffe29
## </param>
Chris PeBenito 3ffe29
#
Chris PeBenito 296273
interface(`java_role',`
Chris PeBenito 3ffe29
	gen_require(`
Chris PeBenito 296273
		type java_t, java_exec_t;
Chris PeBenito 3ffe29
	')
Chris PeBenito 2a9837
Chris PeBenito 296273
	role $1 types java_t;
Chris PeBenito 2a9837
Chris PeBenito 3ffe29
	# The user role is authorized for this domain.
Chris PeBenito 296273
	domtrans_pattern($2, java_exec_t, java_t)
Chris PeBenito 296273
	allow java_t $2:process signull;
Chris PeBenito 3ffe29
	# Unrestricted inheritance from the caller.
Chris PeBenito 296273
	allow $2 java_t:process { noatsecure siginh rlimitinh };
Chris PeBenito 3ffe29
Chris PeBenito 296273
	allow java_t $2:unix_stream_socket connectto;
Chris PeBenito 296273
	allow java_t $2:unix_stream_socket { read write };
Chris PeBenito 4fd088
	allow java_t $2:tcp_socket { read write };
Chris PeBenito 4fd088
')
Chris PeBenito 4fd088
Chris PeBenito 4fd088
#######################################
Chris PeBenito 4fd088
## <summary>
Chris PeBenito 4fd088
##	The role template for the java module.
Chris PeBenito 4fd088
## </summary>
Chris PeBenito 4fd088
## <desc>
Chris PeBenito 4fd088
##	

Chris PeBenito 4fd088
##	This template creates a derived domains which are used
Chris PeBenito 4fd088
##	for java applications.
Chris PeBenito 4fd088
##	

Chris PeBenito 4fd088
## </desc>
Chris PeBenito 4fd088
## <param name="role_prefix">
Chris PeBenito 4fd088
##	<summary>
Chris PeBenito 4fd088
##	The prefix of the user domain (e.g., user
Chris PeBenito 4fd088
##	is the prefix for user_t).
Chris PeBenito 4fd088
##	</summary>
Chris PeBenito 4fd088
## </param>
Chris PeBenito 4fd088
## <param name="user_role">
Chris PeBenito 4fd088
##	<summary>
Chris PeBenito 4fd088
##	The role associated with the user domain.
Chris PeBenito 4fd088
##	</summary>
Chris PeBenito 4fd088
## </param>
Chris PeBenito 4fd088
## <param name="user_domain">
Chris PeBenito 4fd088
##	<summary>
Chris PeBenito 4fd088
##	The type of the user domain.
Chris PeBenito 4fd088
##	</summary>
Chris PeBenito 4fd088
## </param>
Chris PeBenito 4fd088
#
Chris PeBenito 4fd088
template(`java_role_template',`
Chris PeBenito 4fd088
	gen_require(`
Chris PeBenito 4fd088
		type java_exec_t;
Chris PeBenito 4fd088
	')
Chris PeBenito 4fd088
Chris PeBenito 4fd088
	type $1_java_t;
Chris PeBenito 4fd088
	domain_type($1_java_t)
Chris PeBenito 4fd088
	domain_entry_file($1_java_t, java_exec_t)
Chris PeBenito 4fd088
	role $2 types $1_java_t;
Chris PeBenito 4fd088
Chris PeBenito 4fd088
	domain_interactive_fd($1_java_t)
Chris PeBenito 4fd088
Dan Walsh 3eaa99
	userdom_unpriv_usertype($1, $1_java_t)
Dan Walsh 3eaa99
	userdom_manage_tmpfs_role($2, $1_java_t)
Chris PeBenito 4fd088
Chris PeBenito 4fd088
	allow $1_java_t self:process { ptrace signal getsched execmem execstack };
Chris PeBenito 4fd088
Chris PeBenito 4fd088
	dontaudit $1_java_t $3:tcp_socket { read write };
Chris PeBenito 4fd088
Chris PeBenito 4fd088
	allow $3 $1_java_t:process { getattr ptrace noatsecure signal_perms };
Chris PeBenito 4fd088
Chris PeBenito 4fd088
	domtrans_pattern($3, java_exec_t, $1_java_t)
Chris PeBenito 4fd088
Dan Walsh 3eaa99
	corecmd_bin_domtrans($1_java_t, $1_t)
Chris PeBenito 4fd088
Chris PeBenito 4fd088
	dev_dontaudit_append_rand($1_java_t)
Chris PeBenito 4fd088
Chris PeBenito 4fd088
	files_execmod_all_files($1_java_t)
Chris PeBenito 4fd088
Chris PeBenito 4fd088
	fs_dontaudit_rw_tmpfs_files($1_java_t)
Chris PeBenito 4fd088
Chris PeBenito 4fd088
	optional_policy(`
Chris PeBenito 4fd088
		xserver_role($2, $1_java_t)
Chris PeBenito 4fd088
	')
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
## <param name="domain">
Chris PeBenito 6b19be
##	<summary>
Dominick Grift 03b866
##	Domain allowed to transition.
Chris PeBenito 6b19be
##	</summary>
Chris PeBenito 6b19be
## </param>
Chris PeBenito 6b19be
#
Chris PeBenito 296273
template(`java_domtrans',`
Chris PeBenito 6b19be
	gen_require(`
Chris PeBenito 296273
		type java_t, java_exec_t;
Chris PeBenito 6b19be
	')
Chris PeBenito 6b19be
Chris PeBenito 296273
	domtrans_pattern($1, java_exec_t, java_t)
Chris PeBenito 6b19be
')
Chris PeBenito 6b19be
Chris PeBenito 6b19be
########################################
Chris PeBenito 6b19be
## <summary>
Chris PeBenito 4fd088
##	Execute java in the java domain, and
Chris PeBenito 4fd088
##	allow the specified role the java domain.
Chris PeBenito 4fd088
## </summary>
Chris PeBenito 4fd088
## <param name="domain">
Chris PeBenito 4fd088
##	<summary>
Dominick Grift 03b866
##	Domain allowed to transition.
Chris PeBenito 4fd088
##	</summary>
Chris PeBenito 4fd088
## </param>
Chris PeBenito 4fd088
## <param name="role">
Chris PeBenito 4fd088
##	<summary>
Chris PeBenito a7ee7f
##	Role allowed access.
Chris PeBenito 4fd088
##	</summary>
Chris PeBenito 4fd088
## </param>
Chris PeBenito 4fd088
#
Chris PeBenito 4fd088
interface(`java_run',`
Chris PeBenito 4fd088
	gen_require(`
Chris PeBenito 4fd088
		type java_t;
Chris PeBenito 4fd088
	')
Chris PeBenito 4fd088
Chris PeBenito 4fd088
	java_domtrans($1)
Chris PeBenito 4fd088
	role $2 types java_t;
Chris PeBenito 4fd088
')
Chris PeBenito 4fd088
Chris PeBenito 4fd088
########################################
Chris PeBenito 4fd088
## <summary>
Chris PeBenito 296273
##	Execute the java program in the unconfined java domain.
Chris PeBenito 46c69c
## </summary>
Chris PeBenito 46c69c
## <param name="domain">
Chris PeBenito 46c69c
##	<summary>
Dominick Grift 03b866
##	Domain allowed to transition.
Chris PeBenito 46c69c
##	</summary>
Chris PeBenito 46c69c
## </param>
Chris PeBenito 46c69c
#
Chris PeBenito 296273
interface(`java_domtrans_unconfined',`
Chris PeBenito 350b6a
	gen_require(`
Chris PeBenito 296273
		type unconfined_java_t, java_exec_t;
Chris PeBenito 46c69c
	')
Chris PeBenito 350b6a
Chris PeBenito 296273
	domtrans_pattern($1, java_exec_t, unconfined_java_t)
Chris PeBenito 350b6a
	corecmd_search_bin($1)
Chris PeBenito 46c69c
')
Chris PeBenito b26482
Chris PeBenito b26482
########################################
Chris PeBenito b26482
## <summary>
Chris PeBenito b26482
##	Execute the java program in the unconfined java domain.
Chris PeBenito b26482
## </summary>
Chris PeBenito b26482
## <param name="domain">
Chris PeBenito b26482
##	<summary>
Dominick Grift 03b866
##	Domain allowed to transition.
Chris PeBenito b26482
##	</summary>
Chris PeBenito b26482
## </param>
Chris PeBenito b26482
## <param name="role">
Chris PeBenito b26482
##	<summary>
Chris PeBenito b26482
##	Role allowed access.
Chris PeBenito b26482
##	</summary>
Chris PeBenito b26482
## </param>
Chris PeBenito b26482
#
Chris PeBenito b26482
interface(`java_run_unconfined',`
Chris PeBenito b26482
	gen_require(`
Chris PeBenito b26482
		type unconfined_java_t;
Chris PeBenito b26482
	')
Chris PeBenito b26482
Chris PeBenito b26482
	java_domtrans_unconfined($1)
Chris PeBenito b26482
	role $2 types unconfined_java_t;
Dan Walsh 3eaa99
	nsplugin_role_notrans($2, unconfined_java_t)
Chris PeBenito b26482
')
Chris PeBenito 4fd088
Chris PeBenito 4fd088
########################################
Chris PeBenito 4fd088
## <summary>
Chris PeBenito 4fd088
##	Execute the java program in the java domain.
Chris PeBenito 4fd088
## </summary>
Chris PeBenito 4fd088
## <param name="domain">
Chris PeBenito 4fd088
##	<summary>
Chris PeBenito 4fd088
##	Domain allowed access.
Chris PeBenito 4fd088
##	</summary>
Chris PeBenito 4fd088
## </param>
Chris PeBenito 4fd088
#
Chris PeBenito 4fd088
interface(`java_exec',`
Chris PeBenito 4fd088
	gen_require(`
Chris PeBenito 4fd088
		type java_exec_t;
Chris PeBenito 4fd088
	')
Chris PeBenito 4fd088
Chris PeBenito 4fd088
	can_exec($1, java_exec_t)
Chris PeBenito 4fd088
')