Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Label /run/user/.../pulse/ as pulseaudio_home_t #197

Open
wants to merge 3 commits into
base: rawhide
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions pulseaudio.fc
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,4 @@ HOME_DIR/\.config/pulse(/.*)? gen_context(system_u:object_r:pulseaudio_home_t,s0

/var/lib/pulse(/.*)? gen_context(system_u:object_r:pulseaudio_var_lib_t,s0)
/var/run/pulse(/.*)? gen_context(system_u:object_r:pulseaudio_var_run_t,s0)
/var/run/user/([^/]*)/pulse(/.*)? gen_context(system_u:object_r:pulseaudio_home_t,s0)
47 changes: 44 additions & 3 deletions pulseaudio.if
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
interface(`pulseaudio_role',`
gen_require(`
attribute pulseaudio_tmpfsfile;
type pulseaudio_t, pulseaudio_exec_t, pulseaudio_tmpfs_t;
type pulseaudio_t, pulseaudio_exec_t, pulseaudio_tmpfs_t, pulseaudio_home_t;
class dbus { acquire_svc send_msg };
')

Expand All @@ -36,13 +36,17 @@ interface(`pulseaudio_role',`
allow pulseaudio_t $2:unix_stream_socket connectto;
allow $2 pulseaudio_t:unix_stream_socket connectto;

allow $2 { pulseaudio_tmpfs_t pulseaudio_tmpfsfile }:dir { manage_dir_perms relabel_dir_perms };
allow $2 { pulseaudio_tmpfs_t pulseaudio_tmpfsfile }:file { manage_file_perms relabel_file_perms };
allow $2 { pulseaudio_tmpfs_t pulseaudio_tmpfsfile pulseaudio_home_t }:dir { manage_dir_perms relabel_dir_perms };
allow $2 { pulseaudio_tmpfs_t pulseaudio_tmpfsfile pulseaudio_home_t }:file { manage_file_perms relabel_file_perms };

userdom_manage_tmp_role($1, pulseaudio_t)

allow $2 pulseaudio_t:dbus send_msg;
allow pulseaudio_t $2:dbus { acquire_svc send_msg };

# session systemd
userdom_user_tmp_filetrans($2, pulseaudio_home_t, dir, "pulse")
allow $2 pulseaudio_home_t:sock_file { create unlink };
')

########################################
Expand Down Expand Up @@ -293,6 +297,43 @@ interface(`pulseaudio_manage_home_files',`
pulseaudio_filetrans_home_content($1)
')

########################################
## <summary>
## Manage pulseaudio session tmp dirs.
## </summary>
## <param name="domain">
## <summary>
## Domain allowed access.
## </summary>
## </param>
#
interface(`pulseaudio_manage_session_tmp_dirs',`
gen_require(`
type pulseaudio_home_t;
')

manage_dirs_pattern($1, pulseaudio_home_t, pulseaudio_home_t)
')

########################################
## <summary>
## Manage pulseaudio session tmp files.
## </summary>
## <param name="domain">
## <summary>
## Domain allowed access.
## </summary>
## </param>
#
interface(`pulseaudio_manage_session_tmp_files',`
gen_require(`
type pulseaudio_home_t;
')

manage_files_pattern($1, pulseaudio_home_t, pulseaudio_home_t)
allow $1 pulseaudio_home_t:sock_file { create unlink };
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are these permissions sufficient? Domains like systemd_logind_t have some generic permissions which may not be true for other domains.

')

########################################
## <summary>
## Create, read, write, and delete pulseaudio
Expand Down
1 change: 1 addition & 0 deletions pulseaudio.te
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ manage_files_pattern(pulseaudio_t, pulseaudio_home_t, pulseaudio_home_t)
manage_lnk_files_pattern(pulseaudio_t, pulseaudio_home_t, pulseaudio_home_t)
userdom_search_user_home_dirs(pulseaudio_t)
pulseaudio_filetrans_home_content(pulseaudio_t)
userdom_user_tmp_filetrans(pulseaudio_t, pulseaudio_home_t, dir, "pulse") # /run/user/.../pulse
allow pulseaudio_t pulseaudio_home_t:file map;

# ~/.esd_auth - maybe we should label this pulseaudio_home_t?
Expand Down