Skip to contentSkip to conversation

Progress! .532 boots! -- but dbus/hotplug/udev problems remain?

DISCUSSION Russell Coker 7 participants 12 messages Aug 29, 2004 – Sep 1, 2004 1 message not in the archive

Subsystems (2)
lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw
Quoted 3 lines · Tom London

Newest Rawhide updates (including udev-030-10, mkinitrd-4.1.8-1, kernel-2.6.8-1.532, and selinux-policy-strict-1.17.5-2) now boots in strict/enforcing.

I've attached a diff against the CVS policy as well as the .te and .fc files for udev changes which fix this and address some other issues as well.

Please try it out and let me know how it goes.

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 +16 -12
@@ -16,7 +16,6 @@
 etc_domain(udev)
 typealias udev_etc_t alias etc_udev_t;
 type udev_helper_exec_t, file_type, sysadmfile, exec_type;
-r_dir_file(udev_t, udev_helper_exec_t)
 can_exec(udev_t, udev_helper_exec_t)
 
 #
@@ -32,19 +31,20 @@
 allow udev_t device_t:blk_file create_file_perms;
 allow udev_t device_t:chr_file create_file_perms;
 allow udev_t device_t:sock_file create_file_perms;
-allow udev_t etc_t:file { getattr read execute };
+allow udev_t device_t:lnk_file create_lnk_perms;
+allow udev_t etc_t:file { getattr read };
 allow udev_t { bin_t sbin_t }:dir r_dir_perms;
 allow udev_t { sbin_t bin_t }:lnk_file read;
-can_exec(udev_t, { shell_exec_t bin_t sbin_t } )
+allow udev_t bin_t:lnk_file read;
+can_exec(udev_t, { shell_exec_t bin_t sbin_t etc_t } )
 can_exec(udev_t, udev_exec_t)
-can_exec(udev_t, hostname_exec_t)
-can_exec(udev_t, iptables_exec_t)
 r_dir_file(udev_t, sysfs_t)
 allow udev_t sysadm_tty_device_t:chr_file { read write };
 allow udev_t { device_t device_type }:{chr_file blk_file} { relabelfrom relabelto create_file_perms };
 	
-# to read the file_contexts file?
-r_dir_file(udev_t, policy_config_t)
+# to read the file_contexts file
+allow udev_t { selinux_config_t default_context_t }:dir search;
+allow udev_t default_context_t:file { getattr read };
 
 allow udev_t policy_config_t:dir { search };
 allow udev_t proc_t:file { read };
@@ -52,6 +52,9 @@
 # Get security policy decisions.
 can_getsecurity(udev_t)
 
+# set file system create context
+can_setfscreate(udev_t)
+
 allow udev_t kernel_t:fd { use };
 allow udev_t kernel_t:unix_dgram_socket { sendto ioctl read write };
 
@@ -61,7 +64,9 @@
 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 };
+ifdef(`hide_broken_symptoms', `
+dontaudit 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 };
@@ -79,12 +84,11 @@
 can_exec(udev_t, consoletype_exec_t)
 ')
 domain_auto_trans(udev_t, ifconfig_exec_t, ifconfig_t)
