1ec3d1a
## <summary>Telepathy communications framework.</summary>
1ec3d1a
1ec3d1a
#######################################
1ec3d1a
## <summary>
1ec3d1a
##	Creates basic types for telepathy
1ec3d1a
##	domain
1ec3d1a
## </summary>
1ec3d1a
## <param name="prefix">
1ec3d1a
##	<summary>
1ec3d1a
##	Prefix for the domain.
1ec3d1a
##	</summary>
1ec3d1a
## </param>
1ec3d1a
#
1ec3d1a
template(`telepathy_domain_template',`
1ec3d1a
	gen_require(`
1ec3d1a
		attribute telepathy_domain;
1ec3d1a
		attribute telepathy_executable;
1ec3d1a
	')
1ec3d1a
1ec3d1a
	type telepathy_$1_t, telepathy_domain;
1ec3d1a
	type telepathy_$1_exec_t, telepathy_executable;
1ec3d1a
	application_domain(telepathy_$1_t, telepathy_$1_exec_t)
1ec3d1a
	ubac_constrained(telepathy_$1_t)
1ec3d1a
1ec3d1a
	type telepathy_$1_tmp_t;
Chris PeBenito 66b26ac
	userdom_user_tmp_file(telepathy_$1_tmp_t)
1ec3d1a
3f15d96
	kernel_read_system_state(telepathy_$1_t)
1bafb67
Chris PeBenito 7b2152c
	auth_use_nsswitch(telepathy_$1_t)
1ec3d1a
')
1ec3d1a
1ec3d1a
#######################################
1ec3d1a
## <summary>
1ec3d1a
##	Role access for telepathy domains
1ec3d1a
##	that executes via dbus-session
1ec3d1a
## </summary>
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
## <param name="domain_prefix">
1ec3d1a
##	<summary>
1ec3d1a
##	User domain prefix to be used.
1ec3d1a
##	</summary>
1ec3d1a
## </param>
1ec3d1a
#
1ec3d1a
template(`telepathy_role',`
1ec3d1a
	gen_require(`
1ec3d1a
		attribute telepathy_domain;
1ec3d1a
		type telepathy_gabble_t, telepathy_sofiasip_t, telepathy_idle_t;
1ec3d1a
		type telepathy_mission_control_t, telepathy_salut_t, telepathy_sunshine_t;
1ec3d1a
		type telepathy_stream_engine_t, telepathy_msn_t, telepathy_gabble_exec_t;
1ec3d1a
		type telepathy_sofiasip_exec_t, telepathy_idle_exec_t;
1ec3d1a
		type telepathy_logger_t, telepathy_logger_exec_t;
1ec3d1a
		type telepathy_mission_control_exec_t, telepathy_salut_exec_t;
1ec3d1a
		type telepathy_sunshine_exec_t, telepathy_stream_engine_exec_t;
1ec3d1a
		type telepathy_msn_exec_t;
1ec3d1a
	')
1ec3d1a
1ec3d1a
	role $1 types telepathy_domain;
1ec3d1a
1ec3d1a
	allow $2 telepathy_domain:process signal_perms;
1ec3d1a
	ps_process_pattern($2, telepathy_domain)
1ec3d1a
1ec3d1a
	telepathy_gabble_stream_connect($2)
1ec3d1a
	telepathy_msn_stream_connect($2)
1ec3d1a
	telepathy_salut_stream_connect($2)
1ec3d1a
1ec3d1a
	dbus_session_domain($3, telepathy_gabble_exec_t, telepathy_gabble_t)
1ec3d1a
	dbus_session_domain($3, telepathy_sofiasip_exec_t, telepathy_sofiasip_t)
1ec3d1a
	dbus_session_domain($3, telepathy_idle_exec_t, telepathy_idle_t)
1ec3d1a
	dbus_session_domain($3, telepathy_logger_exec_t, telepathy_logger_t)
1ec3d1a
	dbus_session_domain($3, telepathy_mission_control_exec_t, telepathy_mission_control_t)
1ec3d1a
	dbus_session_domain($3, telepathy_salut_exec_t, telepathy_salut_t)
1ec3d1a
	dbus_session_domain($3, telepathy_sunshine_exec_t, telepathy_sunshine_t)
1ec3d1a
	dbus_session_domain($3, telepathy_stream_engine_exec_t, telepathy_stream_engine_t)
1ec3d1a
	dbus_session_domain($3, telepathy_msn_exec_t, telepathy_msn_t)
1ec3d1a
1ec3d1a
	telepathy_dbus_chat($2)
1ec3d1a
')
1ec3d1a
1ec3d1a
########################################
1ec3d1a
## <summary>
1ec3d1a
##	Stream connect to Telepathy Gabble
1ec3d1a
## </summary>
1ec3d1a
## <param name="domain">
1ec3d1a
## 	<summary>
1ec3d1a
##	Domain allowed access.
1ec3d1a
##	</summary>
1ec3d1a
## </param>
1ec3d1a
#
1ec3d1a
interface(`telepathy_gabble_stream_connect', `
1ec3d1a
	gen_require(`
1ec3d1a
		type telepathy_gabble_t, telepathy_gabble_tmp_t;
1ec3d1a
	')
1ec3d1a
1ec3d1a
	stream_connect_pattern($1, telepathy_gabble_tmp_t, telepathy_gabble_tmp_t, telepathy_gabble_t)
1ec3d1a
	files_search_tmp($1)
1ec3d1a
')
1ec3d1a
1ec3d1a
########################################
1ec3d1a
## <summary>
1ec3d1a
##	Send DBus messages to and from
1ec3d1a
##	Telepathy Gabble.
1ec3d1a
## </summary>
1ec3d1a
## <param name="domain">
1ec3d1a
## 	<summary>
1ec3d1a
##	Domain allowed access.
1ec3d1a
##	</summary>
1ec3d1a
## </param>
1ec3d1a
#
1ec3d1a
interface(`telepathy_gabble_dbus_chat', `
1ec3d1a
	gen_require(`
1ec3d1a
		type telepathy_gabble_t;
1ec3d1a
		class dbus send_msg;
1ec3d1a
	')
1ec3d1a
1ec3d1a
	allow $1 telepathy_gabble_t:dbus send_msg;
1ec3d1a
	allow telepathy_gabble_t $1:dbus send_msg;
1ec3d1a
')
1ec3d1a
1ec3d1a
########################################
1ec3d1a
## <summary>
1ec3d1a
##	Read telepathy mission control state.
1ec3d1a
## </summary>
1ec3d1a
## <param name="domain">
1ec3d1a
## 	<summary>
1ec3d1a
##	Domain allowed access.
1ec3d1a
##	</summary>
1ec3d1a
## </param>
1ec3d1a
#
1ec3d1a
interface(`telepathy_mission_control_read_state',`
1ec3d1a
	gen_require(`
1ec3d1a
		type telepathy_mission_control_t;
1ec3d1a
	')
1ec3d1a
1ec3d1a
	kernel_search_proc($1)
1ec3d1a
	ps_process_pattern($1, telepathy_mission_control_t)
1ec3d1a
')
1ec3d1a
1ec3d1a
#######################################
1ec3d1a
## <summary>
1ec3d1a
##	Stream connect to telepathy MSN managers
1ec3d1a
## </summary>
1ec3d1a
## <param name="domain">
1ec3d1a
##	<summary>
1ec3d1a
##	Domain allowed access.
1ec3d1a
##	</summary>
1ec3d1a
## </param>
1ec3d1a
#
1ec3d1a
interface(`telepathy_msn_stream_connect', `
1ec3d1a
	gen_require(`
1ec3d1a
		type telepathy_msn_t, telepathy_msn_tmp_t;
1ec3d1a
	')
1ec3d1a
1ec3d1a
	stream_connect_pattern($1, telepathy_msn_tmp_t, telepathy_msn_tmp_t, telepathy_msn_t)
1ec3d1a
	files_search_tmp($1)
1ec3d1a
')
1ec3d1a
1ec3d1a
########################################
1ec3d1a
## <summary>
1ec3d1a
##	Stream connect to Telepathy Salut
1ec3d1a
## </summary>
1ec3d1a
## <param name="domain">
1ec3d1a
##	<summary>
1ec3d1a
##	Domain allowed access.
1ec3d1a
##	</summary>
1ec3d1a
## </param>
1ec3d1a
#
1ec3d1a
interface(`telepathy_salut_stream_connect', `
1ec3d1a
	gen_require(`
1ec3d1a
		type telepathy_salut_t, telepathy_salut_tmp_t;
1ec3d1a
	')
1ec3d1a
1ec3d1a
	stream_connect_pattern($1, telepathy_salut_tmp_t, telepathy_salut_tmp_t, telepathy_salut_t)
1ec3d1a
	files_search_tmp($1)
1ec3d1a
')
1ec3d1a
1ec3d1a
#######################################
1ec3d1a
## <summary>
1ec3d1a
##	Send DBus messages to and from
1ec3d1a
##	all Telepathy domain.
1ec3d1a
## </summary>
1ec3d1a
## <param name="domain">
1ec3d1a
##	<summary>
1ec3d1a
##	Domain allowed access.
1ec3d1a
##	</summary>
1ec3d1a
## </param>
1ec3d1a
#
1ec3d1a
interface(`telepathy_dbus_chat',`
1ec3d1a
	gen_require(`
1ec3d1a
		attribute telepathy_domain;
1ec3d1a
		class dbus send_msg;
1ec3d1a
	')
1ec3d1a
1ec3d1a
	allow $1 telepathy_domain:dbus send_msg;
1ec3d1a
	allow telepathy_domain $1:dbus send_msg;
1ec3d1a
')
1ec3d1a
1ec3d1a
######################################
1ec3d1a
## <summary>
1ec3d1a
##	Execute telepathy executable
1ec3d1a
##	in the specified domain.
1ec3d1a
## </summary>
1ec3d1a
## <desc>
1ec3d1a
##	

1ec3d1a
##	Execute a telepathy executable
1ec3d1a
##	in the specified domain.  This allows
1ec3d1a
##	the specified domain to execute any file
1ec3d1a
##	on these filesystems in the specified
1ec3d1a
##	domain. 
1ec3d1a
##	

1ec3d1a
##	

1ec3d1a
##	No interprocess communication (signals, pipes,
1ec3d1a
##	etc.) is provided by this interface since
1ec3d1a
##	the domains are not owned by this module.
1ec3d1a
##	

1ec3d1a
## </desc>
1ec3d1a
## <param name="domain">
1ec3d1a
##	<summary>
1ec3d1a
##	Domain allowed to transition.
1ec3d1a
##	</summary>
1ec3d1a
## </param>
1ec3d1a
## <param name="target_domain">
1ec3d1a
##	<summary>
1ec3d1a
##	The type of the new process.
1ec3d1a
##	</summary>
1ec3d1a
## </param>
1ec3d1a
#
1ec3d1a
interface(`telepathy_command_domtrans', `
1ec3d1a
	gen_require(`
1ec3d1a
		attribute telepathy_executable;
1ec3d1a
	')
1ec3d1a
1ec3d1a
	allow $2 telepathy_executable:file entrypoint;
1ec3d1a
	domain_transition_pattern($1, telepathy_executable, $2)
1ec3d1a
	type_transition $1 telepathy_executable:process $2;
1ec3d1a
1ec3d1a
	# needs to dbus chat with unconfined_t and unconfined_dbusd_t
1ec3d1a
	optional_policy(`
1ec3d1a
		telepathy_dbus_chat($1)
1ec3d1a
		telepathy_dbus_chat($2)
1ec3d1a
	')
1ec3d1a
')
1ec3d1a
1ec3d1a
########################################
1ec3d1a
## <summary>
1ec3d1a
##	Create telepathy content in the user home directory
1ec3d1a
##	with an correct label.
1ec3d1a
## </summary>
1ec3d1a
## <param name="domain">
1ec3d1a
##	<summary>
1ec3d1a
##	Domain allowed access.
1ec3d1a
##	</summary>
1ec3d1a
## </param>
1ec3d1a
#
1ec3d1a
interface(`telepathy_filetrans_home_content',`
1ec3d1a
	gen_require(`
1ec3d1a
		type telepathy_mission_control_cache_home_t;
1ec3d1a
		type telepathy_mission_control_home_t;
1ec3d1a
		type telepathy_logger_cache_home_t;
1ec3d1a
		type telepathy_gabble_cache_home_t;
1ec3d1a
		type telepathy_sunshine_home_t;
1ec3d1a
		type telepathy_logger_data_home_t;
1ec3d1a
		type telepathy_cache_home_t, telepathy_data_home_t;
1ec3d1a
		type telepathy_mission_control_data_home_t;
1ec3d1a
	')
1ec3d1a
1ec3d1a
	filetrans_pattern($1, telepathy_cache_home_t, telepathy_logger_cache_home_t, dir, "logger")
1ec3d1a
	filetrans_pattern($1, telepathy_cache_home_t, telepathy_logger_cache_home_t, file, "sqlite-data-journal")
1ec3d1a
	filetrans_pattern($1, telepathy_cache_home_t, telepathy_gabble_cache_home_t, dir, "gabble")
1ec3d1a
1ec3d1a
	filetrans_pattern($1, telepathy_data_home_t, telepathy_mission_control_data_home_t, dir, "mission-control")
1ec3d1a
1ec3d1a
	userdom_user_home_dir_filetrans($1, telepathy_mission_control_home_t, dir, ".mission-control")
1ec3d1a
	userdom_user_home_dir_filetrans($1, telepathy_sunshine_home_t, dir, ".telepathy-sunshine")
1ec3d1a
1ec3d1a
	gnome_cache_filetrans($1, telepathy_mission_control_cache_home_t, file, ".mc_connections")
1ec3d1a
	gnome_cache_filetrans($1, telepathy_gabble_cache_home_t, dir, "gabble")
1ec3d1a
	gnome_cache_filetrans($1, telepathy_gabble_cache_home_t, dir, "wocky")
1ec3d1a
	gnome_cache_filetrans($1, telepathy_cache_home_t, dir, "telepathy")
1ec3d1a
1ec3d1a
	gnome_data_filetrans($1, telepathy_logger_data_home_t, dir, "TpLogger")
1ec3d1a
	gnome_data_filetrans($1, telepathy_data_home_t, dir, "telepathy")
1ec3d1a
')
de1cd91
de1cd91
######################################
de1cd91
## <summary>
de1cd91
##	Execute telepathy in the caller domain.
de1cd91
## </summary>
de1cd91
## <param name="domain">
de1cd91
##	<summary>
de1cd91
##	Domain allowed access.
de1cd91
##	</summary>
de1cd91
## </param>
de1cd91
#
de1cd91
interface(`telepathy_exec',`
de1cd91
	gen_require(`
de1cd91
		attribute telepathy_executable;
de1cd91
	')
de1cd91
de1cd91
	corecmd_search_bin($1)
de1cd91
	can_exec($1, telepathy_executable)
de1cd91
')