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

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

Chris PeBenito 0c3d17
##	

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

Chris PeBenito 0c3d17
## </desc>
Chris PeBenito 0c3d17
## <param name="userdomain_prefix">
Chris PeBenito 885b83
##	<summary>
Chris PeBenito 0c3d17
##	The prefix of the user domain (e.g., user
Chris PeBenito 0c3d17
##	is the prefix for user_t).
Chris PeBenito 885b83
##	</summary>
Chris PeBenito 0c3d17
## </param>
Chris PeBenito 0c3d17
## <param name="user_domain">
Chris PeBenito 885b83
##	<summary>
Chris PeBenito 0c3d17
##	The type of the user domain.
Chris PeBenito 885b83
##	</summary>
Chris PeBenito 0c3d17
## </param>
Chris PeBenito 0c3d17
## <param name="user_role">
Chris PeBenito 885b83
##	<summary>
Chris PeBenito 0c3d17
##	The role associated with the user domain.
Chris PeBenito 885b83
##	</summary>
Chris PeBenito 0c3d17
## </param>
Chris PeBenito 0c3d17
#
Chris PeBenito 0c3d17
template(`dbus_per_userdomain_template',`
Chris PeBenito 0efe52
Chris PeBenito 0c3d17
	##############################
Chris PeBenito 0c3d17
	#
Chris PeBenito 0c3d17
	# Delcarations
Chris PeBenito 0c3d17
	#
Chris PeBenito 0c3d17
	type $1_dbusd_t;
Chris PeBenito 0c3d17
	domain_type($1_dbusd_t)
Chris PeBenito d40c0e
	domain_entry_file($1_dbusd_t,system_dbusd_exec_t)
Chris PeBenito 0c3d17
	role $3 types $1_dbusd_t;
Chris PeBenito 0c3d17
Chris PeBenito 631ee4
	type $1_dbusd_$1_t;
Chris PeBenito 631ee4
Chris PeBenito 0c3d17
	type $1_dbusd_tmp_t;
Chris PeBenito 0c3d17
	files_tmp_file($1_dbusd_tmp_t)
Chris PeBenito 0c3d17
Chris PeBenito 0c3d17
	##############################
Chris PeBenito 0c3d17
	#
Chris PeBenito 0c3d17
	# Local policy
Chris PeBenito 0c3d17
	#
Chris PeBenito 0c3d17
Chris PeBenito 0c3d17
	allow $1_dbusd_t self:process { getattr sigkill signal };
Chris PeBenito cff75c
	allow $1_dbusd_t self:file { getattr read write };
Chris PeBenito 0c3d17
	allow $1_dbusd_t self:dbus { send_msg acquire_svc };
Chris PeBenito 0c3d17
	allow $1_dbusd_t self:unix_stream_socket create_stream_socket_perms;
Chris PeBenito 0c3d17
	allow $1_dbusd_t self:unix_dgram_socket create_socket_perms;
Chris PeBenito 631ee4
	allow $1_dbusd_t self:tcp_socket create_stream_socket_perms;
Chris PeBenito 8967bf
	allow $1_dbusd_t self:netlink_audit_socket { create_netlink_socket_perms nlmsg_relay };
Chris PeBenito cff75c
	allow $1_dbusd_t self:netlink_selinux_socket create_socket_perms;
Chris PeBenito 0c3d17
Chris PeBenito 631ee4
	# For connecting to the bus
Chris PeBenito 631ee4
	allow $2 $1_dbusd_t:unix_stream_socket connectto;
Chris PeBenito 631ee4
	type_change $2 $1_dbusd_t:dbus $1_dbusd_$1_t;
Chris PeBenito 631ee4
Chris PeBenito 631ee4
	# SE-DBus specific permissions
Chris PeBenito 631ee4
	allow $1_dbusd_$1_t { $1_dbusd_t self }:dbus send_msg;
Chris PeBenito 631ee4
	allow $2 $1_dbusd_t:dbus { send_msg acquire_svc };
Chris PeBenito 631ee4
	allow $1_t system_dbusd_t:dbus { send_msg acquire_svc };
Chris PeBenito 631ee4
Chris PeBenito 0c3d17
	allow $1_dbusd_t dbusd_etc_t:dir r_dir_perms;
Chris PeBenito 0c3d17
	allow $1_dbusd_t dbusd_etc_t:file r_file_perms;
Chris PeBenito 0c3d17
	allow $1_dbusd_t dbusd_etc_t:lnk_file { getattr read };
Chris PeBenito 0c3d17
Chris PeBenito 0c3d17
	allow $1_dbusd_t $1_dbusd_tmp_t:dir create_dir_perms;
Chris PeBenito 0c3d17
	allow $1_dbusd_t $1_dbusd_tmp_t:file create_file_perms;
Chris PeBenito 103fe2
	files_tmp_filetrans($1_dbusd_t, $1_dbusd_tmp_t, { file dir })
Chris PeBenito 0c3d17
Chris PeBenito 0c3d17
	domain_auto_trans($2, system_dbusd_exec_t, $1_dbusd_t)
Chris PeBenito 0c3d17
	allow $2 $1_dbusd_t:fd use;
Chris PeBenito 0c3d17
	allow $1_dbusd_t $2:fd use;
Chris PeBenito 0c3d17
	allow $1_dbusd_t $2:fifo_file rw_file_perms;
Chris PeBenito 0c3d17
	allow $1_dbusd_t $2:process sigchld;
Chris PeBenito 0c3d17
Chris PeBenito 0c3d17
	allow $2 $1_dbusd_t:process { sigkill signal };
Chris PeBenito 0c3d17
Chris PeBenito 0c3d17
	kernel_read_system_state($1_dbusd_t)
Chris PeBenito 445522
	kernel_read_kernel_sysctls($1_dbusd_t)
Chris PeBenito 0c3d17
Chris PeBenito 141cff
	corenet_non_ipsec_sendrecv($1_dbusd_t)
Chris PeBenito 631ee4
	corenet_tcp_sendrecv_all_if($1_dbusd_t)
Chris PeBenito 631ee4
	corenet_tcp_sendrecv_all_nodes($1_dbusd_t)
Chris PeBenito 631ee4
	corenet_tcp_sendrecv_all_ports($1_dbusd_t)
Chris PeBenito 631ee4
	corenet_tcp_bind_all_nodes($1_dbusd_t)
Chris PeBenito 631ee4
	corenet_tcp_bind_reserved_port($1_dbusd_t)
Chris PeBenito 631ee4
Chris PeBenito 0c3d17
	dev_read_urand($1_dbusd_t)
Chris PeBenito 0c3d17
Chris PeBenito 0c3d17
	selinux_get_fs_mount($1_dbusd_t)
Chris PeBenito 0c3d17
	selinux_validate_context($1_dbusd_t)
Chris PeBenito 0c3d17
	selinux_compute_access_vector($1_dbusd_t)
Chris PeBenito 0c3d17
	selinux_compute_create_context($1_dbusd_t)
Chris PeBenito 0c3d17
	selinux_compute_relabel_context($1_dbusd_t)
Chris PeBenito 0c3d17
	selinux_compute_user_contexts($1_dbusd_t)
Chris PeBenito 0c3d17
Chris PeBenito 0c3d17
	corecmd_list_bin($1_dbusd_t)
Chris PeBenito 1815ba
	corecmd_read_bin_symlinks($1_dbusd_t)
Chris PeBenito 1815ba
	corecmd_read_bin_files($1_dbusd_t)
Chris PeBenito 1815ba
	corecmd_read_bin_pipes($1_dbusd_t)
Chris PeBenito 1815ba
	corecmd_read_bin_sockets($1_dbusd_t)
Chris PeBenito 0c3d17
	corecmd_list_sbin($1_dbusd_t)
Chris PeBenito 1815ba
	corecmd_read_sbin_symlinks($1_dbusd_t)
Chris PeBenito 1815ba
	corecmd_read_sbin_files($1_dbusd_t)
Chris PeBenito 1815ba
	corecmd_read_sbin_pipes($1_dbusd_t)
Chris PeBenito 1815ba
	corecmd_read_sbin_sockets($1_dbusd_t)
Chris PeBenito 0c3d17
Chris PeBenito 0c3d17
	files_read_etc_files($1_dbusd_t)
Chris PeBenito 0c3d17
	files_list_home($1_dbusd_t)
Chris PeBenito 0c3d17
	files_read_usr_files($1_dbusd_t)
Chris PeBenito 0c3d17
	files_dontaudit_search_var($1_dbusd_t)
Chris PeBenito 0c3d17
Chris PeBenito 0c3d17
	libs_use_ld_so($1_dbusd_t)
Chris PeBenito 0c3d17
	libs_use_shared_libs($1_dbusd_t)
Chris PeBenito 0c3d17
Chris PeBenito 0c3d17
	logging_send_syslog_msg($1_dbusd_t)
Chris PeBenito 0c3d17
Chris PeBenito 0c3d17
	miscfiles_read_localization($1_dbusd_t)
Chris PeBenito 0c3d17
Chris PeBenito 0c3d17
	seutil_read_config($1_dbusd_t)
Chris PeBenito 0c3d17
	seutil_read_default_contexts($1_dbusd_t)
Chris PeBenito 0c3d17
Chris PeBenito 631ee4
	sysnet_read_config($1_dbusd_t)
Chris PeBenito 631ee4
Chris PeBenito 0c3d17
	tunable_policy(`read_default_t',`
Chris PeBenito 0c3d17
		files_list_default($1_dbusd_t)
Chris PeBenito 0c3d17
		files_read_default_files($1_dbusd_t)
Chris PeBenito 0c3d17
		files_read_default_symlinks($1_dbusd_t)
Chris PeBenito 0c3d17
		files_read_default_sockets($1_dbusd_t)
Chris PeBenito 0c3d17
		files_read_default_pipes($1_dbusd_t)
Chris PeBenito 0c3d17
	')
Chris PeBenito 0c3d17
Chris PeBenito bb7170
	optional_policy(`
Chris PeBenito 0c3d17
		auth_read_pam_console_data($1_dbusd_t)
Chris PeBenito 0c3d17
	')
Chris PeBenito 0c3d17
Chris PeBenito bb7170
	optional_policy(`
Chris PeBenito 1815ba
		nscd_socket_use($1_dbusd_t)
Chris PeBenito 0c3d17
	')
Chris PeBenito cff75c
Chris PeBenito cff75c
	ifdef(`TODO',`
Chris PeBenito cff75c
	ifdef(`xdm.te', `
Chris PeBenito cff75c
	can_pipe_xdm($1_dbusd_t)
Chris PeBenito cff75c
	')
Chris PeBenito cff75c
	')
Chris PeBenito 0c3d17
')
Chris PeBenito 0c3d17
Chris PeBenito 0c3d17
#######################################
Chris PeBenito 0c3d17
## <summary>
Chris PeBenito 0c3d17
##	Template for creating connections to
Chris PeBenito 0c3d17
##	the system DBUS.
Chris PeBenito 0c3d17
## </summary>
Chris PeBenito 0c3d17
## <param name="domain_prefix">
Chris PeBenito 885b83
##	<summary>
Chris PeBenito 0c3d17
##	The prefix of the domain (e.g., user
Chris PeBenito 0c3d17
##	is the prefix for user_t).
Chris PeBenito 885b83
##	</summary>
Chris PeBenito 0c3d17
## </param>
Chris PeBenito 0c3d17
## <param name="domain">
Chris PeBenito 885b83
##	<summary>
Chris PeBenito 0c3d17
##	The type of the domain.
Chris PeBenito 885b83
##	</summary>
Chris PeBenito 0c3d17
## </param>
Chris PeBenito 0c3d17
#
Chris PeBenito 0c3d17
template(`dbus_system_bus_client_template',`
Chris PeBenito 631ee4
	gen_require(`
Chris PeBenito 631ee4
		type system_dbusd_t, system_dbusd_t;
Chris PeBenito 631ee4
		type system_dbusd_var_run_t;
Chris PeBenito 631ee4
		class dbus send_msg;
Chris PeBenito 631ee4
	')
Chris PeBenito 0c3d17
Chris PeBenito 0c3d17
	type $1_dbusd_system_t;
Chris PeBenito 0c3d17
	type_change $2 system_dbusd_t:dbus $1_dbusd_system_t;
Chris PeBenito 0c3d17
Chris PeBenito 0c3d17
	# SE-DBus specific permissions
Chris PeBenito 0c3d17
	allow $1_dbusd_system_t { system_dbusd_t self }:dbus send_msg;
Chris PeBenito 0c3d17
Chris PeBenito 0c3d17
	# For connecting to the bus
Chris PeBenito 0c3d17
	files_search_pids($2)
Chris PeBenito 0c3d17
	allow $2 system_dbusd_var_run_t:dir search;
Chris PeBenito 0c3d17
	allow $2 system_dbusd_var_run_t:sock_file write;
Chris PeBenito 0c3d17
	allow $2 system_dbusd_t:unix_stream_socket connectto;
Chris PeBenito 0c3d17
')
Chris PeBenito 631ee4
Chris PeBenito 185272
#######################################
Chris PeBenito 185272
## <summary>
Chris PeBenito 185272
##	Template for creating connections to
Chris PeBenito 185272
##	a user DBUS.
Chris PeBenito 185272
## </summary>
Chris PeBenito 185272
## <param name="user_prefix">
Chris PeBenito 185272
##	<summary>
Chris PeBenito 185272
##	The prefix of the domain (e.g., user
Chris PeBenito 185272
##	is the prefix for user_t).
Chris PeBenito 185272
##	</summary>
Chris PeBenito 185272
## </param>
Chris PeBenito 185272
## <param name="domain_prefix">
Chris PeBenito 185272
##	<summary>
Chris PeBenito 185272
##	The prefix of the domain (e.g., user
Chris PeBenito 185272
##	is the prefix for user_t).
Chris PeBenito 185272
##	</summary>
Chris PeBenito 185272
## </param>
Chris PeBenito 185272
## <param name="domain">
Chris PeBenito 185272
##	<summary>
Chris PeBenito 185272
##	The type of the domain.
Chris PeBenito 185272
##	</summary>
Chris PeBenito 185272
## </param>
Chris PeBenito 185272
#
Chris PeBenito 185272
template(`dbus_user_bus_client_template',`
Chris PeBenito 185272
	gen_require(`
Chris PeBenito 185272
		type $1_dbusd_t, $1_dbusd_t;
Chris PeBenito 185272
		type $1_dbusd_var_run_t;
Chris PeBenito 185272
		class dbus send_msg;
Chris PeBenito 185272
	')
Chris PeBenito 185272
Chris PeBenito 185272
	type $2_dbusd_$1_t;
Chris PeBenito 185272
	type_change $3 $1_dbusd_t:dbus $2_dbusd_$1_t;
Chris PeBenito 185272
Chris PeBenito 185272
	# SE-DBus specific permissions
Chris PeBenito 185272
	allow $2_dbusd_$1_t { $1_dbusd_t self }:dbus send_msg;
Chris PeBenito 185272
Chris PeBenito 185272
	# For connecting to the bus
Chris PeBenito 185272
	files_search_pids($3)
Chris PeBenito 185272
	allow $3 system_dbusd_var_run_t:dir search;
Chris PeBenito 185272
	allow $3 system_dbusd_var_run_t:sock_file write;
Chris PeBenito 185272
	allow $3 system_dbusd_t:unix_stream_socket connectto;
Chris PeBenito 185272
')
Chris PeBenito 185272
Chris PeBenito 185272
########################################
Chris PeBenito 185272
## <summary>
Chris PeBenito 185272
##	Send a message on user/application specific DBUS.
Chris PeBenito 185272
## </summary>
Chris PeBenito 185272
## <param name="domain_prefix">
Chris PeBenito 185272
##	<summary>
Chris PeBenito 185272
##	The prefix of the domain (e.g., user
Chris PeBenito 185272
##	is the prefix for user_t).
Chris PeBenito 185272
##	</summary>
Chris PeBenito 185272
## </param>
Chris PeBenito 185272
## <param name="domain">
Chris PeBenito 185272
##	<summary>
Chris PeBenito 185272
##	Domain allowed access.
Chris PeBenito 185272
##	</summary>
Chris PeBenito 185272
## </param>
Chris PeBenito 185272
#
Chris PeBenito 185272
template(`dbus_send_user_bus',`
Chris PeBenito 185272
	gen_require(`
Chris PeBenito 185272
		type $1_dbusd_t;
Chris PeBenito 185272
		class dbus send_msg;
Chris PeBenito 185272
	')
Chris PeBenito 185272
Chris PeBenito 185272
	allow $2 $1_dbusd_t:dbus send_msg;
Chris PeBenito 185272
')
Chris PeBenito 185272
Chris PeBenito 185272
Chris PeBenito 631ee4
########################################
Chris PeBenito 631ee4
## <summary>
Chris PeBenito bf080a
##	Read dbus configuration.
Chris PeBenito bf080a
## </summary>
Chris PeBenito bf080a
## <param name="domain">
Chris PeBenito 885b83
##	<summary>
Chris PeBenito bf080a
##	Domain allowed access.
Chris PeBenito 885b83
##	</summary>
Chris PeBenito bf080a
## </param>
Chris PeBenito bf080a
#
Chris PeBenito bf080a
interface(`dbus_read_config',`
Chris PeBenito bf080a
	gen_require(`
Chris PeBenito bf080a
		type dbusd_etc_t;
Chris PeBenito bf080a
	')
Chris PeBenito bf080a
Chris PeBenito bf080a
	allow $1 dbusd_etc_t:file r_file_perms;
Chris PeBenito bf080a
')
Chris PeBenito bf080a
Chris PeBenito bf080a
########################################
Chris PeBenito bf080a
## <summary>
Chris PeBenito fdae8e
##	Connect to the the system DBUS
Chris PeBenito fdae8e
##	for service (acquire_svc).
Chris PeBenito fdae8e
## </summary>
Chris PeBenito fdae8e
## <param name="domain">
Chris PeBenito 885b83
##	<summary>
Chris PeBenito fdae8e
##	Domain allowed access.
Chris PeBenito 885b83
##	</summary>
Chris PeBenito fdae8e
## </param>
Chris PeBenito fdae8e
#
Chris PeBenito fdae8e
interface(`dbus_connect_system_bus',`
Chris PeBenito fdae8e
	gen_require(`
Chris PeBenito fdae8e
		type system_dbusd_t;
Chris PeBenito fdae8e
		class dbus acquire_svc;
Chris PeBenito fdae8e
	')
Chris PeBenito fdae8e
Chris PeBenito fdae8e
	allow $1 system_dbusd_t:dbus acquire_svc;
Chris PeBenito fdae8e
')
Chris PeBenito fdae8e
Chris PeBenito fdae8e
########################################
Chris PeBenito fdae8e
## <summary>
Chris PeBenito 631ee4
##	Send a message on the system DBUS.
Chris PeBenito 631ee4
## </summary>
Chris PeBenito 631ee4
## <param name="domain">
Chris PeBenito 885b83
##	<summary>
Chris PeBenito 631ee4
##	Domain allowed access.
Chris PeBenito 885b83
##	</summary>
Chris PeBenito 631ee4
## </param>
Chris PeBenito 631ee4
#
Chris PeBenito 1815ba
interface(`dbus_send_system_bus',`
Chris PeBenito 631ee4
	gen_require(`
Chris PeBenito 631ee4
		type system_dbusd_t;
Chris PeBenito 631ee4
		class dbus send_msg;
Chris PeBenito 631ee4
	')
Chris PeBenito 631ee4
Chris PeBenito 631ee4
	allow $1 system_dbusd_t:dbus send_msg;
Chris PeBenito 631ee4
')
Chris PeBenito 142e9f
Chris PeBenito 142e9f
########################################
Chris PeBenito 142e9f
## <summary>
Chris PeBenito 142e9f
##	Allow unconfined access to the system DBUS.
Chris PeBenito 142e9f
## </summary>
Chris PeBenito 142e9f
## <param name="domain">
Chris PeBenito 885b83
##	<summary>
Chris PeBenito 142e9f
##	Domain allowed access.
Chris PeBenito 885b83
##	</summary>
Chris PeBenito 142e9f
## </param>
Chris PeBenito 142e9f
#
Chris PeBenito 142e9f
interface(`dbus_system_bus_unconfined',`
Chris PeBenito 142e9f
	gen_require(`
Chris PeBenito 142e9f
		type system_dbusd_t;
Chris PeBenito 142e9f
		class dbus all_dbus_perms;
Chris PeBenito 142e9f
	')
Chris PeBenito 142e9f
Chris PeBenito 142e9f
	allow $1 system_dbusd_t:dbus *;
Chris PeBenito 142e9f
')