bluetooth, roles: use user exec domain attribute

Signed-off-by: Kenton Groombridge <me@concord.sh>
This commit is contained in:
Kenton Groombridge 2021-08-08 11:31:51 -04:00
parent 386d00de34
commit afa5769b4c
4 changed files with 31 additions and 16 deletions

View File

@ -83,7 +83,7 @@ ifndef(`distro_redhat',`
')
optional_policy(`
bluetooth_role(staff_r, staff_t)
bluetooth_role(staff, staff_t, staff_application_exec_domain, staff_r)
')
optional_policy(`

View File

@ -1210,7 +1210,7 @@ ifndef(`distro_redhat',`
optional_policy(`
bluetooth_admin(sysadm_t, sysadm_r)
bluetooth_role(sysadm_r, sysadm_t)
bluetooth_role(sysadm, sysadm_t, sysadm_application_exec_domain, sysadm_r)
')
optional_policy(`

View File

@ -47,7 +47,7 @@ ifndef(`distro_redhat',`
')
optional_policy(`
bluetooth_role(user_r, user_t)
bluetooth_role(user, user_t, user_application_exec_domain, user_r)
')
optional_policy(`

View File

@ -4,18 +4,29 @@
## <summary>
## Role access for bluetooth.
## </summary>
## <param name="role_prefix">
## <summary>
## The prefix of the user role (e.g., user
## is the prefix for user_r).
## </summary>
## </param>
## <param name="user_domain">
## <summary>
## User domain for the role.
## </summary>
## </param>
## <param name="user_exec_domain">
## <summary>
## User exec domain for execute and transition access.
## </summary>
## </param>
## <param name="role">
## <summary>
## Role allowed access
## </summary>
## </param>
## <param name="domain">
## <summary>
## User domain for the role
## </summary>
## </param>
#
interface(`bluetooth_role',`
template(`bluetooth_role',`
gen_require(`
attribute_role bluetooth_helper_roles;
type bluetooth_t, bluetooth_helper_t, bluetooth_helper_exec_t;
@ -27,26 +38,30 @@ interface(`bluetooth_role',`
# Declarations
#
roleattribute $1 bluetooth_helper_roles;
roleattribute $4 bluetooth_helper_roles;
########################################
#
# Policy
#
domtrans_pattern($2, bluetooth_helper_exec_t, bluetooth_helper_t)
domtrans_pattern($3, bluetooth_helper_exec_t, bluetooth_helper_t)
ps_process_pattern($2, bluetooth_helper_t)
allow $2 bluetooth_helper_t:process { ptrace signal_perms };
ps_process_pattern($3, bluetooth_helper_t)
allow $3 bluetooth_helper_t:process { ptrace signal_perms };
allow $2 bluetooth_t:socket rw_socket_perms;
allow $3 bluetooth_t:socket rw_socket_perms;
allow $2 { bluetooth_helper_tmp_t bluetooth_helper_tmpfs_t }:dir { manage_dir_perms relabel_dir_perms };
allow $2 { bluetooth_helper_tmp_t bluetooth_helper_tmpfs_t }:file { manage_file_perms relabel_file_perms };
allow $2 bluetooth_helper_tmp_t:sock_file { manage_sock_file_perms relabel_sock_file_perms };
stream_connect_pattern($2, bluetooth_runtime_t, bluetooth_runtime_t, bluetooth_t)
files_search_runtime($2)
stream_connect_pattern($3, bluetooth_runtime_t, bluetooth_runtime_t, bluetooth_t)
files_search_runtime($3)
optional_policy(`
systemd_user_app_status($1, bluetooth_helper_t)
')
')
#####################################