Skip to contentSkip to conversation

patch: general cleanup

DISCUSSION Thomas Bleher 2 participants 5 messages Dec 6, 2004 – Dec 8, 2004 SELinux security module

lore
Share & tools
lore
#0 lore raw

Remove some duplicated permissions and attributes.

Adds a few permissions:
* initrc can setattr xconsole_device_t
* mount can read device_t:lnk_file and read xdm_t:fifo_file

Please apply.

Thomas

Signature · 2 lines
http://www.cip.ifi.lmu.de/~bleher/selinux/ - my SELinux pages
GPG-Fingerprint: BC4F BB16 30D6 F253 E3EA  D09E C562 2BAE B2F4 ABE7
#1 lore raw
Quoted 5 lines · Thomas Bleher

Remove some duplicated permissions and attributes.

Adds a few permissions:
* initrc can setattr xconsole_device_t
* mount can read device_t:lnk_file and read xdm_t:fifo_file

Oops, forgot to attach patch.
Here it is.

Thomas

Signature · 2 lines
http://www.cip.ifi.lmu.de/~bleher/selinux/ - my SELinux pages
GPG-Fingerprint: BC4F BB16 30D6 F253 E3EA  D09E C562 2BAE B2F4 ABE7
domains/program/unused/anaconda.te +1 -1
@@ -12,7 +12,7 @@
 #
 type anaconda_t, admin, etc_writer, fs_domain, privmem, auth_write, domain, privlog, privowner, privmodule, sysctl_kernel_writer, unrestricted;
 role system_r types anaconda_t;
-unconfined_domain(anaconda_t);
+unconfined_domain(anaconda_t)
 
 role system_r types ldconfig_t;
 domain_auto_trans(anaconda_t, ldconfig_exec_t, ldconfig_t)
assert.te +0 -2
@@ -157,6 +158,4 @@
 neverallow * domain:dir ~r_dir_perms;
 neverallow * domain:file_class_set ~rw_file_perms;
 neverallow { domain unlabeled_t } file_type:process *;
-
-neverallow { domain unlabeled_t } file_type:process *;
 neverallow ~{ domain unlabeled_t } *:process *;
macros/base_user_macros.te +3 -3
@@ -31,7 +31,7 @@
 allow $1_t v4l_device_t:chr_file rw_file_perms;
 
 # Grant permissions within the domain.
-general_domain_access($1_t);
+general_domain_access($1_t)
 
 # Allow loading DSOs that require executable stack.
 allow $1_t self:process execmem;
@@ -237,7 +238,7 @@
 dontaudit $1_t net_conf_t:file ioctl;
 
 # Communicate within the domain.
