allow rpm_t to create/relabel device files too
PATCH 1/1 allow rpm_t to create/relabel device files too
Hi,
The attached patch allows rpm_t to create/relabel device files - I needed this when upgrading the "dev" package on my system. I'm surprised this hasn't been caught before, maybe I missed something.
Some AVC messages for reference:
Aug 4 11:11:43 decepticon kernel: audit(1091632303.691:0): avc: denied { getattr } for pid=31094 exe=/usr/bin/python path=/dev/dri dev=sda2 ino=10111422 scontext=root:sysadm_r:rpm_t tcontext=system_u:object_r:dri_device_t tclass=dir
Aug 4 11:16:50 decepticon kernel: audit(1091632610.920:0): avc: denied { relabelfrom } for pid=31149 exe=/usr/bin/python name=dri dev=sda2 ino=10111422 scontext=root:sysadm_r:rpm_t tcontext=system_u:object_r:dri_device_t tclass=dirdomains/program/unused/rpm.te renamed from domains/program/unused/rpm.te~ +3 -3
@@ -90,9 +90,9 @@ general_domain_access(rpm_script_t) # read/write/create any files in the system -allow rpm_t { file_type - shadow_t }:{ file lnk_file dir fifo_file sock_file chr_file blk_file } { relabelfrom relabelto }; -allow rpm_t { file_type - shadow_t }:dir create_dir_perms; -allow rpm_t { file_type - shadow_t }:{ file lnk_file fifo_file sock_file chr_file blk_file } create_file_perms; +allow rpm_t { file_type device_type -shadow_t }:{ file lnk_file dir fifo_file sock_file chr_file blk_file } { relabelfrom relabelto }; +allow rpm_t { file_type device_type - shadow_t }:dir create_dir_perms; +allow rpm_t { file_type device_type - shadow_t }:{ file lnk_file fifo_file sock_file chr_file blk_file } create_file_perms; allow rpm_t sysfs_t:filesystem getattr; allow rpm_t tmpfs_t:filesystem getattr; dontaudit rpm_t domain:{ socket unix_dgram_socket udp_socket unix_stream_socket tcp_socket fifo_file rawip_socket packet_socket } getattr;
Quoted 13 lines · Colin Walters
Hi,
The attached patch allows
rpm_tto create/relabel device files - I needed this when upgrading the "dev" package on my system. I'm surprised this hasn't been caught before, maybe I missed something.Some AVC messages for reference:
Aug 4 11:11:43 decepticon kernel: audit(1091632303.691:0): avc: denied { getattr } for pid=31094 exe=/usr/bin/python path=/dev/dri dev=sda2 ino=10111422 scontext=root:sysadm_r:rpm_t tcontext=system_u:object_r:dri_device_t tclass=dir Aug 4 11:16:50 decepticon kernel: audit(1091632610.920:0): avc: denied { relabelfrom } for pid=31149 exe=/usr/bin/python name=dri dev=sda2 ino=10111422 scontext=root:sysadm_r:rpm_t tcontext=system_u:object_r:dri_device_t tclass=dir
The /dev/dri directory is mislabled. It should be device_t. The latest policy fixes this.
Dan
Quoted 9 lines
------------------------------------------------------------------------
domains/program/unused/rpm.te renamed from domains/program/unused/rpm.te~ +0
-0@@ -90,9 +90,9 @@ general_domain_access(rpm_script_t)
domains/program/unused/rpm.te line 98
Quoted 10 lines
domains/program/unused/rpm.te renamed from domains/program/unused/rpm.te~ +3
-3# read/write/create any files in the system -allow rpm_t { file_type - shadow_t }:{ file lnk_file dir fifo_file sock_file chr_file blk_file } { relabelfrom relabelto }; -allow rpm_t { file_type - shadow_t }:dir create_dir_perms; -allow rpm_t { file_type - shadow_t }:{ file lnk_file fifo_file sock_file chr_file blk_file } create_file_perms; +allow rpm_t { file_type device_type -shadow_t }:{ file lnk_file dir fifo_file sock_file chr_file blk_file } { relabelfrom relabelto }; +allow rpm_t { file_type device_type - shadow_t }:dir create_dir_perms; +allow rpm_t { file_type device_type - shadow_t }:{ file lnk_file fifo_file sock_file chr_file blk_file } create_file_perms; allow rpm_t sysfs_t:filesystem getattr; allow rpm_t tmpfs_t:filesystem getattr; dontaudit rpm_t domain:{ socket unix_dgram_socket udp_socket unix_stream_socket tcp_socket fifo_file rawip_socket packet_socket } getattr;
--
This message was distributed to subscribers of the selinux mailing list. If you no longer wish to subscribe, send mail to [email protected] with the words "unsubscribe selinux" without quotes as the message.