Chris PeBenito 17de1b
## <summary>Desktop messaging bus</summary>
Chris PeBenito 17de1b
Chris PeBenito 17de1b
########################################
Chris PeBenito 17de1b
## <summary>
Chris PeBenito 17de1b
##	DBUS stub interface.  No access allowed.
Chris PeBenito 17de1b
## </summary>
Chris PeBenito 17de1b
## <param name="domain" optional="true">
Chris PeBenito 17de1b
##	<summary>
Chris PeBenito 17de1b
##	N/A
Chris PeBenito 17de1b
##	</summary>
Chris PeBenito 17de1b
## </param>
Chris PeBenito 17de1b
#
Chris PeBenito 17de1b
interface(`dbus_stub',`
Chris PeBenito 17de1b
	gen_require(`
Chris PeBenito 17de1b
		type system_dbusd_t;
Chris PeBenito 17de1b
	')
Chris PeBenito 17de1b
')
Chris PeBenito 17de1b
Chris PeBenito 17de1b
#######################################
Chris PeBenito 17de1b
## <summary>
Chris PeBenito bbcd3c
##	The per role template for the dbus module.
Chris PeBenito 17de1b
## </summary>
Chris PeBenito 17de1b
## <desc>
Chris PeBenito 17de1b
##	

Chris PeBenito 17de1b
##	This template creates a derived domain which is
Chris PeBenito 17de1b
##	used for the user dbus.
Chris PeBenito 17de1b
##	

Chris PeBenito 17de1b
##	

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

Chris PeBenito 17de1b
## </desc>
Chris PeBenito 17de1b
## <param name="userdomain_prefix">
Chris PeBenito 17de1b
##	<summary>
Chris PeBenito 17de1b
##	The prefix of the user domain (e.g., user
Chris PeBenito 17de1b
##	is the prefix for user_t).
Chris PeBenito 17de1b
##	</summary>
Chris PeBenito 17de1b
## </param>
Chris PeBenito 17de1b
## <param name="user_domain">
Chris PeBenito 17de1b
##	<summary>
Chris PeBenito 17de1b
##	The type of the user domain.
Chris PeBenito 17de1b
##	</summary>
Chris PeBenito 17de1b
## </param>
Chris PeBenito 17de1b
## <param name="user_role">
Chris PeBenito 17de1b
##	<summary>
Chris PeBenito 17de1b
##	The role associated with the user domain.
Chris PeBenito 17de1b
##	</summary>
Chris PeBenito 17de1b
## </param>
Chris PeBenito 17de1b
#
Chris PeBenito bbcd3c
template(`dbus_per_role_template',`
Chris PeBenito 17de1b
Chris PeBenito 17de1b
	##############################
Chris PeBenito 17de1b
	#
Chris PeBenito 17de1b
	# Delcarations
Chris PeBenito 17de1b
	#
Chris PeBenito 17de1b
	type $1_dbusd_t;
Chris PeBenito 17de1b
	domain_type($1_dbusd_t)
Chris PeBenito 17de1b
	domain_entry_file($1_dbusd_t,system_dbusd_exec_t)
Chris PeBenito 17de1b
	role $3 types $1_dbusd_t;
Chris PeBenito 17de1b
Chris PeBenito 17de1b
	type $1_dbusd_$1_t;
Chris PeBenito 17de1b
Chris PeBenito 17de1b
	type $1_dbusd_tmp_t;
Chris PeBenito 17de1b
	files_tmp_file($1_dbusd_tmp_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
	##############################
Chris PeBenito 17de1b
	#
Chris PeBenito 17de1b
	# Local policy
Chris PeBenito 17de1b
	#
Chris PeBenito 17de1b
Chris PeBenito 17de1b
	allow $1_dbusd_t self:process { getattr sigkill signal };
Chris PeBenito 17de1b
	allow $1_dbusd_t self:file { getattr read write };
Chris PeBenito 6b19be
	allow $1_dbusd_t self:fifo_file rw_fifo_file_perms;
Chris PeBenito 17de1b
	allow $1_dbusd_t self:dbus { send_msg acquire_svc };
Chris PeBenito 17de1b
	allow $1_dbusd_t self:unix_stream_socket create_stream_socket_perms;
Chris PeBenito 17de1b
	allow $1_dbusd_t self:unix_dgram_socket create_socket_perms;
Chris PeBenito 17de1b
	allow $1_dbusd_t self:tcp_socket create_stream_socket_perms;
Chris PeBenito 17de1b
	allow $1_dbusd_t self:netlink_selinux_socket create_socket_perms;
Chris PeBenito 17de1b
Chris PeBenito c0868a
	send_audit_msgs_pattern($1_dbusd_t)
Chris PeBenito c0868a
Chris PeBenito 17de1b
	# For connecting to the bus
Chris PeBenito 17de1b
	allow $2 $1_dbusd_t:unix_stream_socket connectto;
Chris PeBenito 17de1b
	type_change $2 $1_dbusd_t:dbus $1_dbusd_$1_t;
Chris PeBenito 17de1b
Chris PeBenito 17de1b
	# SE-DBus specific permissions
Chris PeBenito 17de1b
	allow $1_dbusd_$1_t { $1_dbusd_t self }:dbus send_msg;
Chris PeBenito 17de1b
	allow $2 $1_dbusd_t:dbus { send_msg acquire_svc };
Chris PeBenito 17de1b
	allow $1_t system_dbusd_t:dbus { send_msg acquire_svc };
Chris PeBenito 17de1b
Chris PeBenito c0868a
	allow $1_dbusd_t dbusd_etc_t:dir list_dir_perms;
Chris PeBenito c0868a
	read_files_pattern($1_dbusd_t,dbusd_etc_t,dbusd_etc_t)
Chris PeBenito c0868a
	read_lnk_files_pattern($1_dbusd_t,dbusd_etc_t,dbusd_etc_t)
Chris PeBenito 17de1b
Chris PeBenito c0868a
	manage_dirs_pattern($1_dbusd_t,$1_dbusd_tmp_t,$1_dbusd_tmp_t)
Chris PeBenito c0868a
	manage_files_pattern($1_dbusd_t,$1_dbusd_tmp_t,$1_dbusd_tmp_t)
Chris PeBenito 17de1b
	files_tmp_filetrans($1_dbusd_t, $1_dbusd_tmp_t, { file dir })
Chris PeBenito 17de1b
Chris PeBenito c0868a
	domtrans_pattern($2, system_dbusd_exec_t, $1_dbusd_t)
Chris PeBenito 17de1b
	allow $2 $1_dbusd_t:process { sigkill signal };
Chris PeBenito 17de1b
Chris PeBenito 17de1b
	kernel_read_system_state($1_dbusd_t)
Chris PeBenito 17de1b
	kernel_read_kernel_sysctls($1_dbusd_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
	corecmd_list_bin($1_dbusd_t)
Chris PeBenito 17de1b
	corecmd_read_bin_symlinks($1_dbusd_t)
Chris PeBenito 17de1b
	corecmd_read_bin_files($1_dbusd_t)
Chris PeBenito 17de1b
	corecmd_read_bin_pipes($1_dbusd_t)
Chris PeBenito 17de1b
	corecmd_read_bin_sockets($1_dbusd_t)
Chris PeBenito 17de1b
	corecmd_list_sbin($1_dbusd_t)
Chris PeBenito 17de1b
	corecmd_read_sbin_symlinks($1_dbusd_t)
Chris PeBenito 17de1b
	corecmd_read_sbin_files($1_dbusd_t)
Chris PeBenito 17de1b
	corecmd_read_sbin_pipes($1_dbusd_t)
Chris PeBenito 17de1b
	corecmd_read_sbin_sockets($1_dbusd_t)
Chris PeBenito 17de1b
Chris PeBenito 6b19be
	corenet_non_ipsec_sendrecv($1_dbusd_t)
Chris PeBenito 6b19be
	corenet_tcp_sendrecv_all_if($1_dbusd_t)
Chris PeBenito 6b19be
	corenet_tcp_sendrecv_all_nodes($1_dbusd_t)
Chris PeBenito 6b19be
	corenet_tcp_sendrecv_all_ports($1_dbusd_t)
Chris PeBenito 6b19be
	corenet_tcp_bind_all_nodes($1_dbusd_t)
Chris PeBenito 6b19be
	corenet_tcp_bind_reserved_port($1_dbusd_t)
Chris PeBenito 6b19be
Chris PeBenito 6b19be
	dev_read_urand($1_dbusd_t)
Chris PeBenito 6b19be
Chris PeBenito 6b19be
 	domain_use_interactive_fds($1_dbusd_t)
Chris PeBenito 6b19be
Chris PeBenito 17de1b
	files_read_etc_files($1_dbusd_t)
Chris PeBenito 17de1b
	files_list_home($1_dbusd_t)
Chris PeBenito 17de1b
	files_read_usr_files($1_dbusd_t)
Chris PeBenito 17de1b
	files_dontaudit_search_var($1_dbusd_t)
Chris PeBenito 17de1b
Chris PeBenito 6b19be
	fs_getattr_romfs($1_dbusd_t)
Chris PeBenito 6b19be
	fs_getattr_xattr_fs($1_dbusd_t)
Chris PeBenito 6b19be
Chris PeBenito 6b19be
	selinux_get_fs_mount($1_dbusd_t)
Chris PeBenito 6b19be
	selinux_validate_context($1_dbusd_t)
Chris PeBenito 6b19be
	selinux_compute_access_vector($1_dbusd_t)
Chris PeBenito 6b19be
	selinux_compute_create_context($1_dbusd_t)
Chris PeBenito 6b19be
	selinux_compute_relabel_context($1_dbusd_t)
Chris PeBenito 6b19be
	selinux_compute_user_contexts($1_dbusd_t)
Chris PeBenito 6b19be
Chris PeBenito a5e213
	auth_read_pam_console_data($1_dbusd_t)
Chris PeBenito a5e213
Chris PeBenito 17de1b
	libs_use_ld_so($1_dbusd_t)
Chris PeBenito 17de1b
	libs_use_shared_libs($1_dbusd_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
	logging_send_syslog_msg($1_dbusd_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
	miscfiles_read_localization($1_dbusd_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
	seutil_read_config($1_dbusd_t)
Chris PeBenito 17de1b
	seutil_read_default_contexts($1_dbusd_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
	sysnet_read_config($1_dbusd_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
	tunable_policy(`read_default_t',`
Chris PeBenito 17de1b
		files_list_default($1_dbusd_t)
Chris PeBenito 17de1b
		files_read_default_files($1_dbusd_t)
Chris PeBenito 17de1b
		files_read_default_symlinks($1_dbusd_t)
Chris PeBenito 17de1b
		files_read_default_sockets($1_dbusd_t)
Chris PeBenito 17de1b
		files_read_default_pipes($1_dbusd_t)
Chris PeBenito 17de1b
	')
Chris PeBenito 17de1b
Chris PeBenito 17de1b
	optional_policy(`
Chris PeBenito a5e213
		hal_dbus_chat($1_dbusd_t)
Chris PeBenito 17de1b
	')
Chris PeBenito 17de1b
Chris PeBenito 17de1b
	optional_policy(`
Chris PeBenito 17de1b
		nscd_socket_use($1_dbusd_t)
Chris PeBenito 17de1b
	')
Chris PeBenito 17de1b
Chris PeBenito 17de1b
	optional_policy(`
Chris PeBenito 17de1b
		xserver_use_xdm_fds($1_dbusd_t)
Chris PeBenito 17de1b
		xserver_rw_xdm_pipes($1_dbusd_t)
Chris PeBenito 17de1b
	')
Chris PeBenito 17de1b
')
Chris PeBenito 17de1b
Chris PeBenito 17de1b
#######################################
Chris PeBenito 17de1b
## <summary>
Chris PeBenito 17de1b
##	Template for creating connections to
Chris PeBenito 17de1b
##	the system DBUS.
Chris PeBenito 17de1b
## </summary>
Chris PeBenito 17de1b
## <param name="domain_prefix">
Chris PeBenito 17de1b
##	<summary>
Chris PeBenito 17de1b
##	The prefix of the domain (e.g., user
Chris PeBenito 17de1b
##	is the prefix for user_t).
Chris PeBenito 17de1b
##	</summary>
Chris PeBenito 17de1b
## </param>
Chris PeBenito 17de1b
## <param name="domain">
Chris PeBenito 17de1b
##	<summary>
Chris PeBenito 17de1b
##	The type of the domain.
Chris PeBenito 17de1b
##	</summary>
Chris PeBenito 17de1b
## </param>
Chris PeBenito 17de1b
#
Chris PeBenito 17de1b
template(`dbus_system_bus_client_template',`
Chris PeBenito 17de1b
	gen_require(`
Chris PeBenito 17de1b
		type system_dbusd_t, system_dbusd_t;
Chris PeBenito 17de1b
		type system_dbusd_var_run_t;
Chris PeBenito 17de1b
		class dbus send_msg;
Chris PeBenito 17de1b
	')
Chris PeBenito 17de1b
Chris PeBenito 17de1b
	type $1_dbusd_system_t;
Chris PeBenito 17de1b
	type_change $2 system_dbusd_t:dbus $1_dbusd_system_t;
Chris PeBenito 17de1b
Chris PeBenito 17de1b
	# SE-DBus specific permissions
Chris PeBenito 17de1b
	allow $1_dbusd_system_t { system_dbusd_t self }:dbus send_msg;
Chris PeBenito 17de1b
Chris PeBenito 17de1b
	# For connecting to the bus
Chris PeBenito 17de1b
	files_search_pids($2)
Chris PeBenito c0868a
	stream_connect_pattern($2,system_dbusd_var_run_t,system_dbusd_var_run_t,system_dbusd_t)
Chris PeBenito 17de1b
')
Chris PeBenito 17de1b
Chris PeBenito 17de1b
#######################################
Chris PeBenito 17de1b
## <summary>
Chris PeBenito 17de1b
##	Template for creating connections to
Chris PeBenito 17de1b
##	a user DBUS.
Chris PeBenito 17de1b
## </summary>
Chris PeBenito 17de1b
## <param name="user_prefix">
Chris PeBenito 17de1b
##	<summary>
Chris PeBenito 17de1b
##	The prefix of the domain (e.g., user
Chris PeBenito 17de1b
##	is the prefix for user_t).
Chris PeBenito 17de1b
##	</summary>
Chris PeBenito 17de1b
## </param>
Chris PeBenito 17de1b
## <param name="domain_prefix">
Chris PeBenito 17de1b
##	<summary>
Chris PeBenito 17de1b
##	The prefix of the domain (e.g., user
Chris PeBenito 17de1b
##	is the prefix for user_t).
Chris PeBenito 17de1b
##	</summary>
Chris PeBenito 17de1b
## </param>
Chris PeBenito 17de1b
## <param name="domain">
Chris PeBenito 17de1b
##	<summary>
Chris PeBenito 17de1b
##	The type of the domain.
Chris PeBenito 17de1b
##	</summary>
Chris PeBenito 17de1b
## </param>
Chris PeBenito 17de1b
#
Chris PeBenito 17de1b
template(`dbus_user_bus_client_template',`
Chris PeBenito 17de1b
	gen_require(`
Chris PeBenito 17de1b
		type $1_dbusd_t;
Chris PeBenito 17de1b
		class dbus send_msg;
Chris PeBenito 17de1b
	')
Chris PeBenito 17de1b
Chris PeBenito 17de1b
	type $2_dbusd_$1_t;
Chris PeBenito 17de1b
	type_change $3 $1_dbusd_t:dbus $2_dbusd_$1_t;
Chris PeBenito 17de1b
Chris PeBenito 17de1b
	# SE-DBus specific permissions
Chris PeBenito 17de1b
	allow $2_dbusd_$1_t { $1_dbusd_t self }:dbus send_msg;
Chris PeBenito 17de1b
Chris PeBenito 17de1b
	# For connecting to the bus
Chris PeBenito 17de1b
	allow $3 $1_dbusd_t:unix_stream_socket connectto;
Chris PeBenito 17de1b
')
Chris PeBenito 17de1b
Chris PeBenito 17de1b
########################################
Chris PeBenito 17de1b
## <summary>
Chris PeBenito 17de1b
##	Send a message on user/application specific DBUS.
Chris PeBenito 17de1b
## </summary>
Chris PeBenito 17de1b
## <param name="domain_prefix">
Chris PeBenito 17de1b
##	<summary>
Chris PeBenito 17de1b
##	The prefix of the domain (e.g., user
Chris PeBenito 17de1b
##	is the prefix for user_t).
Chris PeBenito 17de1b
##	</summary>
Chris PeBenito 17de1b
## </param>
Chris PeBenito 17de1b
## <param name="domain">
Chris PeBenito 17de1b
##	<summary>
Chris PeBenito 17de1b
##	Domain allowed access.
Chris PeBenito 17de1b
##	</summary>
Chris PeBenito 17de1b
## </param>
Chris PeBenito 17de1b
#
Chris PeBenito 17de1b
template(`dbus_send_user_bus',`
Chris PeBenito 17de1b
	gen_require(`
Chris PeBenito 17de1b
		type $1_dbusd_t;
Chris PeBenito 17de1b
		class dbus send_msg;
Chris PeBenito 17de1b
	')
Chris PeBenito 17de1b
Chris PeBenito 17de1b
	allow $2 $1_dbusd_t:dbus send_msg;
Chris PeBenito 17de1b
')
Chris PeBenito 17de1b
Chris PeBenito 17de1b
Chris PeBenito 17de1b
########################################
Chris PeBenito 17de1b
## <summary>
Chris PeBenito 17de1b
##	Read dbus configuration.
Chris PeBenito 17de1b
## </summary>
Chris PeBenito 17de1b
## <param name="domain">
Chris PeBenito 17de1b
##	<summary>
Chris PeBenito 17de1b
##	Domain allowed access.
Chris PeBenito 17de1b
##	</summary>
Chris PeBenito 17de1b
## </param>
Chris PeBenito 17de1b
#
Chris PeBenito 17de1b
interface(`dbus_read_config',`
Chris PeBenito 17de1b
	gen_require(`
Chris PeBenito 17de1b
		type dbusd_etc_t;
Chris PeBenito 17de1b
	')
Chris PeBenito 17de1b
Chris PeBenito c0868a
	allow $1 dbusd_etc_t:file read_file_perms;
Chris PeBenito 17de1b
')
Chris PeBenito 17de1b
Chris PeBenito 17de1b
########################################
Chris PeBenito 17de1b
## <summary>
Chris PeBenito 17de1b
##	Connect to the the system DBUS
Chris PeBenito 17de1b
##	for service (acquire_svc).
Chris PeBenito 17de1b
## </summary>
Chris PeBenito 17de1b
## <param name="domain">
Chris PeBenito 17de1b
##	<summary>
Chris PeBenito 17de1b
##	Domain allowed access.
Chris PeBenito 17de1b
##	</summary>
Chris PeBenito 17de1b
## </param>
Chris PeBenito 17de1b
#
Chris PeBenito 17de1b
interface(`dbus_connect_system_bus',`
Chris PeBenito 17de1b
	gen_require(`
Chris PeBenito 17de1b
		type system_dbusd_t;
Chris PeBenito 17de1b
		class dbus acquire_svc;
Chris PeBenito 17de1b
	')
Chris PeBenito 17de1b
Chris PeBenito 17de1b
	allow $1 system_dbusd_t:dbus acquire_svc;
Chris PeBenito 17de1b
')
Chris PeBenito 17de1b
Chris PeBenito 17de1b
########################################
Chris PeBenito 17de1b
## <summary>
Chris PeBenito 17de1b
##	Send a message on the system DBUS.
Chris PeBenito 17de1b
## </summary>
Chris PeBenito 17de1b
## <param name="domain">
Chris PeBenito 17de1b
##	<summary>
Chris PeBenito 17de1b
##	Domain allowed access.
Chris PeBenito 17de1b
##	</summary>
Chris PeBenito 17de1b
## </param>
Chris PeBenito 17de1b
#
Chris PeBenito 17de1b
interface(`dbus_send_system_bus',`
Chris PeBenito 17de1b
	gen_require(`
Chris PeBenito 17de1b
		type system_dbusd_t;
Chris PeBenito 17de1b
		class dbus send_msg;
Chris PeBenito 17de1b
	')
Chris PeBenito 17de1b
Chris PeBenito 17de1b
	allow $1 system_dbusd_t:dbus send_msg;
Chris PeBenito 17de1b
')
Chris PeBenito 17de1b
Chris PeBenito 17de1b
########################################
Chris PeBenito 17de1b
## <summary>
Chris PeBenito 17de1b
##	Allow unconfined access to the system DBUS.
Chris PeBenito 17de1b
## </summary>
Chris PeBenito 17de1b
## <param name="domain">
Chris PeBenito 17de1b
##	<summary>
Chris PeBenito 17de1b
##	Domain allowed access.
Chris PeBenito 17de1b
##	</summary>
Chris PeBenito 17de1b
## </param>
Chris PeBenito 17de1b
#
Chris PeBenito 17de1b
interface(`dbus_system_bus_unconfined',`
Chris PeBenito 17de1b
	gen_require(`
Chris PeBenito 17de1b
		type system_dbusd_t;
Chris PeBenito 17de1b
		class dbus all_dbus_perms;
Chris PeBenito 17de1b
	')
Chris PeBenito 17de1b
Chris PeBenito 17de1b
	allow $1 system_dbusd_t:dbus *;
Chris PeBenito 17de1b
')