Skip to contentSkip to conversation

Update policy and file contexts for the alsa module

PATCH Superseded Guido Trentalancia 4 participants 13 messages Aug 9, 2016 – Aug 14, 2016

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Update policy and file contexts for the alsa module

Update the alsa module:

- the alsa_etc_rw_t file context is widened to the whole share directory, instead of just a couple of files;
- alsa_t can manage var_lock_t files.

---
 policy/modules/contrib/alsa.fc |    3 +--
 policy/modules/contrib/alsa.te |    3 ++-
 2 files changed, 3 insertions(+), 3 deletions(-)
policy/modules/contrib/alsa.fc +1 -2
@@ -25,8 +25,7 @@ ifdef(`distro_debian',`
 /usr/sbin/alsactl	--	gen_context(system_u:object_r:alsa_exec_t,s0)
 /usr/sbin/salsa	--	gen_context(system_u:object_r:alsa_exec_t,s0)
 
-/usr/share/alsa/alsa\.conf	gen_context(system_u:object_r:alsa_etc_rw_t,s0)
-/usr/share/alsa/pcm(/.*)?	gen_context(system_u:object_r:alsa_etc_rw_t,s0)
+/usr/share/alsa(/.*)?	gen_context(system_u:object_r:alsa_etc_rw_t,s0)
 
 /var/lib/alsa(/.*)?	gen_context(system_u:object_r:alsa_var_lib_t,s0)
 
policy/modules/contrib/alsa.te +2 -1
@@ -64,7 +64,8 @@ manage_dirs_pattern(alsa_t, alsa_var_lib
 manage_files_pattern(alsa_t, alsa_var_lib_t, alsa_var_lib_t)
 
 allow alsa_t alsa_var_lock_t:file manage_file_perms;
-files_lock_filetrans(alsa_t, alsa_var_lock_t, file);
+files_search_locks(alsa_t)
+files_lock_filetrans(alsa_t, alsa_var_lock_t, file)
 
 kernel_read_system_state(alsa_t)
 
#1 lore raw

PATCH 1/1 Update policy and file contexts for the alsa module

Quoted 27 lines · Guido Trentalancia

Update the alsa module:

- the alsa_etc_rw_t file context is widened to the whole share directory, instead of just a couple of files;
- alsa_t can manage var_lock_t files.

---
 policy/modules/contrib/alsa.fc |    3 +--
 policy/modules/contrib/alsa.te |    3 ++-
 2 files changed, 3 insertions(+), 3 deletions(-)
policy/modules/contrib/alsa.fc +1 -2
@@ -25,8 +25,7 @@ ifdef(`distro_debian',`
 /usr/sbin/alsactl	--	gen_context(system_u:object_r:alsa_exec_t,s0)
 /usr/sbin/salsa	--	gen_context(system_u:object_r:alsa_exec_t,s0)
 
-/usr/share/alsa/alsa\.conf	gen_context(system_u:object_r:alsa_etc_rw_t,s0)
-/usr/share/alsa/pcm(/.*)?	gen_context(system_u:object_r:alsa_etc_rw_t,s0)
+/usr/share/alsa(/.*)?	gen_context(system_u:object_r:alsa_etc_rw_t,s0)
 
 /var/lib/alsa(/.*)?	gen_context(system_u:object_r:alsa_var_lib_t,s0)
 

policy/modules/contrib/alsa.te manage_dirs_pattern(alsa_t, alsa_var_lib · line 67

Quoted 5 lines
policy/modules/contrib/alsa.te +1 -1
@@ -64,7 +64,8 @@ manage_dirs_pattern(alsa_t, alsa_var_lib
 manage_files_pattern(alsa_t, alsa_var_lib_t, alsa_var_lib_t)
 
 allow alsa_t alsa_var_lock_t:file manage_file_perms;
-files_lock_filetrans(alsa_t, alsa_var_lock_t, file);
+files_search_locks(alsa_t)

redundant: files_lock_filetrans() already provides the above

Quoted 9 lines
policy/modules/contrib/alsa.te +1 -0
+files_lock_filetrans(alsa_t, alsa_var_lock_t, file)
 
 kernel_read_system_state(alsa_t)
 

_______________________________________________
refpolicy mailing list
refpolicy at oss.tresys.com
http://oss.tresys.com/mailman/listinfo/refpolicy

Signature · 11 lines
Key fingerprint = 5F4D 3CDB D3F8 3652 FBD8  02D5 3B6C 5F1D 2C7B 6B02
https://sks-keyservers.net/pks/lookup?op=get&search=0x3B6C5F1D2C7B6B02
Dominick Grift

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 648 bytes
Desc: OpenPGP digital signature
Url : http://oss.tresys.com/pipermail/refpolicy/attachments/20160809/9f499699/attachment.bin 
#2 lore raw

PATCH v2 1/1 Update file contexts for the alsa module

Update the alsa module so that the alsa_etc_rw_t file context is widened to the whole share directory, instead of just a couple of files.

Thanks to Dominick Grift for pointing out redundant interface usage in the previous version of this patch.

---
 policy/modules/contrib/alsa.fc |    3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
policy/modules/contrib/alsa.fc +1 -2
@@ -25,8 +25,7 @@ ifdef(`distro_debian',`
 /usr/sbin/alsactl	--	gen_context(system_u:object_r:alsa_exec_t,s0)
 /usr/sbin/salsa	--	gen_context(system_u:object_r:alsa_exec_t,s0)
 
-/usr/share/alsa/alsa\.conf	gen_context(system_u:object_r:alsa_etc_rw_t,s0)
-/usr/share/alsa/pcm(/.*)?	gen_context(system_u:object_r:alsa_etc_rw_t,s0)
+/usr/share/alsa(/.*)?	gen_context(system_u:object_r:alsa_etc_rw_t,s0)
 
 /var/lib/alsa(/.*)?	gen_context(system_u:object_r:alsa_var_lib_t,s0)
 
#3 lore raw

PATCH v2 1/1 Update file contexts for the alsa module

Quoted 2 lines · Guido Trentalancia

Update the alsa module so that the alsa_etc_rw_t file context is widened to the whole share directory, instead of just a couple of files.

[...]

policy/modules/contrib/alsa.fc ifdef(`distro_debian',` · line 28

Quoted 3 lines
policy/modules/contrib/alsa.fc +1 -2
-/usr/share/alsa/alsa\.conf     gen_context(system_u:object_r:alsa_etc_rw_t,s0)
-/usr/share/alsa/pcm(/.*)?      gen_context(system_u:object_r:alsa_etc_rw_t,s0)
+/usr/share/alsa(/.*)?  gen_context(system_u:object_r:alsa_etc_rw_t,s0)

Do you happen to know why or what is trying to write to /usr/share? I would consider /usr/share to be only writable for a very limited number of domains (mostly package managers and such).

Isn't alsa_etc_rw_t not something more oriented towards /etc?

I am somewhat afraid that, tagging the entire /usr/share/alsa as alsa_etc_rw_t makes a large number of alsa domains capable of writing stuff around there (well, besides the Linux DAC controls of course).

Wkr,
Sven Vermeulen

#4 lore raw

PATCH v2 1/1 Update file contexts for the alsa module

Quoted 6 lines · Sven Vermeulen
Quoted 3 lines · Guido Trentalancia

Update the alsa module so that the alsa_etc_rw_t file context is widened to the whole share directory, instead of just a couple of files.

[...]

Quoted 10 lines
Quoted 6 lines

-/usr/share/alsa/alsa\.conf?????gen_context(system_u:object_r:alsa_ etc_rw_t,s0) -/usr/share/alsa/pcm(/.*)???????gen_context(system_u:object_r:alsa_ etc_rw_t,s0) +/usr/share/alsa(/.*)???gen_context(system_u:object_r:alsa_etc_rw_t ,s0)

Do you happen to know why or what is trying to write to /usr/share? I would consider /usr/share to be only writable for a very limited number of domains (mostly package managers and such).

It's a bug in the current module. It should not write to anything in /usr/share/alsa. And the "_rw_" naming is confusing !!

Quoted 1 line

Isn't alsa_etc_rw_t not something more oriented towards /etc?

However, if you want to change the ALSA package, then you should submit a patch to ALSA development...

I believe a subdirectory of /usr/share is the right place for static configuration files (as opposed to user configuration files in /etc).

Quoted 3 lines

I am somewhat afraid that, tagging the entire /usr/share/alsa as alsa_etc_rw_t makes a large number of alsa domains capable of writing stuff around there (well, besides the Linux DAC controls of course).

It is possible on the refpolicy side to fix the existing module in order to only allow read permissions and not manage permissions.

I believe the latter is the best solution possible.

A new revised version of the patch (v3) follows this message...

Quoted 2 lines

Wkr,
? Sven Vermeulen

Regards,

Guido

#5 lore raw

PATCH v3 1/1 Update policy and file contexts for the alsa module

In reply to Guido Trentalancia

Update the alsa module so that the alsa_etc_t file context (previously alsa_etc_rw_t) is widened to the whole alsa share directory, instead of just a couple of files.

The wrong and misleading _rw_ label is also removed from the alsa interface definitions and from their instances throughout the whole Reference Policy (static and system-wide configuration files are not runtime-writable).

This version of the patch finally removes obsolete file contexts and grants read permissions instead of manage permissions for static configuration files in /usr/share/alsa and system-wide configuration files in /etc.

Thanks to Dominick Grift for pointing out redundant interface usage in a previous version of this patch.

---
 doc/policy.xml                       |    4 ++--
 policy/modules/contrib/alsa.fc       |    9 +++------
 policy/modules/contrib/alsa.if       |   24 ++++++++++++------------
 policy/modules/contrib/alsa.te       |   10 +++++-----
 policy/modules/contrib/asterisk.te   |    2 +-
 policy/modules/contrib/entropyd.te   |    2 +-
 policy/modules/contrib/hal.te        |    2 +-
 policy/modules/contrib/mozilla.te    |    2 +-
 policy/modules/contrib/mpd.te        |    2 +-
 policy/modules/contrib/mplayer.te    |    2 +-
 policy/modules/contrib/pulseaudio.te |    2 +-
 policy/modules/system/init.te        |    2 +-
 policy/modules/system/udev.te        |    2 +-
 policy/modules/system/userdomain.if  |    4 ++--
 14 files changed, 33 insertions(+), 36 deletions(-)
policy/modules/contrib/alsa.fc +3 -6
@@ -6,10 +6,8 @@ ifdef(`distro_debian',`
 
 /bin/alsaunmute	--	gen_context(system_u:object_r:alsa_exec_t,s0)
 
-/etc/alsa/asound\.state	--	gen_context(system_u:object_r:alsa_etc_rw_t,s0)
-/etc/alsa/pcm(/.*)?	gen_context(system_u:object_r:alsa_etc_rw_t,s0)
-/etc/asound(/.*)?	gen_context(system_u:object_r:alsa_etc_rw_t,s0)
-/etc/asound\.state	--	gen_context(system_u:object_r:alsa_etc_rw_t,s0)
+/etc/alsa(/.*)?		gen_context(system_u:object_r:alsa_etc_t,s0)
+/etc/asound\.conf	gen_context(system_u:object_r:alsa_etc_t,s0)
 
 /sbin/alsactl	--	gen_context(system_u:object_r:alsa_exec_t,s0)
 /sbin/salsa	--	gen_context(system_u:object_r:alsa_exec_t,s0)
@@ -25,8 +23,7 @@ ifdef(`distro_debian',`
 /usr/sbin/alsactl	--	gen_context(system_u:object_r:alsa_exec_t,s0)
 /usr/sbin/salsa	--	gen_context(system_u:object_r:alsa_exec_t,s0)
 
-/usr/share/alsa/alsa\.conf	gen_context(system_u:object_r:alsa_etc_rw_t,s0)
-/usr/share/alsa/pcm(/.*)?	gen_context(system_u:object_r:alsa_etc_rw_t,s0)
+/usr/share/alsa(/.*)?		gen_context(system_u:object_r:alsa_etc_t,s0)
 
 /var/lib/alsa(/.*)?	gen_context(system_u:object_r:alsa_var_lib_t,s0)
 
policy/modules/contrib/alsa.if +12 -12
@@ -102,7 +102,7 @@ interface(`alsa_rw_shared_mem',`
 
 ########################################
 ## <summary>
-##	Read writable Alsa configuration content.
+##	Read Alsa configuration content.
 ## </summary>
 ## <param name="domain">
 ##	<summary>
@@ -110,15 +110,15 @@ interface(`alsa_rw_shared_mem',`
 ##	</summary>
 ## </param>
 #
-interface(`alsa_read_rw_config',`
+interface(`alsa_read_config',`
 	gen_require(`
-		type alsa_etc_rw_t;
+		type alsa_etc_t;
 	')
 
 	files_search_etc($1)
-	allow $1 alsa_etc_rw_t:dir list_dir_perms;
-	read_files_pattern($1, alsa_etc_rw_t, alsa_etc_rw_t)
-	read_lnk_files_pattern($1, alsa_etc_rw_t, alsa_etc_rw_t)
+	allow $1 alsa_etc_t:dir list_dir_perms;
+	read_files_pattern($1, alsa_etc_t, alsa_etc_t)
+	read_lnk_files_pattern($1, alsa_etc_t, alsa_etc_t)
 
 	ifdef(`distro_debian',`
 		files_search_usr($1)
@@ -127,7 +127,7 @@ interface(`alsa_read_rw_config',`
 
 ########################################
 ## <summary>
-##	Manage writable Alsa config files.
+##	Manage Alsa config files.
 ## </summary>
 ## <param name="domain">
 ##	<summary>
@@ -135,15 +135,15 @@ interface(`alsa_read_rw_config',`
 ##	</summary>
 ## </param>
 #
-interface(`alsa_manage_rw_config',`
+interface(`alsa_manage_config',`
 	gen_require(`
-		type alsa_etc_rw_t;
+		type alsa_etc_t;
 	')
 
 	files_search_etc($1)
-	allow $1 alsa_etc_rw_t:dir list_dir_perms;
-	manage_files_pattern($1, alsa_etc_rw_t, alsa_etc_rw_t)
-	read_lnk_files_pattern($1, alsa_etc_rw_t, alsa_etc_rw_t)
+	allow $1 alsa_etc_t:dir list_dir_perms;
+	manage_files_pattern($1, alsa_etc_t, alsa_etc_t)
+	read_lnk_files_pattern($1, alsa_etc_t, alsa_etc_t)
 
 	ifdef(`distro_debian',`
 		files_search_usr($1)
policy/modules/contrib/alsa.te +5 -5
@@ -12,8 +12,8 @@ type alsa_exec_t;
 init_system_domain(alsa_t, alsa_exec_t)
 role alsa_roles types alsa_t;
 
-type alsa_etc_rw_t;
-files_config_file(alsa_etc_rw_t)
+type alsa_etc_t;
+files_config_file(alsa_etc_t)
 
 type alsa_tmp_t;
 files_tmp_file(alsa_tmp_t)
@@ -46,9 +46,9 @@ allow alsa_t self:unix_stream_socket { a
 
 allow alsa_t alsa_home_t:file read_file_perms;
 
-manage_files_pattern(alsa_t, alsa_etc_rw_t, alsa_etc_rw_t)
-manage_lnk_files_pattern(alsa_t, alsa_etc_rw_t, alsa_etc_rw_t)
-files_etc_filetrans(alsa_t, alsa_etc_rw_t, file)
+list_dirs_pattern(alsa_t, alsa_etc_t, alsa_etc_t)
+read_files_pattern(alsa_t, alsa_etc_t, alsa_etc_t)
+read_lnk_files_pattern(alsa_t, alsa_etc_t, alsa_etc_t)
 
 can_exec(alsa_t, alsa_exec_t)
 
policy/modules/contrib/asterisk.te +1 -1
@@ -156,7 +156,7 @@ userdom_dontaudit_use_unpriv_user_fds(as
 userdom_dontaudit_search_user_home_dirs(asterisk_t)
 
 optional_policy(`
-	alsa_read_rw_config(asterisk_t)
+	alsa_read_config(asterisk_t)
 ')
 
 optional_policy(`
policy/modules/contrib/hal.te +1 -1
@@ -213,7 +213,7 @@ userdom_dontaudit_search_user_home_dirs(
 
 optional_policy(`
 	alsa_domtrans(hald_t)
-	alsa_read_rw_config(hald_t)
+	alsa_read_config(hald_t)
 ')
 
 optional_policy(`
policy/modules/contrib/entropyd.te +1 -1
@@ -68,7 +68,7 @@ tunable_policy(`entropyd_use_audio',`
 optional_policy(`
 	tunable_policy(`entropyd_use_audio',`
 		alsa_read_lib(entropyd_t)
-		alsa_read_rw_config(entropyd_t)
+		alsa_read_config(entropyd_t)
 	')
 ')
 
policy/modules/contrib/pulseaudio.te +1 -1
@@ -146,7 +146,7 @@ tunable_policy(`use_samba_home_dirs',`
 ')
 
 optional_policy(`
-	alsa_read_rw_config(pulseaudio_t)
+	alsa_read_config(pulseaudio_t)
 ')
 
 optional_policy(`
policy/modules/contrib/mpd.te +1 -1
@@ -179,7 +179,7 @@ tunable_policy(`mpd_use_nfs',`
 ')
 
 optional_policy(`
-	alsa_read_rw_config(mpd_t)
+	alsa_read_config(mpd_t)
 ')
 
 optional_policy(`
policy/modules/contrib/mplayer.te +1 -1
@@ -251,7 +251,7 @@ tunable_policy(`allow_mplayer_execstack'
 ')
 
 optional_policy(`
-	alsa_read_rw_config(mplayer_t)
+	alsa_read_config(mplayer_t)
 ')
 
 optional_policy(`
policy/modules/contrib/mozilla.te +1 -1
@@ -518,7 +518,7 @@ tunable_policy(`use_samba_home_dirs',`
 ')
 
 optional_policy(`
-	alsa_read_rw_config(mozilla_plugin_t)
+	alsa_read_config(mozilla_plugin_t)
 	alsa_read_home_files(mozilla_plugin_t)
 ')
 
policy/modules/system/init.te +1 -1
@@ -694,7 +694,7 @@ ifdef(`distro_redhat',`
 	miscfiles_read_hwdata(initrc_t)
 
 	optional_policy(`
-		alsa_manage_rw_config(initrc_t)
+		alsa_manage_config(initrc_t)
 	')
 
 	optional_policy(`
policy/modules/system/udev.te +1 -1
@@ -234,7 +234,7 @@ ifdef(`init_systemd',`
 optional_policy(`
 	alsa_domtrans(udev_t)
 	alsa_read_lib(udev_t)
-	alsa_read_rw_config(udev_t)
+	alsa_read_config(udev_t)
 ')
 
 optional_policy(`
policy/modules/system/userdomain.if +2 -2
@@ -579,7 +579,7 @@ template(`userdom_common_user_template',
 	optional_policy(`
 		alsa_home_filetrans_alsa_home($1_t, file, ".asoundrc")
 		alsa_manage_home_files($1_t)
-		alsa_read_rw_config($1_t)
+		alsa_read_config($1_t)
 		alsa_relabel_home_files($1_t)
 	')
 
@@ -933,7 +933,7 @@ template(`userdom_restricted_xwindows_us
 	xserver_restricted_role($1_r, $1_t)
 
 	optional_policy(`
-		alsa_read_rw_config($1_t)
+		alsa_read_config($1_t)
 	')
 
 	optional_policy(`
doc/policy.xml +2 -2
@@ -1331,7 +1331,7 @@ Domain allowed access.
 </summary>
 </param>
 </interface>
-<interface name="alsa_read_rw_config" lineno="113">
+<interface name="alsa_read_config" lineno="113">
 <summary>
 Read writable Alsa configuration content.
 </summary>
@@ -1341,7 +1341,7 @@ Domain allowed access.
 </summary>
 </param>
 </interface>
-<interface name="alsa_manage_rw_config" lineno="138">
+<interface name="alsa_manage_config" lineno="138">
 <summary>
 Manage writable Alsa config files.
 </summary>
#6 lore raw

PATCH v4 1/1 Update policy and file contexts for the alsa module

Update the alsa module so that the alsa_etc_t file context (previously alsa_etc_rw_t) is widened to the whole alsa share directory, instead of just a couple of files.

The wrong and misleading _rw_ label is also removed from the alsa interface definitions and from their instances throughout the whole Reference Policy (static and system-wide configuration files are not runtime-writable).

This version of the patch finally removes obsolete file contexts and grants read permissions instead of manage permissions for static configuration files in /usr/share/alsa and system-wide configuration files in /etc.

Thanks to Dominick Grift for pointing out redundant interface usage in a previous version of this patch.

---
 policy/modules/contrib/alsa.fc       |    9 +++------
 policy/modules/contrib/alsa.if       |   24 ++++++++++++------------
 policy/modules/contrib/alsa.te       |   10 +++++-----
 policy/modules/contrib/asterisk.te   |    2 +-
 policy/modules/contrib/entropyd.te   |    2 +-
 policy/modules/contrib/hal.te        |    2 +-
 policy/modules/contrib/mozilla.te    |    2 +-
 policy/modules/contrib/mpd.te        |    2 +-
 policy/modules/contrib/mplayer.te    |    2 +-
 policy/modules/contrib/pulseaudio.te |    2 +-
 policy/modules/system/init.te        |    2 +-
 policy/modules/system/udev.te        |    2 +-
 policy/modules/system/userdomain.if  |    4 ++--
 13 files changed, 31 insertions(+), 34 deletions(-)
policy/modules/contrib/alsa.fc +3 -6
@@ -6,10 +6,8 @@ ifdef(`distro_debian',`
 
 /bin/alsaunmute	--	gen_context(system_u:object_r:alsa_exec_t,s0)
 
-/etc/alsa/asound\.state	--	gen_context(system_u:object_r:alsa_etc_rw_t,s0)
-/etc/alsa/pcm(/.*)?	gen_context(system_u:object_r:alsa_etc_rw_t,s0)
-/etc/asound(/.*)?	gen_context(system_u:object_r:alsa_etc_rw_t,s0)
-/etc/asound\.state	--	gen_context(system_u:object_r:alsa_etc_rw_t,s0)
+/etc/alsa(/.*)?		gen_context(system_u:object_r:alsa_etc_t,s0)
+/etc/asound\.conf	gen_context(system_u:object_r:alsa_etc_t,s0)
 
 /sbin/alsactl	--	gen_context(system_u:object_r:alsa_exec_t,s0)
 /sbin/salsa	--	gen_context(system_u:object_r:alsa_exec_t,s0)
@@ -25,8 +23,7 @@ ifdef(`distro_debian',`
 /usr/sbin/alsactl	--	gen_context(system_u:object_r:alsa_exec_t,s0)
 /usr/sbin/salsa	--	gen_context(system_u:object_r:alsa_exec_t,s0)
 
-/usr/share/alsa/alsa\.conf	gen_context(system_u:object_r:alsa_etc_rw_t,s0)
-/usr/share/alsa/pcm(/.*)?	gen_context(system_u:object_r:alsa_etc_rw_t,s0)
+/usr/share/alsa(/.*)?		gen_context(system_u:object_r:alsa_etc_t,s0)
 
 /var/lib/alsa(/.*)?	gen_context(system_u:object_r:alsa_var_lib_t,s0)
 
policy/modules/contrib/alsa.if +12 -12
@@ -102,7 +102,7 @@ interface(`alsa_rw_shared_mem',`
 
 ########################################
 ## <summary>
-##	Read writable Alsa configuration content.
+##	Read Alsa configuration content.
 ## </summary>
 ## <param name="domain">
 ##	<summary>
@@ -110,15 +110,15 @@ interface(`alsa_rw_shared_mem',`
 ##	</summary>
 ## </param>
 #
-interface(`alsa_read_rw_config',`
+interface(`alsa_read_config',`
 	gen_require(`
-		type alsa_etc_rw_t;
+		type alsa_etc_t;
 	')
 
 	files_search_etc($1)
-	allow $1 alsa_etc_rw_t:dir list_dir_perms;
-	read_files_pattern($1, alsa_etc_rw_t, alsa_etc_rw_t)
-	read_lnk_files_pattern($1, alsa_etc_rw_t, alsa_etc_rw_t)
+	allow $1 alsa_etc_t:dir list_dir_perms;
+	read_files_pattern($1, alsa_etc_t, alsa_etc_t)
+	read_lnk_files_pattern($1, alsa_etc_t, alsa_etc_t)
 
 	ifdef(`distro_debian',`
 		files_search_usr($1)
@@ -127,7 +127,7 @@ interface(`alsa_read_rw_config',`
 
 ########################################
 ## <summary>
-##	Manage writable Alsa config files.
+##	Manage Alsa config files.
 ## </summary>
 ## <param name="domain">
 ##	<summary>
@@ -135,15 +135,15 @@ interface(`alsa_read_rw_config',`
 ##	</summary>
 ## </param>
 #
-interface(`alsa_manage_rw_config',`
+interface(`alsa_manage_config',`
 	gen_require(`
-		type alsa_etc_rw_t;
+		type alsa_etc_t;
 	')
 
 	files_search_etc($1)
-	allow $1 alsa_etc_rw_t:dir list_dir_perms;
-	manage_files_pattern($1, alsa_etc_rw_t, alsa_etc_rw_t)
-	read_lnk_files_pattern($1, alsa_etc_rw_t, alsa_etc_rw_t)
+	allow $1 alsa_etc_t:dir list_dir_perms;
+	manage_files_pattern($1, alsa_etc_t, alsa_etc_t)
+	read_lnk_files_pattern($1, alsa_etc_t, alsa_etc_t)
 
 	ifdef(`distro_debian',`
 		files_search_usr($1)
policy/modules/contrib/alsa.te +5 -5
@@ -12,8 +12,8 @@ type alsa_exec_t;
 init_system_domain(alsa_t, alsa_exec_t)
 role alsa_roles types alsa_t;
 
-type alsa_etc_rw_t;
-files_config_file(alsa_etc_rw_t)
+type alsa_etc_t;
+files_config_file(alsa_etc_t)
 
 type alsa_tmp_t;
 files_tmp_file(alsa_tmp_t)
@@ -46,9 +46,9 @@ allow alsa_t self:unix_stream_socket { a
 
 allow alsa_t alsa_home_t:file read_file_perms;
 
-manage_files_pattern(alsa_t, alsa_etc_rw_t, alsa_etc_rw_t)
-manage_lnk_files_pattern(alsa_t, alsa_etc_rw_t, alsa_etc_rw_t)
-files_etc_filetrans(alsa_t, alsa_etc_rw_t, file)
+list_dirs_pattern(alsa_t, alsa_etc_t, alsa_etc_t)
+read_files_pattern(alsa_t, alsa_etc_t, alsa_etc_t)
+read_lnk_files_pattern(alsa_t, alsa_etc_t, alsa_etc_t)
 
 can_exec(alsa_t, alsa_exec_t)
 
policy/modules/contrib/asterisk.te +1 -1
@@ -156,7 +156,7 @@ userdom_dontaudit_use_unpriv_user_fds(as
 userdom_dontaudit_search_user_home_dirs(asterisk_t)
 
 optional_policy(`
-	alsa_read_rw_config(asterisk_t)
+	alsa_read_config(asterisk_t)
 ')
 
 optional_policy(`
policy/modules/contrib/hal.te +1 -1
@@ -213,7 +213,7 @@ userdom_dontaudit_search_user_home_dirs(
 
 optional_policy(`
 	alsa_domtrans(hald_t)
-	alsa_read_rw_config(hald_t)
+	alsa_read_config(hald_t)
 ')
 
 optional_policy(`
policy/modules/contrib/entropyd.te +1 -1
@@ -68,7 +68,7 @@ tunable_policy(`entropyd_use_audio',`
 optional_policy(`
 	tunable_policy(`entropyd_use_audio',`
 		alsa_read_lib(entropyd_t)
-		alsa_read_rw_config(entropyd_t)
+		alsa_read_config(entropyd_t)
 	')
 ')
 
policy/modules/contrib/pulseaudio.te +1 -1
@@ -146,7 +146,7 @@ tunable_policy(`use_samba_home_dirs',`
 ')
 
 optional_policy(`
-	alsa_read_rw_config(pulseaudio_t)
+	alsa_read_config(pulseaudio_t)
 ')
 
 optional_policy(`
policy/modules/contrib/mpd.te +1 -1
@@ -179,7 +179,7 @@ tunable_policy(`mpd_use_nfs',`
 ')
 
 optional_policy(`
-	alsa_read_rw_config(mpd_t)
+	alsa_read_config(mpd_t)
 ')
 
 optional_policy(`
policy/modules/contrib/mplayer.te +1 -1
@@ -251,7 +251,7 @@ tunable_policy(`allow_mplayer_execstack'
 ')
 
 optional_policy(`
-	alsa_read_rw_config(mplayer_t)
+	alsa_read_config(mplayer_t)
 ')
 
 optional_policy(`
policy/modules/contrib/mozilla.te +1 -1
@@ -518,7 +518,7 @@ tunable_policy(`use_samba_home_dirs',`
 ')
 
 optional_policy(`
-	alsa_read_rw_config(mozilla_plugin_t)
+	alsa_read_config(mozilla_plugin_t)
 	alsa_read_home_files(mozilla_plugin_t)
 ')
 
policy/modules/system/init.te +1 -1
@@ -694,7 +694,7 @@ ifdef(`distro_redhat',`
 	miscfiles_read_hwdata(initrc_t)
 
 	optional_policy(`
-		alsa_manage_rw_config(initrc_t)
+		alsa_manage_config(initrc_t)
 	')
 
 	optional_policy(`
policy/modules/system/udev.te +1 -1
@@ -234,7 +234,7 @@ ifdef(`init_systemd',`
 optional_policy(`
 	alsa_domtrans(udev_t)
 	alsa_read_lib(udev_t)
-	alsa_read_rw_config(udev_t)
+	alsa_read_config(udev_t)
 ')
 
 optional_policy(`
policy/modules/system/userdomain.if +2 -2
@@ -579,7 +579,7 @@ template(`userdom_common_user_template',
 	optional_policy(`
 		alsa_home_filetrans_alsa_home($1_t, file, ".asoundrc")
 		alsa_manage_home_files($1_t)
-		alsa_read_rw_config($1_t)
+		alsa_read_config($1_t)
 		alsa_relabel_home_files($1_t)
 	')
 
@@ -933,7 +933,7 @@ template(`userdom_restricted_xwindows_us
 	xserver_restricted_role($1_r, $1_t)
 
 	optional_policy(`
-		alsa_read_rw_config($1_t)
+		alsa_read_config($1_t)
 	')
 
 	optional_policy(`
#7 lore raw

PATCH v4 1/1 Update policy and file contexts for the alsa module

Quoted 17 lines · Guido Trentalancia

Update the alsa module so that the alsa_etc_t file context (previously alsa_etc_rw_t) is widened to the whole alsa share directory, instead of just a couple of files.

The wrong and misleading _rw_ label is also removed from the alsa interface definitions and from their instances throughout the whole Reference Policy (static and system-wide configuration files are not runtime-writable).

This version of the patch finally removes obsolete file contexts and grants read permissions instead of manage permissions for static configuration files in /usr/share/alsa and system-wide configuration files in /etc.

Thanks to Dominick Grift for pointing out redundant interface usage in a previous version of this patch.

[...]

Quoted 12 lines
policy/modules/contrib/alsa.if +1 -1
@@ -102,7 +102,7 @@ interface(`alsa_rw_shared_mem',`
 
 ########################################
 ## <summary>
-##	Read writable Alsa configuration content.
+##	Read Alsa configuration content.
 ## </summary>
 ## <param name="domain">
 ##	<summary>

policy/modules/contrib/alsa.if interface(`alsa_rw_shared_mem',` · line 113

Quoted 5 lines
policy/modules/contrib/alsa.if +1 -1
@@ -110,15 +110,15 @@ interface(`alsa_rw_shared_mem',`
 ##	</summary>
 ## </param>
 #
-interface(`alsa_read_rw_config',`
+interface(`alsa_read_config',`

Since these interfaces have been in releases, please do not remove them, deprecate them. It is fine to have them print out deprecation warnings and call the new interfaces you're creating (grep for "refpolicywarn" to see other deprecated interface examples)

Quoted 45 lines
policy/modules/contrib/alsa.if +10 -10
 	gen_require(`
-		type alsa_etc_rw_t;
+		type alsa_etc_t;
 	')
 
 	files_search_etc($1)
-	allow $1 alsa_etc_rw_t:dir list_dir_perms;
-	read_files_pattern($1, alsa_etc_rw_t, alsa_etc_rw_t)
-	read_lnk_files_pattern($1, alsa_etc_rw_t, alsa_etc_rw_t)
+	allow $1 alsa_etc_t:dir list_dir_perms;
+	read_files_pattern($1, alsa_etc_t, alsa_etc_t)
+	read_lnk_files_pattern($1, alsa_etc_t, alsa_etc_t)
 
 	ifdef(`distro_debian',`
 		files_search_usr($1)
@@ -127,7 +127,7 @@ interface(`alsa_read_rw_config',`
 
 ########################################
 ## <summary>
-##	Manage writable Alsa config files.
+##	Manage Alsa config files.
 ## </summary>
 ## <param name="domain">
 ##	<summary>
@@ -135,15 +135,15 @@ interface(`alsa_read_rw_config',`
 ##	</summary>
 ## </param>
 #
-interface(`alsa_manage_rw_config',`
+interface(`alsa_manage_config',`
 	gen_require(`
-		type alsa_etc_rw_t;
+		type alsa_etc_t;
 	')
 
 	files_search_etc($1)
-	allow $1 alsa_etc_rw_t:dir list_dir_perms;
-	manage_files_pattern($1, alsa_etc_rw_t, alsa_etc_rw_t)
-	read_lnk_files_pattern($1, alsa_etc_rw_t, alsa_etc_rw_t)
+	allow $1 alsa_etc_t:dir list_dir_perms;
+	manage_files_pattern($1, alsa_etc_t, alsa_etc_t)
+	read_lnk_files_pattern($1, alsa_etc_t, alsa_etc_t)
 
 	ifdef(`distro_debian',`
 		files_search_usr($1)
Signature · 1 line
Chris PeBenito
#8 lore raw

PATCH v5 1/1 Update policy and file contexts for the alsa module

In reply to Guido Trentalancia

Update the alsa module so that the alsa_etc_t file context (previously alsa_etc_rw_t) is widened to the whole alsa share directory, instead of just a couple of files.

The wrong and misleading _rw_ label has been deprecated in the alsa interface definitions and in their instances throughout the whole Reference Policy (static and system-wide configuration files are not runtime-writable). Warning messages are printed when the user attempts to use the old namings for the above mentioned alsa interface definitions.

This version of the patch finally removes obsolete file contexts and grants read permissions instead of manage permissions for static configuration files in /usr/share/alsa and system-wide configuration files in /etc.

Thanks to Dominick Grift for pointing out redundant interface usage in a previous version of this patch.

---
 policy/modules/contrib/alsa.fc       |    9 ++----
 policy/modules/contrib/alsa.if       |   52 ++++++++++++++++++++++++++++-------
 policy/modules/contrib/alsa.te       |   10 +++---
 policy/modules/contrib/asterisk.te   |    2 -
 policy/modules/contrib/entropyd.te   |    2 -
 policy/modules/contrib/hal.te        |    2 -
 policy/modules/contrib/mozilla.te    |    2 -
 policy/modules/contrib/mpd.te        |    2 -
 policy/modules/contrib/mplayer.te    |    2 -
 policy/modules/contrib/pulseaudio.te |    2 -
 policy/modules/system/init.te        |    2 -
 policy/modules/system/udev.te        |    2 -
 policy/modules/system/userdomain.if  |    4 +-
 13 files changed, 61 insertions(+), 32 deletions(-)
policy/modules/contrib/alsa.fc +3 -6
@@ -6,10 +6,8 @@ ifdef(`distro_debian',`
 
 /bin/alsaunmute	--	gen_context(system_u:object_r:alsa_exec_t,s0)
 
-/etc/alsa/asound\.state	--	gen_context(system_u:object_r:alsa_etc_rw_t,s0)
-/etc/alsa/pcm(/.*)?	gen_context(system_u:object_r:alsa_etc_rw_t,s0)
-/etc/asound(/.*)?	gen_context(system_u:object_r:alsa_etc_rw_t,s0)
-/etc/asound\.state	--	gen_context(system_u:object_r:alsa_etc_rw_t,s0)
+/etc/alsa(/.*)?		gen_context(system_u:object_r:alsa_etc_t,s0)
+/etc/asound\.conf	gen_context(system_u:object_r:alsa_etc_t,s0)
 
 /sbin/alsactl	--	gen_context(system_u:object_r:alsa_exec_t,s0)
 /sbin/salsa	--	gen_context(system_u:object_r:alsa_exec_t,s0)
@@ -25,8 +23,7 @@ ifdef(`distro_debian',`
 /usr/sbin/alsactl	--	gen_context(system_u:object_r:alsa_exec_t,s0)
 /usr/sbin/salsa	--	gen_context(system_u:object_r:alsa_exec_t,s0)
 
-/usr/share/alsa/alsa\.conf	gen_context(system_u:object_r:alsa_etc_rw_t,s0)
-/usr/share/alsa/pcm(/.*)?	gen_context(system_u:object_r:alsa_etc_rw_t,s0)
+/usr/share/alsa(/.*)?		gen_context(system_u:object_r:alsa_etc_t,s0)
 
 /var/lib/alsa(/.*)?	gen_context(system_u:object_r:alsa_var_lib_t,s0)
 
policy/modules/contrib/alsa.if +42 -10

84 lines not on this page · raw message

policy/modules/contrib/alsa.te +5 -5
@@ -12,8 +12,8 @@ type alsa_exec_t;
 init_system_domain(alsa_t, alsa_exec_t)
 role alsa_roles types alsa_t;
 
-type alsa_etc_rw_t;
-files_config_file(alsa_etc_rw_t)
+type alsa_etc_t;
+files_config_file(alsa_etc_t)
 
 type alsa_tmp_t;
 files_tmp_file(alsa_tmp_t)
@@ -46,9 +46,9 @@ allow alsa_t self:unix_stream_socket { a
 
 allow alsa_t alsa_home_t:file read_file_perms;
 
-manage_files_pattern(alsa_t, alsa_etc_rw_t, alsa_etc_rw_t)
-manage_lnk_files_pattern(alsa_t, alsa_etc_rw_t, alsa_etc_rw_t)
-files_etc_filetrans(alsa_t, alsa_etc_rw_t, file)
+list_dirs_pattern(alsa_t, alsa_etc_t, alsa_etc_t)
+read_files_pattern(alsa_t, alsa_etc_t, alsa_etc_t)
+read_lnk_files_pattern(alsa_t, alsa_etc_t, alsa_etc_t)
 
 can_exec(alsa_t, alsa_exec_t)
 
policy/modules/contrib/asterisk.te +1 -1
@@ -156,7 +156,7 @@ userdom_dontaudit_use_unpriv_user_fds(as
 userdom_dontaudit_search_user_home_dirs(asterisk_t)
 
 optional_policy(`
-	alsa_read_rw_config(asterisk_t)
+	alsa_read_config(asterisk_t)
 ')
 
 optional_policy(`
policy/modules/contrib/entropyd.te +1 -1
@@ -68,7 +68,7 @@ tunable_policy(`entropyd_use_audio',`
 optional_policy(`
 	tunable_policy(`entropyd_use_audio',`
 		alsa_read_lib(entropyd_t)
-		alsa_read_rw_config(entropyd_t)
+		alsa_read_config(entropyd_t)
 	')
 ')
 
policy/modules/contrib/hal.te +1 -1
@@ -213,7 +213,7 @@ userdom_dontaudit_search_user_home_dirs(
 
 optional_policy(`
 	alsa_domtrans(hald_t)
-	alsa_read_rw_config(hald_t)
+	alsa_read_config(hald_t)
 ')
 
 optional_policy(`
policy/modules/contrib/mozilla.te +1 -1
@@ -518,7 +518,7 @@ tunable_policy(`use_samba_home_dirs',`
 ')
 
 optional_policy(`
-	alsa_read_rw_config(mozilla_plugin_t)
+	alsa_read_config(mozilla_plugin_t)
 	alsa_read_home_files(mozilla_plugin_t)
 ')
 
policy/modules/contrib/mpd.te +1 -1
@@ -179,7 +179,7 @@ tunable_policy(`mpd_use_nfs',`
 ')
 
 optional_policy(`
-	alsa_read_rw_config(mpd_t)
+	alsa_read_config(mpd_t)
 ')
 
 optional_policy(`
policy/modules/contrib/mplayer.te +1 -1
@@ -251,7 +251,7 @@ tunable_policy(`allow_mplayer_execstack'
 ')
 
 optional_policy(`
-	alsa_read_rw_config(mplayer_t)
+	alsa_read_config(mplayer_t)
 ')
 
 optional_policy(`
policy/modules/contrib/pulseaudio.te +1 -1
@@ -161,7 +161,7 @@ tunable_policy(`use_samba_home_dirs',`
 ')
 
 optional_policy(`
-	alsa_rw_config(pulseaudio_t)
+	alsa_read_config(pulseaudio_t)
 	alsa_read_home_files(pulseaudio_t)
 ')
 
policy/modules/system/init.te +1 -1
@@ -694,7 +694,7 @@ ifdef(`distro_redhat',`
 	miscfiles_read_hwdata(initrc_t)
 
 	optional_policy(`
-		alsa_manage_rw_config(initrc_t)
+		alsa_manage_config(initrc_t)
 	')
 
 	optional_policy(`
policy/modules/system/udev.te +1 -1
@@ -234,7 +234,7 @@ ifdef(`init_systemd',`
 optional_policy(`
 	alsa_domtrans(udev_t)
 	alsa_read_lib(udev_t)
-	alsa_read_rw_config(udev_t)
+	alsa_read_config(udev_t)
 ')
 
 optional_policy(`
policy/modules/system/userdomain.if +2 -2
@@ -579,7 +579,7 @@ template(`userdom_common_user_template',
 	optional_policy(`
 		alsa_home_filetrans_alsa_home($1_t, file, ".asoundrc")
 		alsa_manage_home_files($1_t)
-		alsa_read_rw_config($1_t)
+		alsa_read_config($1_t)
 		alsa_relabel_home_files($1_t)
 	')
 
@@ -933,7 +933,7 @@ template(`userdom_restricted_xwindows_us
 	xserver_restricted_role($1_r, $1_t)
 
 	optional_policy(`
-		alsa_read_rw_config($1_t)
+		alsa_read_config($1_t)
 	')
 
 	optional_policy(`
#9 lore raw

PATCH v5 1/1 Update policy and file contexts for the alsa module

Quoted 138 lines · Guido Trentalancia

Update the alsa module so that the alsa_etc_t file context (previously alsa_etc_rw_t) is widened to the whole alsa share directory, instead of just a couple of files.

The wrong and misleading _rw_ label has been deprecated in the alsa interface definitions and in their instances throughout the whole Reference Policy (static and system-wide configuration files are not runtime-writable). Warning messages are printed when the user attempts to use the old namings for the above mentioned alsa interface definitions.

This version of the patch finally removes obsolete file contexts and grants read permissions instead of manage permissions for static configuration files in /usr/share/alsa and system-wide configuration files in /etc.

Thanks to Dominick Grift for pointing out redundant interface usage in a previous version of this patch.

---
 policy/modules/contrib/alsa.fc       |    9 ++----
 policy/modules/contrib/alsa.if       |   52 ++++++++++++++++++++++++++++-------
 policy/modules/contrib/alsa.te       |   10 +++---
 policy/modules/contrib/asterisk.te   |    2 -
 policy/modules/contrib/entropyd.te   |    2 -
 policy/modules/contrib/hal.te        |    2 -
 policy/modules/contrib/mozilla.te    |    2 -
 policy/modules/contrib/mpd.te        |    2 -
 policy/modules/contrib/mplayer.te    |    2 -
 policy/modules/contrib/pulseaudio.te |    2 -
 policy/modules/system/init.te        |    2 -
 policy/modules/system/udev.te        |    2 -
 policy/modules/system/userdomain.if  |    4 +-
 13 files changed, 61 insertions(+), 32 deletions(-)
policy/modules/contrib/alsa.fc +3 -6
@@ -6,10 +6,8 @@ ifdef(`distro_debian',`
 
 /bin/alsaunmute	--	gen_context(system_u:object_r:alsa_exec_t,s0)
 
-/etc/alsa/asound\.state	--	gen_context(system_u:object_r:alsa_etc_rw_t,s0)
-/etc/alsa/pcm(/.*)?	gen_context(system_u:object_r:alsa_etc_rw_t,s0)
-/etc/asound(/.*)?	gen_context(system_u:object_r:alsa_etc_rw_t,s0)
-/etc/asound\.state	--	gen_context(system_u:object_r:alsa_etc_rw_t,s0)
+/etc/alsa(/.*)?		gen_context(system_u:object_r:alsa_etc_t,s0)
+/etc/asound\.conf	gen_context(system_u:object_r:alsa_etc_t,s0)
 
 /sbin/alsactl	--	gen_context(system_u:object_r:alsa_exec_t,s0)
 /sbin/salsa	--	gen_context(system_u:object_r:alsa_exec_t,s0)
@@ -25,8 +23,7 @@ ifdef(`distro_debian',`
 /usr/sbin/alsactl	--	gen_context(system_u:object_r:alsa_exec_t,s0)
 /usr/sbin/salsa	--	gen_context(system_u:object_r:alsa_exec_t,s0)
 
-/usr/share/alsa/alsa\.conf	gen_context(system_u:object_r:alsa_etc_rw_t,s0)
-/usr/share/alsa/pcm(/.*)?	gen_context(system_u:object_r:alsa_etc_rw_t,s0)
+/usr/share/alsa(/.*)?		gen_context(system_u:object_r:alsa_etc_t,s0)
 
 /var/lib/alsa(/.*)?	gen_context(system_u:object_r:alsa_var_lib_t,s0)
 
policy/modules/contrib/alsa.if +38 -7
@@ -102,7 +102,8 @@ interface(`alsa_rw_shared_mem',`
 
 ########################################
 ## <summary>
-##	Read writable Alsa configuration content.
+##	Read writable Alsa configuration
+##	content.  (Deprecated)
 ## </summary>
 ## <param name="domain">
 ##	<summary>
@@ -111,14 +112,29 @@ interface(`alsa_rw_shared_mem',`
 ## </param>
 #
 interface(`alsa_read_rw_config',`
+	refpolicywarn(`$0($*) has been deprecated, use alsa_read_config() instead.')
+	alsa_read_config($1)
+')
+
+########################################
+## <summary>
+##	Read Alsa configuration content.
+## </summary>
+## <param name="domain">
+##	<summary>
+##	Domain allowed access.
+##	</summary>
+## </param>
+#
+interface(`alsa_read_config',`
 	gen_require(`
-		type alsa_etc_rw_t;
+		type alsa_etc_t;
 	')
 
 	files_search_etc($1)
-	allow $1 alsa_etc_rw_t:dir list_dir_perms;
-	read_files_pattern($1, alsa_etc_rw_t, alsa_etc_rw_t)
-	read_lnk_files_pattern($1, alsa_etc_rw_t, alsa_etc_rw_t)
+	allow $1 alsa_etc_t:dir list_dir_perms;
+	read_files_pattern($1, alsa_etc_t, alsa_etc_t)
+	read_lnk_files_pattern($1, alsa_etc_t, alsa_etc_t)
 
 	ifdef(`distro_debian',`
 		files_search_usr($1)
@@ -127,7 +143,8 @@ interface(`alsa_read_rw_config',`
 
 ########################################
 ## <summary>
-##	Manage writable Alsa config files.
+##	Manage writable Alsa config
+##	files.  (Deprecated)
 ## </summary>
 ## <param name="domain">
 ##	<summary>
@@ -136,14 +153,29 @@ interface(`alsa_read_rw_config',`
 ## </param>
 #
 interface(`alsa_manage_rw_config',`
+	refpolicywarn(`$0($*) has been deprecated, use alsa_manage_config() instead.')
+	alsa_manage_config($1)
+')
+
+########################################
+## <summary>
+##	Manage Alsa config files.
+## </summary>
+## <param name="domain">
+##	<summary>
+##	Domain allowed access.
+##	</summary>
+## </param>
+#
+interface(`alsa_manage_config',`
 	gen_require(`
-		type alsa_etc_rw_t;

policy/modules/contrib/alsa.if interface(`alsa_read_rw_config',` · line 178

Quoted 10 lines
policy/modules/contrib/alsa.if +4 -3
+		type alsa_etc_t;
 	')
 
 	files_search_etc($1)
-	allow $1 alsa_etc_rw_t:dir list_dir_perms;
-	manage_files_pattern($1, alsa_etc_rw_t, alsa_etc_rw_t)
-	read_lnk_files_pattern($1, alsa_etc_rw_t, alsa_etc_rw_t)
+	allow $1 alsa_etc_t:dir list_dir_perms;
+	manage_files_pattern($1, alsa_etc_t, alsa_etc_t)
+	read_lnk_files_pattern($1, alsa_etc_t, alsa_etc_t)

The interface name suggests that it applies to all alsa_etc_t content. The description suggests that it only applies to files, the reality is somewhere in between...

how about: "Manage Alsa config"

allow $1 alsa_etc_t:dir manage_dir_perms; allow $1 alsa_etc_t:file manage_file_perms; allow $1 alsa_etc_t:lnk_file manage_link_file_perms;

Quoted 153 lines
policy/modules/contrib/alsa.if +0 -0
 	ifdef(`distro_debian',`
 		files_search_usr($1)
policy/modules/contrib/alsa.te +5 -5
@@ -12,8 +12,8 @@ type alsa_exec_t;
 init_system_domain(alsa_t, alsa_exec_t)
 role alsa_roles types alsa_t;
 
-type alsa_etc_rw_t;
-files_config_file(alsa_etc_rw_t)
+type alsa_etc_t;
+files_config_file(alsa_etc_t)
 
 type alsa_tmp_t;
 files_tmp_file(alsa_tmp_t)
@@ -46,9 +46,9 @@ allow alsa_t self:unix_stream_socket { a
 
 allow alsa_t alsa_home_t:file read_file_perms;
 
-manage_files_pattern(alsa_t, alsa_etc_rw_t, alsa_etc_rw_t)
-manage_lnk_files_pattern(alsa_t, alsa_etc_rw_t, alsa_etc_rw_t)
-files_etc_filetrans(alsa_t, alsa_etc_rw_t, file)
+list_dirs_pattern(alsa_t, alsa_etc_t, alsa_etc_t)
+read_files_pattern(alsa_t, alsa_etc_t, alsa_etc_t)
+read_lnk_files_pattern(alsa_t, alsa_etc_t, alsa_etc_t)
 
 can_exec(alsa_t, alsa_exec_t)
 
policy/modules/contrib/asterisk.te +1 -1
@@ -156,7 +156,7 @@ userdom_dontaudit_use_unpriv_user_fds(as
 userdom_dontaudit_search_user_home_dirs(asterisk_t)
 
 optional_policy(`
-	alsa_read_rw_config(asterisk_t)
+	alsa_read_config(asterisk_t)
 ')
 
 optional_policy(`
policy/modules/contrib/entropyd.te +1 -1
@@ -68,7 +68,7 @@ tunable_policy(`entropyd_use_audio',`
 optional_policy(`
 	tunable_policy(`entropyd_use_audio',`
 		alsa_read_lib(entropyd_t)
-		alsa_read_rw_config(entropyd_t)
+		alsa_read_config(entropyd_t)
 	')
 ')
 
policy/modules/contrib/hal.te +1 -1
@@ -213,7 +213,7 @@ userdom_dontaudit_search_user_home_dirs(
 
 optional_policy(`
 	alsa_domtrans(hald_t)
-	alsa_read_rw_config(hald_t)
+	alsa_read_config(hald_t)
 ')
 
 optional_policy(`
policy/modules/contrib/mozilla.te +1 -1
@@ -518,7 +518,7 @@ tunable_policy(`use_samba_home_dirs',`
 ')
 
 optional_policy(`
-	alsa_read_rw_config(mozilla_plugin_t)
+	alsa_read_config(mozilla_plugin_t)
 	alsa_read_home_files(mozilla_plugin_t)
 ')
 
policy/modules/contrib/mpd.te +1 -1
@@ -179,7 +179,7 @@ tunable_policy(`mpd_use_nfs',`
 ')
 
 optional_policy(`
-	alsa_read_rw_config(mpd_t)
+	alsa_read_config(mpd_t)
 ')
 
 optional_policy(`
policy/modules/contrib/mplayer.te +1 -1
@@ -251,7 +251,7 @@ tunable_policy(`allow_mplayer_execstack'
 ')
 
 optional_policy(`
-	alsa_read_rw_config(mplayer_t)
+	alsa_read_config(mplayer_t)
 ')
 
 optional_policy(`
policy/modules/contrib/pulseaudio.te +1 -1
@@ -161,7 +161,7 @@ tunable_policy(`use_samba_home_dirs',`
 ')
 
 optional_policy(`
-	alsa_rw_config(pulseaudio_t)
+	alsa_read_config(pulseaudio_t)
 	alsa_read_home_files(pulseaudio_t)
 ')
 
policy/modules/system/init.te +1 -1
@@ -694,7 +694,7 @@ ifdef(`distro_redhat',`
 	miscfiles_read_hwdata(initrc_t)
 
 	optional_policy(`
-		alsa_manage_rw_config(initrc_t)
+		alsa_manage_config(initrc_t)
 	')
 
 	optional_policy(`
policy/modules/system/udev.te +1 -1
@@ -234,7 +234,7 @@ ifdef(`init_systemd',`
 optional_policy(`
 	alsa_domtrans(udev_t)
 	alsa_read_lib(udev_t)
-	alsa_read_rw_config(udev_t)
+	alsa_read_config(udev_t)
 ')
 
 optional_policy(`
policy/modules/system/userdomain.if +2 -2
@@ -579,7 +579,7 @@ template(`userdom_common_user_template',
 	optional_policy(`
 		alsa_home_filetrans_alsa_home($1_t, file, ".asoundrc")
 		alsa_manage_home_files($1_t)
-		alsa_read_rw_config($1_t)
+		alsa_read_config($1_t)
 		alsa_relabel_home_files($1_t)
 	')
 
@@ -933,7 +933,7 @@ template(`userdom_restricted_xwindows_us
 	xserver_restricted_role($1_r, $1_t)
 
 	optional_policy(`
-		alsa_read_rw_config($1_t)
+		alsa_read_config($1_t)
 	')
 
 	optional_policy(`

_______________________________________________
refpolicy mailing list
refpolicy at oss.tresys.com
http://oss.tresys.com/mailman/listinfo/refpolicy

Signature · 11 lines
Key fingerprint = 5F4D 3CDB D3F8 3652 FBD8  02D5 3B6C 5F1D 2C7B 6B02
https://sks-keyservers.net/pks/lookup?op=get&search=0x3B6C5F1D2C7B6B02
Dominick Grift

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 648 bytes
Desc: OpenPGP digital signature
Url : http://oss.tresys.com/pipermail/refpolicy/attachments/20160813/ac486bcc/attachment-0001.bin 
#10 lore raw

PATCH v6 1/1 Update policy and file contexts for the alsa module

In reply to Guido Trentalancia

Update the alsa module so that the alsa_etc_t file context (previously alsa_etc_rw_t) is widened to the whole alsa share directory, instead of just a couple of files.

The wrong and misleading _rw_ label has been deprecated in the alsa interface definitions and in their instances throughout the whole Reference Policy (static and system-wide configuration files are not runtime-writable). Warning messages are printed when the user attempts to use the old namings for the above mentioned alsa interface definitions.

This version of the patch finally removes obsolete file contexts and grants read permissions instead of manage permissions for static configuration files in /usr/share/alsa and system-wide configuration files in /etc.

Thanks to Dominick Grift for pointing out redundant interface usage in a previous version of this patch.

---
 policy/modules/contrib/alsa.fc       |    9 ++----
 policy/modules/contrib/alsa.if       |   52 ++++++++++++++++++++++++++++-------
 policy/modules/contrib/alsa.te       |   10 +++---
 policy/modules/contrib/asterisk.te   |    2 -
 policy/modules/contrib/entropyd.te   |    2 -
 policy/modules/contrib/hal.te        |    2 -
 policy/modules/contrib/mozilla.te    |    2 -
 policy/modules/contrib/mpd.te        |    2 -
 policy/modules/contrib/mplayer.te    |    2 -
 policy/modules/contrib/pulseaudio.te |    2 -
 policy/modules/system/init.te        |    2 -
 policy/modules/system/udev.te        |    2 -
 policy/modules/system/userdomain.if  |    4 +-
 13 files changed, 61 insertions(+), 32 deletions(-)
policy/modules/contrib/alsa.fc +3 -6
@@ -6,10 +6,8 @@ ifdef(`distro_debian',`
 
 /bin/alsaunmute	--	gen_context(system_u:object_r:alsa_exec_t,s0)
 
-/etc/alsa/asound\.state	--	gen_context(system_u:object_r:alsa_etc_rw_t,s0)
-/etc/alsa/pcm(/.*)?	gen_context(system_u:object_r:alsa_etc_rw_t,s0)
-/etc/asound(/.*)?	gen_context(system_u:object_r:alsa_etc_rw_t,s0)
-/etc/asound\.state	--	gen_context(system_u:object_r:alsa_etc_rw_t,s0)
+/etc/alsa(/.*)?		gen_context(system_u:object_r:alsa_etc_t,s0)
+/etc/asound\.conf	gen_context(system_u:object_r:alsa_etc_t,s0)
 
 /sbin/alsactl	--	gen_context(system_u:object_r:alsa_exec_t,s0)
 /sbin/salsa	--	gen_context(system_u:object_r:alsa_exec_t,s0)
@@ -25,8 +23,7 @@ ifdef(`distro_debian',`
 /usr/sbin/alsactl	--	gen_context(system_u:object_r:alsa_exec_t,s0)
 /usr/sbin/salsa	--	gen_context(system_u:object_r:alsa_exec_t,s0)
 
-/usr/share/alsa/alsa\.conf	gen_context(system_u:object_r:alsa_etc_rw_t,s0)
-/usr/share/alsa/pcm(/.*)?	gen_context(system_u:object_r:alsa_etc_rw_t,s0)
+/usr/share/alsa(/.*)?		gen_context(system_u:object_r:alsa_etc_t,s0)
 
 /var/lib/alsa(/.*)?	gen_context(system_u:object_r:alsa_var_lib_t,s0)
 
policy/modules/contrib/alsa.if +42 -10

84 lines not on this page · raw message

policy/modules/contrib/alsa.te +5 -5
@@ -12,8 +12,8 @@ type alsa_exec_t;
 init_system_domain(alsa_t, alsa_exec_t)
 role alsa_roles types alsa_t;
 
-type alsa_etc_rw_t;
-files_config_file(alsa_etc_rw_t)
+type alsa_etc_t;
+files_config_file(alsa_etc_t)
 
 type alsa_tmp_t;
 files_tmp_file(alsa_tmp_t)
@@ -46,9 +46,9 @@ allow alsa_t self:unix_stream_socket { a
 
 allow alsa_t alsa_home_t:file read_file_perms;
 
-manage_files_pattern(alsa_t, alsa_etc_rw_t, alsa_etc_rw_t)
-manage_lnk_files_pattern(alsa_t, alsa_etc_rw_t, alsa_etc_rw_t)
-files_etc_filetrans(alsa_t, alsa_etc_rw_t, file)
+list_dirs_pattern(alsa_t, alsa_etc_t, alsa_etc_t)
+read_files_pattern(alsa_t, alsa_etc_t, alsa_etc_t)
+read_lnk_files_pattern(alsa_t, alsa_etc_t, alsa_etc_t)
 
 can_exec(alsa_t, alsa_exec_t)
 
policy/modules/contrib/asterisk.te +1 -1
@@ -156,7 +156,7 @@ userdom_dontaudit_use_unpriv_user_fds(as
 userdom_dontaudit_search_user_home_dirs(asterisk_t)
 
 optional_policy(`
-	alsa_read_rw_config(asterisk_t)
+	alsa_read_config(asterisk_t)
 ')
 
 optional_policy(`
policy/modules/contrib/entropyd.te +1 -1
@@ -68,7 +68,7 @@ tunable_policy(`entropyd_use_audio',`
 optional_policy(`
 	tunable_policy(`entropyd_use_audio',`
 		alsa_read_lib(entropyd_t)
-		alsa_read_rw_config(entropyd_t)
+		alsa_read_config(entropyd_t)
 	')
 ')
 
policy/modules/contrib/hal.te +1 -1
@@ -213,7 +213,7 @@ userdom_dontaudit_search_user_home_dirs(
 
 optional_policy(`
 	alsa_domtrans(hald_t)
-	alsa_read_rw_config(hald_t)
+	alsa_read_config(hald_t)
 ')
 
 optional_policy(`
policy/modules/contrib/mozilla.te +1 -1
@@ -518,7 +518,7 @@ tunable_policy(`use_samba_home_dirs',`
 ')
 
 optional_policy(`
-	alsa_read_rw_config(mozilla_plugin_t)
+	alsa_read_config(mozilla_plugin_t)
 	alsa_read_home_files(mozilla_plugin_t)
 ')
 
policy/modules/contrib/mpd.te +1 -1
@@ -179,7 +179,7 @@ tunable_policy(`mpd_use_nfs',`
 ')
 
 optional_policy(`
-	alsa_read_rw_config(mpd_t)
+	alsa_read_config(mpd_t)
 ')
 
 optional_policy(`
policy/modules/contrib/mplayer.te +1 -1
@@ -251,7 +251,7 @@ tunable_policy(`allow_mplayer_execstack'
 ')
 
 optional_policy(`
-	alsa_read_rw_config(mplayer_t)
+	alsa_read_config(mplayer_t)
 ')
 
 optional_policy(`
policy/modules/contrib/pulseaudio.te +1 -1
@@ -146,7 +161,7 @@ tunable_policy(`use_samba_home_dirs',`
 ')
 
 optional_policy(`
-       alsa_read_rw_config(pulseaudio_t)
+       alsa_read_config(pulseaudio_t)
 ')
 
 optional_policy(`
policy/modules/system/init.te +1 -1
@@ -694,7 +694,7 @@ ifdef(`distro_redhat',`
 	miscfiles_read_hwdata(initrc_t)
 
 	optional_policy(`
-		alsa_manage_rw_config(initrc_t)
+		alsa_manage_config(initrc_t)
 	')
 
 	optional_policy(`
policy/modules/system/udev.te +1 -1
@@ -234,7 +234,7 @@ ifdef(`init_systemd',`
 optional_policy(`
 	alsa_domtrans(udev_t)
 	alsa_read_lib(udev_t)
-	alsa_read_rw_config(udev_t)
+	alsa_read_config(udev_t)
 ')
 
 optional_policy(`
policy/modules/system/userdomain.if +2 -2
@@ -579,7 +579,7 @@ template(`userdom_common_user_template',
 	optional_policy(`
 		alsa_home_filetrans_alsa_home($1_t, file, ".asoundrc")
 		alsa_manage_home_files($1_t)
-		alsa_read_rw_config($1_t)
+		alsa_read_config($1_t)
 		alsa_relabel_home_files($1_t)
 	')
 
@@ -933,7 +933,7 @@ template(`userdom_restricted_xwindows_us
 	xserver_restricted_role($1_r, $1_t)
 
 	optional_policy(`
-		alsa_read_rw_config($1_t)
+		alsa_read_config($1_t)
 	')
 
 	optional_policy(`
#11 lore raw

PATCH v7 1/1 Update policy and file contexts for the alsa module

Update the alsa module so that the alsa_etc_t file context (previously alsa_etc_rw_t) is widened to the whole alsa share directory, instead of just a couple of files.

The wrong and misleading _rw_ label has been deprecated in the alsa interface definitions and in their instances throughout the whole Reference Policy (static and system-wide configuration files are not runtime-writable). Warning messages are printed when the user attempts to use the old namings for the above mentioned alsa interface definitions.

After applying this patch, the recent pulseaudio patch should also be applied to complete the removal of the _rw_ labels on the alsa interfaces.

This version of the patch finally removes obsolete file contexts and grants read permissions instead of manage permissions for static configuration files in /usr/share/alsa and system-wide configuration files in /etc.

Thanks to Dominick Grift for pointing out redundant interface usage in a previous version of this patch.

---
 policy/modules/contrib/alsa.fc       |    9 ++----
 policy/modules/contrib/alsa.if       |   52 ++++++++++++++++++++++++++++-------
 policy/modules/contrib/alsa.te       |   10 +++---
 policy/modules/contrib/asterisk.te   |    2 -
 policy/modules/contrib/entropyd.te   |    2 -
 policy/modules/contrib/hal.te        |    2 -
 policy/modules/contrib/mozilla.te    |    2 -
 policy/modules/contrib/mpd.te        |    2 -
 policy/modules/contrib/mplayer.te    |    2 -
 policy/modules/system/init.te        |    2 -
 policy/modules/system/udev.te        |    2 -
 policy/modules/system/userdomain.if  |    4 +-
 13 files changed, 61 insertions(+), 32 deletions(-)
policy/modules/contrib/alsa.fc +3 -6
@@ -6,10 +6,8 @@ ifdef(`distro_debian',`
 
 /bin/alsaunmute	--	gen_context(system_u:object_r:alsa_exec_t,s0)
 
-/etc/alsa/asound\.state	--	gen_context(system_u:object_r:alsa_etc_rw_t,s0)
-/etc/alsa/pcm(/.*)?	gen_context(system_u:object_r:alsa_etc_rw_t,s0)
-/etc/asound(/.*)?	gen_context(system_u:object_r:alsa_etc_rw_t,s0)
-/etc/asound\.state	--	gen_context(system_u:object_r:alsa_etc_rw_t,s0)
+/etc/alsa(/.*)?		gen_context(system_u:object_r:alsa_etc_t,s0)
+/etc/asound\.conf	gen_context(system_u:object_r:alsa_etc_t,s0)
 
 /sbin/alsactl	--	gen_context(system_u:object_r:alsa_exec_t,s0)
 /sbin/salsa	--	gen_context(system_u:object_r:alsa_exec_t,s0)
@@ -25,8 +23,7 @@ ifdef(`distro_debian',`
 /usr/sbin/alsactl	--	gen_context(system_u:object_r:alsa_exec_t,s0)
 /usr/sbin/salsa	--	gen_context(system_u:object_r:alsa_exec_t,s0)
 
-/usr/share/alsa/alsa\.conf	gen_context(system_u:object_r:alsa_etc_rw_t,s0)
-/usr/share/alsa/pcm(/.*)?	gen_context(system_u:object_r:alsa_etc_rw_t,s0)
+/usr/share/alsa(/.*)?		gen_context(system_u:object_r:alsa_etc_t,s0)
 
 /var/lib/alsa(/.*)?	gen_context(system_u:object_r:alsa_var_lib_t,s0)
 
policy/modules/contrib/alsa.if +42 -10

84 lines not on this page · raw message

policy/modules/contrib/alsa.te +5 -5
@@ -12,8 +12,8 @@ type alsa_exec_t;
 init_system_domain(alsa_t, alsa_exec_t)
 role alsa_roles types alsa_t;
 
-type alsa_etc_rw_t;
-files_config_file(alsa_etc_rw_t)
+type alsa_etc_t;
+files_config_file(alsa_etc_t)
 
 type alsa_tmp_t;
 files_tmp_file(alsa_tmp_t)
@@ -46,9 +46,9 @@ allow alsa_t self:unix_stream_socket { a
 
 allow alsa_t alsa_home_t:file read_file_perms;
 
-manage_files_pattern(alsa_t, alsa_etc_rw_t, alsa_etc_rw_t)
-manage_lnk_files_pattern(alsa_t, alsa_etc_rw_t, alsa_etc_rw_t)
-files_etc_filetrans(alsa_t, alsa_etc_rw_t, file)
+list_dirs_pattern(alsa_t, alsa_etc_t, alsa_etc_t)
+read_files_pattern(alsa_t, alsa_etc_t, alsa_etc_t)
+read_lnk_files_pattern(alsa_t, alsa_etc_t, alsa_etc_t)
 
 can_exec(alsa_t, alsa_exec_t)
 
policy/modules/contrib/asterisk.te +1 -1
@@ -156,7 +156,7 @@ userdom_dontaudit_use_unpriv_user_fds(as
 userdom_dontaudit_search_user_home_dirs(asterisk_t)
 
 optional_policy(`
-	alsa_read_rw_config(asterisk_t)
+	alsa_read_config(asterisk_t)
 ')
 
 optional_policy(`
policy/modules/contrib/entropyd.te +1 -1
@@ -68,7 +68,7 @@ tunable_policy(`entropyd_use_audio',`
 optional_policy(`
 	tunable_policy(`entropyd_use_audio',`
 		alsa_read_lib(entropyd_t)
-		alsa_read_rw_config(entropyd_t)
+		alsa_read_config(entropyd_t)
 	')
 ')
 
policy/modules/contrib/hal.te +1 -1
@@ -213,7 +213,7 @@ userdom_dontaudit_search_user_home_dirs(
 
 optional_policy(`
 	alsa_domtrans(hald_t)
-	alsa_read_rw_config(hald_t)
+	alsa_read_config(hald_t)
 ')
 
 optional_policy(`
policy/modules/contrib/mozilla.te +1 -1
@@ -518,7 +518,7 @@ tunable_policy(`use_samba_home_dirs',`
 ')
 
 optional_policy(`
-	alsa_read_rw_config(mozilla_plugin_t)
+	alsa_read_config(mozilla_plugin_t)
 	alsa_read_home_files(mozilla_plugin_t)
 ')
 
policy/modules/contrib/mpd.te +1 -1
@@ -179,7 +179,7 @@ tunable_policy(`mpd_use_nfs',`
 ')
 
 optional_policy(`
-	alsa_read_rw_config(mpd_t)
+	alsa_read_config(mpd_t)
 ')
 
 optional_policy(`
policy/modules/contrib/mplayer.te +1 -1
@@ -251,7 +251,7 @@ tunable_policy(`allow_mplayer_execstack'
 ')
 
 optional_policy(`
-	alsa_read_rw_config(mplayer_t)
+	alsa_read_config(mplayer_t)
 ')
 
 optional_policy(`
policy/modules/system/init.te +1 -1
@@ -694,7 +694,7 @@ ifdef(`distro_redhat',`
 	miscfiles_read_hwdata(initrc_t)
 
 	optional_policy(`
-		alsa_manage_rw_config(initrc_t)
+		alsa_manage_config(initrc_t)
 	')
 
 	optional_policy(`
policy/modules/system/udev.te +1 -1
@@ -234,7 +234,7 @@ ifdef(`init_systemd',`
 optional_policy(`
 	alsa_domtrans(udev_t)
 	alsa_read_lib(udev_t)
-	alsa_read_rw_config(udev_t)
+	alsa_read_config(udev_t)
 ')
 
 optional_policy(`
policy/modules/system/userdomain.if +2 -2
@@ -579,7 +579,7 @@ template(`userdom_common_user_template',
 	optional_policy(`
 		alsa_home_filetrans_alsa_home($1_t, file, ".asoundrc")
 		alsa_manage_home_files($1_t)
-		alsa_read_rw_config($1_t)
+		alsa_read_config($1_t)
 		alsa_relabel_home_files($1_t)
 	')
 
@@ -933,7 +933,7 @@ template(`userdom_restricted_xwindows_us
 	xserver_restricted_role($1_r, $1_t)
 
 	optional_policy(`
-		alsa_read_rw_config($1_t)
+		alsa_read_config($1_t)
 	')
 
 	optional_policy(`
#12 lore raw

PATCH v7 1/1 Update policy and file contexts for the alsa module

Quoted 15 lines · Guido Trentalancia

Update the alsa module so that the alsa_etc_t file context (previously alsa_etc_rw_t) is widened to the whole alsa share directory, instead of just a couple of files.

The wrong and misleading _rw_ label has been deprecated in the alsa interface definitions and in their instances throughout the whole Reference Policy (static and system-wide configuration files are not runtime-writable). Warning messages are printed when the user attempts to use the old namings for the above mentioned alsa interface definitions.

After applying this patch, the recent pulseaudio patch should also be applied to complete the removal of the _rw_ labels on the alsa interfaces.

Quoted 7 lines

This version of the patch finally removes obsolete file contexts and grants read permissions instead of manage permissions for static configuration files in /usr/share/alsa and system-wide configuration files in /etc.

Thanks to Dominick Grift for pointing out redundant interface usage in a previous version of this patch.

Merged. I also added a compatibility alias to alsa_etc_rw_t.

Quoted 265 lines
---
 policy/modules/contrib/alsa.fc       |    9 ++----
 policy/modules/contrib/alsa.if       |   52 ++++++++++++++++++++++++++++-------
 policy/modules/contrib/alsa.te       |   10 +++---
 policy/modules/contrib/asterisk.te   |    2 -
 policy/modules/contrib/entropyd.te   |    2 -
 policy/modules/contrib/hal.te        |    2 -
 policy/modules/contrib/mozilla.te    |    2 -
 policy/modules/contrib/mpd.te        |    2 -
 policy/modules/contrib/mplayer.te    |    2 -
 policy/modules/system/init.te        |    2 -
 policy/modules/system/udev.te        |    2 -
 policy/modules/system/userdomain.if  |    4 +-
 13 files changed, 61 insertions(+), 32 deletions(-)
policy/modules/contrib/alsa.fc +3 -6
@@ -6,10 +6,8 @@ ifdef(`distro_debian',`
 
 /bin/alsaunmute	--	gen_context(system_u:object_r:alsa_exec_t,s0)
 
-/etc/alsa/asound\.state	--	gen_context(system_u:object_r:alsa_etc_rw_t,s0)
-/etc/alsa/pcm(/.*)?	gen_context(system_u:object_r:alsa_etc_rw_t,s0)
-/etc/asound(/.*)?	gen_context(system_u:object_r:alsa_etc_rw_t,s0)
-/etc/asound\.state	--	gen_context(system_u:object_r:alsa_etc_rw_t,s0)
+/etc/alsa(/.*)?		gen_context(system_u:object_r:alsa_etc_t,s0)
+/etc/asound\.conf	gen_context(system_u:object_r:alsa_etc_t,s0)
 
 /sbin/alsactl	--	gen_context(system_u:object_r:alsa_exec_t,s0)
 /sbin/salsa	--	gen_context(system_u:object_r:alsa_exec_t,s0)
@@ -25,8 +23,7 @@ ifdef(`distro_debian',`
 /usr/sbin/alsactl	--	gen_context(system_u:object_r:alsa_exec_t,s0)
 /usr/sbin/salsa	--	gen_context(system_u:object_r:alsa_exec_t,s0)
 
-/usr/share/alsa/alsa\.conf	gen_context(system_u:object_r:alsa_etc_rw_t,s0)
-/usr/share/alsa/pcm(/.*)?	gen_context(system_u:object_r:alsa_etc_rw_t,s0)
+/usr/share/alsa(/.*)?		gen_context(system_u:object_r:alsa_etc_t,s0)
 
 /var/lib/alsa(/.*)?	gen_context(system_u:object_r:alsa_var_lib_t,s0)
 
policy/modules/contrib/alsa.if +42 -10
@@ -102,7 +102,8 @@ interface(`alsa_rw_shared_mem',`
 
 ########################################
 ## <summary>
-##	Read writable Alsa configuration content.
+##	Read writable Alsa configuration
+##	content.  (Deprecated)
 ## </summary>
 ## <param name="domain">
 ##	<summary>
@@ -111,14 +112,29 @@ interface(`alsa_rw_shared_mem',`
 ## </param>
 #
 interface(`alsa_read_rw_config',`
+	refpolicywarn(`$0($*) has been deprecated, use alsa_read_config() instead.')
+	alsa_read_config($1)
+')
+
+########################################
+## <summary>
+##	Read Alsa configuration content.
+## </summary>
+## <param name="domain">
+##	<summary>
+##	Domain allowed access.
+##	</summary>
+## </param>
+#
+interface(`alsa_read_config',`
 	gen_require(`
-		type alsa_etc_rw_t;
+		type alsa_etc_t;
 	')
 
 	files_search_etc($1)
-	allow $1 alsa_etc_rw_t:dir list_dir_perms;
-	read_files_pattern($1, alsa_etc_rw_t, alsa_etc_rw_t)
-	read_lnk_files_pattern($1, alsa_etc_rw_t, alsa_etc_rw_t)
+	allow $1 alsa_etc_t:dir list_dir_perms;
+	read_files_pattern($1, alsa_etc_t, alsa_etc_t)
+	read_lnk_files_pattern($1, alsa_etc_t, alsa_etc_t)
 
 	ifdef(`distro_debian',`
 		files_search_usr($1)
@@ -127,7 +143,8 @@ interface(`alsa_read_rw_config',`
 
 ########################################
 ## <summary>
-##	Manage writable Alsa config files.
+##	Manage writable Alsa config
+##	files.  (Deprecated)
 ## </summary>
 ## <param name="domain">
 ##	<summary>
@@ -136,14 +153,29 @@ interface(`alsa_read_rw_config',`
 ## </param>
 #
 interface(`alsa_manage_rw_config',`
+	refpolicywarn(`$0($*) has been deprecated, use alsa_manage_config() instead.')
+	alsa_manage_config($1)
+')
+
+########################################
+## <summary>
+##	Manage Alsa config files.
+## </summary>
+## <param name="domain">
+##	<summary>
+##	Domain allowed access.
+##	</summary>
+## </param>
+#
+interface(`alsa_manage_config',`
 	gen_require(`
-		type alsa_etc_rw_t;
+		type alsa_etc_t;
 	')
 
 	files_search_etc($1)
-	allow $1 alsa_etc_rw_t:dir list_dir_perms;
-	manage_files_pattern($1, alsa_etc_rw_t, alsa_etc_rw_t)
-	read_lnk_files_pattern($1, alsa_etc_rw_t, alsa_etc_rw_t)
+	allow $1 alsa_etc_t:dir list_dir_perms;
+	manage_files_pattern($1, alsa_etc_t, alsa_etc_t)
+	read_lnk_files_pattern($1, alsa_etc_t, alsa_etc_t)
 
 	ifdef(`distro_debian',`
 		files_search_usr($1)
policy/modules/contrib/alsa.te +5 -5
@@ -12,8 +12,8 @@ type alsa_exec_t;
 init_system_domain(alsa_t, alsa_exec_t)
 role alsa_roles types alsa_t;
 
-type alsa_etc_rw_t;
-files_config_file(alsa_etc_rw_t)
+type alsa_etc_t;
+files_config_file(alsa_etc_t)
 
 type alsa_tmp_t;
 files_tmp_file(alsa_tmp_t)
@@ -46,9 +46,9 @@ allow alsa_t self:unix_stream_socket { a
 
 allow alsa_t alsa_home_t:file read_file_perms;
 
-manage_files_pattern(alsa_t, alsa_etc_rw_t, alsa_etc_rw_t)
-manage_lnk_files_pattern(alsa_t, alsa_etc_rw_t, alsa_etc_rw_t)
-files_etc_filetrans(alsa_t, alsa_etc_rw_t, file)
+list_dirs_pattern(alsa_t, alsa_etc_t, alsa_etc_t)
+read_files_pattern(alsa_t, alsa_etc_t, alsa_etc_t)
+read_lnk_files_pattern(alsa_t, alsa_etc_t, alsa_etc_t)
 
 can_exec(alsa_t, alsa_exec_t)
 
policy/modules/contrib/asterisk.te +1 -1
@@ -156,7 +156,7 @@ userdom_dontaudit_use_unpriv_user_fds(as
 userdom_dontaudit_search_user_home_dirs(asterisk_t)
 
 optional_policy(`
-	alsa_read_rw_config(asterisk_t)
+	alsa_read_config(asterisk_t)
 ')
 
 optional_policy(`
policy/modules/contrib/entropyd.te +1 -1
@@ -68,7 +68,7 @@ tunable_policy(`entropyd_use_audio',`
 optional_policy(`
 	tunable_policy(`entropyd_use_audio',`
 		alsa_read_lib(entropyd_t)
-		alsa_read_rw_config(entropyd_t)
+		alsa_read_config(entropyd_t)
 	')
 ')
 
policy/modules/contrib/hal.te +1 -1
@@ -213,7 +213,7 @@ userdom_dontaudit_search_user_home_dirs(
 
 optional_policy(`
 	alsa_domtrans(hald_t)
-	alsa_read_rw_config(hald_t)
+	alsa_read_config(hald_t)
 ')
 
 optional_policy(`
policy/modules/contrib/mozilla.te +1 -1
@@ -518,7 +518,7 @@ tunable_policy(`use_samba_home_dirs',`
 ')
 
 optional_policy(`
-	alsa_read_rw_config(mozilla_plugin_t)
+	alsa_read_config(mozilla_plugin_t)
 	alsa_read_home_files(mozilla_plugin_t)
 ')
 
policy/modules/contrib/mpd.te +1 -1
@@ -179,7 +179,7 @@ tunable_policy(`mpd_use_nfs',`
 ')
 
 optional_policy(`
-	alsa_read_rw_config(mpd_t)
+	alsa_read_config(mpd_t)
 ')
 
 optional_policy(`
policy/modules/contrib/mplayer.te +1 -1
@@ -251,7 +251,7 @@ tunable_policy(`allow_mplayer_execstack'
 ')
 
 optional_policy(`
-	alsa_read_rw_config(mplayer_t)
+	alsa_read_config(mplayer_t)
 ')
 
 optional_policy(`
policy/modules/system/init.te +1 -1
@@ -694,7 +694,7 @@ ifdef(`distro_redhat',`
 	miscfiles_read_hwdata(initrc_t)
 
 	optional_policy(`
-		alsa_manage_rw_config(initrc_t)
+		alsa_manage_config(initrc_t)
 	')
 
 	optional_policy(`
policy/modules/system/udev.te +1 -1
@@ -234,7 +234,7 @@ ifdef(`init_systemd',`
 optional_policy(`
 	alsa_domtrans(udev_t)
 	alsa_read_lib(udev_t)
-	alsa_read_rw_config(udev_t)
+	alsa_read_config(udev_t)
 ')
 
 optional_policy(`
policy/modules/system/userdomain.if +2 -2
@@ -579,7 +579,7 @@ template(`userdom_common_user_template',
 	optional_policy(`
 		alsa_home_filetrans_alsa_home($1_t, file, ".asoundrc")
 		alsa_manage_home_files($1_t)
-		alsa_read_rw_config($1_t)
+		alsa_read_config($1_t)
 		alsa_relabel_home_files($1_t)
 	')
 
@@ -933,7 +933,7 @@ template(`userdom_restricted_xwindows_us
 	xserver_restricted_role($1_r, $1_t)
 
 	optional_policy(`
-		alsa_read_rw_config($1_t)
+		alsa_read_config($1_t)
 	')
 
 	optional_policy(`
Signature · 1 line
Chris PeBenito