Skip to contentSkip to conversation

udev.te

PATCH Russell Coker 1 participant 1 message Jul 13, 2004

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

The attached patch adds a new type for /dev/udev.tbl , it uses the attribute dbus_client_domain instead of just adding rules (incidentally the rules added didn't include dbusd_t:dbus send_msg access so it's likely that using dbus_client_domain will make it work in situations when the current policy wouldn't).

allow restorecon_t udev_t:unix_dgram_socket { read write };

My policy doesn't have the above line. I suspect that restorecon and udev are not communicating via unix domain sockets and that it's just there because of a bug in udev which lets the wrong file handles be inherited. Could someone test out dontaudit and see how it goes?

allow udev_t var_lock_t:dir { search };
allow udev_t var_lock_t:file { getattr read };

What are the above two lines for? Why not use lock_domain()?

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/unused/udev.te renamed from usr/src/se/policy/domains/program/unused/udev.te +5 -13
@@ -9,7 +9,7 @@
 #
 # udev_exec_t is the type of the udev executable.
 #
-daemon_domain(udev, `, privmodule, privmem, fs_domain, privfd')
+daemon_domain(udev, `, privmodule, privmem, fs_domain, privfd, dbus_client_domain')
 
 general_domain_access(udev_t)
 
@@ -22,8 +22,9 @@
 #
 # Rules used for udev
 #
-create_dir_file(udev_t, device_t)
-allow udev_t self:capability { chown sys_admin dac_override dac_read_search mknod fsetid };
+type udev_tbl_t, file_type, sysadmfile;
+file_type_auto_trans(udev_t, device_t, udev_tbl_t, file)
+allow udev_t self:capability { chown dac_override fowner fsetid sys_admin mknod };
 allow udev_t self:file { getattr read };
 allow udev_t self:unix_stream_socket {connectto create_stream_socket_perms};
 allow udev_t self:unix_dgram_socket create_socket_perms;
@@ -58,8 +59,6 @@
 domain_auto_trans(initrc_t, udev_exec_t, udev_t)
 domain_auto_trans(kernel_t, udev_exec_t, udev_t)
 domain_auto_trans(udev_t, restorecon_exec_t, restorecon_t)
-allow restorecon_t udev_t:unix_dgram_socket { read write };
-
 allow udev_t devpts_t:dir { search };
 allow udev_t etc_runtime_t:file { getattr read };
 allow udev_t etc_t:file { ioctl };
@@ -77,12 +76,5 @@
 can_exec(udev_t, consoletype_exec_t)
 ')
 domain_auto_trans(udev_t, ifconfig_exec_t, ifconfig_t)
-allow udev_t var_lock_t:dir { search };
-allow udev_t var_lock_t:file { getattr read };
-ifdef(`dbusd.te', `
-allow udev_t dbusd_t:unix_stream_socket { connectto };
-allow udev_t dbusd_var_run_t:dir { search };
-allow udev_t dbusd_var_run_t:sock_file { write }; 
-')
 
-dontaudit udev_t file_t:dir { search };
+dontaudit udev_t file_t:dir search;
program/udev.fc renamed from usr/src/se/policy/file_contexts/program/udev.fc +1 -0
@@ -4,3 +4,4 @@
 /sbin/udevd	--	system_u:object_r:udev_exec_t
 /etc/dev.d(/.*)? 	system_u:object_r:udev_helper_exec_t
 /etc/hotplug.d/default/udev.* system_u:object_r:udev_helper_exec_t
+/dev/udev.tbl	--	system_u:object_r:udev_tbl_t