Skip to contentSkip to conversation

pulseaudio: update server and client permissions

PATCH New Guido Trentalancia 2 participants 4 messages Dec 9, 2016 – Dec 11, 2016

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 pulseaudio: update server and client permissions

Update the pulseaudio module, so that:
- the pulseaudio server can send the signull signal to its clients;
- the pulseaudio server can manage not only pulseaudio_tmpfs files but all pulseaudio_tmpfs_content;
- pulseaudio clients can also write and not just read pulseaudio content files in the temporary filesystems (tmpfs);
- pulseaudio clients can use file descriptors for pulseaudio.

This patch has been triggered by recent testing of the games module and it makes the following patch obsolete (not applied yet):

[PATCH 2/2] pulseaudio: improve the support for Gnome games
http://oss.tresys.com/pipermail/refpolicy/2016-December/008651.html

It also makes obsolete interface calls to the following interfaces in addition to pulseaudio_run(): pulseaudio_rw_tmpfs_files() and pulseaudio_use_fds(). These are currently used in the mozilla module (removed in part 2/2 of this patchset).

---
 policy/modules/contrib/pulseaudio.if |    1 +
 policy/modules/contrib/pulseaudio.te |    5 +++--
 2 files changed, 4 insertions(+), 2 deletions(-)
policy/modules/contrib/pulseaudio.if +1 -0
diff -pruN refpolicy-git-07122016-orig/policy/modules/contrib/pulseaudio.if refpolicy-git-07122016/policy/modules/contrib/pulseaudio.if
@@ -40,6 +40,7 @@ interface(`pulseaudio_role',`
 	allow $2 pulseaudio_tmp_t:sock_file { manage_sock_file_perms relabel_sock_file_perms };
 
 	allow pulseaudio_t $2:unix_stream_socket connectto;
+	allow pulseaudio_t $2:process signull;
 ')
 
 ########################################
policy/modules/contrib/pulseaudio.te +3 -2
diff -pruN refpolicy-git-07122016-orig/policy/modules/contrib/pulseaudio.te refpolicy-git-07122016/policy/modules/contrib/pulseaudio.te
@@ -72,7 +72,7 @@ userdom_user_tmp_filetrans(pulseaudio_t,
 userdom_user_tmp_filetrans(pulseaudio_t, pulseaudio_tmp_t, sock_file, "native")
 
 manage_dirs_pattern(pulseaudio_t, pulseaudio_tmpfs_t, pulseaudio_tmpfs_t)
-manage_files_pattern(pulseaudio_t, pulseaudio_tmpfs_t, pulseaudio_tmpfs_t)
+manage_files_pattern(pulseaudio_t, pulseaudio_tmpfs_t, { pulseaudio_tmpfs_t pulseaudio_tmpfsfile })
 fs_tmpfs_filetrans(pulseaudio_t, pulseaudio_tmpfs_t, { dir file })
 
 manage_dirs_pattern(pulseaudio_t, pulseaudio_var_lib_t, pulseaudio_var_lib_t)
@@ -237,7 +237,7 @@ allow pulseaudio_client pulseaudio_tmp_t
 allow pulseaudio_client pulseaudio_tmp_t:file manage_file_perms;
 allow pulseaudio_client pulseaudio_tmp_t:sock_file manage_sock_file_perms;
 
-read_files_pattern(pulseaudio_client, { pulseaudio_tmpfsfile pulseaudio_tmpfs_t }, { pulseaudio_tmpfsfile pulseaudio_tmpfs_t })
+rw_files_pattern(pulseaudio_client, { pulseaudio_tmpfsfile pulseaudio_tmpfs_t }, { pulseaudio_tmpfsfile pulseaudio_tmpfs_t })
 delete_files_pattern(pulseaudio_client, pulseaudio_tmpfsfile, pulseaudio_tmpfsfile)
 
 fs_getattr_tmpfs(pulseaudio_client)
@@ -257,6 +257,7 @@ pulseaudio_home_filetrans_pulseaudio_hom
 pulseaudio_home_filetrans_pulseaudio_home(pulseaudio_client, file, ".esd_auth")
 pulseaudio_home_filetrans_pulseaudio_home(pulseaudio_client, file, ".pulse-cookie")
 pulseaudio_signull(pulseaudio_client)
+pulseaudio_use_fds(pulseaudio_client)
 
 userdom_read_user_tmpfs_files(pulseaudio_client)
 userdom_user_runtime_filetrans(pulseaudio_client, pulseaudio_tmp_t, dir, "pulse")
#1 lore raw

PATCH 2/2 mozilla: remove redundant pulseaudio interface calls

Remove two pulseaudio interface calls from the mozilla module that have been made redundant by part 1/2 of this patchset.

---
 policy/modules/contrib/mozilla.te |    4 ----
 1 file changed, 4 deletions(-)
policy/modules/contrib/mozilla.te +0 -4
@@ -302,8 +302,6 @@ optional_policy(`
 
 optional_policy(`
 	pulseaudio_run(mozilla_t, mozilla_roles)
-	pulseaudio_rw_tmpfs_files(mozilla_t)
-	pulseaudio_use_fds(mozilla_t)
 ')
 
 optional_policy(`
@@ -573,8 +571,6 @@ optional_policy(`
 
 optional_policy(`
 	pulseaudio_run(mozilla_plugin_t, mozilla_plugin_roles)
-	pulseaudio_rw_tmpfs_files(mozilla_plugin_t)
-	pulseaudio_use_fds(mozilla_plugin_t)
 ')
 
 optional_policy(`
#2 lore raw

PATCH 2/2 mozilla: remove redundant pulseaudio interface calls

Quoted 20 lines · Guido Trentalancia via refpolicy

Remove two pulseaudio interface calls from the mozilla module that have been made redundant by part 1/2 of this patchset.

---
 policy/modules/contrib/mozilla.te |    4 ----
 1 file changed, 4 deletions(-)
policy/modules/contrib/mozilla.te +0 -2
@@ -302,8 +302,6 @@ optional_policy(`
 
 optional_policy(`
 	pulseaudio_run(mozilla_t, mozilla_roles)
-	pulseaudio_rw_tmpfs_files(mozilla_t)
-	pulseaudio_use_fds(mozilla_t)
 ')
 
 optional_policy(`

policy/modules/contrib/mozilla.te optional_policy(` · line 576

Quoted 8 lines
policy/modules/contrib/mozilla.te +0 -2
@@ -573,8 +571,6 @@ optional_policy(`
 
 optional_policy(`
 	pulseaudio_run(mozilla_plugin_t, mozilla_plugin_roles)
-	pulseaudio_rw_tmpfs_files(mozilla_plugin_t)
-	pulseaudio_use_fds(mozilla_plugin_t)
 ')
 
 optional_policy(`

Merged.

Signature · 1 line
Chris PeBenito
#3 lore raw

PATCH 1/2 pulseaudio: update server and client permissions

In reply to Guido Trentalancia
Quoted 11 lines · Guido Trentalancia via refpolicy

Update the pulseaudio module, so that:
- the pulseaudio server can send the signull signal to its clients;
- the pulseaudio server can manage not only pulseaudio_tmpfs files but all pulseaudio_tmpfs_content;
- pulseaudio clients can also write and not just read pulseaudio content files in the temporary filesystems (tmpfs);
- pulseaudio clients can use file descriptors for pulseaudio.

This patch has been triggered by recent testing of the games module and it makes the following patch obsolete (not applied yet):

Quoted 7 lines

[PATCH 2/2] pulseaudio: improve the support for Gnome games
http://oss.tresys.com/pipermail/refpolicy/2016-December/008651.html

It also makes obsolete interface calls to the following interfaces in addition to pulseaudio_run(): pulseaudio_rw_tmpfs_files() and pulseaudio_use_fds(). These are currently used in the mozilla module (removed in part 2/2 of this patchset).

Merged.

Quoted 46 lines
---
 policy/modules/contrib/pulseaudio.if |    1 +
 policy/modules/contrib/pulseaudio.te |    5 +++--
 2 files changed, 4 insertions(+), 2 deletions(-)

diff -pruN refpolicy-git-07122016-orig/policy/modules/contrib/pulseaudio.if refpolicy-git-07122016/policy/modules/contrib/pulseaudio.if

policy/modules/contrib/pulseaudio.if +1 -0
@@ -40,6 +40,7 @@ interface(`pulseaudio_role',`
 	allow $2 pulseaudio_tmp_t:sock_file { manage_sock_file_perms relabel_sock_file_perms };
 
 	allow pulseaudio_t $2:unix_stream_socket connectto;
+	allow pulseaudio_t $2:process signull;
 ')
 
 ########################################

diff -pruN refpolicy-git-07122016-orig/policy/modules/contrib/pulseaudio.te refpolicy-git-07122016/policy/modules/contrib/pulseaudio.te

policy/modules/contrib/pulseaudio.te +3 -2
@@ -72,7 +72,7 @@ userdom_user_tmp_filetrans(pulseaudio_t,
 userdom_user_tmp_filetrans(pulseaudio_t, pulseaudio_tmp_t, sock_file, "native")
 
 manage_dirs_pattern(pulseaudio_t, pulseaudio_tmpfs_t, pulseaudio_tmpfs_t)
-manage_files_pattern(pulseaudio_t, pulseaudio_tmpfs_t, pulseaudio_tmpfs_t)
+manage_files_pattern(pulseaudio_t, pulseaudio_tmpfs_t, { pulseaudio_tmpfs_t pulseaudio_tmpfsfile })
 fs_tmpfs_filetrans(pulseaudio_t, pulseaudio_tmpfs_t, { dir file })
 
 manage_dirs_pattern(pulseaudio_t, pulseaudio_var_lib_t, pulseaudio_var_lib_t)
@@ -237,7 +237,7 @@ allow pulseaudio_client pulseaudio_tmp_t
 allow pulseaudio_client pulseaudio_tmp_t:file manage_file_perms;
 allow pulseaudio_client pulseaudio_tmp_t:sock_file manage_sock_file_perms;
 
-read_files_pattern(pulseaudio_client, { pulseaudio_tmpfsfile pulseaudio_tmpfs_t }, { pulseaudio_tmpfsfile pulseaudio_tmpfs_t })
+rw_files_pattern(pulseaudio_client, { pulseaudio_tmpfsfile pulseaudio_tmpfs_t }, { pulseaudio_tmpfsfile pulseaudio_tmpfs_t })
 delete_files_pattern(pulseaudio_client, pulseaudio_tmpfsfile, pulseaudio_tmpfsfile)
 
 fs_getattr_tmpfs(pulseaudio_client)
@@ -257,6 +257,7 @@ pulseaudio_home_filetrans_pulseaudio_hom
 pulseaudio_home_filetrans_pulseaudio_home(pulseaudio_client, file, ".esd_auth")
 pulseaudio_home_filetrans_pulseaudio_home(pulseaudio_client, file, ".pulse-cookie")
 pulseaudio_signull(pulseaudio_client)
+pulseaudio_use_fds(pulseaudio_client)
 
 userdom_read_user_tmpfs_files(pulseaudio_client)
 userdom_user_runtime_filetrans(pulseaudio_client, pulseaudio_tmp_t, dir, "pulse")
Signature · 1 line
Chris PeBenito