1ec3d1a
## <summary>Wine Is Not an Emulator.  Run Windows programs in Linux.</summary>
1ec3d1a
1ec3d1a
#######################################
1ec3d1a
## <summary>
1ec3d1a
##	The per role template for the wine module.
1ec3d1a
## </summary>
1ec3d1a
## <desc>
1ec3d1a
##	

1ec3d1a
##	This template creates a derived domains which are used
1ec3d1a
##	for wine applications.
1ec3d1a
##	

1ec3d1a
## </desc>
9a58032
## <param name="user_role">
1ec3d1a
##	<summary>
9a58032
##	The role associated with the user domain.
1ec3d1a
##	</summary>
1ec3d1a
## </param>
1ec3d1a
## <param name="user_domain">
1ec3d1a
##	<summary>
1ec3d1a
##	The type of the user domain.
1ec3d1a
##	</summary>
1ec3d1a
## </param>
1ec3d1a
#
1ec3d1a
template(`wine_role',`
1ec3d1a
	gen_require(`
1ec3d1a
		type wine_t;
1ec3d1a
		type wine_home_t;
1ec3d1a
		type wine_exec_t;
1ec3d1a
	')
1ec3d1a
1ec3d1a
	role $1 types wine_t;
1ec3d1a
1ec3d1a
	domain_auto_trans($2, wine_exec_t, wine_t)
1ec3d1a
	# Unrestricted inheritance from the caller.
1ec3d1a
	allow $2 wine_t:process { noatsecure siginh rlimitinh };
1ec3d1a
	allow wine_t $2:fd use;
1ec3d1a
	allow wine_t $2:process { sigchld signull };
1ec3d1a
	allow wine_t $2:unix_stream_socket connectto;
1ec3d1a
1ec3d1a
	# Allow the user domain to signal/ps.
1ec3d1a
	ps_process_pattern($2, wine_t)
1ec3d1a
	allow $2 wine_t:process signal_perms;
1ec3d1a
1ec3d1a
	allow $2 wine_t:fd use;
1ec3d1a
	allow $2 wine_t:shm { associate getattr  unix_read unix_write };
1ec3d1a
	allow $2 wine_t:unix_stream_socket connectto;
1ec3d1a
1ec3d1a
	# X access, Home files
1ec3d1a
	manage_dirs_pattern($2, wine_home_t, wine_home_t)
1ec3d1a
	manage_files_pattern($2, wine_home_t, wine_home_t)
1ec3d1a
	manage_lnk_files_pattern($2, wine_home_t, wine_home_t)
1ec3d1a
	relabel_dirs_pattern($2, wine_home_t, wine_home_t)
1ec3d1a
	relabel_files_pattern($2, wine_home_t, wine_home_t)
1ec3d1a
	relabel_lnk_files_pattern($2, wine_home_t, wine_home_t)
1ec3d1a
')
1ec3d1a
1ec3d1a
#######################################
1ec3d1a
## <summary>
1ec3d1a
##	The role template for the wine module.
1ec3d1a
## </summary>
1ec3d1a
## <desc>
1ec3d1a
##	

1ec3d1a
##	This template creates a derived domains which are used
1ec3d1a
##	for wine applications.
1ec3d1a
##	

1ec3d1a
## </desc>
1ec3d1a
## <param name="role_prefix">
1ec3d1a
##	<summary>
1ec3d1a
##	The prefix of the user domain (e.g., user
1ec3d1a
##	is the prefix for user_t).
1ec3d1a
##	</summary>
1ec3d1a
## </param>
1ec3d1a
## <param name="user_role">
1ec3d1a
##	<summary>
1ec3d1a
##	The role associated with the user domain.
1ec3d1a
##	</summary>
1ec3d1a
## </param>
1ec3d1a
## <param name="user_domain">
1ec3d1a
##	<summary>
1ec3d1a
##	The type of the user domain.
1ec3d1a
##	</summary>
1ec3d1a
## </param>
1ec3d1a
#
1ec3d1a
template(`wine_role_template',`
1ec3d1a
	gen_require(`
1ec3d1a
		type wine_t;
1ec3d1a
		type wine_exec_t;
1ec3d1a
	')
1ec3d1a
1ec3d1a
	type $1_wine_t;
1ec3d1a
	domain_type($1_wine_t)
1ec3d1a
	domain_entry_file($1_wine_t, wine_exec_t)
1ec3d1a
	ubac_constrained($1_wine_t)
1ec3d1a
	role $2 types $1_wine_t;
1ec3d1a
1ec3d1a
	allow $1_wine_t self:process { execmem execstack };
1ec3d1a
	allow $3 $1_wine_t:process { getattr noatsecure signal_perms };
1ec3d1a
	domtrans_pattern($3, wine_exec_t, $1_wine_t)
1ec3d1a
	corecmd_bin_domtrans($1_wine_t, $1_t)
1ec3d1a
1ec3d1a
	userdom_unpriv_usertype($1, $1_wine_t)
1ec3d1a
	userdom_manage_tmpfs_role($2, $1_wine_t)
1ec3d1a
1ec3d1a
	domain_mmap_low($1_wine_t)
1ec3d1a
1ec3d1a
	tunable_policy(`wine_mmap_zero_ignore',`
1ec3d1a
		dontaudit $1_wine_t self:memprotect mmap_zero;
1ec3d1a
	')
1ec3d1a
1ec3d1a
	tunable_policy(`wine_mmap_zero_ignore',`
1ec3d1a
		dontaudit $1_wine_t self:memprotect mmap_zero;
1ec3d1a
	')
1ec3d1a
1ec3d1a
	optional_policy(`
1ec3d1a
		xserver_role($1_r, $1_wine_t)
1ec3d1a
	')
1ec3d1a
')
1ec3d1a
1ec3d1a
########################################
1ec3d1a
## <summary>
1ec3d1a
##	Execute the wine program in the wine domain.
1ec3d1a
## </summary>
1ec3d1a
## <param name="domain">
1ec3d1a
##	<summary>
1ec3d1a
##	Domain allowed to transition.
1ec3d1a
##	</summary>
1ec3d1a
## </param>
1ec3d1a
#
1ec3d1a
interface(`wine_domtrans',`
1ec3d1a
	gen_require(`
1ec3d1a
		type wine_t, wine_exec_t;
1ec3d1a
	')
1ec3d1a
1ec3d1a
	corecmd_search_bin($1)
1ec3d1a
	domtrans_pattern($1, wine_exec_t, wine_t)
1ec3d1a
')
1ec3d1a
1ec3d1a
########################################
1ec3d1a
## <summary>
1ec3d1a
##	Execute wine in the wine domain, and
1ec3d1a
##	allow the specified role the wine domain.
1ec3d1a
## </summary>
1ec3d1a
## <param name="domain">
1ec3d1a
##	<summary>
1ec3d1a
##	Domain allowed to transition.
1ec3d1a
##	</summary>
1ec3d1a
## </param>
1ec3d1a
## <param name="role">
1ec3d1a
##	<summary>
1ec3d1a
##	Role allowed access.
1ec3d1a
##	</summary>
1ec3d1a
## </param>
1ec3d1a
#
1ec3d1a
interface(`wine_run',`
1ec3d1a
	gen_require(`
1ec3d1a
		type wine_t;
1ec3d1a
	')
1ec3d1a
1ec3d1a
	wine_domtrans($1)
1ec3d1a
	role $2 types wine_t;
1ec3d1a
')
1ec3d1a
1ec3d1a
########################################
1ec3d1a
## <summary>
1ec3d1a
##	Read and write wine Shared
1ec3d1a
##	memory segments.
1ec3d1a
## </summary>
1ec3d1a
## <param name="domain">
1ec3d1a
##	<summary>
1ec3d1a
##	Domain allowed access.
1ec3d1a
##	</summary>
1ec3d1a
## </param>
1ec3d1a
#
1ec3d1a
interface(`wine_rw_shm',`
1ec3d1a
	gen_require(`
1ec3d1a
		type wine_t;
1ec3d1a
	')
1ec3d1a
1ec3d1a
	allow $1 wine_t:shm rw_shm_perms;
1ec3d1a
')