device_type vs file_type
Subsystems (2)
The attached patch removes the file_type attribute from the types for device nodes.
In most cases rules using file_type are not intended to catch the types for device nodes as well so this should make things simpler.
Signature · 4 lines
http://www.coker.com.au/selinux/ My NSA Security Enhanced Linux packages http://www.coker.com.au/bonnie++/ Bonnie++ hard drive benchmark http://www.coker.com.au/postal/ Postal SMTP/POP benchmark http://www.coker.com.au/~russell/ My home page
device.te +30 -30
@@ -15,127 +15,127 @@ # # null_device_t is the type of /dev/null. # -type null_device_t, file_type, device_type, mlstrustedobject; +type null_device_t, device_type, mlstrustedobject; # # zero_device_t is the type of /dev/zero. # -type zero_device_t, file_type, device_type, mlstrustedobject; +type zero_device_t, device_type, mlstrustedobject; # # console_device_t is the type of /dev/console. # -type console_device_t, file_type, device_type; +type console_device_t, device_type; # # memory_device_t is the type of /dev/kmem, # /dev/mem, and /dev/port. # -type memory_device_t, file_type, device_type; +type memory_device_t, device_type; # # random_device_t is the type of /dev/random # urandom_device_t is the type of /dev/urandom # -type random_device_t, file_type, device_type; -type urandom_device_t, file_type, device_type; +type random_device_t, device_type; +type urandom_device_t, device_type; # # devtty_t is the type of /dev/tty. # -type devtty_t, file_type, device_type, mlstrustedobject; +type devtty_t, device_type, mlstrustedobject; # # tty_device_t is the type of /dev/*tty* # -type tty_device_t, file_type, serial_device, device_type; +type tty_device_t, serial_device, device_type; # # usbtty_device_t is the type of /dev/usr/tty* # -type usbtty_device_t, file_type, serial_device, device_type; +type usbtty_device_t, serial_device, device_type; # # fixed_disk_device_t is the type of # /dev/hd* and /dev/sd*. # -type fixed_disk_device_t, file_type, device_type; +type fixed_disk_device_t, device_type; # # scsi_generic_device_t is the type of /dev/sg* # it gives access to ALL SCSI devices (both fixed and removable) # -type scsi_generic_device_t, file_type, device_type; +type scsi_generic_device_t, device_type; # # removable_device_t is the type of # /dev/scd* and /dev/fd*. # -type removable_device_t, file_type, device_type; +type removable_device_t, device_type; # # clock_device_t is the type of # /dev/rtc. # -type clock_device_t, file_type, device_type; +type clock_device_t, device_type; # # tun_tap_device_t is the type of /dev/net/tun/* and /dev/net/tap/* # -type tun_tap_device_t, file_type, device_type; +type tun_tap_device_t, device_type; # # misc_device_t is the type of miscellaneous devices. # XXX: FIXME! Appropriate access to these devices need to be identified. # -type misc_device_t, file_type, device_type; +type misc_device_t, device_type; # # A more general type for mouse devices. # -type mouse_device_t, file_type, device_type; +type mouse_device_t, device_type; # # For generic /dev/input/event* event devices # -type event_device_t, file_type, device_type; +type event_device_t, device_type; # # Not sure what these devices are for, but X wants access to them. # -type agp_device_t, file_type, device_type; -type dri_device_t, file_type, device_type; +type agp_device_t, device_type; +type dri_device_t, device_type; # Type for sound devices. -type sound_device_t, file_type, device_type; +type sound_device_t, device_type; # Type for /dev/ppp. -type ppp_device_t, file_type, device_type; +type ppp_device_t, device_type; # Type for frame buffer /dev/fb/* -type framebuf_device_t, file_type, device_type; +type framebuf_device_t, device_type; # Type for /dev/.devfsd -type devfs_control_t, file_type, device_type; +type devfs_control_t, device_type; # Type for /dev/cpu/mtrr -type mtrr_device_t, file_type, device_type; +type mtrr_device_t, device_type; # Type for /dev/apm_bios -type apm_bios_t, file_type, device_type; +type apm_bios_t, device_type; # Type for v4l -type v4l_device_t, file_type, device_type; +type v4l_device_t, device_type; # tape drives -type tape_device_t, file_type, device_type; +type tape_device_t, device_type; # scanners -type scanner_device_t, file_type, device_type; +type scanner_device_t, device_type; # cpu control devices /dev/cpu/0/* -type cpu_device_t, file_type, device_type; +type cpu_device_t, device_type; # for other device nodes such as the NVidia binary-only driver -type xserver_misc_device_t, file_type, device_type; +type xserver_misc_device_t, device_type;
file.te +1 -1
@@ -257,7 +257,7 @@ # Allow each file type to be associated with # the default file system type. # -allow file_type fs_t:filesystem associate; +allow { file_type device_type } fs_t:filesystem associate; # Allow the pty to be associated with the file system. allow devpts_t devpts_t:filesystem associate;
Quoted 5 lines · Russell Coker
The attached patch removes the
file_typeattribute from the types for device nodes.In most cases rules using
file_typeare not intended to catch the types for device nodes as well so this should make things simpler.
Likely requires an audit of all uses of file_type in the policy, e.g. setfiles assumes file_type includes device node types as well.
Signature · 8 lines
Stephen Smalley <[email protected]> National Security Agency -- 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.
Quoted 9 lines · Stephen Smalley
Quoted 5 lines · Russell Coker
The attached patch removes the
file_typeattribute from the types for device nodes.In most cases rules using
file_typeare not intended to catch the types for device nodes as well so this should make things simpler.Likely requires an audit of all uses of
file_typein the policy, e.g. setfiles assumesfile_typeincludes device node types as well.
The attached patch should be all that's required for setfiles.
Signature · 4 lines
http://www.coker.com.au/selinux/ My NSA Security Enhanced Linux packages http://www.coker.com.au/bonnie++/ Bonnie++ hard drive benchmark http://www.coker.com.au/postal/ Postal SMTP/POP benchmark http://www.coker.com.au/~russell/ My home page
program/setfiles.te renamed from usr/src/se/policy/domains/program/setfiles.te +1 -1
@@ -37,7 +37,7 @@ r_dir_file(setfiles_t, { policy_src_t policy_config_t file_context_t selinux_config_t }) allow setfiles_t file_type:dir r_dir_perms; -allow setfiles_t { file_type unlabeled_t }:dir_file_class_set { getattr relabelfrom }; +allow setfiles_t { file_type unlabeled_t device_type }:dir_file_class_set { getattr relabelfrom }; allow setfiles_t file_type:{ dir file lnk_file sock_file fifo_file } relabelto; allow setfiles_t unlabeled_t:dir read; allow setfiles_t device_type:{ chr_file blk_file } relabelto;
Quoted 5 lines · Russell Coker
The attached patch removes the
file_typeattribute from the types for device nodes.In most cases rules using
file_typeare not intended to catch the types for device nodes as well so this should make things simpler.
Ok, merged, along with the setfiles diff.
Signature · 8 lines
Stephen Smalley <[email protected]> National Security Agency -- 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.