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 f7eaee
## <param name="domain" unused="true">
Chris PeBenito 17de1b
##	<summary>
Chris PeBenito f7eaee
##	Domain allowed access
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 350b6a
		class dbus all_dbus_perms;
Chris PeBenito 17de1b
	')
Chris PeBenito 17de1b
')
Chris PeBenito 17de1b
Chris PeBenito 296273
########################################
Chris PeBenito 17de1b
## <summary>
Chris PeBenito 296273
##	Role access for dbus
Chris PeBenito 17de1b
## </summary>
Chris PeBenito 296273
## <param name="role_prefix">
Chris PeBenito 17de1b
##	<summary>
Chris PeBenito 296273
##	The prefix of the user role (e.g., user
Chris PeBenito 296273
##	is the prefix for user_r).
Chris PeBenito 17de1b
##	</summary>
Chris PeBenito 17de1b
## </param>
Chris PeBenito 296273
## <param name="role">
Chris PeBenito 17de1b
##	<summary>
Chris PeBenito 296273
##	Role allowed access
Chris PeBenito 17de1b
##	</summary>
Chris PeBenito 17de1b
## </param>
Chris PeBenito 296273
## <param name="domain">
Chris PeBenito 17de1b
##	<summary>
Chris PeBenito 296273
##	User domain for the role
Chris PeBenito 17de1b
##	</summary>
Chris PeBenito 17de1b
## </param>
Chris PeBenito 17de1b
#
Chris PeBenito 296273
template(`dbus_role_template',`
Chris PeBenito 8a9d6f
	gen_require(`
Chris PeBenito 8a9d6f
		class dbus { send_msg acquire_svc };
Chris PeBenito 296273
Chris PeBenito 296273
		attribute session_bus_type;
Chris PeBenito 296273
		type system_dbusd_t, session_dbusd_tmp_t, dbusd_exec_t, dbusd_etc_t;
Chris PeBenito 8a9d6f
	')
Chris PeBenito 17de1b
Chris PeBenito 17de1b
	##############################
Chris PeBenito 17de1b
	#
Chris PeBenito 17de1b
	# Delcarations
Chris PeBenito 17de1b
	#
Chris PeBenito 17de1b
Chris PeBenito 296273
	type $1_dbusd_t, session_bus_type;
Chris PeBenito 296273
	domain_type($1_dbusd_t)
Chris PeBenito 296273
	domain_entry_file($1_dbusd_t, dbusd_exec_t)
Chris PeBenito 296273
	ubac_constrained($1_dbusd_t)
Chris PeBenito 296273
	role $2 types $1_dbusd_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 8a9d6f
	dontaudit $1_dbusd_t self:process ptrace;
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 17de1b
	# For connecting to the bus
Chris PeBenito 296273
	allow $3 $1_dbusd_t:unix_stream_socket connectto;
Chris PeBenito 17de1b
Chris PeBenito 17de1b
	# SE-DBus specific permissions
Chris PeBenito 296273
	allow $3 $1_dbusd_t:dbus { send_msg acquire_svc };
Chris PeBenito 296273
	allow $3 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 0bfccd
	read_files_pattern($1_dbusd_t, dbusd_etc_t, dbusd_etc_t)
Chris PeBenito 0bfccd
	read_lnk_files_pattern($1_dbusd_t, dbusd_etc_t, dbusd_etc_t)
Chris PeBenito 17de1b
Chris PeBenito 296273
	manage_dirs_pattern($1_dbusd_t, session_dbusd_tmp_t, session_dbusd_tmp_t)
Chris PeBenito 296273
	manage_files_pattern($1_dbusd_t, session_dbusd_tmp_t, session_dbusd_tmp_t)
Chris PeBenito 296273
	files_tmp_filetrans($1_dbusd_t, session_dbusd_tmp_t, { file dir })
Chris PeBenito 17de1b
Chris PeBenito 296273
	domtrans_pattern($3, dbusd_exec_t, $1_dbusd_t)
Chris PeBenito 296273
	allow $3 $1_dbusd_t:process { sigkill signal };
Chris PeBenito 17de1b
Chris PeBenito 8a9d6f
	# cjp: this seems very broken
Chris PeBenito 296273
	corecmd_bin_domtrans($1_dbusd_t, $3)
Chris PeBenito 296273
	allow $1_dbusd_t $3:process sigkill;
Chris PeBenito 296273
	allow $3 $1_dbusd_t:fd use;
Chris PeBenito 296273
	allow $3 $1_dbusd_t:fifo_file rw_fifo_file_perms;
Chris PeBenito 296273
	allow $3 $1_dbusd_t:process sigchld;
Chris PeBenito 8a9d6f
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
Chris PeBenito 190066
	corenet_all_recvfrom_unlabeled($1_dbusd_t)
Chris PeBenito 190066
	corenet_all_recvfrom_netlabel($1_dbusd_t)
Chris PeBenito 668b30
	corenet_tcp_sendrecv_generic_if($1_dbusd_t)
Chris PeBenito c12621
	corenet_tcp_sendrecv_generic_node($1_dbusd_t)
Chris PeBenito 6b19be
	corenet_tcp_sendrecv_all_ports($1_dbusd_t)
Chris PeBenito c12621
	corenet_tcp_bind_generic_node($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 e04438
	domain_read_all_domains_state($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 ba7969
	fs_list_inotifyfs($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 c0cf6e
	auth_use_nsswitch($1_dbusd_t)
Chris PeBenito a5e213
Chris PeBenito d5b81a
	logging_send_audit_msgs($1_dbusd_t)
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 296273
	userdom_read_user_home_content_files($1_dbusd_t)
Chris PeBenito 8a9d6f
Chris PeBenito 8a9d6f
	ifdef(`hide_broken_symptoms', `
Chris PeBenito 296273
		dontaudit $3 $1_dbusd_t:netlink_selinux_socket { read write };
Chris PeBenito 8a9d6f
	')
Chris PeBenito 8a9d6f
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
		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">
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 296273
interface(`dbus_system_bus_client',`
Chris PeBenito 17de1b
	gen_require(`
Chris PeBenito 17de1b
		type system_dbusd_t, system_dbusd_t;
Chris PeBenito 8a9d6f
		type system_dbusd_var_run_t, system_dbusd_var_lib_t;
Chris PeBenito 17de1b
		class dbus send_msg;
Chris PeBenito 17de1b
	')
Chris PeBenito 17de1b
Chris PeBenito 17de1b
	# SE-DBus specific permissions
Chris PeBenito 296273
	allow $1 { system_dbusd_t self }:dbus send_msg;
Chris PeBenito 17de1b
Chris PeBenito 296273
	read_files_pattern($1, system_dbusd_var_lib_t, system_dbusd_var_lib_t)
Chris PeBenito 296273
	files_search_var_lib($1)
Chris PeBenito 8a9d6f
Chris PeBenito 17de1b
	# For connecting to the bus
Chris PeBenito 296273
	files_search_pids($1)
Chris PeBenito 296273
	stream_connect_pattern($1, system_dbusd_var_run_t, system_dbusd_var_run_t, system_dbusd_t)
Chris PeBenito 296273
	dbus_read_config($1)
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="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 296273
interface(`dbus_session_bus_client',`
Chris PeBenito 17de1b
	gen_require(`
Chris PeBenito 296273
		attribute session_bus_type;
Chris PeBenito 17de1b
		class dbus send_msg;
Chris PeBenito 17de1b
	')
Chris PeBenito 17de1b
Chris PeBenito 17de1b
	# SE-DBus specific permissions
Chris PeBenito 296273
	allow $1 { session_bus_type self }:dbus send_msg;
Chris PeBenito 17de1b
Chris PeBenito 17de1b
	# For connecting to the bus
Chris PeBenito 296273
	allow $1 session_bus_type:unix_stream_socket connectto;
Chris PeBenito 17de1b
')
Chris PeBenito 17de1b
Chris PeBenito 17de1b
########################################
Chris PeBenito 17de1b
## <summary>
Chris PeBenito 296273
##	Send a message the session 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 296273
interface(`dbus_send_session_bus',`
Chris PeBenito 17de1b
	gen_require(`
Chris PeBenito 296273
		attribute session_bus_type;
Chris PeBenito 17de1b
		class dbus send_msg;
Chris PeBenito 17de1b
	')
Chris PeBenito 17de1b
Chris PeBenito 296273
	allow $1 session_bus_type:dbus send_msg;
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 8a9d6f
	allow $1 dbusd_etc_t:dir list_dir_perms;
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 e04438
##	Connect to the the session DBUS
Chris PeBenito e04438
##	for service (acquire_svc).
Chris PeBenito e04438
## </summary>
Chris PeBenito e04438
## <param name="domain">
Chris PeBenito e04438
##	<summary>
Chris PeBenito e04438
##	Domain allowed access.
Chris PeBenito e04438
##	</summary>
Chris PeBenito e04438
## </param>
Chris PeBenito e04438
#
Chris PeBenito e04438
interface(`dbus_connect_session_bus',`
Chris PeBenito e04438
	gen_require(`
Chris PeBenito e04438
		attribute session_bus_type;
Chris PeBenito e04438
		class dbus acquire_svc;
Chris PeBenito e04438
	')
Chris PeBenito e04438
Chris PeBenito e04438
	allow $1 session_bus_type:dbus acquire_svc;
Chris PeBenito e04438
')
Chris PeBenito e04438
Chris PeBenito e04438
########################################
Chris PeBenito e04438
## <summary>
Chris PeBenito e04438
##	Connect to 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
')
Chris PeBenito e04438
Chris PeBenito e04438
########################################
Chris PeBenito e04438
## <summary>
Chris PeBenito e04438
##	Create a domain for processes
Chris PeBenito e04438
##	which can be started by the system dbus
Chris PeBenito e04438
## </summary>
Chris PeBenito e04438
## <param name="domain">
Chris PeBenito e04438
##	<summary>
Chris PeBenito e04438
##	Type to be used as a domain.
Chris PeBenito e04438
##	</summary>
Chris PeBenito e04438
## </param>
Chris PeBenito e04438
## <param name="entry_point">
Chris PeBenito e04438
##	<summary>
Chris PeBenito e04438
##	Type of the program to be used as an entry point to this domain.
Chris PeBenito e04438
##	</summary>
Chris PeBenito e04438
## </param>
Chris PeBenito e04438
#
Chris PeBenito e04438
interface(`dbus_system_domain',`
Chris PeBenito e04438
	gen_require(`
Chris PeBenito e04438
		type system_dbusd_t;
Chris PeBenito e04438
		role system_r;
Chris PeBenito e04438
	')
Chris PeBenito e04438
Chris PeBenito e04438
	domain_type($1)
Chris PeBenito e04438
	domain_entry_file($1, $2)
Chris PeBenito e04438
Chris PeBenito e04438
	role system_r types $1;
Chris PeBenito e04438
Chris PeBenito e04438
	domtrans_pattern(system_dbusd_t, $2, $1)
Chris PeBenito e04438
Chris PeBenito e04438
	dbus_system_bus_client($1)
Chris PeBenito e04438
	dbus_connect_system_bus($1)
Chris PeBenito e04438
Chris PeBenito e04438
	ifdef(`hide_broken_symptoms', `
Chris PeBenito e04438
		dontaudit $1 system_dbusd_t:netlink_selinux_socket { read write };
Chris PeBenito e04438
	')
Chris PeBenito e04438
')
Chris PeBenito e04438
Chris PeBenito e04438
########################################
Chris PeBenito e04438
## <summary>
Chris PeBenito e04438
##	Dontaudit Read, and write system dbus TCP sockets.
Chris PeBenito e04438
## </summary>
Chris PeBenito e04438
## <param name="domain">
Chris PeBenito e04438
##	<summary>
Chris PeBenito e04438
##	Domain allowed access.
Chris PeBenito e04438
##	</summary>
Chris PeBenito e04438
## </param>
Chris PeBenito e04438
#
Chris PeBenito e04438
interface(`dbus_dontaudit_system_bus_rw_tcp_sockets',`
Chris PeBenito e04438
	gen_require(`
Chris PeBenito e04438
		type system_dbusd_t;
Chris PeBenito e04438
	')
Chris PeBenito e04438
Chris PeBenito e04438
	allow $1 system_dbusd_t:tcp_socket { read write };
Chris PeBenito e04438
	allow $1 system_dbusd_t:fd use;
Chris PeBenito e04438
')
Chris PeBenito e04438
Chris PeBenito e04438
########################################
Chris PeBenito e04438
## <summary>
Chris PeBenito e04438
##	Allow unconfined access to the system DBUS.
Chris PeBenito e04438
## </summary>
Chris PeBenito e04438
## <param name="domain">
Chris PeBenito e04438
##	<summary>
Chris PeBenito e04438
##	Domain allowed access.
Chris PeBenito e04438
##	</summary>
Chris PeBenito e04438
## </param>
Chris PeBenito e04438
#
Chris PeBenito e04438
interface(`dbus_unconfined',`
Chris PeBenito e04438
	gen_require(`
Chris PeBenito e04438
		attribute dbusd_unconfined;
Chris PeBenito e04438
	')
Chris PeBenito e04438
Chris PeBenito e04438
	typeattribute $1 dbusd_unconfined;
Chris PeBenito e04438
')