Chris PeBenito 8cffa7
## <summary>IRC client policy</summary>
Chris PeBenito 8cffa7
Chris PeBenito 8cffa7
#######################################
Chris PeBenito 8cffa7
## <summary>
Chris PeBenito bbcd3c
##	The per role template for the irc module.
Chris PeBenito 8cffa7
## </summary>
Chris PeBenito 8cffa7
## <desc>
Chris PeBenito 8cffa7
##	

Chris PeBenito 8cffa7
##	This template creates a derived domains which are used
Chris PeBenito 8cffa7
##	for an irc client sessions.
Chris PeBenito 8cffa7
##	

Chris PeBenito 8cffa7
##	

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

Chris PeBenito 8cffa7
## </desc>
Chris PeBenito 8cffa7
## <param name="userdomain_prefix">
Chris PeBenito 885b83
##	<summary>
Chris PeBenito 8cffa7
##	The prefix of the user domain (e.g., user
Chris PeBenito 8cffa7
##	is the prefix for user_t).
Chris PeBenito 885b83
##	</summary>
Chris PeBenito 8cffa7
## </param>
Chris PeBenito 8cffa7
## <param name="user_domain">
Chris PeBenito 885b83
##	<summary>
Chris PeBenito 8cffa7
##	The type of the user domain.
Chris PeBenito 885b83
##	</summary>
Chris PeBenito 8cffa7
## </param>
Chris PeBenito 8cffa7
## <param name="user_role">
Chris PeBenito 885b83
##	<summary>
Chris PeBenito 8cffa7
##	The role associated with the user domain.
Chris PeBenito 885b83
##	</summary>
Chris PeBenito 8cffa7
## </param>
Chris PeBenito 8cffa7
#
Chris PeBenito bbcd3c
template(`irc_per_role_template',`
Chris PeBenito 8cffa7
	gen_require(`
Chris PeBenito 8cffa7
		type irc_exec_t;
Chris PeBenito 8cffa7
	')
Chris PeBenito 8cffa7
Chris PeBenito 8cffa7
	########################################
Chris PeBenito 8cffa7
	#
Chris PeBenito 8cffa7
	# Declarations
Chris PeBenito 8cffa7
	#
Chris PeBenito 8cffa7
Chris PeBenito 8cffa7
	type $1_irc_t;
Chris PeBenito 8cffa7
	domain_type($1_irc_t)
Chris PeBenito 8cffa7
	domain_entry_file($1_irc_t,irc_exec_t)
Chris PeBenito 8cffa7
	role $3 types $1_irc_t;
Chris PeBenito 8cffa7
Chris PeBenito 8cffa7
	type $1_irc_exec_t;
Chris PeBenito 103fe2
	userdom_user_home_content($1,$1_irc_exec_t)
Chris PeBenito 8cffa7
	domain_entry_file($1_irc_t,$1_irc_exec_t)
Chris PeBenito 8cffa7
Chris PeBenito 8cffa7
	type $1_irc_home_t;
Chris PeBenito 103fe2
	userdom_user_home_content($1,$1_irc_home_t)
Chris PeBenito 4ace0f
Chris PeBenito 4ace0f
	type $1_irc_tmp_t;
Chris PeBenito 103fe2
	userdom_user_home_content($1,$1_irc_tmp_t)
Chris PeBenito 8cffa7
	
Chris PeBenito 8cffa7
	########################################
Chris PeBenito 8cffa7
	#
Chris PeBenito 8cffa7
	# Local policy
Chris PeBenito 8cffa7
	#
Chris PeBenito 8cffa7
Chris PeBenito 8cffa7
	allow $1_irc_t self:unix_stream_socket create_stream_socket_perms;
Chris PeBenito 8cffa7
	allow $1_irc_t self:tcp_socket create_socket_perms;
Chris PeBenito 8cffa7
	allow $1_irc_t self:udp_socket create_socket_perms;
Chris PeBenito 8cffa7
Chris PeBenito c0868a
	manage_dirs_pattern($1_irc_t,$1_irc_home_t,$1_irc_home_t)
Chris PeBenito c0868a
	manage_files_pattern($1_irc_t,$1_irc_home_t,$1_irc_home_t)
Chris PeBenito c0868a
	manage_lnk_files_pattern($1_irc_t,$1_irc_home_t,$1_irc_home_t)
Chris PeBenito 103fe2
	userdom_user_home_dir_filetrans($1,$1_irc_t,$1_irc_home_t,{ dir file lnk_file })
Chris PeBenito 8cffa7
Chris PeBenito 8cffa7
	# access files under /tmp
Chris PeBenito c0868a
	manage_dirs_pattern($1_irc_t,$1_irc_tmp_t,$1_irc_tmp_t)
Chris PeBenito c0868a
	manage_files_pattern($1_irc_t,$1_irc_tmp_t,$1_irc_tmp_t)
Chris PeBenito c0868a
	manage_lnk_files_pattern($1_irc_t,$1_irc_tmp_t,$1_irc_tmp_t)
Chris PeBenito c0868a
	manage_fifo_files_pattern($1_irc_t,$1_irc_tmp_t,$1_irc_tmp_t)
Chris PeBenito c0868a
	manage_sock_files_pattern($1_irc_t,$1_irc_tmp_t,$1_irc_tmp_t)
Chris PeBenito 103fe2
	files_tmp_filetrans($1_irc_t,$1_irc_tmp_t,{ file dir lnk_file sock_file fifo_file })
Chris PeBenito 8cffa7
Chris PeBenito 8cffa7
	# Transition from the user domain to the derived domain.
Chris PeBenito c0868a
	domtrans_pattern($2,irc_exec_t,$1_irc_t)
Chris PeBenito 8cffa7
	
Chris PeBenito c0868a
	allow $2 $1_irc_exec_t:file { relabelfrom relabelto manage_file_perms };
Chris PeBenito 8cffa7
Chris PeBenito 8cffa7
	# allow ps to show irc
Chris PeBenito c0868a
	ps_process_pattern($2,$1_irc_t)
Chris PeBenito c0868a
	allow $2 $1_irc_t:process signal;
Chris PeBenito 8cffa7
	
Chris PeBenito 8cffa7
	kernel_read_proc_symlinks($1_irc_t)
Chris PeBenito 8cffa7
Chris PeBenito 190066
	corenet_all_recvfrom_unlabeled($1_irc_t)
Chris PeBenito 190066
	corenet_all_recvfrom_netlabel($1_irc_t)
Chris PeBenito 8cffa7
	corenet_tcp_sendrecv_generic_if($1_irc_t)
Chris PeBenito 8cffa7
	corenet_udp_sendrecv_generic_if($1_irc_t)
Chris PeBenito 8cffa7
	corenet_tcp_sendrecv_all_nodes($1_irc_t)
Chris PeBenito 8cffa7
	corenet_udp_sendrecv_all_nodes($1_irc_t)
Chris PeBenito 8cffa7
	corenet_tcp_sendrecv_all_ports($1_irc_t)
Chris PeBenito 8cffa7
	corenet_udp_sendrecv_all_ports($1_irc_t)
Chris PeBenito c0d8c4
	corenet_sendrecv_ircd_client_packets($1_irc_t)
Chris PeBenito 8cffa7
	# cjp: this seems excessive:
Chris PeBenito 8cffa7
	corenet_tcp_connect_all_ports($1_irc_t)
Chris PeBenito c0d8c4
	corenet_sendrecv_all_client_packets($1_irc_t)
Chris PeBenito 8cffa7
Chris PeBenito 15722e
	domain_use_interactive_fds($1_irc_t)
Chris PeBenito 8cffa7
Chris PeBenito 8cffa7
	files_dontaudit_search_pids($1_irc_t)
Chris PeBenito 8cffa7
	files_search_var($1_irc_t)
Chris PeBenito 8cffa7
	files_read_etc_files($1_irc_t)
Chris PeBenito 8cffa7
	files_read_usr_files($1_irc_t)
Chris PeBenito 8cffa7
Chris PeBenito 8cffa7
	fs_getattr_xattr_fs($1_irc_t)
Chris PeBenito 8cffa7
	fs_search_auto_mountpoints($1_irc_t)
Chris PeBenito 8cffa7
Chris PeBenito 8cffa7
	term_use_controlling_term($1_irc_t)
Chris PeBenito 8cffa7
	term_list_ptys($1_irc_t)
Chris PeBenito 8cffa7
Chris PeBenito 8cffa7
	# allow utmp access
Chris PeBenito 68228b
	init_read_utmp($1_irc_t)
Chris PeBenito 68228b
	init_dontaudit_lock_utmp($1_irc_t)
Chris PeBenito 8cffa7
Chris PeBenito 8cffa7
	libs_use_ld_so($1_irc_t)
Chris PeBenito 8cffa7
	libs_use_shared_libs($1_irc_t)
Chris PeBenito 8cffa7
Chris PeBenito 8cffa7
	miscfiles_read_localization($1_irc_t)
Chris PeBenito 8cffa7
Chris PeBenito 8cffa7
	# Inherit and use descriptors from newrole.
Chris PeBenito 15722e
	seutil_use_newrole_fds($1_irc_t)
Chris PeBenito 8cffa7
Chris PeBenito 8cffa7
	sysnet_read_config($1_irc_t)
Chris PeBenito 8cffa7
Chris PeBenito 8cffa7
	# Write to the user domain tty.
Chris PeBenito 8cffa7
	userdom_use_user_terminals($1,$1_irc_t)
Chris PeBenito 8cffa7
Chris PeBenito 8cffa7
	tunable_policy(`use_nfs_home_dirs',`
Chris PeBenito 8cffa7
		fs_manage_nfs_dirs($1_irc_t)
Chris PeBenito 8cffa7
		fs_manage_nfs_files($1_irc_t)
Chris PeBenito 8cffa7
		fs_manage_nfs_symlinks($1_irc_t)
Chris PeBenito 8cffa7
	')
Chris PeBenito 8cffa7
Chris PeBenito 8cffa7
	tunable_policy(`use_samba_home_dirs',`
Chris PeBenito 8cffa7
		fs_manage_cifs_dirs($1_irc_t)
Chris PeBenito 8cffa7
		fs_manage_cifs_files($1_irc_t)
Chris PeBenito 8cffa7
		fs_manage_cifs_symlinks($1_irc_t)
Chris PeBenito 8cffa7
	')
Chris PeBenito 8cffa7
Chris PeBenito bb7170
	optional_policy(`
Chris PeBenito 8cffa7
		nis_use_ypbind($1_irc_t)
Chris PeBenito 8cffa7
	')
Chris PeBenito 8cffa7
')