All pastes #1021177 Raw Edit

Stuff

public text v1 · immutable
#1021177 ·published 2008-05-17 17:56 UTC
rendered paste body
## <summary>SELinux policy module for Ekiga</summary>
## <desc>
##	<p>
##		Applies SELinux security to Ekiga
##	</p>
## </desc>

#######################################
## <summary>
##      The per role template for the Ekiga module.
## </summary>
## <desc>
##      <p>
##      This template creates derived domains which are used
##      for Ekiga.
##      </p>
##      <p>
##      This template is invoked automatically for each user, and
##      generally does not need to be invoked directly
##      by policy writers.
##      </p>
## </desc>
## <param name="userdomain_prefix">
##      <summary>
##      The prefix of the user domain (e.g., user
##      is the prefix for user_t).
##      </summary>
## </param>
## <param name="user_domain">
##      <summary>
##      The type of the user domain.
##      </summary>
## </param>
## <param name="user_role">
##      <summary>
##      The role associated with the user domain.
##      </summary>
## </param>
#
template(`ekiga_per_role_template',`
	gen_require(`
		type ekiga_exec_t, ekiga_config_exec_t, ekiga_helper_exec_t, user_ekiga_tmp_t;
	')

	########################################
	#
	# Declarations
	#

	type $1_ekiga_t;
	application_domain($1_ekiga_t,ekiga_exec_t)
	role $3 types $1_ekiga_t;

	type $1_ekiga_config_t;
	application_domain($1_ekiga_config_t,ekiga_config_exec_t)
	role $3 types $1_ekiga_config_t;

	type $1_ekiga_helper_t;
	application_domain($1_ekiga_helper_t,ekiga_helper_exec_t)
	role $3 types $1_ekiga_helper_t;

	type $1_ekiga_tmpfs_t;
	files_tmpfs_file($1_ekiga_tmpfs_t)

	## <desc>
	## <p>
	## Confine Ekiga per user domain
	## </p>
	## </desc>

	gen_tunable(ekiga_confine_$1,false)

	ifelse(`$1',`user',`',`
		typealias user_ekiga_tmp_t alias $1_ekiga_tmp_t;
	')

	########################################
	#
	# Ekiga local policy
	#	

	allow $1_ekiga_t self:fifo_file rw_fifo_file_perms;
	allow $1_ekiga_t self:process { signal_perms getsched ptrace };
	allow $1_ekiga_t self:shm { write unix_read unix_write read destroy create };
	allow $1_ekiga_t self:tcp_socket { setopt read bind create write getattr connect getopt listen };
	allow $1_ekiga_t self:udp_socket { setopt read bind create getattr write ioctl connect shutdown };

	allow $1_ekiga_t $2:process signal_perms;
	allow $1_ekiga_t $2:unix_stream_socket connectto;

	allow $2 $1_ekiga_t:process signal_perms;
	allow $2 $1_ekiga_t:unix_stream_socket connectto;

	manage_dirs_pattern($1_ekiga_t,user_ekiga_tmp_t,user_ekiga_tmp_t)
	manage_sock_files_pattern($1_ekiga_t,user_ekiga_tmp_t,user_ekiga_tmp_t)
	userdom_user_tmp_filetrans($1,$1_ekiga_t,user_ekiga_tmp_t,{ dir sock_file })

	files_list_tmp($1_ekiga_t)

	ps_process_pattern($2,$1_ekiga_t)

	gen_require(`
		type $1_tmpfs_t, udev_tbl_t, user_home_t, user_tmp_t;
	')

	allow $1_ekiga_t user_home_t:file { read getattr append };
	allow $1_ekiga_t user_tmp_t:dir setattr;
	allow $1_ekiga_t user_tmp_t:sock_file { write read };
	userdom_manage_unpriv_users_tmp_files($1_ekiga_t)

	dontaudit $1_ekiga_t $1_tmpfs_t:file getattr; # pulse
	dontaudit $1_ekiga_t udev_tbl_t:file getattr; 

	allow $2 user_ekiga_tmp_t:sock_file write;

	fs_getattr_tmpfs($1_ekiga_t)
	fs_manage_tmpfs_files($1_ekiga_t)
	fs_manage_tmpfs_dirs($1_ekiga_t)

	fs_search_inotifyfs($1_ekiga_t)
	fs_search_auto_mountpoints($1_ekiga_t)

	fs_read_noxattr_fs_files($1_ekiga_t)

	dev_dontaudit_getattr_all_blk_files($1_ekiga_t)
	dev_dontaudit_getattr_all_chr_files($1_ekiga_t)

	logging_send_syslog_msg($1_ekiga_t)

	libs_use_ld_so($1_ekiga_t)
	libs_use_shared_libs($1_ekiga_t)

	miscfiles_read_localization($1_ekiga_t)

	files_read_etc_files($1_ekiga_t)
	files_read_etc_runtime_files($1_ekiga_t)
	files_read_etc_symlinks($1_ekiga_t)

	files_read_usr_files($1_ekiga_t)
	files_read_usr_symlinks($1_ekiga_t)

	sysnet_read_config($1_ekiga_t)

	kernel_getattr_core_if($1_ekiga_t)
	kernel_read_system_state($1_ekiga_t)

	miscfiles_read_fonts($1_ekiga_t)

	term_getattr_unallocated_ttys($1_ekiga_t)
	term_list_ptys($1_ekiga_t)
	term_read_console($1_ekiga_t)

	corecmd_exec_bin($1_ekiga_t)
	application_exec($1_ekiga_t)

	dev_list_sysfs($1_ekiga_t)

	dev_read_input($1_ekiga_t)
	dev_read_lvm_control($1_ekiga_t)
	dev_read_rand($1_ekiga_t)
	dev_read_raw_memory($1_ekiga_t)
	dev_read_realtime_clock($1_ekiga_t)
	dev_read_sysfs($1_ekiga_t)
	dev_read_urand($1_ekiga_t)
	dev_write_sound($1_ekiga_t)
	dev_read_sound($1_ekiga_t)
	dev_read_video_dev($1_ekiga_t)
	dev_write_video_dev($1_ekiga_t)

	xserver_user_x_domain_template($1,$1_ekiga,$1_ekiga_t,$1_ekiga_tmpfs_t)
	xserver_read_xdm_pid($1_ekiga_t)
	xserver_dontaudit_read_xdm_tmp_files($1_ekiga_t)
	xserver_dontaudit_getattr_xdm_tmp_sockets($1_ekiga_t)

	corenet_all_recvfrom_unlabeled($1_ekiga_t)
	corenet_all_recvfrom_netlabel($1_ekiga_t)

	corenet_tcp_sendrecv_generic_if($1_ekiga_t)
	corenet_udp_sendrecv_generic_if($1_ekiga_t)

	corenet_tcp_sendrecv_all_nodes($1_ekiga_t)
	corenet_udp_sendrecv_all_nodes($1_ekiga_t)

	corenet_tcp_bind_generic_node($1_ekiga_t)
	corenet_udp_bind_generic_node($1_ekiga_t)
	corenet_udp_bind_inaddr_any_node($1_ekiga_t)

	corenet_tcp_connect_http_port($1_ekiga_t)

	corenet_tcp_bind_asterisk_port($1_ekiga_t)
	corenet_udp_bind_asterisk_port($1_ekiga_t)

	# make this ekiga_port_t
	corenet_udp_bind_generic_port(user_ekiga_t)
	
	optional_policy(`
		avahi_dbus_chat($1_ekiga_t)
	')

	optional_policy(`
		alsa_read_rw_config($1_ekiga_t)
	')

	optional_policy(`
		automount_dontaudit_getattr_tmp_dirs($1_ekiga_t)
	')

	optional_policy(`
		cups_read_rw_config($1_ekiga_t)
		cups_dbus_chat($1_ekiga_t)
		cups_stream_connect($1_ekiga_t)
	')

	optional_policy(`
		dbus_system_bus_client_template($1_ekiga,$1_ekiga_t)
		dbus_user_bus_client_template($1,$1_ekiga,$1_ekiga_t)
		dbus_connectto_user_bus($1,$1_ekiga_t)
	')

	optional_policy(`
		gnome_exec_gconf($1_ekiga_t)
		gnome_manage_user_gnome_config($1,$1_ekiga_t)
	')

	optional_policy(`
		gnome_domtrans_user_gconf($1,$1_ekiga_t)
		gnome_stream_connect_gconf_template($1,$1_ekiga_t)
	')

	tunable_policy(`use_nfs_home_dirs',`
		fs_manage_nfs_dirs($1_ekiga_t)
		fs_manage_nfs_files($1_ekiga_t)
		fs_manage_nfs_symlinks($1_ekiga_t)
	')

	tunable_policy(`use_samba_home_dirs',`
		fs_manage_cifs_dirs($1_ekiga_t)
		fs_manage_cifs_files($1_ekiga_t)
		fs_manage_cifs_symlinks($1_ekiga_t)
	')

	tunable_policy(`ekiga_confine_$1',`
		domain_auto_trans($2,ekiga_exec_t,$1_ekiga_t)
		domain_auto_trans($2,ekiga_config_exec_t,$1_ekiga_config_t)
		domain_auto_trans($2,ekiga_helper_exec_t,$1_ekiga_helper_t)
	',`
		can_exec($2,ekiga_exec_t)
		can_exec($2,ekiga_config_exec_t)
		can_exec($2,ekiga_helper_exec_t)
	')
')