-can_udp_send($1_t, $1_t)
+can_udp_send($1_t, self)
 
 # Connect to inetd.
 ifdef(`inetd.te', `
@@ -360,7 +361,7 @@
 dontaudit $1_t default_context_t:dir search;
 
 ifdef(`rpcd.te', `
-create_dir_file($1_t,nfsd_rw_t);
+create_dir_file($1_t, nfsd_rw_t)
 ')
 
 ')dnl end base_user_domain macro
domains/program/initrc.te +2 -2
@@ -186,13 +194,13 @@
 allow initrc_t fixed_disk_device_t:blk_file getattr;
 
 # Set device ownerships/modes.
-allow initrc_t framebuf_device_t:lnk_file read;
-allow initrc_t framebuf_device_t:devfile_class_set setattr;
+allow initrc_t framebuf_device_t:chr_file setattr;
 allow initrc_t misc_device_t:devfile_class_set setattr;
 allow initrc_t device_t:devfile_class_set setattr;
 allow initrc_t fixed_disk_device_t:devfile_class_set setattr;
 allow initrc_t removable_device_t:devfile_class_set setattr;
 allow initrc_t device_t:lnk_file read;
+allow initrc_t xconsole_device_t:fifo_file setattr;
 
 # Stat any file.
 allow initrc_t file_type:notdevfile_class_set getattr;
domains/program/unused/kudzu.te +0 -1
@@ -16,7 +16,6 @@
 
 allow kudzu_t ramfs_t:dir search;
 allow kudzu_t ramfs_t:sock_file write;
-allow kudzu_t etc_t:file { getattr read };
 allow kudzu_t self:capability { dac_override sys_admin sys_rawio net_admin sys_tty_config mknod };
 allow kudzu_t modules_conf_t:file { getattr read };
 allow kudzu_t modules_object_t:dir r_dir_perms;
domains/program/login.te +3 -4
@@ -151,11 +154,10 @@
 dontaudit local_login_t fixed_disk_device_t:blk_file { getattr setattr };
 dontaudit local_login_t removable_device_t:blk_file { getattr setattr };
 dontaudit local_login_t device_t:{ chr_file blk_file lnk_file } { getattr setattr };
-dontaudit local_login_t misc_device_t:{ chr_file blk_file lnk_file } { getattr setattr };
-dontaudit local_login_t framebuf_device_t:{ chr_file blk_file lnk_file } { getattr setattr read };
+dontaudit local_login_t misc_device_t:{ chr_file blk_file } { getattr setattr };
+dontaudit local_login_t framebuf_device_t:chr_file { getattr setattr read };
 dontaudit local_login_t apm_bios_t:chr_file { getattr setattr };
-dontaudit local_login_t v4l_device_t:{ chr_file blk_file lnk_file } { getattr setattr read };
-dontaudit local_login_t v4l_device_t:dir { read search getattr };
+dontaudit local_login_t v4l_device_t:chr_file { getattr setattr read };
 dontaudit local_login_t removable_device_t:chr_file { getattr setattr };
 dontaudit local_login_t scanner_device_t:chr_file { getattr setattr };
 
macros/program/sudo_macros.te +0 -1
@@ -31,7 +31,6 @@
 rw_dir_create_file($1_sudo_t, $1_tmp_t)
 rw_dir_create_file($1_sudo_t, $1_home_t)
 domain_auto_trans($1_t, sudo_exec_t, $1_sudo_t)
-r_dir_file($1_sudo_t, selinux_config_t)
 ')
 
 # arch-tag: 67418b54-b56c-44d7-841c-5c895e795cd8
macros/user_macros.te +3 -3
@@ -221,22 +222,22 @@
 #  Allow users to mount file systems like floppies and cdrom
 #
 mount_domain($1, $1_mount, `, fs_domain')
-role $1_r types $1_mount_t;
 r_dir_file($1_t, mnt_t)
+allow $1_mount_t device_t:lnk_file read;
 allow $1_mount_t removable_device_t:blk_file read;
 allow $1_mount_t iso9660_t:filesystem relabelfrom;
 allow $1_mount_t removable_t:filesystem { mount relabelto };
 allow $1_mount_t removable_t:dir mounton;
 ifdef(`xdm.te', `
 allow $1_mount_t xdm_t:fd use;
-allow $1_mount_t xdm_t:fifo_file write;
+allow $1_mount_t xdm_t:fifo_file { read write };
 ')
 ')
 
 #
 # Rules used to associate a homedir as a mountpoint
 #
-allow $1_home_t $1_home_t:filesystem associate;
+allow $1_home_t self:filesystem associate;
 allow $1_file_type $1_home_t:filesystem associate;
 ')
 
macros/program/vmware_macros.te +2 -2
@@ -23,10 +23,10 @@
 role $1_r types $1_vmware_t;
 
 # The user file type is for files created when the user is running VMWare
-type $1_vmware_file_t, $1_file_type, file_type, sysadmfile, $1_file_type;
+type $1_vmware_file_t, $1_file_type, file_type, sysadmfile;
 
 # The user file type for the VMWare configuration files
-type $1_vmware_conf_t, $1_file_type, file_type, sysadmfile, $1_file_type;
+type $1_vmware_conf_t, $1_file_type, file_type, sysadmfile;
 
 # for compatibility with older policy versions
 typealias $1_vmware_t alias vmware_$1_t;
#2 lore raw
Quoted 15 lines · Thomas Bleher
Quoted 5 lines · Thomas Bleher

Remove some duplicated permissions and attributes.

Adds a few permissions:
* initrc can setattr xconsole_device_t
* mount can read device_t:lnk_file and read xdm_t:fifo_file

Oops, forgot to attach patch.
Here it is.

Thomas

macros/program/sudo_macros.te line 34

Quoted 5 lines
macros/program/sudo_macros.te +0 -1
@@ -31,7 +31,6 @@
 rw_dir_create_file($1_sudo_t, $1_tmp_t)
 rw_dir_create_file($1_sudo_t, $1_home_t)
 domain_auto_trans($1_t, sudo_exec_t, $1_sudo_t)
-r_dir_file($1_sudo_t, selinux_config_t)
 ')

This doesn't look like a duplicate rule to me.

Quoted 10 lines
macros/program/sudo_macros.te +0 -0
 # arch-tag: 67418b54-b56c-44d7-841c-5c895e795cd8
macros/user_macros.te +1 -1
@@ -221,22 +222,22 @@
 #  Allow users to mount file systems like floppies and cdrom
 #
 mount_domain($1, $1_mount, `, fs_domain')
-role $1_r types $1_mount_t;
 r_dir_file($1_t, mnt_t)
+allow $1_mount_t device_t:lnk_file read;

macros/user_macros.te line 235

Quoted 10 lines
macros/user_macros.te +1 -1
 allow $1_mount_t removable_device_t:blk_file read;
 allow $1_mount_t iso9660_t:filesystem relabelfrom;
 allow $1_mount_t removable_t:filesystem { mount relabelto };
 allow $1_mount_t removable_t:dir mounton;
 ifdef(`xdm.te', `
 allow $1_mount_t xdm_t:fd use;
-allow $1_mount_t xdm_t:fifo_file write;
+allow $1_mount_t xdm_t:fifo_file { read write };
 ')
 ')

Same with the role $1_r types $1_mount_t rule. I see similar role rules elsewhere for system_r and sysadm_r, but not for user_r and staff_r.

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.
#3 lore raw
Quoted 13 lines · James Carter
Quoted 11 lines · Thomas Bleher
Quoted 5 lines · Thomas Bleher

Remove some duplicated permissions and attributes.

Adds a few permissions:
* initrc can setattr xconsole_device_t
* mount can read device_t:lnk_file and read xdm_t:fifo_file

Oops, forgot to attach patch.
Here it is.

Thomas

Quoted 10 lines

macros/program/sudo_macros.te line 34

Quoted 8 lines
macros/program/sudo_macros.te +0 -1
@@ -31,7 +31,6 @@
 rw_dir_create_file($1_sudo_t, $1_tmp_t)
 rw_dir_create_file($1_sudo_t, $1_home_t)
 domain_auto_trans($1_t, sudo_exec_t, $1_sudo_t)
-r_dir_file($1_sudo_t, selinux_config_t)
 ')

This doesn't look like a duplicate rule to me.

OK, I should probably comment my changes a little better. sudo_domain() includes newrole_domain() which allows r_dir_file($1_t, selinux_config_t)

Quoted 16 lines
Quoted 16 lines
macros/program/sudo_macros.te +0 -0
 # arch-tag: 67418b54-b56c-44d7-841c-5c895e795cd8
macros/user_macros.te +1 -1
@@ -221,22 +222,22 @@
 #  Allow users to mount file systems like floppies and cdrom
 #
 mount_domain($1, $1_mount, `, fs_domain')
-role $1_r types $1_mount_t;
 r_dir_file($1_t, mnt_t)
+allow $1_mount_t device_t:lnk_file read;
 allow $1_mount_t removable_device_t:blk_file read;
 allow $1_mount_t iso9660_t:filesystem relabelfrom;
 allow $1_mount_t removable_t:filesystem { mount relabelto };
 allow $1_mount_t removable_t:dir mounton;
 ifdef(`xdm.te', `
Quoted 8 lines

macros/user_macros.te line 235

Quoted 5 lines
macros/user_macros.te +1 -1
 allow $1_mount_t xdm_t:fd use;
-allow $1_mount_t xdm_t:fifo_file write;
+allow $1_mount_t xdm_t:fifo_file { read write };
 ')
 ')

Same with the role $1_r types $1_mount_t rule. I see similar role rules elsewhere for system_r and sysadm_r, but not for user_r and staff_r.

It's in macros/program/mount_macros.te, line 30.

Thomas

Signature · 2 lines
http://www.cip.ifi.lmu.de/~bleher/selinux/ - my SELinux pages
GPG-Fingerprint: BC4F BB16 30D6 F253 E3EA  D09E C562 2BAE B2F4 ABE7
#4 lore raw

Merged.

I am not sure how I missed the role rule in mount_macros.te. Oh well.

Quoted 57 lines · Thomas Bleher
Quoted 13 lines · James Carter
Quoted 11 lines · Thomas Bleher
Quoted 5 lines · Thomas Bleher

Remove some duplicated permissions and attributes.

Adds a few permissions:
* initrc can setattr xconsole_device_t
* mount can read device_t:lnk_file and read xdm_t:fifo_file

Oops, forgot to attach patch.
Here it is.

Thomas

Quoted 10 lines

macros/program/sudo_macros.te line 34

Quoted 8 lines
macros/program/sudo_macros.te +0 -1
@@ -31,7 +31,6 @@
 rw_dir_create_file($1_sudo_t, $1_tmp_t)
 rw_dir_create_file($1_sudo_t, $1_home_t)
 domain_auto_trans($1_t, sudo_exec_t, $1_sudo_t)
-r_dir_file($1_sudo_t, selinux_config_t)
 ')

This doesn't look like a duplicate rule to me.

OK, I should probably comment my changes a little better. sudo_domain() includes newrole_domain() which allows r_dir_file($1_t, selinux_config_t)

Quoted 16 lines
Quoted 16 lines
macros/program/sudo_macros.te +0 -0
 # arch-tag: 67418b54-b56c-44d7-841c-5c895e795cd8
macros/user_macros.te +1 -1
@@ -221,22 +222,22 @@
 #  Allow users to mount file systems like floppies and cdrom
 #
 mount_domain($1, $1_mount, `, fs_domain')
-role $1_r types $1_mount_t;
 r_dir_file($1_t, mnt_t)
+allow $1_mount_t device_t:lnk_file read;
 allow $1_mount_t removable_device_t:blk_file read;
 allow $1_mount_t iso9660_t:filesystem relabelfrom;
 allow $1_mount_t removable_t:filesystem { mount relabelto };
 allow $1_mount_t removable_t:dir mounton;
 ifdef(`xdm.te', `
Quoted 8 lines

macros/user_macros.te line 235

Quoted 5 lines
macros/user_macros.te +1 -1
 allow $1_mount_t xdm_t:fd use;
-allow $1_mount_t xdm_t:fifo_file write;
+allow $1_mount_t xdm_t:fifo_file { read write };
 ')
 ')

Same with the role $1_r types $1_mount_t rule. I see similar role rules elsewhere for system_r and sysadm_r, but not for user_r and staff_r.

It's in macros/program/mount_macros.te, line 30.

Thomas

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.