Skip to contentSkip to conversation

netscape & x patches

PATCH Russell Coker 1 participant 1 message Aug 26, 2002 SELinux security module

lore
Share & tools
lore
#0 lore raw

Attached is a file of patches for netscape and xserver.

This has some significant changes. Firstly I removed the $1_netscape_noread_t type because I think it's simply a bad idea and it's obsoleted by my newer work on user_home_dir_t etc.

I have netscape being denied all access to $1_home_t, and I have added a new type $1_netscape_ro_t which is for directories and files that are readable by Netscape and for which $1_t has full read-write access.

Signature · 3 lines
I do not get viruses because I do not use MS software.
If you use Outlook then please do not put my email address in your
address-book so that WHEN you get a virus it won't use my address in the
Quoted 1 line

From field.

macros/program/netscape_macros.te renamed from tmp/policy/macros/program/netscape_macros.te +17 -19
diff -ruN /tmp/policy/macros/program/netscape_macros.te policy/macros/program/netscape_macros.te
@@ -38,25 +38,15 @@
 
 # Allow the user domain to relabel to or create files with this type
 # to provide the domain with write access to particular files.
-allow $1_t $1_home_t:{ dir file lnk_file } relabelfrom;
-allow $1_t $1_netscape_rw_t:{ dir file lnk_file } relabelto;
+allow $1_t $1_netscape_rw_t:{ dir file lnk_file } { relabelfrom relabelto };
 allow $1_t $1_netscape_rw_t:dir create_dir_perms;
 allow $1_t $1_netscape_rw_t:{ file lnk_file } create_file_perms;
 
-# Allow the user domain to relabel files written by this domain
-# to the home directory type, so that the user can "import"
-# downloaded files for general use if desired.
-allow $1_t $1_netscape_rw_t:{ dir file lnk_file } relabelfrom;
-allow $1_t $1_home_t:{ dir file lnk_file } relabelto;
-
-# Type for files that are not readable by this domain.
-type $1_netscape_noread_t, file_type, sysadmfile;
-
-# Allow the user domain to relabel to or create files with this type
-# to make them unreadable by this domain.
-allow $1_t $1_netscape_noread_t:dir create_dir_perms;
-allow $1_t $1_netscape_noread_t:notdevfile_class_set create_file_perms;
-allow $1_t $1_netscape_noread_t:{ dir file lnk_file } relabelto;
+# Type for files that are read-only for this domain
+type $1_netscape_ro_t, file_type, sysadmfile;
+r_dir_file($1_netscape_t, $1_netscape_ro_t)
+rw_dir_create_file($1_t, $1_netscape_ro_t)
+allow $1_t $1_netscape_ro_t:{ dir file lnk_file } { relabelto relabelfrom };
 
 # Allow the user domain to send any signal to the netscape process.
 allow $1_t $1_netscape_t:process signal_perms;
@@ -93,9 +83,17 @@
 
 ifdef(`xdm.te', `
 # Allow connections to X server run by an X Display Manager.
-allow $1_netscape_t xdm_xserver_tmp_t:dir r_dir_perms;
-allow $1_netscape_t xdm_xserver_tmp_t:sock_file rw_file_perms;
-can_unix_connect($1_netscape_t, xdm_xserver_t)')
+#allow $1_netscape_t xdm_tmp_t:dir r_dir_perms;
+#allow $1_netscape_t xdm_tmp_t:sock_file rw_file_perms;
+can_unix_connect($1_netscape_t, xdm_xserver_t)
+allow $1_netscape_t xdm_xserver_tmp_t:dir search;
+allow $1_netscape_t xdm_xserver_tmp_t:sock_file { read write };
+allow $1_netscape_t xdm_t:fd use;
+dontaudit $1_netscape_t xdm_t:tcp_socket { read write };
+
+# for .xsession-errors
+dontaudit $1_netscape_t $1_home_t:file write;
+')
 
 # Allow probing of network interfaces.
 allow $1_netscape_t kernel_t:system net_io_control;
macros/program/xserver_macros.te renamed from tmp/policy/macros/program/xserver_macros.te +5 -5
diff -ruN /tmp/policy/macros/program/xserver_macros.te policy/macros/program/xserver_macros.te
@@ -41,9 +41,8 @@
 every_domain($1_xserver_t)
 
 # Use capabilities.  Access /dev/mem.  
-# Commented out by default.  Uncomment if you want to run X.
-#allow $1_xserver_t $1_xserver_t:capability { net_bind_service setuid setgid chown dac_override fsetid sys_rawio mknod sys_admin sys_nice };
-#allow $1_xserver_t memory_device_t:chr_file { rw_file_perms execute };
+allow $1_xserver_t self:capability { net_bind_service setuid setgid chown dac_override fsetid sys_rawio sys_admin sys_nice };
+allow $1_xserver_t memory_device_t:chr_file { rw_file_perms execute };
 
 allow $1_xserver_t mtrr_device_t:file rw_file_perms;
 allow $1_xserver_t apm_bios_t:chr_file rw_file_perms;
@@ -82,8 +81,9 @@
 
 # Access ttys.
 ifelse($1, xdm, , `
-allow $1_xserver_t $1_tty_device_t:chr_file { setattr rw_file_perms};')
-allow $1_xserver_t tty_device_t:chr_file { setattr rw_file_perms};
+allow $1_xserver_t $1_tty_device_t:chr_file { setattr rw_file_perms };
+')
+allow $1_xserver_t tty_device_t:chr_file { setattr rw_file_perms };
 
 # Get network interface configuration.
 allow $1_xserver_t kernel_t:system { net_io_control };