Chris PeBenito 0834f9b
## <summary>Ethereal packet capture tool.</summary>
Chris PeBenito 0834f9b
Chris PeBenito 0834f9b
#######################################
Chris PeBenito 0834f9b
## <summary>
Chris PeBenito bbcd3c9
##	The per role template for the ethereal module.
Chris PeBenito 0834f9b
## </summary>
Chris PeBenito 0834f9b
## <desc>
Chris PeBenito 0834f9b
##	

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

Chris PeBenito 0834f9b
##	

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

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

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

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

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

Chris PeBenito 0834f9b
##	

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

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