Restrict Home v. 2
Subsystems (2)
Here's version 2 of this patch, still not in
merge-able state, but getting closer.
Changelog:
==========
- GConf runs in its own domain. Things that want to make use of gconf call gconf_client(). This allows them to connect to gconfd via ORBit. Each client can launch the daemon if necessary.
- Lots of gnome-specific folders in /home are labeled differently to differentiate from ROLE_home_t.
- Gift, games, Xserver, and mozilla are denied access to ROLE_home_t. Mozilla's readhome and writehome booleans are dropped, and it needs to write ROLE_untrusted_content_t. Gift writes the same thing. X uses a macro to access per/user fonts, which now have their own type.
- Gift, mozilla are denied access to ROLE_tmp_t, previously needed because of ORBit connection to gconf.
- Mailcap/mime types stuff labeled differently too
- Probably other stuff I forgot.
TODO:
=====
- Startup script for creation and persistent labeling of of /tmp/gconfd-$USER, /tmp/orbit-$USER, $HOME/downloads.
- worry about how to label .ICE-unix/.ICE-authority.
- worry about policy for fc-cache that properly labels the font cache file.
Signature · 2 lines
Ivan Gyurdiev <[email protected]> Cornell University
genhomedircon.new renamed from genhomedircon +7 -1
@@ -357,16 +357,22 @@ return udict def getHomeDirContext(self, user, home, role): - ret="\n\n#\n# Context for user %s\n#\n\n" % user + ret="\n\n#\n# Home Context for user %s\n#\n\n" % user rc=commands.getstatusoutput("grep '^HOME_DIR' %s | sed -e 's|HOME_DIR|%s|' -e 's/ROLE/%s/' -e 's/system_u/%s/'" % (self.getHomeDirTemplate(), home, role, user)) return ret + rc[1] + "\n" + def getUserContext(self, user, role): + ret="\n\n#\n# Other Context for user %s\n#\n\n" % user + rc=commands.getstatusoutput("grep 'USER' %s | sed -e 's/USER/%s/' -e 's/ROLE/%s/' -e 's/system_u/%s/'" % (self.getHomeDirTemplate(), user, role, user)) + return ret + rc[1] + "\n" + def genHomeDirContext(self): users = self.getUsers() ret="" # Fill in HOME and ROLE for users that are defined for u in users.keys(): ret += self.getHomeDirContext (u, users[u]["home"], users[u]["role"]) + ret += self.getUserContext (u, users[u]["role"]) return ret+"\n" def checkExists(self, home):
Makefile.new renamed from Makefile +1 -1
@@ -221,7 +221,7 @@ @echo "Building file contexts files..." @m4 $(M4PARAM) $(ALL_TUNABLES) tmp/program_used_flags.te $(FCFILES) > [email protected] @grep -v -e HOME -e ROLE [email protected] > $@ - @grep -e HOME -e ROLE [email protected] > $(HOMEDIR_TEMPLATE) + @grep -e HOME -e ROLE -e USER [email protected] > $(HOMEDIR_TEMPLATE) @-rm [email protected] # Create a tags-file for the policy:
domains/program/apache.te +3 -1
@@ -233,7 +233,9 @@ allow httpd_t bin_t:dir search; allow httpd_t sbin_t:dir search; allow httpd_t httpd_log_t:dir remove_name; -r_dir_file(httpd_t, fonts_t) + +read_fonts(httpd_t) +read_mime_types(httpd_t) allow httpd_t self:netlink_route_socket { bind create getattr nlmsg_read read write };
domains/program/cups.te +1 -1
@@ -112,7 +112,7 @@ can_exec(cupsd_t, { shell_exec_t bin_t sbin_t }) # They will also invoke ghostscript, which needs to read fonts -r_dir_file(cupsd_t, fonts_t) +read_fonts(cupsd_t) # Read /usr/lib/gconv/gconv-modules.* and /usr/lib/python2.2/.* allow cupsd_t lib_t:file { read getattr };
domains/program/fontconfig.te +7 -0
@@ -0,0 +1,7 @@ +# +# Fontconfig related types +# +# Author: Ivan Gyurdiev <[email protected]> +# + +# Look in fontconfig_macros.te
domains/program/gconf.te +12 -0
@@ -0,0 +1,12 @@ +# DESC - GConf preference daemon +# +# Author: Ivan Gyurdiev <[email protected]> +# + +# Type for executable +type gconfd_exec_t, file_type, exec_type, sysadmfile; + +# Type for /etc files +type gconf_etc_t, file_type, sysadmfile; + +# Everything else is in macros/gconfd_macros.te
domains/program/gnome.te +7 -0
@@ -0,0 +1,7 @@ +# +# GNOME related types +# +# Author: Ivan Gyurdiev <[email protected]> +# + +# Look in gnome_macros.te
domains/program/lpd.te +1 -1
@@ -20,7 +20,7 @@ allow lpd_t lpd_var_run_t:sock_file create_file_perms; -r_dir_file(lpd_t, fonts_t) +read_fonts(lpd_t) type printer_t, file_type, sysadmfile, dev_fs;
domains/program/mailcap.te +9 -0
@@ -0,0 +1,9 @@ +# +# Mailcap related types +# +# Author: Ivan Gyurdiev <[email protected]> +# + +type mime_types_t, file_type, sysadmfile; + +# Look in mailcap_macros.te
domains/program/orbit.te +7 -0
@@ -0,0 +1,7 @@ +# +# ORBit related types +# +# Author: Ivan Gyurdiev <[email protected]> +# + +# Look in orbit_macros.te
domains/program/rhgb.te +1 -5
@@ -43,9 +43,6 @@ allow rhgb_t port_type:tcp_socket name_connect; can_ypbind(rhgb_t) -# for fonts -allow rhgb_t usr_t:{ file lnk_file } { getattr read }; - # for running setxkbmap r_dir_file(rhgb_t, xkb_var_lib_t)
@@ -68,8 +65,7 @@ tmpfs_domain(rhgb) allow xdm_xserver_t rhgb_tmpfs_t:file { read write }; -allow rhgb_t fonts_t:dir { getattr read search }; -allow rhgb_t fonts_t:file { getattr read }; +read_fonts(rhgb_t) # for nscd dontaudit rhgb_t var_t:dir search;
domains/program/xdm.te +3 -1
@@ -225,7 +225,9 @@ # Read /usr/share/terminfo/l/linux and /usr/share/icons/default/index.theme... allow xdm_t usr_t:{ lnk_file file } { getattr read }; -r_dir_file(xdm_t, fonts_t) + +# Read fonts +read_fonts(xdm_t) # Do not audit attempts to write to index files under /usr dontaudit xdm_t usr_t:file write;
domains/program/xfs.te +2 -3
@@ -37,9 +37,8 @@ allow xfs_t self:unix_stream_socket create_stream_socket_perms; allow xfs_t self:unix_dgram_socket create_socket_perms; -# Read /usr/X11R6/lib/X11/fonts/.* and /usr/share/fonts/.* -allow xfs_t fonts_t:dir search; -allow xfs_t fonts_t:file { getattr read }; +# Read fonts +read_fonts(xfs_t) # Unlink the xfs socket. allow initrc_t xfs_tmp_t:dir rw_dir_perms;
file_contexts/program/gconf.fc +5 -0
@@ -0,0 +1,5 @@ +/usr/libexec/gconfd-2 -- system_u:object_r:gconfd_exec_t +/etc/gconf(/.*)? system_u:object_r:gconf_etc_t +HOME_DIR/\.gconf(/.*)? system_u:object_r:ROLE_gconf_data_t +HOME_DIR/\.gconfd(/.*)? system_u:object_r:ROLE_gconfd_home_t +/tmp/gconfd-USER system_u:object_r:ROLE_gconfd_tmp_t
file_contexts/program/gnome.fc +9 -0
@@ -0,0 +1,9 @@ +HOME_DIR/\.gnome(2)?(/.*)? system_u:object_r:ROLE_gnome_settings_t +HOME_DIR/\.gnome(2)?_private?(/.*)? system_u:object_r:ROLE_gnome_settings_t +HOME_DIR/\.gnome2/share/fonts(/.*)? system_u:object_r:ROLE_fonts_t +HOME_DIR/\.gnome2/share/cursor-fonts(/.*)? system_u:object_r:ROLE_fonts_t +HOME_DIR/\.gtk-bookmarks -- system_u:object_r:ROLE_gnome_data_t +HOME_DIR/\.local(/.*)? system_u:object_r:ROLE_gnome_data_t +HOME_DIR/\.themes(/.)? system_u:object_r:ROLE_gnome_data_t +HOME_DIR/\.icons(/.*)? system_u:object_r:ROLE_gnome_data_t +HOME_DIR/\.thumbnails(/.*)? system_u:object_r:ROLE_gnome_data_t
file_contexts/program/mailcap.fc +8 -0
@@ -0,0 +1,8 @@ +# +# Mime types +# + +/etc/mailcap -- system_u:object_r:mime_types_t +/etc/mime.types -- system_u:object_r:mime_types_t +HOME_DIR/\.mailcap -- system_u:object_r:ROLE_mime_types_t +HOME_DIR/\.mime\.types -- system_u:object_r:ROLE_mime_types_t
file_contexts/program/mozilla.fc +0 -3
@@ -3,9 +3,6 @@ HOME_DIR/\.netscape(/.*)? system_u:object_r:ROLE_mozilla_home_t HOME_DIR/\.mozilla(/.*)? system_u:object_r:ROLE_mozilla_home_t HOME_DIR/\.phoenix(/.*)? system_u:object_r:ROLE_mozilla_home_t -HOME_DIR/\.gconfd(/.*)? system_u:object_r:ROLE_mozilla_home_t -HOME_DIR/\.gconf(/.*)? system_u:object_r:ROLE_mozilla_home_t -HOME_DIR/\.gnome2/epiphany(/.*)? system_u:object_r:ROLE_mozilla_home_t HOME_DIR/My.Downloads(/.*)? system_u:object_r:ROLE_mozilla_home_t HOME_DIR/\.java(/.*)? system_u:object_r:ROLE_mozilla_home_t /usr/bin/netscape -- system_u:object_r:mozilla_exec_t
file_contexts/program/orbit.fc +2 -0
@@ -0,0 +1,2 @@ +/tmp/orbit-USER -d system_u:object_r:ROLE_orbit_tmp_t +/tmp/orbit-USER/bonobo.* -- system_u:object_r:ROLE_orbit_tmp_t
file_contexts/types.fc +1 -12
@@ -58,7 +58,7 @@ # # Mount points; do not relabel subdirectories, since -# we don not want to change any removable media by default. +# we don't want to change any removable media by default. /mnt(/[^/]*)? -d system_u:object_r:mnt_t /mnt/[^/]*/.* <<none>> /media(/[^/]*)? -d system_u:object_r:mnt_t
@@ -388,17 +388,6 @@ /usr/X11R6/man(/.*)? system_u:object_r:man_t # -# Fonts dir -# -/usr/X11R6/lib/X11/fonts(/.*)? system_u:object_r:fonts_t -ifdef(`distro_debian', ` -/var/lib/msttcorefonts(/.*)? system_u:object_r:fonts_t -') -/usr/share/fonts(/.*)? system_u:object_r:fonts_t -/usr/share/ghostscript/fonts(/.*)? system_u:object_r:fonts_t -/usr/local/share/fonts(/.*)? system_u:object_r:fonts_t - -# # /var/run # /var/run(/.*)? system_u:object_r:var_run_t
macros/admin_macros.te +6 -0
@@ -14,11 +14,17 @@ # undefine(`admin_domain') define(`admin_domain',` + # Type for home directory. attribute $1_file_type; type $1_home_dir_t, file_type, sysadmfile, home_dir_type, home_type; type $1_home_t, file_type, sysadmfile, home_type, $1_file_type; +# Type for network content. +type $1_untrusted_content_t, file_type, $1_file_type, sysadmfile, customizable; +create_dir_file($1_t, $1_untrusted_content_t) +allow $1_t $1_untrusted_content_t:{ dir file } { relabelto relabelfrom }; + # Type and access for pty devices. can_create_pty($1, `, admin_tty_type')
macros/base_user_macros.te +26 -2
@@ -75,7 +75,7 @@ # Create, access, and remove files in home directory. file_type_auto_trans($1_t, $1_home_dir_t, $1_home_t) -allow $1_t $1_home_t:notdevfile_class_set { relabelfrom relabelto }; +allow $1_t $1_home_t:{ notdevfile_class_set dir } { relabelfrom relabelto }; can_setfscreate($1_t) allow $1_t autofs_t:dir { search getattr };
@@ -176,7 +176,6 @@ ifdef(`tvtime.te', `tvtime_domain($1)') ifdef(`mozilla.te', `mozilla_domain($1)') ifdef(`samba.te', `samba_domain($1)') -ifdef(`games.te', `games_domain($1)') ifdef(`gpg.te', `gpg_domain($1)') ifdef(`xauth.te', `xauth_domain($1)') ifdef(`startx.te', `xserver_domain($1)')
@@ -189,7 +188,28 @@ ifdef(`uml.te', `uml_domain($1)') ifdef(`cdrecord.te', `cdrecord_domain($1)') ifdef(`mplayer.te', `mplayer_domains($1)') + +# GNOME +ifdef(`gnome.te', ` + +# Base +gnome_domain($1) +gconfd_domain($1) +gconf_client($1, $1) + +# Applications +ifdef(`games.te', `games_domain($1)') ifdef(`gift.te', `gift_domains($1)') +') + +# Fonts, mailcap - required stuff +mailcap_domain($1) +fontconfig_domain($1) + +# ORBit sockets +# Serves double purpose of defining the per/user folder type, +# and letting us create sockets in it +orbit_domain($1, $1) # Instantiate a derived domain for user cron jobs. ifdef(`crond.te', `crond_domain($1)')
@@ -350,6 +370,10 @@ allow $1_t default_t:notdevfile_class_set r_file_perms; } +# Read mime types +read_mime_types($1_t, $1) +read_fonts($1_t, $1) + read_sysctl($1_t); #
macros/global_macros.te +0 -1
@@ -156,7 +156,6 @@ r_dir_file($1, locale_t) ') - ################################### # # access_terminal(domain, typeprefix)
macros/program/apache_macros.te +1 -1
@@ -101,7 +101,7 @@ # Allow the scripts to read, read/write, append to the specified directories # or files ############################################################################ -r_dir_file(httpd_$1_script_t, fonts_t) +read_fonts(httpd_$1_script_t) r_dir_file(httpd_$1_script_t, httpd_$1_script_ro_t) create_dir_file(httpd_$1_script_t, httpd_$1_script_rw_t) ra_dir_file(httpd_$1_script_t, httpd_$1_script_ra_t)
macros/program/fontconfig_macros.te +42 -0
42 lines not on this page · raw message
macros/program/games_domain.te +7 -3
@@ -43,10 +43,14 @@ can_udp_send($1_games_t, $1_games_t) can_tcp_connect($1_games_t, $1_games_t) -# Access /home/user/.gnome2 -create_dir_file($1_games_t, $1_home_t) +# Access /home/user/.gnome2, /home/user/.themes +allow $1_games_t $1_gnome_settings_t:dir rw_dir_perms; +allow $1_games_t $1_gnome_settings_t:file create_file_perms; allow $1_games_t $1_home_dir_t:dir { read getattr search }; -allow $1_games_t $1_home_t:dir { read getattr }; +r_dir_file($1_games_t, $1_gnome_data_t) + +# Connect to gconf +gconf_client($1_games, $1) create_dir_file($1_games_t, $1_tmp_t) allow $1_games_t $1_tmp_t:sock_file create_file_perms;
macros/program/gconf_macros.te +65 -0
65 lines not on this page · raw message
macros/program/gift_macros.te +10 -15
@@ -32,9 +32,15 @@ # Self permissions allow $1_gift_t self:process getsched; +allow $1_gift_t self:fifo_file { read write }; # Fonts, icons r_dir_file($1_gift_t, usr_t) +r_dir_file($1_gift_t, $1_gnome_data_t) +read_fonts($1_gift_t) + +# Connect to gconf +gconf_client($1_gift, $1) # Launch gift daemon allow $1_gift_t bin_t:dir search;
@@ -53,23 +59,9 @@ allow $1_gift_t etc_t:file { getattr read }; allow $1_gift_t etc_runtime_t:file { getattr read }; -# Tmp/ORBit -tmp_domain($1_gift) -file_type_auto_trans($1_gift_t, $1_tmp_t, $1_gift_tmp_t) -can_unix_connect($1_t, $1_gift_t) -can_unix_connect($1_gift_t, $1_t) -allow $1_t $1_gift_tmp_t:sock_file write; -allow $1_gift_t $1_tmp_t:file { getattr read write lock }; -allow $1_gift_t $1_tmp_t:sock_file { read write }; -dontaudit $1_gift_t $1_tmp_t:dir setattr; - # Access random device allow $1_gift_t urandom_device_t:chr_file { read getattr ioctl }; -# giftui looks in .icons, .themes, .fonts-cache. -dontaudit $1_gift_t $1_home_t:dir { getattr read search }; -dontaudit $1_gift_t $1_home_t:file { getattr read unlink }; - ') dnl gift_domain ##########################
@@ -102,9 +94,12 @@ # Access home domain home_domain_access($1_giftd_t, $1, gift) + +# Allow gift to create untrusted content +create_dir_file($1_giftd_t, $1_untrusted_content_t) # Allow networking -allow $1_giftd_t port_t:tcp_socket name_bind; +allow $1_giftd_t port_t:tcp_socket { name_bind name_connect }; allow $1_giftd_t port_t:udp_socket name_bind; can_network_server($1_giftd_t) can_network_client($1_giftd_t)
macros/program/gnome_macros.te +16 -0
@@ -0,0 +1,16 @@ +# +# GNOME related types +# +# Author: Ivan Gyurdiev <[email protected]> +# +# gnome_domain(role_prefix) - create GNOME domain + +define(`gnome_domain', ` + +type $1_gnome_settings_t, file_type, $1_file_type, sysadmfile; +type $1_gnome_data_t, file_type, $1_file_type, sysadmfile; + +create_dir_file($1_t, $1_gnome_settings_t) +create_dir_file($1_t, $1_gnome_data_t) + +') dnl gnome_domain
macros/program/gpg_agent_macros.te +1 -1
@@ -89,7 +89,7 @@ allow $1_gpg_pinentry_t xdm_t:fd use; ')dnl end ig xdm.te -r_dir_file($1_gpg_pinentry_t, fonts_t) +read_fonts($1_gpg_pinentry_t, $1) # read kde font cache allow $1_gpg_pinentry_t usr_t:file { getattr read };
macros/program/java_macros.te +3 -5
@@ -4,7 +4,7 @@ # Macros for javaplugin (java plugin) domains. # # -# javaplugin_domain(domain_prefix, user) +# javaplugin_domain(domain_prefix, role) # # Define a derived domain for the javaplugin program when executed by # a web browser.
@@ -44,7 +44,8 @@ allow $1_javaplugin_t sysctl_vm_t:dir search; tmp_domain($1_javaplugin) -r_dir_file($1_javaplugin_t,{ fonts_t usr_t etc_t }) +read_fonts($1_javaplugin_t, $2) +r_dir_file($1_javaplugin_t,{ usr_t etc_t }) # Search bin directory under javaplugin for javaplugin executable allow $1_javaplugin_t bin_t:dir search;
@@ -91,7 +92,4 @@ dontaudit $1_javaplugin_t tmpfs_t:file { execute read write }; dontaudit $1_javaplugin_t $1_home_t:file { execute setattr }; -# Do not audit read/getattr of .fonts-cache-1 -dontaudit $1_javaplugin_t $1_home_t:file { read getattr }; - ')
macros/program/mailcap_macros.te +25 -0
@@ -0,0 +1,25 @@ +# +# Mailcap related types +# +# Author: Ivan Gyurdiev <[email protected]> +# +# mailcap_domain(role_prefix) - create mailcap domain +# +# read_mime_types(domain, role_prefix) - +# allow domain to read mime types, optionally per/user + +define(`mailcap_domain', ` + +type $1_mime_types_t, file_type, $1_file_type, sysadmfile; + +create_dir_file($1_t, $1_mime_types_t) + +') dnl gnome_domain + +define(`read_mime_types', ` +allow $1 mime_types_t:file r_file_perms; +ifelse(`$2', `', `', ` +allow $1 $2_mime_types_t:file r_file_perms; +') +') +
macros/program/mozilla_macros.te +46 -48
153 lines not on this page · raw message
macros/program/orbit_macros.te +28 -0
@@ -0,0 +1,28 @@ +# +# ORBit related types +# +# Author: Ivan Gyurdiev <[email protected]> +# +# orbit_domain(prefix, role) - create ORBit sockets +# orbit_connect(type1, type2) - allow communication through ORBit sockets + +define(`orbit_domain', ` +ifdef(`$1_orbit_tmp_t_defined',`', ` +define(`$1_orbit_tmp_t_defined') +type $1_orbit_tmp_t, file_type, sysadmfile; +file_type_auto_trans($1_t, $2_orbit_tmp_t, $1_orbit_tmp_t, sock_file) + +allow $1_t self:unix_stream_socket create_stream_socket_perms; +allow $1_t self:unix_dgram_socket create_socket_perms; + +allow $1_t $2_orbit_tmp_t:file { getattr read write lock }; +dontaudit $1_t $2_orbit_tmp_t:dir setattr; +') +') + +define(`orbit_connect', ` +can_unix_connect($1_t, $2_t) +can_unix_connect($2_t, $1_t) +allow $1_t $2_orbit_tmp_t:sock_file { read write }; +allow $2_t $1_orbit_tmp_t:sock_file { read write }; +')
macros/program/x_client_macros.te +1 -1
@@ -74,7 +74,7 @@ allow $1_t self:shm create_shm_perms; # allow X client to read all font files -r_dir_file($1_t, fonts_t) +read_fonts($1_t, $2) # Allow connections to X server. ifdef(`xserver.te', `
macros/program/xserver_macros.te +16 -4
@@ -79,6 +79,14 @@ allow xdm_xserver_t init_t:fd use; dontaudit xdm_xserver_t home_dir_type:dir { read search }; + +# Suppress fonts denials +disallow_home_fonts(xdm_xserver_t, user) +disallow_home_fonts(xdm_xserver_t, staff) +disallow_home_fonts(xdm_xserver_t, sysadm) + +# Read global fonts +read_fonts(xdm_xserver_t) ', ` # The user role is authorized for this domain. role $1_r types $1_xserver_t;
@@ -95,9 +103,15 @@ # Access the home directory. allow $1_xserver_t home_root_t:dir search; allow $1_xserver_t $1_home_dir_t:dir { getattr search }; + +# Suppress fonts denials +disallow_home_fonts($1_xserver_t, $1) + +# Now re-enable according to boolean if (allow_xserver_home_fonts) { -r_dir_file($1_xserver_t, $1_home_t) -} +read_fonts($1_xserver_t, $1) +} + ifdef(`xauth.te', ` domain_auto_trans($1_xserver_t, xauth_exec_t, $1_xauth_t) allow $1_xserver_t $1_xauth_home_t:file { getattr read };
@@ -263,8 +277,6 @@ allow $1_xserver_t var_lib_t:dir search; rw_dir_create_file($1_xserver_t, xkb_var_lib_t) -# for fonts -r_dir_file($1_xserver_t, fonts_t) ')dnl end macro definition ', `
macros/user_macros.te +5 -0
@@ -21,6 +21,11 @@ type $1_home_dir_t, file_type, sysadmfile, home_dir_type, home_type, user_home_dir_type; type $1_home_t, file_type, sysadmfile, home_type, user_home_type, $1_file_type; +# Type for network content. +type $1_untrusted_content_t, file_type, $1_file_type, sysadmfile, customizable; +create_dir_file($1_t, $1_untrusted_content_t) +allow $1_t $1_untrusted_content_t:{ dir file } { relabelto relabelfrom }; + tmp_domain($1, `, user_tmpfile, $1_file_type', `{ file lnk_file dir sock_file fifo_file }') base_user_domain($1)
Re: Restrict Home v. 3
Quoted 2 lines · Ivan Gyurdiev
Here's version 2 of this patch, still not in
merge-able state, but getting closer.
..and version 3 - adds policy for gnome_vfs_daemon, and allows mozilla to communicate w/ it over ORBit.
Also centralizes the gnome stuff into one gnome_domain() call, which makes things easier.
Adds a new attribute called mount_point for every mount point, and uses that to grant mounton to mount, and getattr to gnome_vfs_daemon.
Is binfmt_misc_fs_t a mount point? Marked it as such, because of denials, but I'm not sure.
Also, this makes bonobo-activation-server run in the gnome-vfs-daemon domain as a side effect - is this a bad thing? I haven't seen denials yet...
Patch attached.
Signature · 2 lines
Ivan Gyurdiev <[email protected]> Cornell University
attrib.te +6 -0
@@ -265,6 +265,12 @@ # overall filesystem statistics. attribute fs_type; +# The mount_point attribute identifies all types that can serve +# as a mount point (for the mount binary). It is used in the mount +# policy to grant mounton permission, and in other domains to grant +# getattr permission over all the mount points. +attribute mount_point; + # The exec_type attribute identifies all types assigned # to entrypoint executables for domains. This attribute is # used in TE rules and assertions that should be applied to all
domains/program/apache.te +3 -1
@@ -233,7 +233,9 @@ allow httpd_t bin_t:dir search; allow httpd_t sbin_t:dir search; allow httpd_t httpd_log_t:dir remove_name; -r_dir_file(httpd_t, fonts_t) + +read_fonts(httpd_t) +read_mime_types(httpd_t) allow httpd_t self:netlink_route_socket { bind create getattr nlmsg_read read write };
domains/program/cups.te +1 -1
@@ -112,7 +112,7 @@ can_exec(cupsd_t, { shell_exec_t bin_t sbin_t }) # They will also invoke ghostscript, which needs to read fonts -r_dir_file(cupsd_t, fonts_t) +read_fonts(cupsd_t) # Read /usr/lib/gconv/gconv-modules.* and /usr/lib/python2.2/.* allow cupsd_t lib_t:file { read getattr };
domains/program/fontconfig.te +7 -0
@@ -0,0 +1,7 @@ +# +# Fontconfig related types +# +# Author: Ivan Gyurdiev <[email protected]> +# + +# Look in fontconfig_macros.te
domains/program/gconf.te +12 -0
@@ -0,0 +1,12 @@ +# DESC - GConf preference daemon +# +# Author: Ivan Gyurdiev <[email protected]> +# + +# Type for executable +type gconfd_exec_t, file_type, exec_type, sysadmfile; + +# Type for /etc files +type gconf_etc_t, file_type, sysadmfile; + +# Everything else is in macros/gconfd_macros.te
domains/program/gnome.te +7 -0
@@ -0,0 +1,7 @@ +# +# GNOME related types +# +# Author: Ivan Gyurdiev <[email protected]> +# + +# Look in gnome_macros.te
domains/program/gnome_vfs.te +9 -0
@@ -0,0 +1,9 @@ +# DESC - GNOME-vfs daemon +# +# Author: Ivan Gyurdiev <[email protected]> +# + +# Type for executable +type gnome_vfsd_exec_t, file_type, exec_type, sysadmfile; + +# Everything else is in macros/gnome_vfsd_macros.te
domains/program/lpd.te +1 -1
@@ -20,7 +20,7 @@ allow lpd_t lpd_var_run_t:sock_file create_file_perms; -r_dir_file(lpd_t, fonts_t) +read_fonts(lpd_t) type printer_t, file_type, sysadmfile, dev_fs;
domains/program/mailcap.te +9 -0
@@ -0,0 +1,9 @@ +# +# Mailcap related types +# +# Author: Ivan Gyurdiev <[email protected]> +# + +type mime_types_t, file_type, sysadmfile; + +# Look in mailcap_macros.te
domains/program/mount.te +2 -26
@@ -37,29 +37,9 @@ # Mount, remount and unmount file systems. allow mount_t fs_type:filesystem mount_fs_perms; -allow mount_t default_t:dir mounton; -allow mount_t file_t:dir mounton; -allow mount_t usr_t:dir mounton; -allow mount_t src_t:dir mounton; -allow mount_t var_t:dir mounton; -allow mount_t proc_t:dir mounton; -allow mount_t root_t:dir mounton; -allow mount_t home_root_t:dir mounton; -allow mount_t tmp_t:dir mounton; -allow mount_t mnt_t:dir mounton; -allow mount_t devpts_t:dir mounton; -allow mount_t usbdevfs_t:dir mounton; -allow mount_t sysfs_t:dir mounton; -allow mount_t nfs_t:dir mounton; +allow mount_t mount_point:dir mounton; allow mount_t nfs_t:dir search; -# nfsv4 has a filesystem to mount for its userspace daemons -allow mount_t var_lib_nfs_t:dir mounton; - -# On some RedHat systems, /boot is a mount point -allow mount_t boot_t:dir mounton; -allow mount_t device_t:dir mounton; -# mount binfmt_misc on /proc/sys/fs/binfmt_misc -allow mount_t sysctl_t:dir { mounton search }; +allow mount_t sysctl_t:dir search; allow mount_t root_t:filesystem unmount;
@@ -99,11 +79,7 @@ allow mount_t userdomain:fd use; can_exec(mount_t, { sbin_t bin_t }) allow mount_t device_t:dir r_dir_perms; -ifdef(`distro_redhat', ` allow mount_t tmpfs_t:chr_file { read write }; -allow mount_t tmpfs_t:dir mounton; -') - # tries to read /init dontaudit mount_t root_t:file { getattr read };
domains/program/orbit.te +7 -0
@@ -0,0 +1,7 @@ +# +# ORBit related types +# +# Author: Ivan Gyurdiev <[email protected]> +# + +# Look in orbit_macros.te
domains/program/rhgb.te +1 -5
@@ -43,9 +43,6 @@ allow rhgb_t port_type:tcp_socket name_connect; can_ypbind(rhgb_t) -# for fonts -allow rhgb_t usr_t:{ file lnk_file } { getattr read }; - # for running setxkbmap r_dir_file(rhgb_t, xkb_var_lib_t)
@@ -68,8 +65,7 @@ tmpfs_domain(rhgb) allow xdm_xserver_t rhgb_tmpfs_t:file { read write }; -allow rhgb_t fonts_t:dir { getattr read search }; -allow rhgb_t fonts_t:file { getattr read }; +read_fonts(rhgb_t) # for nscd dontaudit rhgb_t var_t:dir search;
domains/program/xdm.te +3 -1
@@ -225,7 +225,9 @@ # Read /usr/share/terminfo/l/linux and /usr/share/icons/default/index.theme... allow xdm_t usr_t:{ lnk_file file } { getattr read }; -r_dir_file(xdm_t, fonts_t) + +# Read fonts +read_fonts(xdm_t) # Do not audit attempts to write to index files under /usr dontaudit xdm_t usr_t:file write;
domains/program/xfs.te +2 -3
@@ -37,9 +37,8 @@ allow xfs_t self:unix_stream_socket create_stream_socket_perms; allow xfs_t self:unix_dgram_socket create_socket_perms; -# Read /usr/X11R6/lib/X11/fonts/.* and /usr/share/fonts/.* -allow xfs_t fonts_t:dir search; -allow xfs_t fonts_t:file { getattr read }; +# Read fonts +read_fonts(xfs_t) # Unlink the xfs socket. allow initrc_t xfs_tmp_t:dir rw_dir_perms;
file_contexts/program/gconf.fc +5 -0
@@ -0,0 +1,5 @@ +/usr/libexec/gconfd-2 -- system_u:object_r:gconfd_exec_t +/etc/gconf(/.*)? system_u:object_r:gconf_etc_t +HOME_DIR/\.gconf(/.*)? system_u:object_r:ROLE_gconf_data_t +HOME_DIR/\.gconfd(/.*)? system_u:object_r:ROLE_gconfd_home_t +/tmp/gconfd-USER system_u:object_r:ROLE_gconfd_tmp_t
file_contexts/program/gnome.fc +9 -0
@@ -0,0 +1,9 @@ +HOME_DIR/\.gnome(2)?(/.*)? system_u:object_r:ROLE_gnome_settings_t +HOME_DIR/\.gnome(2)?_private?(/.*)? system_u:object_r:ROLE_gnome_settings_t +HOME_DIR/\.gnome2/share/fonts(/.*)? system_u:object_r:ROLE_fonts_t +HOME_DIR/\.gnome2/share/cursor-fonts(/.*)? system_u:object_r:ROLE_fonts_t +HOME_DIR/\.gtk-bookmarks -- system_u:object_r:ROLE_gnome_data_t +HOME_DIR/\.local(/.*)? system_u:object_r:ROLE_gnome_data_t +HOME_DIR/\.themes(/.)? system_u:object_r:ROLE_gnome_data_t +HOME_DIR/\.icons(/.*)? system_u:object_r:ROLE_gnome_data_t +HOME_DIR/\.thumbnails(/.*)? system_u:object_r:ROLE_gnome_data_t
file_contexts/program/gnome_vfs.fc +1 -0
@@ -0,0 +1 @@ +/usr/libexec/gnome-vfs-daemon -- system_u:object_r:gnome_vfsd_exec_t
file_contexts/program/mailcap.fc +8 -0
@@ -0,0 +1,8 @@ +# +# Mime types +# + +/etc/mailcap -- system_u:object_r:mime_types_t +/etc/mime.types -- system_u:object_r:mime_types_t +HOME_DIR/\.mailcap -- system_u:object_r:ROLE_mime_types_t +HOME_DIR/\.mime\.types -- system_u:object_r:ROLE_mime_types_t
file_contexts/program/mozilla.fc +0 -3
@@ -3,9 +3,6 @@ HOME_DIR/\.netscape(/.*)? system_u:object_r:ROLE_mozilla_home_t HOME_DIR/\.mozilla(/.*)? system_u:object_r:ROLE_mozilla_home_t HOME_DIR/\.phoenix(/.*)? system_u:object_r:ROLE_mozilla_home_t -HOME_DIR/\.gconfd(/.*)? system_u:object_r:ROLE_mozilla_home_t -HOME_DIR/\.gconf(/.*)? system_u:object_r:ROLE_mozilla_home_t -HOME_DIR/\.gnome2/epiphany(/.*)? system_u:object_r:ROLE_mozilla_home_t HOME_DIR/My.Downloads(/.*)? system_u:object_r:ROLE_mozilla_home_t HOME_DIR/\.java(/.*)? system_u:object_r:ROLE_mozilla_home_t /usr/bin/netscape -- system_u:object_r:mozilla_exec_t
file_contexts/program/orbit.fc +2 -0
@@ -0,0 +1,2 @@ +/tmp/orbit-USER -d system_u:object_r:ROLE_orbit_tmp_t +/tmp/orbit-USER/bonobo.* -- system_u:object_r:ROLE_orbit_tmp_t
file_contexts/types.fc +1 -12
@@ -58,7 +58,7 @@ # # Mount points; do not relabel subdirectories, since -# we don not want to change any removable media by default. +# we don't want to change any removable media by default. /mnt(/[^/]*)? -d system_u:object_r:mnt_t /mnt/[^/]*/.* <<none>> /media(/[^/]*)? -d system_u:object_r:mnt_t
@@ -388,17 +388,6 @@ /usr/X11R6/man(/.*)? system_u:object_r:man_t # -# Fonts dir -# -/usr/X11R6/lib/X11/fonts(/.*)? system_u:object_r:fonts_t -ifdef(`distro_debian', ` -/var/lib/msttcorefonts(/.*)? system_u:object_r:fonts_t -') -/usr/share/fonts(/.*)? system_u:object_r:fonts_t -/usr/share/ghostscript/fonts(/.*)? system_u:object_r:fonts_t -/usr/local/share/fonts(/.*)? system_u:object_r:fonts_t - -# # /var/run # /var/run(/.*)? system_u:object_r:var_run_t
macros/admin_macros.te +6 -0
@@ -14,11 +14,17 @@ # undefine(`admin_domain') define(`admin_domain',` + # Type for home directory. attribute $1_file_type; type $1_home_dir_t, file_type, sysadmfile, home_dir_type, home_type; type $1_home_t, file_type, sysadmfile, home_type, $1_file_type; +# Type for network content. +type $1_untrusted_content_t, file_type, $1_file_type, sysadmfile, customizable; +create_dir_file($1_t, $1_untrusted_content_t) +allow $1_t $1_untrusted_content_t:{ dir file } { relabelto relabelfrom }; + # Type and access for pty devices. can_create_pty($1, `, admin_tty_type')
macros/base_user_macros.te +15 -2
@@ -75,7 +75,7 @@ # Create, access, and remove files in home directory. file_type_auto_trans($1_t, $1_home_dir_t, $1_home_t) -allow $1_t $1_home_t:notdevfile_class_set { relabelfrom relabelto }; +allow $1_t $1_home_t:{ notdevfile_class_set dir } { relabelfrom relabelto }; can_setfscreate($1_t) allow $1_t autofs_t:dir { search getattr };
@@ -176,7 +176,6 @@ ifdef(`tvtime.te', `tvtime_domain($1)') ifdef(`mozilla.te', `mozilla_domain($1)') ifdef(`samba.te', `samba_domain($1)') -ifdef(`games.te', `games_domain($1)') ifdef(`gpg.te', `gpg_domain($1)') ifdef(`xauth.te', `xauth_domain($1)') ifdef(`startx.te', `xserver_domain($1)')
@@ -189,7 +188,17 @@ ifdef(`uml.te', `uml_domain($1)') ifdef(`cdrecord.te', `cdrecord_domain($1)') ifdef(`mplayer.te', `mplayer_domains($1)') + +# GNOME +ifdef(`gnome.te', ` +gnome_domain($1) +ifdef(`games.te', `games_domain($1)') ifdef(`gift.te', `gift_domains($1)') +') + +# Fonts, mailcap - required stuff +mailcap_domain($1) +fontconfig_domain($1) # Instantiate a derived domain for user cron jobs. ifdef(`crond.te', `crond_domain($1)')
@@ -350,6 +359,10 @@ allow $1_t default_t:notdevfile_class_set r_file_perms; } +# Read mime types +read_mime_types($1_t, $1) +read_fonts($1_t, $1) + read_sysctl($1_t); #
macros/global_macros.te +0 -1
@@ -156,7 +156,6 @@ r_dir_file($1, locale_t) ') - ################################### # # access_terminal(domain, typeprefix)
macros/program/apache_macros.te +1 -1
@@ -101,7 +101,7 @@ # Allow the scripts to read, read/write, append to the specified directories # or files ############################################################################ -r_dir_file(httpd_$1_script_t, fonts_t) +read_fonts(httpd_$1_script_t) r_dir_file(httpd_$1_script_t, httpd_$1_script_ro_t) create_dir_file(httpd_$1_script_t, httpd_$1_script_rw_t) ra_dir_file(httpd_$1_script_t, httpd_$1_script_ra_t)
macros/program/fontconfig_macros.te +42 -0
42 lines not on this page · raw message
macros/program/games_domain.te +7 -3
@@ -43,10 +43,14 @@ can_udp_send($1_games_t, $1_games_t) can_tcp_connect($1_games_t, $1_games_t) -# Access /home/user/.gnome2 -create_dir_file($1_games_t, $1_home_t) +# Access /home/user/.gnome2, /home/user/.themes +allow $1_games_t $1_gnome_settings_t:dir rw_dir_perms; +allow $1_games_t $1_gnome_settings_t:file create_file_perms; allow $1_games_t $1_home_dir_t:dir { read getattr search }; -allow $1_games_t $1_home_t:dir { read getattr }; +r_dir_file($1_games_t, $1_gnome_data_t) + +# Connect to gconf +gconf_client($1_games, $1) create_dir_file($1_games_t, $1_tmp_t) allow $1_games_t $1_tmp_t:sock_file create_file_perms;
macros/program/gconf_macros.te +67 -0
67 lines not on this page · raw message
macros/program/gift_macros.te +10 -15
@@ -32,9 +32,15 @@ # Self permissions allow $1_gift_t self:process getsched; +allow $1_gift_t self:fifo_file { read write }; # Fonts, icons r_dir_file($1_gift_t, usr_t) +r_dir_file($1_gift_t, $1_gnome_data_t) +read_fonts($1_gift_t) + +# Connect to gconf +gconf_client($1_gift, $1) # Launch gift daemon allow $1_gift_t bin_t:dir search;
@@ -53,23 +59,9 @@ allow $1_gift_t etc_t:file { getattr read }; allow $1_gift_t etc_runtime_t:file { getattr read }; -# Tmp/ORBit -tmp_domain($1_gift) -file_type_auto_trans($1_gift_t, $1_tmp_t, $1_gift_tmp_t) -can_unix_connect($1_t, $1_gift_t) -can_unix_connect($1_gift_t, $1_t) -allow $1_t $1_gift_tmp_t:sock_file write; -allow $1_gift_t $1_tmp_t:file { getattr read write lock }; -allow $1_gift_t $1_tmp_t:sock_file { read write }; -dontaudit $1_gift_t $1_tmp_t:dir setattr; - # Access random device allow $1_gift_t urandom_device_t:chr_file { read getattr ioctl }; -# giftui looks in .icons, .themes, .fonts-cache. -dontaudit $1_gift_t $1_home_t:dir { getattr read search }; -dontaudit $1_gift_t $1_home_t:file { getattr read unlink }; - ') dnl gift_domain ##########################
@@ -102,9 +94,12 @@ # Access home domain home_domain_access($1_giftd_t, $1, gift) + +# Allow gift to create untrusted content +create_dir_file($1_giftd_t, $1_untrusted_content_t) # Allow networking -allow $1_giftd_t port_t:tcp_socket name_bind; +allow $1_giftd_t port_t:tcp_socket { name_bind name_connect }; allow $1_giftd_t port_t:udp_socket name_bind; can_network_server($1_giftd_t) can_network_client($1_giftd_t)
macros/program/gnome_macros.te +22 -0
@@ -0,0 +1,22 @@ +# +# GNOME related types +# +# Author: Ivan Gyurdiev <[email protected]> +# +# gnome_domain(role_prefix) - create GNOME domain + +define(`gnome_domain', ` + +type $1_gnome_settings_t, file_type, $1_file_type, sysadmfile; +type $1_gnome_data_t, file_type, $1_file_type, sysadmfile; + +create_dir_file($1_t, $1_gnome_settings_t) +create_dir_file($1_t, $1_gnome_data_t) + +gconfd_domain($1) +gconf_client($1, $1) +gnome_vfs_domain($1) +gnome_vfs_client($1, $1) +orbit_domain($1) + +') dnl gnome_domain
macros/program/gnome_vfs_macros.te +79 -0
79 lines not on this page · raw message
macros/program/gpg_agent_macros.te +1 -1
@@ -89,7 +89,7 @@ allow $1_gpg_pinentry_t xdm_t:fd use; ')dnl end ig xdm.te -r_dir_file($1_gpg_pinentry_t, fonts_t) +read_fonts($1_gpg_pinentry_t, $1) # read kde font cache allow $1_gpg_pinentry_t usr_t:file { getattr read };
macros/program/java_macros.te +3 -5
@@ -4,7 +4,7 @@ # Macros for javaplugin (java plugin) domains. # # -# javaplugin_domain(domain_prefix, user) +# javaplugin_domain(domain_prefix, role) # # Define a derived domain for the javaplugin program when executed by # a web browser.
@@ -44,7 +44,8 @@ allow $1_javaplugin_t sysctl_vm_t:dir search; tmp_domain($1_javaplugin) -r_dir_file($1_javaplugin_t,{ fonts_t usr_t etc_t }) +read_fonts($1_javaplugin_t, $2) +r_dir_file($1_javaplugin_t,{ usr_t etc_t }) # Search bin directory under javaplugin for javaplugin executable allow $1_javaplugin_t bin_t:dir search;
@@ -91,7 +92,4 @@ dontaudit $1_javaplugin_t tmpfs_t:file { execute read write }; dontaudit $1_javaplugin_t $1_home_t:file { execute setattr }; -# Do not audit read/getattr of .fonts-cache-1 -dontaudit $1_javaplugin_t $1_home_t:file { read getattr }; - ')
macros/program/mailcap_macros.te +25 -0
@@ -0,0 +1,25 @@ +# +# Mailcap related types +# +# Author: Ivan Gyurdiev <[email protected]> +# +# mailcap_domain(role_prefix) - create mailcap domain +# +# read_mime_types(domain, role_prefix) - +# allow domain to read mime types, optionally per/user + +define(`mailcap_domain', ` + +type $1_mime_types_t, file_type, $1_file_type, sysadmfile; + +create_dir_file($1_t, $1_mime_types_t) + +') dnl gnome_domain + +define(`read_mime_types', ` +allow $1 mime_types_t:file r_file_perms; +ifelse(`$2', `', `', ` +allow $1 $2_mime_types_t:file r_file_perms; +') +') +
macros/program/mozilla_macros.te +47 -48
154 lines not on this page · raw message
macros/program/orbit_macros.te +28 -0
@@ -0,0 +1,28 @@ +# +# ORBit related types +# +# Author: Ivan Gyurdiev <[email protected]> +# +# orbit_domain(prefix, role) - create ORBit sockets +# orbit_connect(type1, type2) - allow communication through ORBit sockets + +define(`orbit_domain', ` +ifdef(`$1_orbit_tmp_t_defined',`', ` +define(`$1_orbit_tmp_t_defined') +type $1_orbit_tmp_t, file_type, sysadmfile; +file_type_auto_trans($1_t, $2_orbit_tmp_t, $1_orbit_tmp_t, sock_file) + +allow $1_t self:unix_stream_socket create_stream_socket_perms; +allow $1_t self:unix_dgram_socket create_socket_perms; + +allow $1_t $2_orbit_tmp_t:file { getattr read write lock }; +dontaudit $1_t $2_orbit_tmp_t:dir setattr; +') +') + +define(`orbit_connect', ` +can_unix_connect($1_t, $2_t) +can_unix_connect($2_t, $1_t) +allow $1_t $2_orbit_tmp_t:sock_file { read write }; +allow $2_t $1_orbit_tmp_t:sock_file { read write }; +')
macros/program/x_client_macros.te +1 -1
@@ -74,7 +74,7 @@ allow $1_t self:shm create_shm_perms; # allow X client to read all font files -r_dir_file($1_t, fonts_t) +read_fonts($1_t, $2) # Allow connections to X server. ifdef(`xserver.te', `
macros/program/xserver_macros.te +16 -4
@@ -79,6 +79,14 @@ allow xdm_xserver_t init_t:fd use; dontaudit xdm_xserver_t home_dir_type:dir { read search }; + +# Suppress fonts denials +disallow_home_fonts(xdm_xserver_t, user) +disallow_home_fonts(xdm_xserver_t, staff) +disallow_home_fonts(xdm_xserver_t, sysadm) + +# Read global fonts +read_fonts(xdm_xserver_t) ', ` # The user role is authorized for this domain. role $1_r types $1_xserver_t;
@@ -95,9 +103,15 @@ # Access the home directory. allow $1_xserver_t home_root_t:dir search; allow $1_xserver_t $1_home_dir_t:dir { getattr search }; + +# Suppress fonts denials +disallow_home_fonts($1_xserver_t, $1) + +# Now re-enable according to boolean if (allow_xserver_home_fonts) { -r_dir_file($1_xserver_t, $1_home_t) -} +read_fonts($1_xserver_t, $1) +} + ifdef(`xauth.te', ` domain_auto_trans($1_xserver_t, xauth_exec_t, $1_xauth_t) allow $1_xserver_t $1_xauth_home_t:file { getattr read };
@@ -263,8 +277,6 @@ allow $1_xserver_t var_lib_t:dir search; rw_dir_create_file($1_xserver_t, xkb_var_lib_t) -# for fonts -r_dir_file($1_xserver_t, fonts_t) ')dnl end macro definition ', `
macros/user_macros.te +5 -0
@@ -21,6 +21,11 @@ type $1_home_dir_t, file_type, sysadmfile, home_dir_type, home_type, user_home_dir_type; type $1_home_t, file_type, sysadmfile, home_type, user_home_type, $1_file_type; +# Type for network content. +type $1_untrusted_content_t, file_type, $1_file_type, sysadmfile, customizable; +create_dir_file($1_t, $1_untrusted_content_t) +allow $1_t $1_untrusted_content_t:{ dir file } { relabelto relabelfrom }; + tmp_domain($1, `, user_tmpfile, $1_file_type', `{ file lnk_file dir sock_file fifo_file }') base_user_domain($1)
types/device.te +1 -1
@@ -10,7 +10,7 @@ # # device_t is the type of /dev. # -type device_t, file_type, dev_fs; +type device_t, file_type, mount_point, dev_fs; # # null_device_t is the type of /dev/null.
types/devpts.te +1 -1
@@ -16,6 +16,6 @@ # devpts_t is the type of the devpts file system and # the type of the root directory of the file system. # -type devpts_t, fs_type; +type devpts_t, mount_point, fs_type;
types/file.te +17 -17
@@ -23,37 +23,37 @@ type eventpollfs_t, fs_type; type futexfs_t, fs_type; type bdev_t, fs_type; -type usbfs_t, fs_type; +type usbfs_t, mount_point, fs_type; type nfsd_fs_t, fs_type; type rpc_pipefs_t, fs_type; -type binfmt_misc_fs_t, fs_type; +type binfmt_misc_fs_t, mount_point, fs_type; # # file_t is the default type of a file that has not yet been # assigned an extended attribute (EA) value (when using a filesystem # that supports EAs). # -type file_t, file_type, sysadmfile; +type file_t, file_type, mount_point, sysadmfile; # default_t is the default type for files that do not # match any specification in the file_contexts configuration # other than the generic /.* specification. -type default_t, file_type, sysadmfile; +type default_t, file_type, mount_point, sysadmfile; # # root_t is the type for the root directory. # -type root_t, file_type, sysadmfile; +type root_t, file_type, mount_point, sysadmfile; # # mnt_t is the type for mount points such as /mnt/cdrom -type mnt_t, file_type, sysadmfile; +type mnt_t, file_type, mount_point, sysadmfile; # # home_root_t is the type for the directory where user home directories # are created # -type home_root_t, file_type, sysadmfile; +type home_root_t, file_type, mount_point, sysadmfile; # # lost_found_t is the type for the lost+found directories.
@@ -64,7 +64,7 @@ # boot_t is the type for files in /boot, # including the kernel. # -type boot_t, file_type, sysadmfile; +type boot_t, file_type, mount_point, sysadmfile; # system_map_t is for the system.map files in /boot type system_map_t, file_type, sysadmfile;
@@ -77,7 +77,7 @@ # # tmp_t is the type of /tmp and /var/tmp. # -type tmp_t, file_type, sysadmfile, tmpfile; +type tmp_t, file_type, mount_point, sysadmfile, tmpfile; # # etc_t is the type of the system etc directories.
@@ -171,17 +171,17 @@ # # usr_t is the type for /usr. # -type usr_t, file_type, sysadmfile; +type usr_t, file_type, mount_point, sysadmfile; # # src_t is the type of files in the system src directories. # -type src_t, file_type, sysadmfile; +type src_t, file_type, mount_point, sysadmfile; # # var_t is the type for /var. # -type var_t, file_type, sysadmfile; +type var_t, file_type, mount_point, sysadmfile; # # Types for subdirectories of /var.
@@ -190,7 +190,7 @@ type var_log_t, file_type, sysadmfile, logfile; type faillog_t, file_type, sysadmfile, logfile; type var_lock_t, file_type, sysadmfile, lockfile; -type var_lib_t, file_type, sysadmfile; +type var_lib_t, mount_point, file_type, sysadmfile; # for /var/{spool,lib}/texmf index files type tetex_data_t, file_type, sysadmfile, tmpfile; type var_spool_t, file_type, sysadmfile, tmpfile;
@@ -203,7 +203,7 @@ type lastlog_t, file_type, sysadmfile, logfile; # Type for /var/lib/nfs. -type var_lib_nfs_t, file_type, sysadmfile, usercanread; +type var_lib_nfs_t, file_type, mount_point, sysadmfile, usercanread; # # wtmp_t is the type of /var/log/wtmp.
@@ -275,7 +275,7 @@ # Allow the pty to be associated with the file system. allow devpts_t self:filesystem associate; -type tmpfs_t, file_type, sysadmfile, fs_type; +type tmpfs_t, file_type, mount_point, sysadmfile, fs_type; allow { tmpfs_t tmpfile } tmpfs_t:filesystem associate; allow tmpfile tmp_t:filesystem associate; ifdef(`distro_redhat', `
@@ -285,10 +285,10 @@ type autofs_t, fs_type, noexattrfile, sysadmfile; allow autofs_t self:filesystem associate; -type usbdevfs_t, fs_type, noexattrfile, sysadmfile; +type usbdevfs_t, fs_type, mount_point, noexattrfile, sysadmfile; allow usbdevfs_t self:filesystem associate; -type sysfs_t, fs_type, sysadmfile; +type sysfs_t, mount_point, fs_type, sysadmfile; allow sysfs_t self:filesystem associate; type iso9660_t, fs_type, noexattrfile, sysadmfile;
types/nfs.te +1 -1
@@ -13,7 +13,7 @@ # The nfs_*_t types are used for specific NFS # servers in net_contexts or net_contexts.mls. # -type nfs_t, fs_type; +type nfs_t, mount_point, fs_type; # # Allow NFS files to be associated with an NFS file system.
types/procfs.te +2 -2
@@ -14,7 +14,7 @@ # proc_mdstat_t is the type of /proc/mdstat. # proc_net_t is the type of /proc/net. # -type proc_t, fs_type, proc_fs; +type proc_t, fs_type, mount_point, proc_fs; type proc_kmsg_t, proc_fs; type proc_kcore_t, proc_fs; type proc_mdstat_t, proc_fs;
@@ -35,7 +35,7 @@ # These types are applied to both the entries in # /proc/sys and the corresponding sysctl parameters. # -type sysctl_t, sysctl_type; +type sysctl_t, mount_point, sysctl_type; type sysctl_fs_t, sysctl_type; type sysctl_kernel_t, sysctl_type; type sysctl_modprobe_t, sysctl_type;
types/security.te +1 -1
@@ -12,7 +12,7 @@ # the permissions in the security class. It is also # applied to selinuxfs inodes. # -type security_t, fs_type; +type security_t, mount_point, fs_type; # # policy_config_t is the type of /etc/security/selinux/*
Re: Restrict Home v. 4
New version - I am now running in enforcing mode w/ this patch, and there's very few denials - some complaints from xdm when it logs in that it can't read gnome icons...
Other than that, it seems to mostly work.
However, it requires restorecon on both /tmp and /home, and I'm sure a lot of newly created folders will be the wrong type.
==============================================================
V4 Changelog:
- Prevent gnome_vfs_daemon from starting bonobo_activation_server, because that's a major problem - all things it starts inherit from its type, causing chaos - not sure how to confine it, but if started together w/ gnome_vfs it gets staff_t type.
- Rework file_browse_domain macros - separate into three macros, to be invoked when necessary. For example, mozilla doesn't need to suppress read denials, because the GNOME file dialog hides inaccessible folders. Also, add more types to finally get rid of *all* the denials. All, except the "secure_file_type" ones, but I lost that argument...
- Add labeling of $HOME/downloads and Mozilla's built-in "My Downloads" as ROLE_untrusted_content_t
- Make gmplayer work better.
- Fix bugs.
TODO:
======
Mozilla's still talking to ROLE_t over ORBit - find out what it's talking to, and confine it - gnome_settings_daemon ?
The Places menu in the file dialog is not working - why?
GNOME (Places) bookmark saving erases the old file, and writes it over - this is a problem - how to set the type?
Signature · 2 lines
Ivan Gyurdiev <[email protected]> Cornell University
attrib.te +6 -0
@@ -265,6 +265,12 @@ # overall filesystem statistics. attribute fs_type; +# The mount_point attribute identifies all types that can serve +# as a mount point (for the mount binary). It is used in the mount +# policy to grant mounton permission, and in other domains to grant +# getattr permission over all the mount points. +attribute mount_point; + # The exec_type attribute identifies all types assigned # to entrypoint executables for domains. This attribute is # used in TE rules and assertions that should be applied to all
domains/program/apache.te +3 -1
@@ -233,7 +233,9 @@ allow httpd_t bin_t:dir search; allow httpd_t sbin_t:dir search; allow httpd_t httpd_log_t:dir remove_name; -r_dir_file(httpd_t, fonts_t) + +read_fonts(httpd_t) +read_mime_types(httpd_t) allow httpd_t self:netlink_route_socket { bind create getattr nlmsg_read read write };
domains/program/cups.te +1 -1
@@ -112,7 +112,7 @@ can_exec(cupsd_t, { shell_exec_t bin_t sbin_t }) # They will also invoke ghostscript, which needs to read fonts -r_dir_file(cupsd_t, fonts_t) +read_fonts(cupsd_t) # Read /usr/lib/gconv/gconv-modules.* and /usr/lib/python2.2/.* allow cupsd_t lib_t:file { read getattr };
domains/program/fontconfig.te +7 -0
@@ -0,0 +1,7 @@ +# +# Fontconfig related types +# +# Author: Ivan Gyurdiev <[email protected]> +# + +# Look in fontconfig_macros.te
domains/program/gconf.te +12 -0
@@ -0,0 +1,12 @@ +# DESC - GConf preference daemon +# +# Author: Ivan Gyurdiev <[email protected]> +# + +# Type for executable +type gconfd_exec_t, file_type, exec_type, sysadmfile; + +# Type for /etc files +type gconf_etc_t, file_type, sysadmfile; + +# Everything else is in macros/gconfd_macros.te
domains/program/gnome.te +7 -0
@@ -0,0 +1,7 @@ +# +# GNOME related types +# +# Author: Ivan Gyurdiev <[email protected]> +# + +# Look in gnome_macros.te
domains/program/gnome_vfs.te +9 -0
@@ -0,0 +1,9 @@ +# DESC - GNOME-vfs daemon +# +# Author: Ivan Gyurdiev <[email protected]> +# + +# Type for executable +type gnome_vfsd_exec_t, file_type, exec_type, sysadmfile; + +# Everything else is in macros/gnome_vfsd_macros.te
domains/program/lpd.te +1 -1
@@ -20,7 +20,7 @@ allow lpd_t lpd_var_run_t:sock_file create_file_perms; -r_dir_file(lpd_t, fonts_t) +read_fonts(lpd_t) type printer_t, file_type, sysadmfile, dev_fs;
domains/program/mailcap.te +9 -0
@@ -0,0 +1,9 @@ +# +# Mailcap related types +# +# Author: Ivan Gyurdiev <[email protected]> +# + +type mime_types_t, file_type, sysadmfile; + +# Look in mailcap_macros.te
domains/program/mount.te +2 -26
@@ -37,29 +37,9 @@ # Mount, remount and unmount file systems. allow mount_t fs_type:filesystem mount_fs_perms; -allow mount_t default_t:dir mounton; -allow mount_t file_t:dir mounton; -allow mount_t usr_t:dir mounton; -allow mount_t src_t:dir mounton; -allow mount_t var_t:dir mounton; -allow mount_t proc_t:dir mounton; -allow mount_t root_t:dir mounton; -allow mount_t home_root_t:dir mounton; -allow mount_t tmp_t:dir mounton; -allow mount_t mnt_t:dir mounton; -allow mount_t devpts_t:dir mounton; -allow mount_t usbdevfs_t:dir mounton; -allow mount_t sysfs_t:dir mounton; -allow mount_t nfs_t:dir mounton; +allow mount_t mount_point:dir mounton; allow mount_t nfs_t:dir search; -# nfsv4 has a filesystem to mount for its userspace daemons -allow mount_t var_lib_nfs_t:dir mounton; - -# On some RedHat systems, /boot is a mount point -allow mount_t boot_t:dir mounton; -allow mount_t device_t:dir mounton; -# mount binfmt_misc on /proc/sys/fs/binfmt_misc -allow mount_t sysctl_t:dir { mounton search }; +allow mount_t sysctl_t:dir search; allow mount_t root_t:filesystem unmount;
@@ -99,11 +79,7 @@ allow mount_t userdomain:fd use; can_exec(mount_t, { sbin_t bin_t }) allow mount_t device_t:dir r_dir_perms; -ifdef(`distro_redhat', ` allow mount_t tmpfs_t:chr_file { read write }; -allow mount_t tmpfs_t:dir mounton; -') - # tries to read /init dontaudit mount_t root_t:file { getattr read };
domains/program/orbit.te +7 -0
@@ -0,0 +1,7 @@ +# +# ORBit related types +# +# Author: Ivan Gyurdiev <[email protected]> +# + +# Look in orbit_macros.te
domains/program/rhgb.te +1 -5
@@ -43,9 +43,6 @@ allow rhgb_t port_type:tcp_socket name_connect; can_ypbind(rhgb_t) -# for fonts -allow rhgb_t usr_t:{ file lnk_file } { getattr read }; - # for running setxkbmap r_dir_file(rhgb_t, xkb_var_lib_t)
@@ -68,8 +65,7 @@ tmpfs_domain(rhgb) allow xdm_xserver_t rhgb_tmpfs_t:file { read write }; -allow rhgb_t fonts_t:dir { getattr read search }; -allow rhgb_t fonts_t:file { getattr read }; +read_fonts(rhgb_t) # for nscd dontaudit rhgb_t var_t:dir search;
domains/program/xdm.te +3 -1
@@ -225,7 +225,9 @@ # Read /usr/share/terminfo/l/linux and /usr/share/icons/default/index.theme... allow xdm_t usr_t:{ lnk_file file } { getattr read }; -r_dir_file(xdm_t, fonts_t) + +# Read fonts +read_fonts(xdm_t) # Do not audit attempts to write to index files under /usr dontaudit xdm_t usr_t:file write;
domains/program/xfs.te +2 -3
@@ -37,9 +37,8 @@ allow xfs_t self:unix_stream_socket create_stream_socket_perms; allow xfs_t self:unix_dgram_socket create_socket_perms; -# Read /usr/X11R6/lib/X11/fonts/.* and /usr/share/fonts/.* -allow xfs_t fonts_t:dir search; -allow xfs_t fonts_t:file { getattr read }; +# Read fonts +read_fonts(xfs_t) # Unlink the xfs socket. allow initrc_t xfs_tmp_t:dir rw_dir_perms;
file_contexts/program/gconf.fc +5 -0
@@ -0,0 +1,5 @@ +/usr/libexec/gconfd-2 -- system_u:object_r:gconfd_exec_t +/etc/gconf(/.*)? system_u:object_r:gconf_etc_t +HOME_DIR/\.gconf(/.*)? system_u:object_r:ROLE_gconf_data_t +HOME_DIR/\.gconfd(/.*)? system_u:object_r:ROLE_gconfd_home_t +/tmp/gconfd-USER system_u:object_r:ROLE_gconfd_tmp_t
file_contexts/program/gnome.fc +9 -0
@@ -0,0 +1,9 @@ +HOME_DIR/\.gnome(2)?(/.*)? system_u:object_r:ROLE_gnome_settings_t +HOME_DIR/\.gnome(2)?_private?(/.*)? system_u:object_r:ROLE_gnome_settings_t +HOME_DIR/\.gnome2/share/fonts(/.*)? system_u:object_r:ROLE_fonts_t +HOME_DIR/\.gnome2/share/cursor-fonts(/.*)? system_u:object_r:ROLE_fonts_t +HOME_DIR/\.gtk-bookmarks -- system_u:object_r:ROLE_gnome_data_t +HOME_DIR/\.local(/.*)? system_u:object_r:ROLE_gnome_data_t +HOME_DIR/\.themes(/.)? system_u:object_r:ROLE_gnome_data_t +HOME_DIR/\.icons(/.*)? system_u:object_r:ROLE_gnome_data_t +HOME_DIR/\.thumbnails(/.*)? system_u:object_r:ROLE_gnome_data_t
file_contexts/program/gnome_vfs.fc +1 -0
@@ -0,0 +1 @@ +/usr/libexec/gnome-vfs-daemon -- system_u:object_r:gnome_vfsd_exec_t
file_contexts/program/mailcap.fc +8 -0
@@ -0,0 +1,8 @@ +# +# Mime types +# + +/etc/mailcap -- system_u:object_r:mime_types_t +/etc/mime.types -- system_u:object_r:mime_types_t +HOME_DIR/\.mailcap -- system_u:object_r:ROLE_mime_types_t +HOME_DIR/\.mime\.types -- system_u:object_r:ROLE_mime_types_t
file_contexts/program/mozilla.fc +0 -3
@@ -3,9 +3,6 @@ HOME_DIR/\.netscape(/.*)? system_u:object_r:ROLE_mozilla_home_t HOME_DIR/\.mozilla(/.*)? system_u:object_r:ROLE_mozilla_home_t HOME_DIR/\.phoenix(/.*)? system_u:object_r:ROLE_mozilla_home_t -HOME_DIR/\.gconfd(/.*)? system_u:object_r:ROLE_mozilla_home_t -HOME_DIR/\.gconf(/.*)? system_u:object_r:ROLE_mozilla_home_t -HOME_DIR/\.gnome2/epiphany(/.*)? system_u:object_r:ROLE_mozilla_home_t HOME_DIR/My.Downloads(/.*)? system_u:object_r:ROLE_mozilla_home_t HOME_DIR/\.java(/.*)? system_u:object_r:ROLE_mozilla_home_t /usr/bin/netscape -- system_u:object_r:mozilla_exec_t
file_contexts/program/orbit.fc +2 -0
@@ -0,0 +1,2 @@ +/tmp/orbit-USER -d system_u:object_r:ROLE_orbit_tmp_t +/tmp/orbit-USER/bonobo.* -- system_u:object_r:ROLE_orbit_tmp_t
file_contexts/types.fc +3 -12
@@ -53,12 +53,14 @@ HOME_ROOT -d system_u:object_r:home_root_t HOME_DIR -d system_u:object_r:ROLE_home_dir_t HOME_DIR/.+ system_u:object_r:ROLE_home_t +HOME_DIR/downloads(/.*)? system_u:object_r:ROLE_untrusted_content_t +HOME_DIR/.*Downloads(/.*)? system_u:object_r:ROLE_untrusted_content_t /root/\.default_contexts -- system_u:object_r:default_context_t # # Mount points; do not relabel subdirectories, since -# we don not want to change any removable media by default. +# we don't want to change any removable media by default. /mnt(/[^/]*)? -d system_u:object_r:mnt_t /mnt/[^/]*/.* <<none>> /media(/[^/]*)? -d system_u:object_r:mnt_t
@@ -388,17 +390,6 @@ /usr/X11R6/man(/.*)? system_u:object_r:man_t # -# Fonts dir -# -/usr/X11R6/lib/X11/fonts(/.*)? system_u:object_r:fonts_t -ifdef(`distro_debian', ` -/var/lib/msttcorefonts(/.*)? system_u:object_r:fonts_t -') -/usr/share/fonts(/.*)? system_u:object_r:fonts_t -/usr/share/ghostscript/fonts(/.*)? system_u:object_r:fonts_t -/usr/local/share/fonts(/.*)? system_u:object_r:fonts_t - -# # /var/run # /var/run(/.*)? system_u:object_r:var_run_t
macros/admin_macros.te +6 -0
@@ -14,11 +14,17 @@ # undefine(`admin_domain') define(`admin_domain',` + # Type for home directory. attribute $1_file_type; type $1_home_dir_t, file_type, sysadmfile, home_dir_type, home_type; type $1_home_t, file_type, sysadmfile, home_type, $1_file_type; +# Type for network content. +type $1_untrusted_content_t, file_type, $1_file_type, sysadmfile, customizable; +create_dir_file($1_t, $1_untrusted_content_t) +allow $1_t $1_untrusted_content_t:{ dir file } { relabelto relabelfrom }; + # Type and access for pty devices. can_create_pty($1, `, admin_tty_type')
macros/base_user_macros.te +23 -3
@@ -68,14 +68,21 @@ allow $1_t dri_device_t:chr_file getattr; dontaudit $1_t dri_device_t:chr_file rw_file_perms; -file_browse_domain($1_t) +# Supress ls denials: +# getattr() - ls -l +# search_dir() - symlink path resolution +# read_dir() - deep ls: ls parent/... + +dontaudit_getattr($1_t) +dontaudit_search_dir($1_t) +dontaudit_read_dir($1_t) # allow ptrace can_ptrace($1_t, $1_t) # Create, access, and remove files in home directory. file_type_auto_trans($1_t, $1_home_dir_t, $1_home_t) -allow $1_t $1_home_t:notdevfile_class_set { relabelfrom relabelto }; +allow $1_t $1_home_t:{ notdevfile_class_set dir } { relabelfrom relabelto }; can_setfscreate($1_t) allow $1_t autofs_t:dir { search getattr };
@@ -176,7 +183,6 @@ ifdef(`tvtime.te', `tvtime_domain($1)') ifdef(`mozilla.te', `mozilla_domain($1)') ifdef(`samba.te', `samba_domain($1)') -ifdef(`games.te', `games_domain($1)') ifdef(`gpg.te', `gpg_domain($1)') ifdef(`xauth.te', `xauth_domain($1)') ifdef(`startx.te', `xserver_domain($1)')
@@ -189,7 +195,17 @@ ifdef(`uml.te', `uml_domain($1)') ifdef(`cdrecord.te', `cdrecord_domain($1)') ifdef(`mplayer.te', `mplayer_domains($1)') + +# GNOME +ifdef(`gnome.te', ` +gnome_domain($1) +ifdef(`games.te', `games_domain($1)') ifdef(`gift.te', `gift_domains($1)') +') + +# Fonts, mailcap - required stuff +mailcap_domain($1) +fontconfig_domain($1) # Instantiate a derived domain for user cron jobs. ifdef(`crond.te', `crond_domain($1)')
@@ -350,6 +366,10 @@ allow $1_t default_t:notdevfile_class_set r_file_perms; } +# Read mime types +read_mime_types($1_t, $1) +read_fonts($1_t, $1) + read_sysctl($1_t); #
macros/global_macros.te +17 -16
@@ -156,7 +156,6 @@ r_dir_file($1, locale_t) ') - ################################### # # access_terminal(domain, typeprefix)
@@ -620,23 +619,25 @@ allow $1_t etc_t:dir r_dir_perms; ') -# Do not flood message log, if the user does a browse -define(`file_browse_domain', ` +# Dontaudit macros to prevent flooding the log -# Regular files/directories that are not security sensitive +define(`dontaudit_getattr', ` dontaudit $1 file_type - secure_file_type:dir_file_class_set getattr; -dontaudit $1 file_type - secure_file_type:dir { read search }; - -# /dev -dontaudit $1 dev_fs:dir_file_class_set getattr; -dontaudit $1 dev_fs:dir { read search }; - -# /proc -dontaudit $1 sysctl_t:dir_file_class_set getattr; -dontaudit $1 proc_fs:dir { read search }; - -')dnl end file_browse_domain - +dontaudit $1 unlabeled_t:dir_file_class_set getattr; +dontaudit $1 { fs_type proc_fs dev_fs sysctl_type }:dir_file_class_set getattr; +')dnl end dontaudit_getattr + +define(`dontaudit_search_dir', ` +dontaudit $1 file_type - secure_file_type:dir search; +dontaudit $1 unlabeled_t:dir search; +dontaudit $1 { fs_type proc_fs dev_fs sysctl_type }:dir search; +')dnl end dontaudit_search_dir + +define(`dontaudit_read_dir', ` +dontaudit $1 file_type - secure_file_type:dir read; +dontaudit $1 unlabeled_t:dir read; +dontaudit $1 { fs_type proc_fs dev_fs sysctl_type }:dir read; +')dnl end dontaudit_read_dir # Define legacy_domain for legacy binaries (java) # "legacy" binary == lacks PT_GNU_STACK header, i.e. built with an old
macros/program/apache_macros.te +1 -1
@@ -101,7 +101,7 @@ # Allow the scripts to read, read/write, append to the specified directories # or files ############################################################################ -r_dir_file(httpd_$1_script_t, fonts_t) +read_fonts(httpd_$1_script_t) r_dir_file(httpd_$1_script_t, httpd_$1_script_ro_t) create_dir_file(httpd_$1_script_t, httpd_$1_script_rw_t) ra_dir_file(httpd_$1_script_t, httpd_$1_script_ra_t)
macros/program/fontconfig_macros.te +42 -0
42 lines not on this page · raw message
macros/program/games_domain.te +7 -3
@@ -43,10 +43,14 @@ can_udp_send($1_games_t, $1_games_t) can_tcp_connect($1_games_t, $1_games_t) -# Access /home/user/.gnome2 -create_dir_file($1_games_t, $1_home_t) +# Access /home/user/.gnome2, /home/user/.themes +allow $1_games_t $1_gnome_settings_t:dir rw_dir_perms; +allow $1_games_t $1_gnome_settings_t:file create_file_perms; allow $1_games_t $1_home_dir_t:dir { read getattr search }; -allow $1_games_t $1_home_t:dir { read getattr }; +r_dir_file($1_games_t, $1_gnome_data_t) + +# Connect to gconf +gconf_client($1_games, $1) create_dir_file($1_games_t, $1_tmp_t) allow $1_games_t $1_tmp_t:sock_file create_file_perms;
macros/program/gconf_macros.te +67 -0
67 lines not on this page · raw message
macros/program/gift_macros.te +10 -15
@@ -32,9 +32,15 @@ # Self permissions allow $1_gift_t self:process getsched; +allow $1_gift_t self:fifo_file { read write }; # Fonts, icons r_dir_file($1_gift_t, usr_t) +r_dir_file($1_gift_t, $1_gnome_data_t) +read_fonts($1_gift_t) + +# Connect to gconf +gconf_client($1_gift, $1) # Launch gift daemon allow $1_gift_t bin_t:dir search;
@@ -53,23 +59,9 @@ allow $1_gift_t etc_t:file { getattr read }; allow $1_gift_t etc_runtime_t:file { getattr read }; -# Tmp/ORBit -tmp_domain($1_gift) -file_type_auto_trans($1_gift_t, $1_tmp_t, $1_gift_tmp_t) -can_unix_connect($1_t, $1_gift_t) -can_unix_connect($1_gift_t, $1_t) -allow $1_t $1_gift_tmp_t:sock_file write; -allow $1_gift_t $1_tmp_t:file { getattr read write lock }; -allow $1_gift_t $1_tmp_t:sock_file { read write }; -dontaudit $1_gift_t $1_tmp_t:dir setattr; - # Access random device allow $1_gift_t urandom_device_t:chr_file { read getattr ioctl }; -# giftui looks in .icons, .themes, .fonts-cache. -dontaudit $1_gift_t $1_home_t:dir { getattr read search }; -dontaudit $1_gift_t $1_home_t:file { getattr read unlink }; - ') dnl gift_domain ##########################
@@ -102,9 +94,12 @@ # Access home domain home_domain_access($1_giftd_t, $1, gift) + +# Allow gift to create untrusted content +create_dir_file($1_giftd_t, $1_untrusted_content_t) # Allow networking -allow $1_giftd_t port_t:tcp_socket name_bind; +allow $1_giftd_t port_t:tcp_socket { name_bind name_connect }; allow $1_giftd_t port_t:udp_socket name_bind; can_network_server($1_giftd_t) can_network_client($1_giftd_t)
macros/program/gnome_macros.te +22 -0
@@ -0,0 +1,22 @@ +# +# GNOME related types +# +# Author: Ivan Gyurdiev <[email protected]> +# +# gnome_domain(role_prefix) - create GNOME domain + +define(`gnome_domain', ` + +type $1_gnome_settings_t, file_type, $1_file_type, sysadmfile; +type $1_gnome_data_t, file_type, $1_file_type, sysadmfile; + +create_dir_file($1_t, $1_gnome_settings_t) +create_dir_file($1_t, $1_gnome_data_t) + +gconfd_domain($1) +gconf_client($1, $1) +gnome_vfs_domain($1) +gnome_vfs_client($1, $1) +orbit_domain($1) + +') dnl gnome_domain
macros/program/gnome_vfs_macros.te +76 -0
76 lines not on this page · raw message
macros/program/gpg_agent_macros.te +1 -1
@@ -89,7 +89,7 @@ allow $1_gpg_pinentry_t xdm_t:fd use; ')dnl end ig xdm.te -r_dir_file($1_gpg_pinentry_t, fonts_t) +read_fonts($1_gpg_pinentry_t, $1) # read kde font cache allow $1_gpg_pinentry_t usr_t:file { getattr read };
macros/program/java_macros.te +3 -5
@@ -4,7 +4,7 @@ # Macros for javaplugin (java plugin) domains. # # -# javaplugin_domain(domain_prefix, user) +# javaplugin_domain(domain_prefix, role) # # Define a derived domain for the javaplugin program when executed by # a web browser.
@@ -44,7 +44,8 @@ allow $1_javaplugin_t sysctl_vm_t:dir search; tmp_domain($1_javaplugin) -r_dir_file($1_javaplugin_t,{ fonts_t usr_t etc_t }) +read_fonts($1_javaplugin_t, $2) +r_dir_file($1_javaplugin_t,{ usr_t etc_t }) # Search bin directory under javaplugin for javaplugin executable allow $1_javaplugin_t bin_t:dir search;
@@ -91,7 +92,4 @@ dontaudit $1_javaplugin_t tmpfs_t:file { execute read write }; dontaudit $1_javaplugin_t $1_home_t:file { execute setattr }; -# Do not audit read/getattr of .fonts-cache-1 -dontaudit $1_javaplugin_t $1_home_t:file { read getattr }; - ')
macros/program/mailcap_macros.te +25 -0
@@ -0,0 +1,25 @@ +# +# Mailcap related types +# +# Author: Ivan Gyurdiev <[email protected]> +# +# mailcap_domain(role_prefix) - create mailcap domain +# +# read_mime_types(domain, role_prefix) - +# allow domain to read mime types, optionally per/user + +define(`mailcap_domain', ` + +type $1_mime_types_t, file_type, $1_file_type, sysadmfile; + +create_dir_file($1_t, $1_mime_types_t) + +') dnl gnome_domain + +define(`read_mime_types', ` +allow $1 mime_types_t:file r_file_perms; +ifelse(`$2', `', `', ` +allow $1 $2_mime_types_t:file r_file_perms; +') +') +
macros/program/mozilla_macros.te +51 -49
158 lines not on this page · raw message
macros/program/mplayer_macros.te +37 -13
92 lines not on this page · raw message
macros/program/orbit_macros.te +28 -0
@@ -0,0 +1,28 @@ +# +# ORBit related types +# +# Author: Ivan Gyurdiev <[email protected]> +# +# orbit_domain(prefix, role) - create ORBit sockets +# orbit_connect(type1, type2) - allow communication through ORBit sockets + +define(`orbit_domain', ` +ifdef(`$1_orbit_tmp_t_defined',`', ` +define(`$1_orbit_tmp_t_defined') +type $1_orbit_tmp_t, file_type, sysadmfile; +file_type_auto_trans($1_t, $2_orbit_tmp_t, $1_orbit_tmp_t, sock_file) + +allow $1_t self:unix_stream_socket create_stream_socket_perms; +allow $1_t self:unix_dgram_socket create_socket_perms; + +allow $1_t $2_orbit_tmp_t:file { getattr read write lock }; +dontaudit $1_t $2_orbit_tmp_t:dir setattr; +') +') + +define(`orbit_connect', ` +can_unix_connect($1_t, $2_t) +can_unix_connect($2_t, $1_t) +allow $1_t $2_orbit_tmp_t:sock_file { read write }; +allow $2_t $1_orbit_tmp_t:sock_file { read write }; +')
macros/program/x_client_macros.te +1 -1
@@ -74,7 +74,7 @@ allow $1_t self:shm create_shm_perms; # allow X client to read all font files -r_dir_file($1_t, fonts_t) +read_fonts($1_t, $2) # Allow connections to X server. ifdef(`xserver.te', `
macros/program/xserver_macros.te +16 -4
@@ -79,6 +79,14 @@ allow xdm_xserver_t init_t:fd use; dontaudit xdm_xserver_t home_dir_type:dir { read search }; + +# Suppress fonts denials +dontaudit_home_fonts(xdm_xserver_t, user) +dontaudit_home_fonts(xdm_xserver_t, staff) +dontaudit_home_fonts(xdm_xserver_t, sysadm) + +# Read global fonts +read_fonts(xdm_xserver_t) ', ` # The user role is authorized for this domain. role $1_r types $1_xserver_t;
@@ -95,9 +103,15 @@ # Access the home directory. allow $1_xserver_t home_root_t:dir search; allow $1_xserver_t $1_home_dir_t:dir { getattr search }; + +# Suppress fonts denials +dontaudit_home_fonts($1_xserver_t, $1) + +# Now re-enable according to boolean if (allow_xserver_home_fonts) { -r_dir_file($1_xserver_t, $1_home_t) -} +read_fonts($1_xserver_t, $1) +} + ifdef(`xauth.te', ` domain_auto_trans($1_xserver_t, xauth_exec_t, $1_xauth_t) allow $1_xserver_t $1_xauth_home_t:file { getattr read };
@@ -263,8 +277,6 @@ allow $1_xserver_t var_lib_t:dir search; rw_dir_create_file($1_xserver_t, xkb_var_lib_t) -# for fonts -r_dir_file($1_xserver_t, fonts_t) ')dnl end macro definition ', `
macros/user_macros.te +5 -0
@@ -21,6 +21,11 @@ type $1_home_dir_t, file_type, sysadmfile, home_dir_type, home_type, user_home_dir_type; type $1_home_t, file_type, sysadmfile, home_type, user_home_type, $1_file_type; +# Type for network content. +type $1_untrusted_content_t, file_type, $1_file_type, sysadmfile, customizable; +create_dir_file($1_t, $1_untrusted_content_t) +allow $1_t $1_untrusted_content_t:{ dir file } { relabelto relabelfrom }; + tmp_domain($1, `, user_tmpfile, $1_file_type', `{ file lnk_file dir sock_file fifo_file }') base_user_domain($1)
types/device.te +1 -1
@@ -10,7 +10,7 @@ # # device_t is the type of /dev. # -type device_t, file_type, dev_fs; +type device_t, file_type, mount_point, dev_fs; # # null_device_t is the type of /dev/null.
types/devpts.te +1 -1
@@ -16,6 +16,6 @@ # devpts_t is the type of the devpts file system and # the type of the root directory of the file system. # -type devpts_t, fs_type; +type devpts_t, mount_point, fs_type;
types/file.te +17 -17
@@ -23,37 +23,37 @@ type eventpollfs_t, fs_type; type futexfs_t, fs_type; type bdev_t, fs_type; -type usbfs_t, fs_type; +type usbfs_t, mount_point, fs_type; type nfsd_fs_t, fs_type; type rpc_pipefs_t, fs_type; -type binfmt_misc_fs_t, fs_type; +type binfmt_misc_fs_t, mount_point, fs_type; # # file_t is the default type of a file that has not yet been # assigned an extended attribute (EA) value (when using a filesystem # that supports EAs). # -type file_t, file_type, sysadmfile; +type file_t, file_type, mount_point, sysadmfile; # default_t is the default type for files that do not # match any specification in the file_contexts configuration # other than the generic /.* specification. -type default_t, file_type, sysadmfile; +type default_t, file_type, mount_point, sysadmfile; # # root_t is the type for the root directory. # -type root_t, file_type, sysadmfile; +type root_t, file_type, mount_point, sysadmfile; # # mnt_t is the type for mount points such as /mnt/cdrom -type mnt_t, file_type, sysadmfile; +type mnt_t, file_type, mount_point, sysadmfile; # # home_root_t is the type for the directory where user home directories # are created # -type home_root_t, file_type, sysadmfile; +type home_root_t, file_type, mount_point, sysadmfile; # # lost_found_t is the type for the lost+found directories.
@@ -64,7 +64,7 @@ # boot_t is the type for files in /boot, # including the kernel. # -type boot_t, file_type, sysadmfile; +type boot_t, file_type, mount_point, sysadmfile; # system_map_t is for the system.map files in /boot type system_map_t, file_type, sysadmfile;
@@ -77,7 +77,7 @@ # # tmp_t is the type of /tmp and /var/tmp. # -type tmp_t, file_type, sysadmfile, tmpfile; +type tmp_t, file_type, mount_point, sysadmfile, tmpfile; # # etc_t is the type of the system etc directories.
@@ -171,17 +171,17 @@ # # usr_t is the type for /usr. # -type usr_t, file_type, sysadmfile; +type usr_t, file_type, mount_point, sysadmfile; # # src_t is the type of files in the system src directories. # -type src_t, file_type, sysadmfile; +type src_t, file_type, mount_point, sysadmfile; # # var_t is the type for /var. # -type var_t, file_type, sysadmfile; +type var_t, file_type, mount_point, sysadmfile; # # Types for subdirectories of /var.
@@ -190,7 +190,7 @@ type var_log_t, file_type, sysadmfile, logfile; type faillog_t, file_type, sysadmfile, logfile; type var_lock_t, file_type, sysadmfile, lockfile; -type var_lib_t, file_type, sysadmfile; +type var_lib_t, mount_point, file_type, sysadmfile; # for /var/{spool,lib}/texmf index files type tetex_data_t, file_type, sysadmfile, tmpfile; type var_spool_t, file_type, sysadmfile, tmpfile;
@@ -203,7 +203,7 @@ type lastlog_t, file_type, sysadmfile, logfile; # Type for /var/lib/nfs. -type var_lib_nfs_t, file_type, sysadmfile, usercanread; +type var_lib_nfs_t, file_type, mount_point, sysadmfile, usercanread; # # wtmp_t is the type of /var/log/wtmp.
@@ -275,7 +275,7 @@ # Allow the pty to be associated with the file system. allow devpts_t self:filesystem associate; -type tmpfs_t, file_type, sysadmfile, fs_type; +type tmpfs_t, file_type, mount_point, sysadmfile, fs_type; allow { tmpfs_t tmpfile } tmpfs_t:filesystem associate; allow tmpfile tmp_t:filesystem associate; ifdef(`distro_redhat', `
@@ -285,10 +285,10 @@ type autofs_t, fs_type, noexattrfile, sysadmfile; allow autofs_t self:filesystem associate; -type usbdevfs_t, fs_type, noexattrfile, sysadmfile; +type usbdevfs_t, fs_type, mount_point, noexattrfile, sysadmfile; allow usbdevfs_t self:filesystem associate; -type sysfs_t, fs_type, sysadmfile; +type sysfs_t, mount_point, fs_type, sysadmfile; allow sysfs_t self:filesystem associate; type iso9660_t, fs_type, noexattrfile, sysadmfile;
types/nfs.te +1 -1
@@ -13,7 +13,7 @@ # The nfs_*_t types are used for specific NFS # servers in net_contexts or net_contexts.mls. # -type nfs_t, fs_type; +type nfs_t, mount_point, fs_type; # # Allow NFS files to be associated with an NFS file system.
types/procfs.te +2 -2
@@ -14,7 +14,7 @@ # proc_mdstat_t is the type of /proc/mdstat. # proc_net_t is the type of /proc/net. # -type proc_t, fs_type, proc_fs; +type proc_t, fs_type, mount_point, proc_fs; type proc_kmsg_t, proc_fs; type proc_kcore_t, proc_fs; type proc_mdstat_t, proc_fs;
@@ -35,7 +35,7 @@ # These types are applied to both the entries in # /proc/sys and the corresponding sysctl parameters. # -type sysctl_t, sysctl_type; +type sysctl_t, mount_point, sysctl_type; type sysctl_fs_t, sysctl_type; type sysctl_kernel_t, sysctl_type; type sysctl_modprobe_t, sysctl_type;
types/security.te +1 -1
@@ -12,7 +12,7 @@ # the permissions in the security class. It is also # applied to selinuxfs inodes. # -type security_t, fs_type; +type security_t, mount_point, fs_type; # # policy_config_t is the type of /etc/security/selinux/*