Chris PeBenito 0834f9
## <summary>Ethereal packet capture tool.</summary>
Chris PeBenito 0834f9
Chris PeBenito 0834f9
#######################################
Chris PeBenito 0834f9
## <summary>
Chris PeBenito 0834f9
##	The per user domain template for the ethereal module.
Chris PeBenito 0834f9
## </summary>
Chris PeBenito 0834f9
## <desc>
Chris PeBenito 0834f9
##	

Chris PeBenito 0834f9
##	This template creates a derived domains which are used
Chris PeBenito 0834f9
##	for ethereal packet capture tool.
Chris PeBenito 0834f9
##	

Chris PeBenito 0834f9
##	

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

Chris PeBenito 0834f9
## </desc>
Chris PeBenito 0834f9
## <param name="userdomain_prefix">
Chris PeBenito 0834f9
##	<summary>
Chris PeBenito 0834f9
##	The prefix of the user domain (e.g., user
Chris PeBenito 0834f9
##	is the prefix for user_t).
Chris PeBenito 0834f9
##	</summary>
Chris PeBenito 0834f9
## </param>
Chris PeBenito 0834f9
## <param name="user_domain">
Chris PeBenito 0834f9
##	<summary>
Chris PeBenito 0834f9
##	The type of the user domain.
Chris PeBenito 0834f9
##	</summary>
Chris PeBenito 0834f9
## </param>
Chris PeBenito 0834f9
## <param name="user_role">
Chris PeBenito 0834f9
##	<summary>
Chris PeBenito 0834f9
##	The role associated with the user domain.
Chris PeBenito 0834f9
##	</summary>
Chris PeBenito 0834f9
## </param>
Chris PeBenito 0834f9
#
Chris PeBenito 0834f9
template(`ethereal_per_userdomain_template',`
Chris PeBenito 0834f9
Chris PeBenito 0834f9
	##############################
Chris PeBenito 0834f9
	#
Chris PeBenito 0834f9
	# Declarations
Chris PeBenito 0834f9
	#
Chris PeBenito 0834f9
Chris PeBenito 0834f9
	# Type for program
Chris PeBenito 0834f9
	type $1_ethereal_t;
Chris PeBenito 0834f9
	domain_type($1_ethereal_t)
Chris PeBenito 0834f9
	domain_entry_file($1_ethereal_t,ethereal_exec_t)
Chris PeBenito 0834f9
	role $3 types $1_ethereal_t;
Chris PeBenito 0834f9
Chris PeBenito 0834f9
	type $1_ethereal_home_t alias $1_ethereal_rw_t;
Chris PeBenito 0834f9
	files_poly_member($1_ethereal_home_t)
Chris PeBenito 0834f9
	userdom_user_home_content($1,$1_ethereal_home_t)
Chris PeBenito 0834f9
Chris PeBenito 0834f9
	type $1_ethereal_tmp_t;
Chris PeBenito 0834f9
	files_tmp_file($1_ethereal_tmp_t)
Chris PeBenito 0834f9
Chris PeBenito 0834f9
	type $1_ethereal_tmpfs_t;
Chris PeBenito 0834f9
	files_tmpfs_file($1_ethereal_tmpfs_t)
Chris PeBenito 0834f9
Chris PeBenito 0834f9
	##############################
Chris PeBenito 0834f9
	#
Chris PeBenito 0834f9
	# Local Policy
Chris PeBenito 0834f9
	#
Chris PeBenito 0834f9
Chris PeBenito 0834f9
	allow $1_ethereal_t self:capability { net_admin net_raw setgid };
Chris PeBenito 0834f9
	allow $1_ethereal_t self:process { signal getsched };
Chris PeBenito 0834f9
	allow $1_ethereal_t self:fifo_file { getattr read write };
Chris PeBenito 0834f9
	allow $1_ethereal_t self:shm destroy;
Chris PeBenito 0834f9
	allow $1_ethereal_t self:shm create_shm_perms;
Chris PeBenito 0834f9
	allow $1_ethereal_t self:netlink_route_socket { nlmsg_read create_socket_perms };
Chris PeBenito 0834f9
	allow $1_ethereal_t self:packet_socket { setopt bind ioctl getopt create read };
Chris PeBenito 0834f9
	allow $1_ethereal_t self:tcp_socket create_socket_perms;
Chris PeBenito 0834f9
	allow $1_ethereal_t self:udp_socket create_socket_perms;
Chris PeBenito 0834f9
Chris PeBenito 0834f9
	# Store temporary files
Chris PeBenito 0834f9
	allow $1_ethereal_t $1_ethereal_tmp_t:dir create_dir_perms;
Chris PeBenito 0834f9
	allow $1_ethereal_t $1_ethereal_tmp_t:file create_file_perms;
Chris PeBenito 0834f9
	files_tmp_filetrans($1_ethereal_t, $1_ethereal_tmp_t, { dir file })
Chris PeBenito 0834f9
Chris PeBenito 0834f9
	# Re-execute itself (why?)
Chris PeBenito 0834f9
	can_exec($1_ethereal_t, ethereal_exec_t)
Chris PeBenito 0834f9
	corecmd_search_sbin($1_ethereal_t)
Chris PeBenito 0834f9
Chris PeBenito 0834f9
	# /home/.ethereal
Chris PeBenito 0834f9
	allow $1_ethereal_t $1_ethereal_home_t:dir manage_dir_perms;
Chris PeBenito 0834f9
	allow $1_ethereal_t $1_ethereal_home_t:file manage_file_perms;
Chris PeBenito 0834f9
	allow $1_ethereal_t $1_ethereal_home_t:lnk_file create_lnk_perms;
Chris PeBenito 0834f9
	userdom_user_home_dir_filetrans($1,$1_ethereal_t,$1_ethereal_home_t,dir)
Chris PeBenito 0834f9
Chris PeBenito 0834f9
	allow $1_ethereal_t $1_ethereal_tmpfs_t:dir manage_dir_perms;
Chris PeBenito 0834f9
	allow $1_ethereal_t $1_ethereal_tmpfs_t:file manage_file_perms;
Chris PeBenito 0834f9
	allow $1_ethereal_t $1_ethereal_tmpfs_t:lnk_file create_lnk_perms;
Chris PeBenito 0834f9
	allow $1_ethereal_t $1_ethereal_tmpfs_t:sock_file manage_file_perms;
Chris PeBenito 0834f9
	allow $1_ethereal_t $1_ethereal_tmpfs_t:fifo_file manage_file_perms;
Chris PeBenito 0834f9
	fs_tmpfs_filetrans($1_ethereal_t,$1_ethereal_tmpfs_t,{ dir file lnk_file sock_file fifo_file })
Chris PeBenito 0834f9
Chris PeBenito 0834f9
	domain_auto_trans($2, ethereal_exec_t, $1_ethereal_t)
Chris PeBenito 0834f9
	allow $1_ethereal_t $2:fd use;
Chris PeBenito 0834f9
	allow $1_ethereal_t $2:process sigchld;
Chris PeBenito 0834f9
Chris PeBenito 0834f9
	allow $2 $1_ethereal_home_t:dir manage_dir_perms;
Chris PeBenito 0834f9
	allow $2 $1_ethereal_home_t:file manage_file_perms;
Chris PeBenito 0834f9
	allow $2 $1_ethereal_home_t:lnk_file create_lnk_perms;
Chris PeBenito 0834f9
	allow $2 $1_ethereal_home_t:{ dir file lnk_file } { relabelfrom relabelto };
Chris PeBenito 0834f9
Chris PeBenito 0834f9
	kernel_read_kernel_sysctls($1_ethereal_t)
Chris PeBenito 0834f9
	kernel_read_system_state($1_ethereal_t)
Chris PeBenito 0834f9
	kernel_read_sysctl($1_ethereal_t)
Chris PeBenito 0834f9
Chris PeBenito 0834f9
	corecmd_search_bin($1_ethereal_t)
Chris PeBenito 0834f9
Chris PeBenito 0834f9
	corenet_tcp_connect_generic_port($1_ethereal_t)
Chris PeBenito 0834f9
	corenet_tcp_sendrecv_generic_if($1_ethereal_t)
Chris PeBenito 0834f9
	
Chris PeBenito 0834f9
	dev_read_urand($1_ethereal_t)
Chris PeBenito 0834f9
Chris PeBenito 0834f9
	files_read_etc_files($1_ethereal_t)
Chris PeBenito 0834f9
	files_read_usr_files($1_ethereal_t)
Chris PeBenito 0834f9
Chris PeBenito 0834f9
	fs_list_inotifyfs($1_ethereal_t)
Chris PeBenito 0834f9
	fs_search_auto_mountpoints($1_ethereal_t)
Chris PeBenito 0834f9
Chris PeBenito 0834f9
	libs_read_lib_files($1_ethereal_t)
Chris PeBenito 0834f9
	libs_use_ld_so($1_ethereal_t)
Chris PeBenito 0834f9
	libs_use_shared_libs($1_ethereal_t)
Chris PeBenito 0834f9
Chris PeBenito 0834f9
	miscfiles_read_fonts($1_ethereal_t)
Chris PeBenito 0834f9
	miscfiles_read_localization($1_ethereal_t)
Chris PeBenito 0834f9
Chris PeBenito 0834f9
	seutil_use_newrole_fds($1_ethereal_t)
Chris PeBenito 0834f9
Chris PeBenito 0834f9
	sysnet_read_config($1_ethereal_t)
Chris PeBenito 0834f9
Chris PeBenito 0834f9
	userdom_manage_user_home_content_files($1,$1_ethereal_t)
Chris PeBenito 0834f9
	
Chris PeBenito 0834f9
	tunable_policy(`use_nfs_home_dirs',`
Chris PeBenito 0834f9
		fs_manage_nfs_dirs($1_ethereal_t)
Chris PeBenito 0834f9
		fs_manage_nfs_files($1_ethereal_t)
Chris PeBenito 0834f9
		fs_manage_nfs_symlinks($1_ethereal_t)
Chris PeBenito 0834f9
	')
Chris PeBenito 0834f9
Chris PeBenito 0834f9
	tunable_policy(`use_samba_home_dirs',`
Chris PeBenito 0834f9
		fs_manage_cifs_dirs($1_ethereal_t)
Chris PeBenito 0834f9
		fs_manage_cifs_files($1_ethereal_t)
Chris PeBenito 0834f9
		fs_manage_cifs_symlinks($1_ethereal_t)
Chris PeBenito 0834f9
	')
Chris PeBenito 0834f9
Chris PeBenito 0834f9
	optional_policy(`nscd',`
Chris PeBenito 0834f9
		nscd_socket_use($1_ethereal_t)
Chris PeBenito 0834f9
	')
Chris PeBenito 0834f9
Chris PeBenito 0834f9
	# Manual transition from userhelper 
Chris PeBenito 0834f9
	optional_policy(`userhelper', `
Chris PeBenito 0834f9
		userhelper_use_user_fd($1,$1_ethereal_t)
Chris PeBenito 0834f9
		userhelper_sigchld_user($1,$1_ethereal_t)
Chris PeBenito 0834f9
	')
Chris PeBenito 0834f9
Chris PeBenito 0834f9
	optional_policy(`xserver',`
Chris PeBenito 0834f9
		xserver_user_client_template($1,$1_ethereal_t,$1_ethereal_tmpfs_t)
Chris PeBenito 0834f9
		xserver_create_xdm_tmp_sockets($1_ethereal_t)
Chris PeBenito 0834f9
	')
Chris PeBenito 0834f9
	
Chris PeBenito 0834f9
	ifdef(`TODO',`
Chris PeBenito 0834f9
		# Why does it write this?
Chris PeBenito 0834f9
		optional_policy(`snmpd.te', `
Chris PeBenito 0834f9
			dontaudit sysadm_ethereal_t snmpd_var_lib_t:file write;
Chris PeBenito 0834f9
		')
Chris PeBenito 0834f9
		#TODO
Chris PeBenito 0834f9
		gnome_application($1_ethereal, $1)
Chris PeBenito 0834f9
		gnome_file_dialog($1_ethereal, $1)
Chris PeBenito 0834f9
		# FIXME: policy is incomplete
Chris PeBenito 0834f9
	')
Chris PeBenito 0834f9
	
Chris PeBenito 0834f9
')
Chris PeBenito 0834f9
Chris PeBenito 0834f9
#######################################
Chris PeBenito 0834f9
## <summary>
Chris PeBenito 0834f9
##	The administrative functions template for the ethereal module.
Chris PeBenito 0834f9
## </summary>
Chris PeBenito 0834f9
## <desc>
Chris PeBenito 0834f9
##	

Chris PeBenito 0834f9
##	This template creates rules for administrating ethereal,
Chris PeBenito 0834f9
##	allowing the specified user to manage ethereal files.
Chris PeBenito 0834f9
##	

Chris PeBenito 0834f9
## </desc>
Chris PeBenito 0834f9
## <param name="userdomain_prefix">
Chris PeBenito 0834f9
##	<summary>
Chris PeBenito 0834f9
##	The prefix of the user domain (e.g., user
Chris PeBenito 0834f9
##	is the prefix for user_t).
Chris PeBenito 0834f9
##	</summary>
Chris PeBenito 0834f9
## </param>
Chris PeBenito 0834f9
## <param name="user_domain">
Chris PeBenito 0834f9
##	<summary>
Chris PeBenito 0834f9
##	The type of the user domain.
Chris PeBenito 0834f9
##	</summary>
Chris PeBenito 0834f9
## </param>
Chris PeBenito 0834f9
#
Chris PeBenito c28caf
template(`ethereal_admin_template',`
Chris PeBenito 0834f9
	gen_require(`
Chris PeBenito 0834f9
		type $1_ethereal_t;
Chris PeBenito 0834f9
	')
Chris PeBenito 0834f9
Chris PeBenito 0834f9
	# Create various types of sockets
Chris PeBenito 0834f9
	allow $1_ethereal_t self:netlink_route_socket create_netlink_socket_perms;
Chris PeBenito 0834f9
	allow $1_ethereal_t self:udp_socket create_socket_perms;
Chris PeBenito 0834f9
	allow $1_ethereal_t self:packet_socket create_socket_perms;
Chris PeBenito 0834f9
	allow $1_ethereal_t self:unix_stream_socket create_stream_socket_perms;
Chris PeBenito 0834f9
	allow $1_ethereal_t self:tcp_socket create_socket_perms;
Chris PeBenito 0834f9
	
Chris PeBenito 0834f9
	userdom_use_user_terminals($1,$1_ethereal_t)
Chris PeBenito 0834f9
	# Ethereal tries to write to user terminal
Chris PeBenito 0834f9
	userdom_dontaudit_use_user_terminals($1,$1_ethereal_t)
Chris PeBenito 0834f9
')
Chris PeBenito 0834f9
Chris PeBenito 0834f9
########################################
Chris PeBenito 0834f9
## <summary>
Chris PeBenito 0834f9
##	Run ethereal in ethereal domain.
Chris PeBenito 0834f9
## </summary>
Chris PeBenito 0834f9
## <desc>
Chris PeBenito 0834f9
##	

Chris PeBenito 0834f9
##	Run ethereal in ethereal domain.
Chris PeBenito 0834f9
##	

Chris PeBenito 0834f9
##	

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

Chris PeBenito 0834f9
## </desc>
Chris PeBenito 0834f9
## <param name="userdomain_prefix">
Chris PeBenito 0834f9
##	<summary>
Chris PeBenito 0834f9
##	The prefix of the user domain (e.g., user
Chris PeBenito 0834f9
##	is the prefix for user_t).
Chris PeBenito 0834f9
##	</summary>
Chris PeBenito 0834f9
## </param>
Chris PeBenito 0834f9
## <param name="domain">
Chris PeBenito 0834f9
##	<summary>
Chris PeBenito 0834f9
##	Domain allowed access.
Chris PeBenito 0834f9
##	</summary>
Chris PeBenito 0834f9
## </param>
Chris PeBenito 0834f9
#
Chris PeBenito 0834f9
template(`ethereal_domtrans_user_ethereal',`
Chris PeBenito 0834f9
	gen_require(`
Chris PeBenito 0834f9
		type $1_ethereal_t, ethereal_exec_t;
Chris PeBenito 0834f9
	')
Chris PeBenito 0834f9
Chris PeBenito 0834f9
	domain_auto_trans($2,ethereal_exec_t,$1_ethereal_t)
Chris PeBenito 0834f9
Chris PeBenito 0834f9
	allow $2 $1_ethereal_t:fd use;
Chris PeBenito 0834f9
	allow $1_ethereal_t $2:fd use;
Chris PeBenito 0834f9
	allow $1_ethereal_t $2:fifo_file rw_file_perms;
Chris PeBenito 0834f9
	allow $1_ethereal_t $2:process sigchld;
Chris PeBenito 0834f9
')
Chris PeBenito 0834f9
Chris PeBenito 0834f9
########################################
Chris PeBenito 0834f9
## <summary>
Chris PeBenito 0834f9
##	Run tethereal in the tethereal domain.
Chris PeBenito 0834f9
## </summary>
Chris PeBenito 0834f9
## <param name="domain">
Chris PeBenito 0834f9
##	<summary>
Chris PeBenito 0834f9
##	Domain allowed access.
Chris PeBenito 0834f9
##	</summary>
Chris PeBenito 0834f9
## </param>
Chris PeBenito 0834f9
#
Chris PeBenito 0834f9
template(`ethereal_domtrans_tethereal',`
Chris PeBenito 0834f9
	gen_require(`
Chris PeBenito 0834f9
		type tethereal_t, tethereal_exec_t;
Chris PeBenito 0834f9
	')
Chris PeBenito 0834f9
Chris PeBenito 0834f9
	domain_auto_trans($1,tethereal_exec_t,tethereal_t)
Chris PeBenito 0834f9
Chris PeBenito 0834f9
	allow $1 tethereal_t:fd use;
Chris PeBenito 0834f9
	allow tethereal_t $1:fd use;
Chris PeBenito 0834f9
	allow tethereal_t $1:fifo_file rw_file_perms;
Chris PeBenito 0834f9
	allow tethereal_t $1:process sigchld;
Chris PeBenito 0834f9
')
Chris PeBenito 0834f9
Chris PeBenito 0834f9
########################################
Chris PeBenito 0834f9
## <summary>
Chris PeBenito 0834f9
##	Execute tethereal in the tethereal domain, and
Chris PeBenito 0834f9
##	allow the specified role the tethereal domain.
Chris PeBenito 0834f9
## </summary>
Chris PeBenito 0834f9
## <param name="domain">
Chris PeBenito 0834f9
##	<summary>
Chris PeBenito 0834f9
##	Domain allowed access.
Chris PeBenito 0834f9
##	</summary>
Chris PeBenito 0834f9
## </param>
Chris PeBenito 0834f9
## <param name="role">
Chris PeBenito 0834f9
##	<summary>
Chris PeBenito 0834f9
##	The role to be allowed the tethereal domain.
Chris PeBenito 0834f9
##	</summary>
Chris PeBenito 0834f9
## </param>
Chris PeBenito 0834f9
## <param name="terminal">
Chris PeBenito 0834f9
##	<summary>
Chris PeBenito 0834f9
##	The type of the terminal allow the tethereal domain to use.
Chris PeBenito 0834f9
##	</summary>
Chris PeBenito 0834f9
## </param>
Chris PeBenito 0834f9
#
Chris PeBenito 0834f9
interface(`ethereal_run_tethereal',`
Chris PeBenito 0834f9
	gen_require(`
Chris PeBenito 0834f9
		type tethereal_t;
Chris PeBenito 0834f9
	')
Chris PeBenito 0834f9
Chris PeBenito 0834f9
	ethereal_domtrans_tethereal($1)
Chris PeBenito 0834f9
	role $2 types tethereal_t;
Chris PeBenito 0834f9
	allow tethereal_t $3:chr_file rw_term_perms;
Chris PeBenito 0834f9
')