selinux-policy/policy/modules/services/dbus.if

353 lines
8.1 KiB
Plaintext
Raw Normal View History

2005-08-31 20:58:12 +00:00
## <summary>Desktop messaging bus</summary>
2005-11-25 16:43:03 +00:00
########################################
## <summary>
## DBUS stub interface. No access allowed.
## </summary>
## <param name="domain" optional="true">
## <summary>
2005-11-25 16:43:03 +00:00
## N/A
## </summary>
2005-11-25 16:43:03 +00:00
## </param>
#
interface(`dbus_stub',`
gen_require(`
type system_dbusd_t;
')
')
2005-08-31 20:58:12 +00:00
#######################################
## <summary>
## The per user domain template for the dbus module.
## </summary>
## <desc>
## <p>
## This template creates a derived domain which is
## used for the user dbus.
## </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>
2005-08-31 20:58:12 +00:00
## The prefix of the user domain (e.g., user
## is the prefix for user_t).
## </summary>
2005-08-31 20:58:12 +00:00
## </param>
## <param name="user_domain">
## <summary>
2005-08-31 20:58:12 +00:00
## The type of the user domain.
## </summary>
2005-08-31 20:58:12 +00:00
## </param>
## <param name="user_role">
## <summary>
2005-08-31 20:58:12 +00:00
## The role associated with the user domain.
## </summary>
2005-08-31 20:58:12 +00:00
## </param>
#
template(`dbus_per_userdomain_template',`
2005-10-19 14:36:04 +00:00
2005-08-31 20:58:12 +00:00
##############################
#
# Delcarations
#
type $1_dbusd_t;
domain_type($1_dbusd_t)
2006-05-01 19:11:54 +00:00
domain_entry_file($1_dbusd_t,system_dbusd_exec_t)
2005-08-31 20:58:12 +00:00
role $3 types $1_dbusd_t;
2005-09-01 13:34:45 +00:00
type $1_dbusd_$1_t;
2005-08-31 20:58:12 +00:00
type $1_dbusd_tmp_t;
files_tmp_file($1_dbusd_tmp_t)
##############################
#
# Local policy
#
allow $1_dbusd_t self:capability audit_write;
2005-08-31 20:58:12 +00:00
allow $1_dbusd_t self:process { getattr sigkill signal };
2005-09-16 19:36:10 +00:00
allow $1_dbusd_t self:file { getattr read write };
2005-08-31 20:58:12 +00:00
allow $1_dbusd_t self:dbus { send_msg acquire_svc };
allow $1_dbusd_t self:unix_stream_socket create_stream_socket_perms;
allow $1_dbusd_t self:unix_dgram_socket create_socket_perms;
2005-09-01 13:34:45 +00:00
allow $1_dbusd_t self:tcp_socket create_stream_socket_perms;
allow $1_dbusd_t self:netlink_audit_socket { create_netlink_socket_perms nlmsg_relay };
2005-09-16 19:36:10 +00:00
allow $1_dbusd_t self:netlink_selinux_socket create_socket_perms;
2005-08-31 20:58:12 +00:00
2005-09-01 13:34:45 +00:00
# For connecting to the bus
allow $2 $1_dbusd_t:unix_stream_socket connectto;
type_change $2 $1_dbusd_t:dbus $1_dbusd_$1_t;
# SE-DBus specific permissions
allow $1_dbusd_$1_t { $1_dbusd_t self }:dbus send_msg;
allow $2 $1_dbusd_t:dbus { send_msg acquire_svc };
allow $1_t system_dbusd_t:dbus { send_msg acquire_svc };
2005-08-31 20:58:12 +00:00
allow $1_dbusd_t dbusd_etc_t:dir r_dir_perms;
allow $1_dbusd_t dbusd_etc_t:file r_file_perms;
allow $1_dbusd_t dbusd_etc_t:lnk_file { getattr read };
allow $1_dbusd_t $1_dbusd_tmp_t:dir create_dir_perms;
allow $1_dbusd_t $1_dbusd_tmp_t:file create_file_perms;
2006-02-21 18:40:44 +00:00
files_tmp_filetrans($1_dbusd_t, $1_dbusd_tmp_t, { file dir })
2005-08-31 20:58:12 +00:00
domain_auto_trans($2, system_dbusd_exec_t, $1_dbusd_t)
allow $2 $1_dbusd_t:fd use;
allow $1_dbusd_t $2:fd use;
allow $1_dbusd_t $2:fifo_file rw_file_perms;
allow $1_dbusd_t $2:process sigchld;
allow $2 $1_dbusd_t:process { sigkill signal };
kernel_read_system_state($1_dbusd_t)
kernel_read_kernel_sysctls($1_dbusd_t)
2005-08-31 20:58:12 +00:00
2006-05-30 19:46:34 +00:00
corenet_non_ipsec_sendrecv($1_dbusd_t)
2005-09-01 13:34:45 +00:00
corenet_tcp_sendrecv_all_if($1_dbusd_t)
corenet_tcp_sendrecv_all_nodes($1_dbusd_t)
corenet_tcp_sendrecv_all_ports($1_dbusd_t)
corenet_tcp_bind_all_nodes($1_dbusd_t)
corenet_tcp_bind_reserved_port($1_dbusd_t)
2005-08-31 20:58:12 +00:00
dev_read_urand($1_dbusd_t)
selinux_get_fs_mount($1_dbusd_t)
selinux_validate_context($1_dbusd_t)
selinux_compute_access_vector($1_dbusd_t)
selinux_compute_create_context($1_dbusd_t)
selinux_compute_relabel_context($1_dbusd_t)
selinux_compute_user_contexts($1_dbusd_t)
corecmd_list_bin($1_dbusd_t)
2006-02-02 21:08:12 +00:00
corecmd_read_bin_symlinks($1_dbusd_t)
corecmd_read_bin_files($1_dbusd_t)
corecmd_read_bin_pipes($1_dbusd_t)
corecmd_read_bin_sockets($1_dbusd_t)
2005-08-31 20:58:12 +00:00
corecmd_list_sbin($1_dbusd_t)
2006-02-02 21:08:12 +00:00
corecmd_read_sbin_symlinks($1_dbusd_t)
corecmd_read_sbin_files($1_dbusd_t)
corecmd_read_sbin_pipes($1_dbusd_t)
corecmd_read_sbin_sockets($1_dbusd_t)
2005-08-31 20:58:12 +00:00
files_read_etc_files($1_dbusd_t)
files_list_home($1_dbusd_t)
files_read_usr_files($1_dbusd_t)
files_dontaudit_search_var($1_dbusd_t)
libs_use_ld_so($1_dbusd_t)
libs_use_shared_libs($1_dbusd_t)
logging_send_syslog_msg($1_dbusd_t)
miscfiles_read_localization($1_dbusd_t)
seutil_read_config($1_dbusd_t)
seutil_read_default_contexts($1_dbusd_t)
2005-09-01 13:34:45 +00:00
sysnet_read_config($1_dbusd_t)
2005-08-31 20:58:12 +00:00
tunable_policy(`read_default_t',`
files_list_default($1_dbusd_t)
files_read_default_files($1_dbusd_t)
files_read_default_symlinks($1_dbusd_t)
files_read_default_sockets($1_dbusd_t)
files_read_default_pipes($1_dbusd_t)
')
optional_policy(`
2005-08-31 20:58:12 +00:00
auth_read_pam_console_data($1_dbusd_t)
')
optional_policy(`
2006-02-02 21:08:12 +00:00
nscd_socket_use($1_dbusd_t)
2005-08-31 20:58:12 +00:00
')
2005-09-16 19:36:10 +00:00
optional_policy(`
xserver_use_xdm_fds($1_dbusd_t)
xserver_rw_xdm_pipes($1_dbusd_t)
2005-09-16 19:36:10 +00:00
')
2005-08-31 20:58:12 +00:00
')
#######################################
## <summary>
## Template for creating connections to
## the system DBUS.
## </summary>
## <param name="domain_prefix">
## <summary>
2005-08-31 20:58:12 +00:00
## The prefix of the domain (e.g., user
## is the prefix for user_t).
## </summary>
2005-08-31 20:58:12 +00:00
## </param>
## <param name="domain">
## <summary>
2005-08-31 20:58:12 +00:00
## The type of the domain.
## </summary>
2005-08-31 20:58:12 +00:00
## </param>
#
template(`dbus_system_bus_client_template',`
2005-09-01 13:34:45 +00:00
gen_require(`
type system_dbusd_t, system_dbusd_t;
type system_dbusd_var_run_t;
class dbus send_msg;
')
2005-08-31 20:58:12 +00:00
type $1_dbusd_system_t;
type_change $2 system_dbusd_t:dbus $1_dbusd_system_t;
# SE-DBus specific permissions
allow $1_dbusd_system_t { system_dbusd_t self }:dbus send_msg;
# For connecting to the bus
files_search_pids($2)
allow $2 system_dbusd_var_run_t:dir search;
allow $2 system_dbusd_var_run_t:sock_file write;
allow $2 system_dbusd_t:unix_stream_socket connectto;
')
2005-09-01 13:34:45 +00:00
2006-03-08 20:09:42 +00:00
#######################################
## <summary>
## Template for creating connections to
## a user DBUS.
## </summary>
## <param name="user_prefix">
## <summary>
## The prefix of the domain (e.g., user
## is the prefix for user_t).
## </summary>
## </param>
## <param name="domain_prefix">
## <summary>
## The prefix of the domain (e.g., user
## is the prefix for user_t).
## </summary>
## </param>
## <param name="domain">
## <summary>
## The type of the domain.
## </summary>
## </param>
#
template(`dbus_user_bus_client_template',`
gen_require(`
2006-06-12 16:55:18 +00:00
type $1_dbusd_t;
2006-03-08 20:09:42 +00:00
class dbus send_msg;
')
type $2_dbusd_$1_t;
type_change $3 $1_dbusd_t:dbus $2_dbusd_$1_t;
# SE-DBus specific permissions
allow $2_dbusd_$1_t { $1_dbusd_t self }:dbus send_msg;
# For connecting to the bus
2006-06-12 16:55:18 +00:00
allow $3 $1_dbusd_t:unix_stream_socket connectto;
2006-03-08 20:09:42 +00:00
')
########################################
## <summary>
## Send a message on user/application specific DBUS.
## </summary>
## <param name="domain_prefix">
## <summary>
## The prefix of the domain (e.g., user
## is the prefix for user_t).
## </summary>
## </param>
## <param name="domain">
## <summary>
## Domain allowed access.
## </summary>
## </param>
#
template(`dbus_send_user_bus',`
gen_require(`
type $1_dbusd_t;
class dbus send_msg;
')
allow $2 $1_dbusd_t:dbus send_msg;
')
2006-01-06 22:51:40 +00:00
########################################
## <summary>
## Read dbus configuration.
## </summary>
## <param name="domain">
## <summary>
2006-01-06 22:51:40 +00:00
## Domain allowed access.
## </summary>
2006-01-06 22:51:40 +00:00
## </param>
#
interface(`dbus_read_config',`
gen_require(`
type dbusd_etc_t;
')
allow $1 dbusd_etc_t:file r_file_perms;
')
2005-09-02 20:29:52 +00:00
########################################
## <summary>
## Connect to the the system DBUS
## for service (acquire_svc).
## </summary>
## <param name="domain">
## <summary>
2005-09-02 20:29:52 +00:00
## Domain allowed access.
## </summary>
2005-09-02 20:29:52 +00:00
## </param>
#
interface(`dbus_connect_system_bus',`
gen_require(`
type system_dbusd_t;
class dbus acquire_svc;
')
allow $1 system_dbusd_t:dbus acquire_svc;
')
2005-09-01 13:34:45 +00:00
########################################
## <summary>
## Send a message on the system DBUS.
## </summary>
## <param name="domain">
## <summary>
2005-09-01 13:34:45 +00:00
## Domain allowed access.
## </summary>
2005-09-01 13:34:45 +00:00
## </param>
#
2006-02-02 21:08:12 +00:00
interface(`dbus_send_system_bus',`
2005-09-01 13:34:45 +00:00
gen_require(`
type system_dbusd_t;
class dbus send_msg;
')
allow $1 system_dbusd_t:dbus send_msg;
')
2005-09-21 14:49:41 +00:00
########################################
## <summary>
## Allow unconfined access to the system DBUS.
## </summary>
## <param name="domain">
## <summary>
2005-09-21 14:49:41 +00:00
## Domain allowed access.
## </summary>
2005-09-21 14:49:41 +00:00
## </param>
#
interface(`dbus_system_bus_unconfined',`
gen_require(`
type system_dbusd_t;
class dbus all_dbus_perms;
')
allow $1 system_dbusd_t:dbus *;
')