-allow ifconfig_t udev_t:unix_dgram_socket { read write };
+ifdef(`hide_broken_symptoms', `
+dontaudit ifconfig_t udev_t:unix_dgram_socket { read write };
+')
 
 dontaudit udev_t file_t:dir search;
-allow udev_t device_t:lnk_file create_file_perms;
-allow udev_t var_lock_t:dir { search };
-allow udev_t var_lock_t:file { getattr read };
 ifdef(`dhcpc.te', `
 domain_auto_trans(udev_t, dhcpc_exec_t, dhcpc_t)
 ')
program/udev.fc renamed from usr/src/se/policy/file_contexts/program/udev.fc +3 -2
@@ -3,7 +3,8 @@
 /sbin/udev	--	system_u:object_r:udev_exec_t
 /sbin/udevd	--	system_u:object_r:udev_exec_t
 /usr/bin/udevinfo --	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
+/etc/dev\.d/.+	--	system_u:object_r:udev_helper_exec_t
+/etc/udev/scripts/.+	-- 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
 /dev/\.udev\.tdb --	system_u:object_r:udev_tbl_t

#DESC udev - Linux configurable dynamic device naming support #
# Author: Dan Walsh [email protected]
#

#################################
#
# Rules for the udev_t domain.
#

# udev_exec_t is the type of the udev executable.
#
daemon_domain(udev, `, privmodule, privmem, fs_domain, privfd, dbus_client_domain')

general_domain_access(udev_t)

etc_domain(udev)
typealias udev_etc_t alias etc_udev_t;
type udev_helper_exec_t, file_type, sysadmfile, exec_type; can_exec(udev_t, udev_helper_exec_t)

#
# Rules used for udev
#
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 dac_read_search 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;
allow udev_t self:fifo_file rw_file_perms;
allow udev_t device_t:blk_file create_file_perms;
allow udev_t device_t:chr_file create_file_perms;
allow udev_t device_t:sock_file create_file_perms;
allow udev_t device_t:lnk_file create_lnk_perms;
allow udev_t etc_t:file { getattr read };
allow udev_t { bin_t sbin_t }:dir r_dir_perms;
allow udev_t { sbin_t bin_t }:lnk_file read;
allow udev_t bin_t:lnk_file read;
can_exec(udev_t, { shell_exec_t bin_t sbin_t etc_t } )
can_exec(udev_t, udev_exec_t)
r_dir_file(udev_t, sysfs_t)
allow udev_t sysadm_tty_device_t:chr_file { read write };
allow udev_t { device_t device_type }:{chr_file blk_file} { relabelfrom relabelto create_file_perms };

# to read the file_contexts file
allow udev_t { selinux_config_t default_context_t }:dir search;
allow udev_t default_context_t:file { getattr read };

allow udev_t policy_config_t:dir { search };
allow udev_t proc_t:file { read };

# Get security policy decisions.
can_getsecurity(udev_t)

# set file system create context
can_setfscreate(udev_t)

allow udev_t kernel_t:fd { use };
allow udev_t kernel_t:unix_dgram_socket { sendto ioctl read write };

allow udev_t initrc_var_run_t:file r_file_perms;
dontaudit udev_t initrc_var_run_t:file write;

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) ifdef(hide_broken_symptoms',
dontaudit 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 };
allow udev_t proc_t:file { getattr };
ifdef(xdm.te',
allow udev_t xdm_var_run_t:file { getattr read };
')

ifdef(hotplug.te',
r_dir_file(udev_t, hotplug_etc_t)
')
allow udev_t var_log_t:dir { search };

ifdef(consoletype.te',
can_exec(udev_t, consoletype_exec_t)
')
domain_auto_trans(udev_t, ifconfig_exec_t, ifconfig_t) ifdef(hide_broken_symptoms',
dontaudit ifconfig_t udev_t:unix_dgram_socket { read write }; ')

dontaudit udev_t file_t:dir search;
ifdef(dhcpc.te',
domain_auto_trans(udev_t, dhcpc_exec_t, dhcpc_t)
')

# udev
/sbin/udevsend	--	system_u:object_r:udev_exec_t
/sbin/udev	--	system_u:object_r:udev_exec_t
/sbin/udevd	--	system_u:object_r:udev_exec_t
/usr/bin/udevinfo --	system_u:object_r:udev_exec_t
/etc/dev\.d/.+	--	system_u:object_r:udev_helper_exec_t
/etc/udev/scripts/.+	-- 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
/dev/\.udev\.tdb --	system_u:object_r:udev_tbl_t
#2 lore raw

btw i didn't see an acknowledgement from the person who sent the last udev patch (dan was it you?)

the use of the "mode" argument it is clear has not been used, to call i think it was matchpathcon.

instead, because i had three near-identical code portions all of which had different S_IFXXX thingies, dan-i-think-it-was moved the near-identical code into a function with a "mode" argument...

... and forgot to use the "mode" argument such that matchpathcon is called with S_IFDIR.

given that i haven't seen an acknowledgement of this issue either in my inbox or on the mailing lists (which i am checking manually) i thought it best to hassle people until i know it's been spotted.

this is IMPORTANT because it will impact the contexts on inodes and stuff created in /dev: the "optimising" argument "mode" passed to matchpathcon and setfscreatecon, if wrong, results in relevant (and correct!) file_context entries being skipped!

l.

Quoted 7 lines · Russell Coker
Quoted 3 lines · Tom London

Newest Rawhide updates (including udev-030-10, mkinitrd-4.1.8-1, kernel-2.6.8-1.532, and selinux-policy-strict-1.17.5-2) now boots in strict/enforcing.

I've attached a diff against the CVS policy as well as the .te and .fc files for udev changes which fix this and address some other issues as well.

--
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.

#3 lore raw
Quoted 39 lines · Luke Kenneth Casson Leighton

btw i didn't see an acknowledgement from the person who sent the last udev patch (dan was it you?)

the use of the "mode" argument it is clear has not been used, to call i think it was matchpathcon.

instead, because i had three near-identical code portions all of which had different S_IFXXX thingies, dan-i-think-it-was moved the near-identical code into a function with a "mode" argument...

... and forgot to use the "mode" argument such that matchpathcon is called with S_IFDIR.

given that i haven't seen an acknowledgement of this issue either in my inbox or on the mailing lists (which i am checking manually) i thought it best to hassle people until i know it's been spotted.

this is IMPORTANT because it will impact the contexts on inodes and stuff created in /dev: the "optimising" argument "mode" passed to matchpathcon and setfscreatecon, if wrong, results in relevant (and correct!) file_context entries being skipped!

l.

Quoted 8 lines · Russell Coker
Quoted 5 lines · Tom London

Newest Rawhide updates (including udev-030-10, mkinitrd-4.1.8-1, kernel-2.6.8-1.532, and selinux-policy-strict-1.17.5-2) now boots in strict/enforcing.

Quoted 9 lines
Quoted 3 lines

I've attached a diff against the CVS policy as well as the .te and .fc files for udev changes which fix this and address some other issues as well.

--
fedora-selinux-list mailing list
[email protected]
http://www.redhat.com/mailman/listinfo/fedora-selinux-list

Yes it was me and I modified out udev rpm, but I guess I never responded. Sorry about that.

Luke thanks for the fix.

Dan

Makefile renamed from Makefile.selinux +8 -0
@@ -25,6 +25,8 @@
 # Leave this set to `false' for production use.
 DEBUG = false
 
+# Set this to compile with Security-Enhanced Linux support.
+USE_SELINUX = true
 
 ROOT =		udev
 DAEMON =	udevd
@@ -172,6 +174,11 @@
 
 CFLAGS += -I$(PWD)/libsysfs
 
+ifeq ($(strip $(USE_SELINUX)),true)
+	CFLAGS += -DUSE_SELINUX
+	LIB_OBJS += -lselinux
+endif
+
 all: $(ROOT) $(SENDER) $(DAEMON) $(INFO) $(TESTER) $(STARTER)
 	@extras="$(EXTRAS)" ; for target in $$extras ; do \
 		echo $$target ; \
@@ -216,6 +223,7 @@
 		udevdb.h	\
 		klibc_fixups.h	\
 		logging.h	\
+		selinux.h	\
 		list.h
 
 ifeq ($(strip $(USE_KLIBC)),true)
selinux.h renamed from selinux.h.selinux +80 -0

80 lines not on this page · raw message

udev-add.c renamed from udev-add.c.selinux +8 -0
@@ -50,6 +50,8 @@
 
 #define LOCAL_USER "$local"
 
+#include "selinux.h"
+
 /* 
  * Right now the major/minor of a device is stored in a file called
  * "dev" in sysfs.
@@ -92,6 +94,7 @@
 			break;
 		*pos = 0x00;
 		if (stat(p, &stats)) {
+			selinux_setfscreatecon(p, S_IFDIR);
 			retval = mkdir(p, 0755);
 			if (retval != 0) {
 				dbg("mkdir(%s) failed with error '%s'",
@@ -117,6 +120,7 @@
 	if (((stats.st_mode & S_IFMT) == S_IFBLK || (stats.st_mode & S_IFMT) == S_IFCHR) &&
 	    (stats.st_rdev == makedev(major, minor))) {
 		dbg("preserve file '%s', cause it has correct dev_t", file);
+		selinux_setfilecon(file,stats.st_mode);
 		if (udev_preserve_owner)
 		  goto exit;
 		else
@@ -129,6 +133,7 @@
 		dbg("already present file '%s' unlinked", file);
 
 create:
+	selinux_setfscreatecon(file, mode);
 	retval = mknod(file, mode, makedev(major, minor));
 	if (retval != 0) {
 		dbg("mknod(%s, %#o, %u, %u) failed with error '%s'",
@@ -307,6 +312,7 @@
 
 		dbg("symlink(%s, %s)", linktarget, filename);
 		if (!fake) {
+			selinux_setfscreatecon(filename, S_IFLNK);
 			unlink(filename);
 			if (symlink(linktarget, filename) != 0)
 				dbg("symlink(%s, %s) failed with error '%s'",
@@ -441,6 +447,7 @@
 
 	dbg("name='%s'", dev.name);
 
+	selinux_init();
 	switch (dev.type) {
 	case 'b':
 	case 'c':
@@ -478,6 +485,7 @@
 	}
 
 exit:
+	selinux_restore();
 	sysfs_close_class_device(class_dev);
 
 	return retval;
#4 lore raw
In reply to Russell Coker

Russell,

Thanks, but it didn't quite work. The following change to dbusd.te seems to make graphical login work under strict/enforcing.

Please correct/improve... :)
tom

dbusd.te 2004-08-29 12:19:25.000000000 -0700 renamed from root/src.package/policy/domains/program/dbusd.te 2004-08-29 11:38:27.000000000 -0700 +0 -0
@@ -32,3 +32,7 @@
 

# SE-DBus specific permissions
allow { dbus_client_domain userdomain } { dbusd_t self }:dbus { send_msg }; +
+allow user_t etc_dbusd_t:dir { search };
+allow user_t etc_dbusd_t:file { getattr read };
+allow user_t user_t:netlink_selinux_socket { bind create };

Quoted 9 lines · Russell Coker
Quoted 5 lines · Tom London

Newest Rawhide updates (including udev-030-10, mkinitrd-4.1.8-1, kernel-2.6.8-1.532, and selinux-policy-strict-1.17.5-2) now boots in strict/enforcing.

Quoted 6 lines

I've attached a diff against the CVS policy as well as the .te and .fc files for udev changes which fix this and address some other issues as well.

Please try it out and let me know how it goes.

--
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.

#5 lore raw
Quoted 4 lines · Tom London

Russell,

Thanks, but it didn't quite work. The following change to dbusd.te seems to make graphical login work under strict/enforcing.

I think we need to rework the dbusd.te to break it into dbusd_system_t and dbusd_{user,staff}_t.

#6 lore raw
In reply to Tom London

Review

Quoted 11 lines · Tom London

--- /root/src.package/policy/domains/program/dbusd.te 2004-08-29
11:38:27.000000000 -0700
+++ dbusd.te 2004-08-29 12:19:25.000000000 -0700

(quoted diff) +0 -0
@@ -32,3 +32,7 @@
 
 # SE-DBus specific permissions
 allow { dbus_client_domain userdomain } { dbusd_t self }:dbus { send_msg

}; +

(quoted diff) +3 -0
+allow user_t etc_dbusd_t:dir { search };
+allow user_t etc_dbusd_t:file { getattr read };
+allow user_t user_t:netlink_selinux_socket { bind create };

One thing to remember is that any time you see user_t in policy it's a local customisation or a bug.

In this case it seems to me that one correct way of writing policy for this is the following:
allow { dbus_client_domain userdomain } etc_dbusd_t:dir { search }; allow { dbus_client_domain userdomain } etc_dbusd_t:file { getattr read }; allow { dbus_client_domain userdomain } user_t:netlink_selinux_socket { bind create };

But then we are granting almost every domain that has any significance in the security of the system read access. So why not just label the files as etc_t and remove the etc_dbusd_t type entirely?

Signature · 9 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

--
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.
#7 lore raw
Quoted 10 lines · Russell Coker

One thing to remember is that any time you see user_t in policy it's a local customisation or a bug.

In this case it seems to me that one correct way of writing policy for this is the following:
allow { dbus_client_domain userdomain } etc_dbusd_t:dir { search }; allow { dbus_client_domain userdomain } etc_dbusd_t:file { getattr read }; allow { dbus_client_domain userdomain } user_t:netlink_selinux_socket { bind create };

Quoted 3 lines

But then we are granting almost every domain that has any significance in the security of the system read access. So why not just label the files as etc_t and remove the etc_dbusd_t type entirely?

These permissions shouldn't be granted directly to the user domains. We need per-userdomain dbusd domains defined via a macro for the per-session message bus.

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.
#8 lore raw
Quoted 3 lines · Stephen Smalley

These permissions shouldn't be granted directly to the user domains. We need per-userdomain dbusd domains defined via a macro for the per-session message bus.

BTW, note that in the rawhide policy, Dan (or someone) has added a domain_auto_trans(userdomain, dbusd_exec_t, dbusd_t) to dbusd.te as a workaround so that the per-session bus daemons also run in dbusd_t, but that isn't truly what we want in the long term.

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.
#9 lore raw
In reply to Russell Coker

Russell,

The following changes to udev.te seem needed.... (If udev shouldn't be reading file_contexts, then dontaudit?)

Please correct/improve,
tom

udev.te 2004-08-29 12:40:58.000000000 -0700 renamed from tmp/patches/udev.te 2004-08-29 11:35:48.000000000 -0700 +0 -0
@@ -44,7 +44,9 @@
 
# to read the file_contexts file
allow udev_t { selinux_config_t default_context_t }:dir search;
-allow udev_t default_context_t:file { getattr read };
+allow udev_t { selinux_config_t default_context_t }:file { getattr read };
+allow udev_t file_context_t:dir { search };
+allow udev_t file_context_t:file { getattr read };

allow udev_t policy_config_t:dir { search };
allow udev_t proc_t:file { read };

Quoted 9 lines · Russell Coker
Quoted 5 lines · Tom London

Newest Rawhide updates (including udev-030-10, mkinitrd-4.1.8-1, kernel-2.6.8-1.532, and selinux-policy-strict-1.17.5-2) now boots in strict/enforcing.

Quoted 4 lines

I've attached a diff against the CVS policy as well as the .te and .fc files for udev changes which fix this and address some other issues as well.

Please try it out and let me know how it goes.

--
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.

#10 lore raw
Quoted 5 lines · Tom London

Russell,

The following changes to udev.te seem needed.... (If udev shouldn't be reading file_contexts, then dontaudit?)

udev needs to read file_contexts. It is doing a matchpathcon in order to setup the devices with the correct context.

Quoted 30 lines

Please correct/improve,
tom

udev.te 2004-08-29 12:40:58.000000000 -0700 renamed from tmp/patches/udev.te 2004-08-29 11:35:48.000000000 -0700 +3 -1
@@ -44,7 +44,9 @@
 
 # to read the file_contexts file
 allow udev_t { selinux_config_t default_context_t }:dir search;
-allow udev_t default_context_t:file { getattr read };
+allow udev_t { selinux_config_t default_context_t }:file { getattr 
 read };
+allow udev_t file_context_t:dir { search };
+allow udev_t file_context_t:file { getattr read };
 
 allow udev_t policy_config_t:dir { search };

allow udev_t proc_t:file { read };

Quoted 9 lines · Russell Coker
Quoted 4 lines · Tom London

Newest Rawhide updates (including udev-030-10, mkinitrd-4.1.8-1, kernel-2.6.8-1.532, and selinux-policy-strict-1.17.5-2) now boots in strict/enforcing.

Quoted 8 lines
Quoted 4 lines

I've attached a diff against the CVS policy as well as the .te and .fc files for udev changes which fix this and address some other issues as well.

Please try it out and let me know how it goes.

Signature · 3 lines
fedora-selinux-list mailing list
[email protected]
http://www.redhat.com/mailman/listinfo/fedora-selinux-list

--
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.

#11 lore raw
Quoted 9 lines · Daniel J Walsh
Quoted 5 lines · Tom London

Russell,

The following changes to udev.te seem needed.... (If udev shouldn't be reading file_contexts, then dontaudit?)

udev needs to read file_contexts. It is doing a matchpathcon in order to setup the devices with the correct context.

dan, dan, you MUST fix the bug in that patch before making changes to the selinux policy files for udev!!!

matchpathcon() is being called with S_IFDIR not with the mode argument!

l.

--
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.

#12 lore raw
In reply to Tom London

Thanks Russell and Tom. Merged into sourceforge policy using r_dir_file() for selinux_config_t, file_context_t, and default_context_t.

Showing only the part changed from Russell's patch:

program/unused/udev.te +6 -6
@@ -32,19 +31,19 @@
 allow udev_t device_t:blk_file create_file_perms;
 allow udev_t device_t:chr_file create_file_perms;
 allow udev_t device_t:sock_file create_file_perms;
-allow udev_t etc_t:file { getattr read execute };
+allow udev_t device_t:lnk_file create_lnk_perms;
+allow udev_t etc_t:file { getattr read };
 allow udev_t { bin_t sbin_t }:dir r_dir_perms;
 allow udev_t { sbin_t bin_t }:lnk_file read;
-can_exec(udev_t, { shell_exec_t bin_t sbin_t } )
+allow udev_t bin_t:lnk_file read;
+can_exec(udev_t, { shell_exec_t bin_t sbin_t etc_t } )
 can_exec(udev_t, udev_exec_t)
-can_exec(udev_t, hostname_exec_t)
-can_exec(udev_t, iptables_exec_t)
 r_dir_file(udev_t, sysfs_t)
 allow udev_t sysadm_tty_device_t:chr_file { read write };
 allow udev_t { device_t device_type }:{chr_file blk_file} { relabelfrom relabelto create_file_perms };
 	
-# to read the file_contexts file?
-r_dir_file(udev_t, policy_config_t)
+# to read the file_contexts file
+r_dir_file(udev_t, { selinux_config_t file_context_t default_context_t } )
 
 allow udev_t policy_config_t:dir { search };
 allow udev_t proc_t:file { read };
Quoted 44 lines · Tom London

Russell,

The following changes to udev.te seem needed.... (If udev shouldn't be reading file_contexts, then dontaudit?)

Please correct/improve,
tom

udev.te 2004-08-29 12:40:58.000000000 -0700 renamed from tmp/patches/udev.te 2004-08-29 11:35:48.000000000 -0700 +3 -1
@@ -44,7 +44,9 @@
 
 # to read the file_contexts file
 allow udev_t { selinux_config_t default_context_t }:dir search;
-allow udev_t default_context_t:file { getattr read };
+allow udev_t { selinux_config_t default_context_t }:file { getattr read };
+allow udev_t file_context_t:dir { search };
+allow udev_t file_context_t:file { getattr read };
 
 allow udev_t policy_config_t:dir { search };
 allow udev_t proc_t:file { read };
Quoted 9 lines · Russell Coker
Quoted 5 lines · Tom London

Newest Rawhide updates (including udev-030-10, mkinitrd-4.1.8-1, kernel-2.6.8-1.532, and selinux-policy-strict-1.17.5-2) now boots in strict/enforcing.

Quoted 5 lines

I've attached a diff against the CVS policy as well as the .te and .fc files for udev changes which fix this and address some other issues as well.

Please try it out and let me know how it goes.

--
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.

Signature · 7 lines
James Carter <[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.