Content macros - request for comments
What is your opinion of the attached patch. Ignore the ethereal/gift/minor stuff. The focus of the patch is content handling, specifically untrusted content.
It introduces new macros:read_content, write_trusted, and write_untrusted. Applications would choose between write_trusted and write_untrusted.
The goal of the patch is to unify content handling - allow reading from multiple sources for all apps that are concerned with "content" and not just ROLE_t, as well as introduce control over untrusted types.
This patch also separates out certain macros into their own files to improve readability. Home domain macros lose the transition, as it becomes the responsibility of the caller. One backwards compatibility alias in home domain is removed.
Auditing: is suppressed failing a boolean check, since the app is working properly, but the sysadmin has chosen to disable this functionality.
Boolean Control: certain sensitive roles such as writing to ROLE_home_t, or reading from ROLE_home_t can have a boolean prefix passed in to construct a new boolean. To make this optional (I don't want a boolean for ROLE_t, for example), I tried to rely on constants true/false, but no such thing seems to exist - any suggestions?
Signature · 2 lines
Ivan Gyurdiev <[email protected]> Cornell University
domains/program/ethereal.te +22 -47
@@ -8,39 +8,6 @@ type ethereal_exec_t, file_type, exec_type, sysadmfile; ######################################################## -# ethereal_common(app_prefix) - common ethereal rules -# -define(`ethereal_common', ` - -uses_shlib($1_t) -read_locale($1_t) - -# Terminal output -access_terminal($1_t, sysadm) - -# /proc -read_sysctl($1_t) -allow $1_t { self proc_t }:dir { read search getattr }; -allow $1_t { self proc_t }:{ file lnk_file } { read getattr }; - -# Access root -allow $1_t root_t:dir search; - -# Read ethereal files in /usr -allow $1_t usr_t:file { read getattr }; - -# /etc/nsswitch.conf -allow $1_t etc_t:file { read getattr }; - -# Networking privileges -allow $1_t self:netlink_route_socket create_netlink_socket_perms; -allow $1_t self:unix_stream_socket create_stream_socket_perms; -allow $1_t self:udp_socket create_socket_perms; -allow $1_t self:packet_socket create_socket_perms; - -') dnl ethereal_common - -######################################################## # Tethereal #
@@ -51,23 +18,31 @@ domain_auto_trans(sysadm_t, tethereal_exec_t, tethereal_t) role sysadm_r types tethereal_t; -# Ethereal common -ethereal_common(tethereal) +uses_shlib(tethereal_t) +read_locale(tethereal_t) -######################################################## -# Ethereal (GNOME) -# +# Terminal output +access_terminal(tethereal_t, sysadm) -ifdef(`gnome.te', ` +# /proc +read_sysctl(tethereal_t) +allow tethereal_t { self proc_t }:dir { read search getattr }; +allow tethereal_t { self proc_t }:{ file lnk_file } { read getattr }; -# Type for program -type ethereal_t, domain, nscd_client_domain; +# Access root +allow tethereal_t root_t:dir search; -# Transition from sysadm type -domain_auto_trans(sysadm_t, ethereal_exec_t, ethereal_t) -role sysadm_r types ethereal_t; +# Read ethereal files in /usr +allow tethereal_t usr_t:file { read getattr }; + +# /etc/nsswitch.conf +allow tethereal_t etc_t:file { read getattr }; + +# Ethereal sysadm rules +ethereal_networking(tethereal) -# Ethereal common -ethereal_common(ethereal) +# FIXME: policy is incomplete -') dnl gnome.te +##################################### +# Ethereal (GNOME) policy can be found +# in ethereal_macros.te
domains/program/gift.te +0 -3
@@ -6,8 +6,5 @@ type gift_exec_t, file_type, exec_type, sysadmfile; type giftd_exec_t, file_type, exec_type, sysadmfile; type giftd_port_t, port_type; -type giftd_openft_port_t, port_type; -type giftd_fasttrack_port_t, port_type; -type giftd_gnutella_port_t, port_type; # Everything else is in macros/gift_macros.te
domains/program/mozilla.te +0 -6
@@ -8,12 +8,6 @@ type mozilla_exec_t, file_type, sysadmfile, exec_type; type mozilla_conf_t, file_type, sysadmfile; -# Allow mozilla to read files in the user home directory -bool mozilla_readhome false; - -# Allow mozilla to write files in the user home directory -bool mozilla_writehome false; - # Run in user_t bool disable_mozilla_trans false;
domains/user.te +12 -2
@@ -4,6 +4,16 @@ # Booleans for user domains. +# Allow applications to read untrusted content +# If this is disallowed, Internet content has +# to be manually relabeled for read access to be granted +bool read_untrusted_content false; + +# Allow applications to write untrusted content +# If this is disallowed, no Internet content +# will be stored. +bool write_untrusted_content false; + # Allow users to read system messages. bool user_dmesg false;
@@ -79,9 +89,9 @@ dontaudit $1_su_t { sysadm_home_t staff_home_t }:file create_file_perms; ') dnl ifdef su.te ifdef(`xauth.te', ` -file_type_auto_trans($1_xauth_t, sysadm_home_dir_t, sysadm_home_xauth_t,file) +file_type_auto_trans($1_xauth_t, sysadm_home_dir_t, sysadm_xauth_home_t,file) ifdef(`userhelper.te', ` -file_type_auto_trans($1_userhelper_t, sysadm_home_dir_t, sysadm_home_xauth_t,file) +file_type_auto_trans($1_userhelper_t, sysadm_home_dir_t, sysadm_xauth_home_t,file) ') dnl userhelper.te ') dnl xauth.te ') dnl reach_sysadm
file_contexts/program/irc.fc +1 -1
@@ -2,4 +2,4 @@ /usr/bin/[st]irc -- system_u:object_r:irc_exec_t /usr/bin/ircII -- system_u:object_r:irc_exec_t /usr/bin/tinyirc -- system_u:object_r:irc_exec_t -HOME_DIR/\.ircmotd -- system_u:object_r:ROLE_home_irc_t +HOME_DIR/\.ircmotd -- system_u:object_r:ROLE_irc_home_t
file_contexts/program/xauth.fc +1 -0
@@ -1,3 +1,4 @@ # xauth /usr/X11R6/bin/xauth -- system_u:object_r:xauth_exec_t +HOME_DIR/\.xauth.* -- system_u:object_r:ROLE_xauth_home_t HOME_DIR/\.Xauthority.* -- system_u:object_r:ROLE_xauth_home_t
macros/admin_macros.te +3 -1
@@ -22,7 +22,9 @@ # Type and access for pty devices. can_create_pty($1, `, admin_tty_type') -tmp_domain($1, `, $1_file_type', `{ file dir lnk_file sock_file fifo_file }') +# Transition manually for { lnk sock fifo }. The rest is in content macros. +tmp_domain_notrans($1, `, $1_file_type') +file_type_auto_trans($1_t, tmp_t, $1_tmp_t, { lnk_file sock_file fifo_file }) allow $1_t $1_tmp_t:{ dir file } { relabelto relabelfrom }; # Type for tty devices.
macros/base_user_macros.te +21 -32
88 lines not on this page · raw message
macros/content_macros.te +152 -0
152 lines not on this page · raw message
macros/global_macros.te +5 -109
126 lines not on this page · raw message
macros/home_macros.te +128 -0
128 lines not on this page · raw message
macros/program/ethereal_macros.te +22 -1
@@ -17,6 +17,8 @@ allow $1_t self:unix_stream_socket create_stream_socket_perms; allow $1_t self:tcp_socket create_socket_perms; +allow $1_t self:capability { dac_override dac_read_search net_raw setgid setuid }; + # Resolve names via DNS can_resolve($1_t)
@@ -35,16 +37,35 @@ domain_auto_trans($1_t, ethereal_exec_t, $1_ethereal_t) role $1_r types $1_ethereal_t; +# Manual transition from userhelper +ifdef(`userhelper.te', ` +allow $1_userhelper_t { sysadm_ethereal_t $1_ethereal_t }:process { transition siginh rlimitinh noatsecure }; +allow sysadm_ethereal_t $1_userhelper_t:fd use; +allow sysadm_ethereal_t $1_userhelper_t:process sigchld; +') + # X, GNOME x_client_domain($1_ethereal, $1) gnome_application($1_ethereal, $1) gnome_file_dialog($1_ethereal, $1) +# Why does it write this? +ifdef(`snmpd.te', ` +dontaudit sysadm_ethereal_t snmpd_var_lib_t:file write; +') + # /home/.ethereal home_domain($1, ethereal) +file_type_auto_trans($1_ethereal_t, $1_home_dir_t, $1_ethereal_home_t, dir) # Enable restricted networking rules for sysadm - this is shared w/ tethereal -ifelse($1, `sysadm', `ethereal_networking($1_ethereal)', `') +ifelse($1, `sysadm', ` +ethereal_networking($1_ethereal) + +# Ethereal tries to write to user terminal +dontaudit sysadm_ethereal_t user_tty_type:chr_file { read write }; +dontaudit sysadm_ethereal_t unpriv_userdomain:fd use; +', `') # Store temporary files tmp_domain($1_ethereal)
macros/program/evolution_macros.te +4 -4
@@ -137,7 +137,7 @@ # /tmp/.exchange-$USER tmp_domain($1_evolution_exchange) - + # Allow netstat allow $1_evolution_exchange_t bin_t:dir search; can_exec($1_evolution_exchange_t, bin_t)
@@ -145,6 +145,9 @@ allow $1_evolution_exchange_t sysctl_net_t:dir search; allow $1_evolution_exchange_t self:{ udp_socket tcp_socket } create_socket_perms; +# Clock applet talks to exchange (FIXME: Needs policy) +bonobo_connect($1, $1_evolution_exchange) + # FIXME: policy incomplete ') dnl evolution_exchange
@@ -179,9 +182,6 @@ # Access .evolution home_domain($1, evolution) -# Store documents in /tmp (to print, etc..) -tmp_domain($1_evolution) - # Store passwords in .gnome2_private gnome_private_store($1_evolution, $1)
macros/program/fontconfig_macros.te +6 -1
@@ -18,6 +18,9 @@ create_dir_file($1_t, $1_fonts_t) allow $1_t $1_fonts_t:{ dir file } { relabelto relabelfrom }; +create_dir_file($1_t, $1_fonts_config_t) +allow $1_t $1_fonts_config_t:file { relabelto relabelfrom }; + # For startup relabel allow $1_t $1_fonts_cache_t:{ dir file } { relabelto relabelfrom };
@@ -33,7 +36,9 @@ ifelse(`$2', `', `', ` -allow $1 $2_fonts_cache_t:file create_file_perms; +# Manipulate the global font cache +create_dir_file($1, $2_fonts_cache_t) + # Read per user fonts and font config r_dir_file($1, $2_fonts_t) r_dir_file($1, $2_fonts_config_t)
macros/program/games_domain.te +1 -1
@@ -24,7 +24,7 @@ # X access, GNOME, /tmp files x_client_domain($1_games, $1) -tmp_domain($1_games, `', { dir notdevfile_class_set }) +tmp_domain($1_games, `', `{ dir notdevfile_class_set }') gnome_application($1_games, $1) gnome_file_dialog($1_games, $1)
macros/program/gconf_macros.te +1 -0
@@ -23,6 +23,7 @@ # Access .gconfd and .gconf home_domain($1, gconfd) +file_type_auto_trans($1_gconfd_t, $1_home_dir_t, $1_gconfd_home_t, dir) # Access /etc/gconf r_dir_file($1_gconfd_t, gconf_etc_t)
macros/program/gift_macros.te +2 -1
@@ -21,7 +21,7 @@ x_client_domain($1_gift, $1) gnome_application($1_gift, $1) home_domain($1, gift) -tmp_domain($1_gift) +file_type_auto_trans($1_gift_t, $1_home_dir_t, $1_gift_home_t, dir) # Allow the user domain to signal/ps. can_ps($1_t, $1_gift_t)
@@ -75,6 +75,7 @@ # Access home domain home_domain_access($1_giftd_t, $1, gift) +file_type_auto_trans($1_gift_t, $1_home_dir_t, $1_gift_home_t, dir) # Serve content on various p2p networks. Ports can be random. can_network_server($1_giftd_t)
macros/program/iceauth_macros.te +2 -1
@@ -15,7 +15,8 @@ role $1_r types $1_iceauth_t; # Store .ICEauthority files -home_domain($1, iceauth, file) +home_domain($1, iceauth) +file_type_auto_trans($1_iceauth_t, $1_home_dir_t, $1_iceauth_home_t, file) # Supress xdm trying to restore .ICEauthority permissions ifdef(`xdm.te', `
macros/program/irc_macros.te +1 -0
@@ -21,6 +21,7 @@ # Home domain home_domain($1, irc) +file_type_auto_trans($1_irc_t, $1_home_dir_t, $1_irc_home_t, dir) # Derived domain based on the calling user domain and the program. type $1_irc_t, domain;
macros/program/lpr_macros.te +2 -19
@@ -53,7 +53,6 @@ ') tmp_domain($1_lpr) -r_dir_file($1_lpr_t, $1_tmp_t) # Type for spool files. type $1_print_spool_t, file_type, sysadmfile;
@@ -72,18 +71,8 @@ allow $1_lpr_t privfd:fd use; # Read user files. -allow sysadm_lpr_t { home_root_t $1_home_t $1_home_dir_t }:dir search; -allow sysadm_lpr_t $1_home_t:{ file lnk_file } r_file_perms; -allow $1_lpr_t { home_root_t $1_home_t $1_home_dir_t }:dir search; -allow $1_lpr_t $1_home_t:{ file lnk_file } r_file_perms; - -if (use_nfs_home_dirs) { -r_dir_file($1_lpr_t, nfs_t) -} - -if (use_samba_home_dirs) { -r_dir_file($1_lpr_t, cifs_t) -} +read_content(sysadm_lpr_t, $1, lpr) +read_content($1_lpr_t, $1, lpr) # Read and write shared files in the spool directory. allow $1_lpr_t print_spool_t:file rw_file_perms;
@@ -124,11 +113,5 @@ can_tcp_connect({ $1_lpr_t $1_t }, cupsd_t) ')dnl end ifdef cups.te -ifdef(`hide_broken_symptoms', ` -# thunderbird causes these -dontaudit $1_lpr_t $1_t:tcp_socket { read write }; -dontaudit $1_lpr_t { $1_home_t $1_tmp_t }:file write; -') - ')dnl end macro definition
macros/program/mail_client_macros.te +6 -18
@@ -4,10 +4,6 @@ # Author: Ivan Gyurdiev <[email protected]> # -# Home access -bool mail_writehome false; -bool mail_readhome false; - ######################################## # mail_client_domain(client, role_prefix) #
@@ -36,25 +32,17 @@ ifdef(`lpr.te', ` domain_auto_trans($1_t, lpr_exec_t, $2_lpr_t) ') -# FIXME - common type needed for internet content -allow $2_lpr_t $1_tmp_t:file r_file_perms; -# Save mail in the home directory -# FIXME - common type needed for internet content -if (mail_writehome) { -file_type_auto_trans($1_t, { $2_home_t $2_home_dir_t }, $1_home_t, file) -} - -# Read home (for attachments) -if (mail_readhome || mail_writehome) { -r_dir_file($1_t, $2_home_t) -} +# Attachments +read_content($1_t, $2, mail) + +# Save mail +write_untrusted($1_t, $2) # Encrypt mail ifdef(`gpg.te', ` domain_auto_trans($1_t, gpg_exec_t, $2_gpg_t) -# FIXME - common type needed for internet content -allow $2_gpg_t $1_tmp_t:file r_file_perms; +allow $2_gpg_t $2_untrusted_content_t:file r_file_perms; ') ')
macros/program/mozilla_macros.te +11 -31
66 lines not on this page · raw message
macros/program/mplayer_macros.te +6 -5
@@ -92,10 +92,6 @@ # RTC clock allow $1_mplayer_t clock_device_t:chr_file { ioctl read }; -# Play content from /home, and from CDs -r_dir_file($1_mplayer_t, $1_home_t); -r_dir_file($1_mplayer_t, removable_t); - # Legacy domain issues if (allow_mplayer_execstack) { allow $1_mplayer_t $1_mplayer_tmpfs_t:file execute;
@@ -120,6 +116,9 @@ can_exec($1_mplayer_t, shell_exec_t) #============================# +# Read songs +read_content($1_mplayer_t, $1, mplayer) + ') dnl end mplayer_domain ###################################
@@ -128,7 +127,6 @@ define(`mencoder_domain',` -# FIXME: privhome temporarily removed... type $1_mencoder_t, domain; # Type transition
@@ -141,6 +139,9 @@ # Mplayer common stuff mplayer_common($1, mencoder) +# Save encoded files +write_trusted($1_mplayer_t, $1, mplayer) + ') dnl end mencoder_domain #############################
macros/program/orbit_macros.te +2 -6
@@ -13,12 +13,11 @@ ifdef(`orbit_domain_$1_$2', `', ` define(`orbit_domain_$1_$2') -# Type for ORBit sockets -type $1_orbit_tmp_t, file_type, $2_file_type, sysadmfile, tmpfile; - # Relabel directory (startup script) allow $1_t $1_orbit_tmp_t:{ dir file } { relabelfrom relabelto }; +# Type for ORBit sockets +type $1_orbit_tmp_t, file_type, $2_file_type, sysadmfile, tmpfile; file_type_auto_trans($1_t, $2_orbit_tmp_t, $1_orbit_tmp_t) allow $1_t tmp_t:dir { read search getattr };
@@ -42,7 +41,4 @@ can_unix_connect($1_t, $2_t) allow $1_t $2_orbit_tmp_t:sock_file write; -# Why do they do that? -dontaudit $1_t $2_orbit_tmp_t:dir setattr; - ') dnl orbit_connect
macros/program/pyzor_macros.te +1 -0
@@ -52,6 +52,7 @@ # Per-user config/data files home_domain($1, pyzor) +file_type_auto_trans($1_pyzor_t, $1_home_dir_t, $1_pyzor_home_t, dir) # System config files r_dir_file($1_pyzor_t, pyzor_etc_t)
macros/program/razor_macros.te +1 -0
@@ -62,6 +62,7 @@ # Per-user config/data files home_domain($1, razor) +file_type_auto_trans($1_razor_t, $1_home_dir_t, $1_razor_home_t, dir) tmp_domain($1_razor)
macros/program/spamassassin_macros.te +1 -1
@@ -44,7 +44,6 @@ uses_shlib($1_$2_t) read_locale($1_$2_t) dontaudit $1_$2_t var_t:dir search; -allow $1_$2_t $1_home_dir_t:dir r_dir_perms; tmp_domain($1_$2) allow $1_$2_t privfd:fd use; allow $1_$2_t userpty_type:chr_file rw_file_perms;
@@ -81,6 +80,7 @@ # For ~/.spamassassin home_domain($1, spamassassin) +file_type_auto_trans($1_spamassassin_t, $1_home_dir_t, $1_spamassassin_home_t, dir) spamassassin_agent_privs($1_spamassassin_t, $1)
macros/program/thunderbird_macros.te +0 -2
@@ -51,8 +51,6 @@ # Access ~/.thunderbird home_domain($1, thunderbird) -tmp_domain($1_thunderbird) - # RSS feeds can_network_client_tcp($1_thunderbird_t, http_port_t) allow $1_thunderbird_t http_port_t:tcp_socket name_connect;
macros/program/tvtime_macros.te +1 -0
@@ -26,6 +26,7 @@ # X access, Home files home_domain($1, tvtime) +file_type_auto_trans($1_tvtime_t, $1_home_dir_t, $1_tvtime_home_t, dir) x_client_domain($1_tvtime, $1) uses_shlib($1_tvtime_t)
macros/program/xauth_macros.te +2 -1
@@ -23,7 +23,8 @@ allow $1_xauth_t self:process signal; -home_domain($1, xauth, file) +home_domain($1, xauth) +file_type_auto_trans($1_xauth_t, $1_home_dir_t, $1_xauth_home_t, dir) # Transition from the user domain to this domain. domain_auto_trans($1_t, xauth_exec_t, $1_xauth_t)
macros/user_macros.te +3 -1
@@ -21,7 +21,9 @@ type $1_home_dir_t, file_type, sysadmfile, home_dir_type, home_type, user_home_dir_type, polydir; type $1_home_t, file_type, sysadmfile, home_type, user_home_type, $1_file_type, polymember; -tmp_domain($1, `, user_tmpfile, $1_file_type', `{ file lnk_file dir sock_file fifo_file }') +# Transition manually for { lnk sock fifo }. The rest is in content macros. +tmp_domain_notrans($1, `, user_tmpfile, $1_file_type') +file_type_auto_trans($1_t, tmp_t, $1_tmp_t, { lnk_file sock_file fifo_file }) allow $1_t $1_tmp_t:{ dir file } { relabelto relabelfrom }; ifdef(`support_polyinstantiation', `
Quoted 8 lines
Boolean Control: certain sensitive roles such as writing to
ROLE_home_t, or reading fromROLE_home_tcan have a boolean prefix passed in to construct a new boolean. To make this optional (I don't want a boolean forROLE_t, for example), I tried to rely on constants true/false, but no such thing seems to exist - any suggestions?
Never mind this - I was confused, and this is an old version. Attached is a fixed patch - it's not pretty, but it works (I think..) It's also an updated diff, so all the ethereal stuff is gone.
(Patch requires .mplayer be added to pre-created folders)
domains/program/mozilla.te +0 -6
@@ -8,12 +8,6 @@ type mozilla_exec_t, file_type, sysadmfile, exec_type; type mozilla_conf_t, file_type, sysadmfile; -# Allow mozilla to read files in the user home directory -bool mozilla_readhome false; - -# Allow mozilla to write files in the user home directory -bool mozilla_writehome false; - # Run in user_t bool disable_mozilla_trans false;
domains/user.te +12 -2
@@ -4,6 +4,16 @@ # Booleans for user domains. +# Allow applications to read untrusted content +# If this is disallowed, Internet content has +# to be manually relabeled for read access to be granted +bool read_untrusted_content false; + +# Allow applications to write untrusted content +# If this is disallowed, no Internet content +# will be stored. +bool write_untrusted_content false; + # Allow users to read system messages. bool user_dmesg false;
@@ -79,9 +89,9 @@ dontaudit $1_su_t { sysadm_home_t staff_home_t }:file create_file_perms; ') dnl ifdef su.te ifdef(`xauth.te', ` -file_type_auto_trans($1_xauth_t, sysadm_home_dir_t, sysadm_home_xauth_t,file) +file_type_auto_trans($1_xauth_t, sysadm_home_dir_t, sysadm_xauth_home_t,file) ifdef(`userhelper.te', ` -file_type_auto_trans($1_userhelper_t, sysadm_home_dir_t, sysadm_home_xauth_t,file) +file_type_auto_trans($1_userhelper_t, sysadm_home_dir_t, sysadm_xauth_home_t,file) ') dnl userhelper.te ') dnl xauth.te ') dnl reach_sysadm
file_contexts/program/irc.fc +1 -1
@@ -2,4 +2,4 @@ /usr/bin/[st]irc -- system_u:object_r:irc_exec_t /usr/bin/ircII -- system_u:object_r:irc_exec_t /usr/bin/tinyirc -- system_u:object_r:irc_exec_t -HOME_DIR/\.ircmotd -- system_u:object_r:ROLE_home_irc_t +HOME_DIR/\.ircmotd -- system_u:object_r:ROLE_irc_home_t
macros/admin_macros.te +3 -1
@@ -22,7 +22,9 @@ # Type and access for pty devices. can_create_pty($1, `, admin_tty_type') -tmp_domain($1, `, $1_file_type', `{ file dir lnk_file sock_file fifo_file }') +# Transition manually for { lnk sock fifo }. The rest is in content macros. +tmp_domain_notrans($1, `, $1_file_type') +file_type_auto_trans($1_t, tmp_t, $1_tmp_t, { lnk_file sock_file fifo_file }) allow $1_t $1_tmp_t:{ dir file } { relabelto relabelfrom }; # Type for tty devices.
macros/base_user_macros.te +21 -26
76 lines not on this page · raw message
macros/content_macros.te +182 -0
182 lines not on this page · raw message
macros/global_macros.te +5 -109
126 lines not on this page · raw message
macros/home_macros.te +128 -0
128 lines not on this page · raw message
macros/program/evolution_macros.te +4 -4
@@ -137,7 +137,7 @@ # /tmp/.exchange-$USER tmp_domain($1_evolution_exchange) - + # Allow netstat allow $1_evolution_exchange_t bin_t:dir search; can_exec($1_evolution_exchange_t, bin_t)
@@ -145,6 +145,9 @@ allow $1_evolution_exchange_t sysctl_net_t:dir search; allow $1_evolution_exchange_t self:{ udp_socket tcp_socket } create_socket_perms; +# Clock applet talks to exchange (FIXME: Needs policy) +bonobo_connect($1, $1_evolution_exchange) + # FIXME: policy incomplete ') dnl evolution_exchange
@@ -179,9 +182,6 @@ # Access .evolution home_domain($1, evolution) -# Store documents in /tmp (to print, etc..) -tmp_domain($1_evolution) - # Store passwords in .gnome2_private gnome_private_store($1_evolution, $1)
macros/program/gconf_macros.te +1 -0
@@ -23,6 +23,7 @@ # Access .gconfd and .gconf home_domain($1, gconfd) +file_type_auto_trans($1_gconfd_t, $1_home_dir_t, $1_gconfd_home_t, dir) # Access /etc/gconf r_dir_file($1_gconfd_t, gconf_etc_t)
macros/program/gift_macros.te +2 -1
@@ -21,7 +21,7 @@ x_client_domain($1_gift, $1) gnome_application($1_gift, $1) home_domain($1, gift) -tmp_domain($1_gift) +file_type_auto_trans($1_gift_t, $1_home_dir_t, $1_gift_home_t, dir) # Allow the user domain to signal/ps. can_ps($1_t, $1_gift_t)
@@ -75,6 +75,7 @@ # Access home domain home_domain_access($1_giftd_t, $1, gift) +file_type_auto_trans($1_gift_t, $1_home_dir_t, $1_gift_home_t, dir) # Serve content on various p2p networks. Ports can be random. can_network_server($1_giftd_t)
macros/program/iceauth_macros.te +2 -1
@@ -15,7 +15,8 @@ role $1_r types $1_iceauth_t; # Store .ICEauthority files -home_domain($1, iceauth, file) +home_domain($1, iceauth) +file_type_auto_trans($1_iceauth_t, $1_home_dir_t, $1_iceauth_home_t, file) # Supress xdm trying to restore .ICEauthority permissions ifdef(`xdm.te', `
macros/program/irc_macros.te +1 -0
@@ -21,6 +21,7 @@ # Home domain home_domain($1, irc) +file_type_auto_trans($1_irc_t, $1_home_dir_t, $1_irc_home_t, dir) # Derived domain based on the calling user domain and the program. type $1_irc_t, domain;
macros/program/lpr_macros.te +2 -19
@@ -53,7 +53,6 @@ ') tmp_domain($1_lpr) -r_dir_file($1_lpr_t, $1_tmp_t) # Type for spool files. type $1_print_spool_t, file_type, sysadmfile;
@@ -72,18 +71,8 @@ allow $1_lpr_t privfd:fd use; # Read user files. -allow sysadm_lpr_t { home_root_t $1_home_t $1_home_dir_t }:dir search; -allow sysadm_lpr_t $1_home_t:{ file lnk_file } r_file_perms; -allow $1_lpr_t { home_root_t $1_home_t $1_home_dir_t }:dir search; -allow $1_lpr_t $1_home_t:{ file lnk_file } r_file_perms; - -if (use_nfs_home_dirs) { -r_dir_file($1_lpr_t, nfs_t) -} - -if (use_samba_home_dirs) { -r_dir_file($1_lpr_t, cifs_t) -} +read_content(sysadm_lpr_t, $1, lpr) +read_content($1_lpr_t, $1, lpr) # Read and write shared files in the spool directory. allow $1_lpr_t print_spool_t:file rw_file_perms;
@@ -124,11 +113,5 @@ can_tcp_connect({ $1_lpr_t $1_t }, cupsd_t) ')dnl end ifdef cups.te -ifdef(`hide_broken_symptoms', ` -# thunderbird causes these -dontaudit $1_lpr_t $1_t:tcp_socket { read write }; -dontaudit $1_lpr_t { $1_home_t $1_tmp_t }:file write; -') - ')dnl end macro definition
macros/program/mail_client_macros.te +6 -18
@@ -4,10 +4,6 @@ # Author: Ivan Gyurdiev <[email protected]> # -# Home access -bool mail_writehome false; -bool mail_readhome false; - ######################################## # mail_client_domain(client, role_prefix) #
@@ -36,25 +32,17 @@ ifdef(`lpr.te', ` domain_auto_trans($1_t, lpr_exec_t, $2_lpr_t) ') -# FIXME - common type needed for internet content -allow $2_lpr_t $1_tmp_t:file r_file_perms; -# Save mail in the home directory -# FIXME - common type needed for internet content -if (mail_writehome) { -file_type_auto_trans($1_t, { $2_home_t $2_home_dir_t }, $1_home_t, file) -} - -# Read home (for attachments) -if (mail_readhome || mail_writehome) { -r_dir_file($1_t, $2_home_t) -} +# Attachments +read_content($1_t, $2, mail) + +# Save mail +write_untrusted($1_t, $2) # Encrypt mail ifdef(`gpg.te', ` domain_auto_trans($1_t, gpg_exec_t, $2_gpg_t) -# FIXME - common type needed for internet content -allow $2_gpg_t $1_tmp_t:file r_file_perms; +allow $2_gpg_t $2_untrusted_content_t:file r_file_perms; ') ')
macros/program/mozilla_macros.te +11 -33
66 lines not on this page · raw message
macros/program/mplayer_macros.te +6 -5
@@ -92,10 +92,6 @@ # RTC clock allow $1_mplayer_t clock_device_t:chr_file { ioctl read }; -# Play content from /home, and from CDs -r_dir_file($1_mplayer_t, $1_home_t); -r_dir_file($1_mplayer_t, removable_t); - # Legacy domain issues if (allow_mplayer_execstack) { allow $1_mplayer_t $1_mplayer_tmpfs_t:file execute;
@@ -120,6 +116,9 @@ can_exec($1_mplayer_t, shell_exec_t) #============================# +# Read songs +read_content($1_mplayer_t, $1, mplayer) + ') dnl end mplayer_domain ###################################
@@ -128,7 +127,6 @@ define(`mencoder_domain',` -# FIXME: privhome temporarily removed... type $1_mencoder_t, domain; # Type transition
@@ -141,6 +139,9 @@ # Mplayer common stuff mplayer_common($1, mencoder) +# Save encoded files +write_trusted($1_mplayer_t, $1, mplayer) + ') dnl end mencoder_domain #############################
macros/program/pyzor_macros.te +1 -0
@@ -52,6 +52,7 @@ # Per-user config/data files home_domain($1, pyzor) +file_type_auto_trans($1_pyzor_t, $1_home_dir_t, $1_pyzor_home_t, dir) # System config files r_dir_file($1_pyzor_t, pyzor_etc_t)
macros/program/razor_macros.te +1 -0
@@ -62,6 +62,7 @@ # Per-user config/data files home_domain($1, razor) +file_type_auto_trans($1_razor_t, $1_home_dir_t, $1_razor_home_t, dir) tmp_domain($1_razor)
macros/program/spamassassin_macros.te +1 -1
@@ -44,7 +44,6 @@ uses_shlib($1_$2_t) read_locale($1_$2_t) dontaudit $1_$2_t var_t:dir search; -allow $1_$2_t $1_home_dir_t:dir r_dir_perms; tmp_domain($1_$2) allow $1_$2_t privfd:fd use; allow $1_$2_t userpty_type:chr_file rw_file_perms;
@@ -81,6 +80,7 @@ # For ~/.spamassassin home_domain($1, spamassassin) +file_type_auto_trans($1_spamassassin_t, $1_home_dir_t, $1_spamassassin_home_t, dir) spamassassin_agent_privs($1_spamassassin_t, $1)
macros/program/thunderbird_macros.te +0 -2
@@ -51,8 +51,6 @@ # Access ~/.thunderbird home_domain($1, thunderbird) -tmp_domain($1_thunderbird) - # RSS feeds can_network_client_tcp($1_thunderbird_t, http_port_t) allow $1_thunderbird_t http_port_t:tcp_socket name_connect;
macros/program/tvtime_macros.te +1 -0
@@ -26,6 +26,7 @@ # X access, Home files home_domain($1, tvtime) +file_type_auto_trans($1_tvtime_t, $1_home_dir_t, $1_tvtime_home_t, dir) x_client_domain($1_tvtime, $1) uses_shlib($1_tvtime_t)
macros/program/xauth_macros.te +2 -1
@@ -23,7 +23,8 @@ allow $1_xauth_t self:process signal; -home_domain($1, xauth, file) +home_domain($1, xauth) +file_type_auto_trans($1_xauth_t, $1_home_dir_t, $1_xauth_home_t, file) # Transition from the user domain to this domain. domain_auto_trans($1_t, xauth_exec_t, $1_xauth_t)
macros/program/xdm_macros.te +1 -1
@@ -7,5 +7,5 @@ define(`can_pipe_xdm', ` allow $1 xdm_t:fd use; -allow $1 xdm_t:fifo_file { getattr read write }; +allow $1 xdm_t:fifo_file { getattr read write ioctl }; ') dnl can_pipe_xdm
macros/user_macros.te +3 -1
@@ -21,7 +21,9 @@ type $1_home_dir_t, file_type, sysadmfile, home_dir_type, home_type, user_home_dir_type, polydir; type $1_home_t, file_type, sysadmfile, home_type, user_home_type, $1_file_type, polymember; -tmp_domain($1, `, user_tmpfile, $1_file_type', `{ file lnk_file dir sock_file fifo_file }') +# Transition manually for { lnk sock fifo }. The rest is in content macros. +tmp_domain_notrans($1, `, user_tmpfile, $1_file_type') +file_type_auto_trans($1_t, tmp_t, $1_tmp_t, { lnk_file sock_file fifo_file }) allow $1_t $1_tmp_t:{ dir file } { relabelto relabelfrom }; ifdef(`support_polyinstantiation', `
Re: Content macros v 2
Content Macros v.2
Requires .mplayer and .gpg to be pre-created (selinux.sh, for lack of a better solution).
Dan, merge at your discretion.
I think most things will work fine, but certain
things start to break when the booleans get turned off. In particular, mozilla generates icons, writes them
in /tmp and reads them back in again. This doesn't
work when read_mozilla_content or read_untrusted_content is disabled. This is an app misbehavior IMHO, and needs to be fixed there. Discussing this w/ mozilla people...
The other major thing that doesn't work is printing
if read_APP_content or read_untrusted is disabled.
I need to investigate how printing is done to get
this working. In particular, why isn't lpr
reading the document, instead of APP. If lpr
was reading the document, we could add a print_untrusted boolean to lpr that's different from read_untrusted_content.
Also, mplayer-mozilla interaction I have yet to test, as well as java (since I removed some things).
domains/program/gpg.te +0 -3
@@ -11,8 +11,5 @@ allow sysadm_gpg_t { home_root_t user_home_dir_type }:dir search; allow sysadm_gpg_t ptyfile:chr_file rw_file_perms; -# Allow gpg exec stack -bool allow_gpg_execstack false; - # Everything else is in the gpg_domain macro in # macros/program/gpg_macros.te.
domains/program/mount.te +1 -1
@@ -68,7 +68,7 @@ # for localization allow mount_t lib_t:file { getattr read }; allow mount_t autofs_t:dir read; -allow mount_t fs_t:filesystem relabelfrom; +allow mount_t fs_type:filesystem relabelfrom; # # This rule needs to be generalized. Only admin, initrc should have it. #
domains/program/mozilla.te +0 -6
@@ -8,12 +8,6 @@ type mozilla_exec_t, file_type, sysadmfile, exec_type; type mozilla_conf_t, file_type, sysadmfile; -# Allow mozilla to read files in the user home directory -bool mozilla_readhome false; - -# Allow mozilla to write files in the user home directory -bool mozilla_writehome false; - # Run in user_t bool disable_mozilla_trans false;
domains/program/xdm.te +3 -3
@@ -326,7 +326,7 @@ allow xdm_t pam_var_run_t:dir create_dir_perms; allow xdm_t pam_var_run_t:file create_file_perms; allow pam_t xdm_t:fifo_file { getattr ioctl write }; -can_exec(xdm_t, pam_console_exec_t) +domain_auto_trans(xdm_t, pam_console_exec_t, pam_console_t) can_exec(xdm_t, pam_exec_t) # For pam_console rw_dir_create_file(xdm_t, pam_var_console_t)
@@ -368,7 +368,7 @@ # Allow gdm to run gdm-binary can_exec(xdm_t, xdm_exec_t) -# Supress getattr check on .ICE-unix -dontaudit xdm_t ice_tmp_t:dir getattr; +# Supress permission check on .ICE-unix +dontaudit xdm_t ice_tmp_t:dir { getattr setattr }; #### Also see xdm_macros.te
domains/user.te +12 -2
@@ -4,6 +4,16 @@ # Booleans for user domains. +# Allow applications to read untrusted content +# If this is disallowed, Internet content has +# to be manually relabeled for read access to be granted +bool read_untrusted_content false; + +# Allow applications to write untrusted content +# If this is disallowed, no Internet content +# will be stored. +bool write_untrusted_content false; + # Allow users to read system messages. bool user_dmesg false;
@@ -79,9 +89,9 @@ dontaudit $1_su_t { sysadm_home_t staff_home_t }:file create_file_perms; ') dnl ifdef su.te ifdef(`xauth.te', ` -file_type_auto_trans($1_xauth_t, sysadm_home_dir_t, sysadm_home_xauth_t,file) +file_type_auto_trans($1_xauth_t, sysadm_home_dir_t, sysadm_xauth_home_t,file) ifdef(`userhelper.te', ` -file_type_auto_trans($1_userhelper_t, sysadm_home_dir_t, sysadm_home_xauth_t,file) +file_type_auto_trans($1_userhelper_t, sysadm_home_dir_t, sysadm_xauth_home_t,file) ') dnl userhelper.te ') dnl xauth.te ') dnl reach_sysadm
file_contexts/distros.fc +3 -12
@@ -88,18 +88,9 @@ /usr/X11R6/lib/modules/dri/.*\.so -- system_u:object_r:texrel_shlib_t /usr/X11R6/lib/libOSMesa\.so.* -- system_u:object_r:texrel_shlib_t /usr/lib/libHermes\.so.* -- system_u:object_r:texrel_shlib_t -/usr/lib/valgrind/libpthread\.so -- system_u:object_r:texrel_shlib_t -/usr/lib/valgrind/vgpreload_addrcheck\.so -- system_u:object_r:texrel_shlib_t -/usr/lib/valgrind/vgpreload_memcheck\.so -- system_u:object_r:texrel_shlib_t -/usr/lib/valgrind/vgskin_addrcheck\.so -- system_u:object_r:texrel_shlib_t -/usr/lib/valgrind/vgskin_cachegrind\.so -- system_u:object_r:texrel_shlib_t -/usr/lib/valgrind/vgskin_callgrind\.so -- system_u:object_r:texrel_shlib_t -/usr/lib/valgrind/vgskin_corecheck\.so -- system_u:object_r:texrel_shlib_t -/usr/lib/valgrind/vgskin_helgrind\.so -- system_u:object_r:texrel_shlib_t -/usr/lib/valgrind/vgskin_lackey\.so -- system_u:object_r:texrel_shlib_t -/usr/lib/valgrind/vgskin_massif\.so -- system_u:object_r:texrel_shlib_t -/usr/lib/valgrind/vgskin_memcheck\.so -- system_u:object_r:texrel_shlib_t -/usr/lib/valgrind/vgskin_none\.so -- system_u:object_r:texrel_shlib_t +/usr/lib/valgrind/hp2ps -- system_u:object_r:texrel_shlib_t +/usr/lib/valgrind/stage2 -- system_u:object_r:texrel_shlib_t +/usr/lib/valgrind/vg.*\.so -- system_u:object_r:texrel_shlib_t /usr/lib/.*/program/libicudata\.so.* -- system_u:object_r:texrel_shlib_t /usr/lib/.*/program/libsts645li\.so -- system_u:object_r:texrel_shlib_t /usr/lib/.*/program/libvclplug_gen645li\.so -- system_u:object_r:texrel_shlib_t
file_contexts/program/irc.fc +1 -1
@@ -2,4 +2,4 @@ /usr/bin/[st]irc -- system_u:object_r:irc_exec_t /usr/bin/ircII -- system_u:object_r:irc_exec_t /usr/bin/tinyirc -- system_u:object_r:irc_exec_t -HOME_DIR/\.ircmotd -- system_u:object_r:ROLE_home_irc_t +HOME_DIR/\.ircmotd -- system_u:object_r:ROLE_irc_home_t
macros/admin_macros.te +3 -1
@@ -22,7 +22,9 @@ # Type and access for pty devices. can_create_pty($1, `, admin_tty_type') -tmp_domain($1, `, $1_file_type', `{ file dir lnk_file sock_file fifo_file }') +# Transition manually for { lnk sock fifo }. The rest is in content macros. +tmp_domain_notrans($1, `, $1_file_type') +file_type_auto_trans($1_t, tmp_t, $1_tmp_t, { lnk_file sock_file fifo_file }) allow $1_t $1_tmp_t:{ dir file } { relabelto relabelfrom }; # Type for tty devices.
macros/base_user_macros.te +25 -26
80 lines not on this page · raw message
macros/content_macros.te +194 -0
194 lines not on this page · raw message
macros/core_macros.te +5 -0
@@ -103,6 +103,11 @@ # define(`create_file_perms', `{ create ioctl read getattr lock write setattr append link unlink rename }') +# +# Permissions for creating files, but not reading +# +define(`create_noread_file_perms', `{ create ioctl getattr lock write setattr append link unlink rename }') + # # Permissions for reading directories and their attributes. #
macros/global_macros.te +5 -109
126 lines not on this page · raw message
macros/home_macros.te +130 -0
130 lines not on this page · raw message
macros/program/evolution_macros.te +7 -4
@@ -61,6 +61,9 @@ can_network_client_tcp($1_evolution_server_t, ldap_port_t) allow $1_evolution_server_t ldap_port_t:tcp_socket name_connect; +# Look in /etc/pki +allow $1_evolution_server_t cert_t:dir r_dir_perms; + ') dnl evolution_data_server #######################################
@@ -137,7 +140,7 @@ # /tmp/.exchange-$USER tmp_domain($1_evolution_exchange) - + # Allow netstat allow $1_evolution_exchange_t bin_t:dir search; can_exec($1_evolution_exchange_t, bin_t)
@@ -145,6 +148,9 @@ allow $1_evolution_exchange_t sysctl_net_t:dir search; allow $1_evolution_exchange_t self:{ udp_socket tcp_socket } create_socket_perms; +# Clock applet talks to exchange (FIXME: Needs policy) +bonobo_connect($1, $1_evolution_exchange) + # FIXME: policy incomplete ') dnl evolution_exchange
@@ -179,9 +185,6 @@ # Access .evolution home_domain($1, evolution) -# Store documents in /tmp (to print, etc..) -tmp_domain($1_evolution) - # Store passwords in .gnome2_private gnome_private_store($1_evolution, $1)
macros/program/gconf_macros.te +1 -0
@@ -23,6 +23,7 @@ # Access .gconfd and .gconf home_domain($1, gconfd) +file_type_auto_trans($1_gconfd_t, $1_home_dir_t, $1_gconfd_home_t, dir) # Access /etc/gconf r_dir_file($1_gconfd_t, gconf_etc_t)
macros/program/gift_macros.te +2 -1
@@ -21,7 +21,7 @@ x_client_domain($1_gift, $1) gnome_application($1_gift, $1) home_domain($1, gift) -tmp_domain($1_gift) +file_type_auto_trans($1_gift_t, $1_home_dir_t, $1_gift_home_t, dir) # Allow the user domain to signal/ps. can_ps($1_t, $1_gift_t)
@@ -75,6 +75,7 @@ # Access home domain home_domain_access($1_giftd_t, $1, gift) +file_type_auto_trans($1_gift_t, $1_home_dir_t, $1_gift_home_t, dir) # Serve content on various p2p networks. Ports can be random. can_network_server($1_giftd_t)
macros/program/gpg_macros.te +6 -36
70 lines not on this page · raw message
macros/program/iceauth_macros.te +2 -1
@@ -15,7 +15,8 @@ role $1_r types $1_iceauth_t; # Store .ICEauthority files -home_domain($1, iceauth, file) +home_domain($1, iceauth) +file_type_auto_trans($1_iceauth_t, $1_home_dir_t, $1_iceauth_home_t, file) # Supress xdm trying to restore .ICEauthority permissions ifdef(`xdm.te', `
macros/program/irc_macros.te +1 -0
@@ -21,6 +21,7 @@ # Home domain home_domain($1, irc) +file_type_auto_trans($1_irc_t, $1_home_dir_t, $1_irc_home_t, dir) # Derived domain based on the calling user domain and the program. type $1_irc_t, domain;
macros/program/lpr_macros.te +2 -19
@@ -53,7 +53,6 @@ ') tmp_domain($1_lpr) -r_dir_file($1_lpr_t, $1_tmp_t) # Type for spool files. type $1_print_spool_t, file_type, sysadmfile;
@@ -72,18 +71,8 @@ allow $1_lpr_t privfd:fd use; # Read user files. -allow sysadm_lpr_t { home_root_t $1_home_t $1_home_dir_t }:dir search; -allow sysadm_lpr_t $1_home_t:{ file lnk_file } r_file_perms; -allow $1_lpr_t { home_root_t $1_home_t $1_home_dir_t }:dir search; -allow $1_lpr_t $1_home_t:{ file lnk_file } r_file_perms; - -if (use_nfs_home_dirs) { -r_dir_file($1_lpr_t, nfs_t) -} - -if (use_samba_home_dirs) { -r_dir_file($1_lpr_t, cifs_t) -} +read_content(sysadm_lpr_t, $1) +read_content($1_lpr_t, $1) # Read and write shared files in the spool directory. allow $1_lpr_t print_spool_t:file rw_file_perms;
@@ -124,11 +113,5 @@ can_tcp_connect({ $1_lpr_t $1_t }, cupsd_t) ')dnl end ifdef cups.te -ifdef(`hide_broken_symptoms', ` -# thunderbird causes these -dontaudit $1_lpr_t $1_t:tcp_socket { read write }; -dontaudit $1_lpr_t { $1_home_t $1_tmp_t }:file write; -') - ')dnl end macro definition
macros/program/mail_client_macros.te +6 -18
@@ -4,10 +4,6 @@ # Author: Ivan Gyurdiev <[email protected]> # -# Home access -bool mail_writehome false; -bool mail_readhome false; - ######################################## # mail_client_domain(client, role_prefix) #
@@ -36,25 +32,17 @@ ifdef(`lpr.te', ` domain_auto_trans($1_t, lpr_exec_t, $2_lpr_t) ') -# FIXME - common type needed for internet content -allow $2_lpr_t $1_tmp_t:file r_file_perms; -# Save mail in the home directory -# FIXME - common type needed for internet content -if (mail_writehome) { -file_type_auto_trans($1_t, { $2_home_t $2_home_dir_t }, $1_home_t, file) -} - -# Read home (for attachments) -if (mail_readhome || mail_writehome) { -r_dir_file($1_t, $2_home_t) -} +# Attachments +read_content($1_t, $2, mail) + +# Save mail +write_untrusted($1_t, $2) # Encrypt mail ifdef(`gpg.te', ` domain_auto_trans($1_t, gpg_exec_t, $2_gpg_t) -# FIXME - common type needed for internet content -allow $2_gpg_t $1_tmp_t:file r_file_perms; +allow $1_t $2_gpg_t:process signal; ') ')
macros/program/mozilla_macros.te +22 -55
121 lines not on this page · raw message
macros/program/mplayer_macros.te +9 -5
@@ -92,10 +92,6 @@ # RTC clock allow $1_mplayer_t clock_device_t:chr_file { ioctl read }; -# Play content from /home, and from CDs -r_dir_file($1_mplayer_t, $1_home_t); -r_dir_file($1_mplayer_t, removable_t); - # Legacy domain issues if (allow_mplayer_execstack) { allow $1_mplayer_t $1_mplayer_tmpfs_t:file execute;
@@ -120,6 +116,9 @@ can_exec($1_mplayer_t, shell_exec_t) #============================# +# Read songs +read_content($1_mplayer_t, $1) + ') dnl end mplayer_domain ###################################
@@ -128,7 +127,6 @@ define(`mencoder_domain',` -# FIXME: privhome temporarily removed... type $1_mencoder_t, domain; # Type transition
@@ -141,6 +139,12 @@ # Mplayer common stuff mplayer_common($1, mencoder) +# Read content to encode +read_content($1_mencoder_t, $1) + +# Save encoded files +write_trusted($1_mencoder_t, $1) + ') dnl end mencoder_domain #############################
macros/program/pyzor_macros.te +1 -0
@@ -52,6 +52,7 @@ # Per-user config/data files home_domain($1, pyzor) +file_type_auto_trans($1_pyzor_t, $1_home_dir_t, $1_pyzor_home_t, dir) # System config files r_dir_file($1_pyzor_t, pyzor_etc_t)
macros/program/razor_macros.te +1 -0
@@ -62,6 +62,7 @@ # Per-user config/data files home_domain($1, razor) +file_type_auto_trans($1_razor_t, $1_home_dir_t, $1_razor_home_t, dir) tmp_domain($1_razor)
macros/program/spamassassin_macros.te +1 -1
@@ -44,7 +44,6 @@ uses_shlib($1_$2_t) read_locale($1_$2_t) dontaudit $1_$2_t var_t:dir search; -allow $1_$2_t $1_home_dir_t:dir r_dir_perms; tmp_domain($1_$2) allow $1_$2_t privfd:fd use; allow $1_$2_t userpty_type:chr_file rw_file_perms;
@@ -81,6 +80,7 @@ # For ~/.spamassassin home_domain($1, spamassassin) +file_type_auto_trans($1_spamassassin_t, $1_home_dir_t, $1_spamassassin_home_t, dir) spamassassin_agent_privs($1_spamassassin_t, $1)
macros/program/thunderbird_macros.te +0 -2
@@ -51,8 +51,6 @@ # Access ~/.thunderbird home_domain($1, thunderbird) -tmp_domain($1_thunderbird) - # RSS feeds can_network_client_tcp($1_thunderbird_t, http_port_t) allow $1_thunderbird_t http_port_t:tcp_socket name_connect;
macros/program/tvtime_macros.te +1 -0
@@ -26,6 +26,7 @@ # X access, Home files home_domain($1, tvtime) +file_type_auto_trans($1_tvtime_t, $1_home_dir_t, $1_tvtime_home_t, dir) x_client_domain($1_tvtime, $1) uses_shlib($1_tvtime_t)
macros/program/xauth_macros.te +2 -1
@@ -23,7 +23,8 @@ allow $1_xauth_t self:process signal; -home_domain($1, xauth, file) +home_domain($1, xauth) +file_type_auto_trans($1_xauth_t, $1_home_dir_t, $1_xauth_home_t, file) # Transition from the user domain to this domain. domain_auto_trans($1_t, xauth_exec_t, $1_xauth_t)
macros/program/xdm_macros.te +1 -1
@@ -7,5 +7,5 @@ define(`can_pipe_xdm', ` allow $1 xdm_t:fd use; -allow $1 xdm_t:fifo_file { getattr read write }; +allow $1 xdm_t:fifo_file { getattr read write ioctl }; ') dnl can_pipe_xdm
macros/user_macros.te +3 -1
@@ -21,7 +21,9 @@ type $1_home_dir_t, file_type, sysadmfile, home_dir_type, home_type, user_home_dir_type, polydir; type $1_home_t, file_type, sysadmfile, home_type, user_home_type, $1_file_type, polymember; -tmp_domain($1, `, user_tmpfile, $1_file_type', `{ file lnk_file dir sock_file fifo_file }') +# Transition manually for { lnk sock fifo }. The rest is in content macros. +tmp_domain_notrans($1, `, user_tmpfile, $1_file_type') +file_type_auto_trans($1_t, tmp_t, $1_tmp_t, { lnk_file sock_file fifo_file }) allow $1_t $1_tmp_t:{ dir file } { relabelto relabelfrom }; ifdef(`support_polyinstantiation', `
Re: Content macros v 2 (create implies read in policy)
Quoted 8 lines
The other major thing that doesn't work is printing
ifread_APP_contentorread_untrustedis disabled.
I need to investigate how printing is done to get
this working. In particular, why isn't lpr
reading the document, instead of APP. If lpr
was reading the document, we could add aprint_untrustedboolean to lpr that's different fromread_untrusted_content.
So, here's an outline of the problem.
CHANGES:
=========
I've done two things in the content macros that might be of interest, because they break stuff.
1) I've broken the assumption that create implies read. If you look at the write_* macros, you will see that the new versions I added are specifically written to disallow read. I was actually surprised to see that create implies read everywhere, and there's not even a macro for write-only. I added a new core macro called create_noread_file_perms.
2) if you look at the read_content macro, you will see that the read_untrusted_content boolean has no effect if the read_APP_content boolean is present, and false. What this means is - I can prevent an application from reading any content, whether it's trusted, or not. The booleans stack.
Now, those two things make sense to me, but at the same time break printing.
BOOLEAN STATE:
==============
Now assume the following state of booleans:
mozilla_read_content is off - this indicates that mozilla has no business reading my private files, trusted or not
mail_read_content is off - this indicates evolution/t-bird can't read my private files, trusted or not
read_untrusted_content is on - this indicates that the applications that are allowed to read content, can also read untrusted content. This is the likely state of that boolean for now, lacking any sort of conversion mechanism at this point, other than chcon to change content from untrusted to trusted. This needs to change in the future to something more user friendly, or this whole untrusted business will be of limited use.
write_untrusted_content is on - this indicates
that applications that try to write untrusted
content are allowed to do so.
THE PROBLEM:
============
Now, lpr, being a somewhat trusted application, can read content, without a controlling boolean, so that it can print it out. Since I've also allowed reading untrusted content, it should be able to print my file.
Mozilla/evolution is also allowed to write that file to disk.
What's broken is the part where mozilla/evolution read the untrusted content back in. I'm not sure why they do this. There's speculation that they do this, in order to concaternate the file itself, with header data. That part is disallowed, because those apps can't read *any* content. I've decided to do away with the capability of reading content for the purpose of uploading it to forms, for using it as attachments... it's a download only stream, with this particular configuration.
POSSIBLE SOLUTIONS:
===================
0) Fix apps so they do this printer manipulation in their private folders, whether that's in $HOME or in /tmp. This requires changing the application code, which is unfortunate. I have to investigate whether this is library code or not. If the folder is in /tmp, it might require pre-creating more folders with a script (or alternative mechanism, when implemented).
1) Stop trying to change the assumption that create implies read, and grant back this privilege to mozilla. This, however, subverts read content booleans. Now mozilla can read untrusted content, by write implies read. Being untrusted does not mean unimportant. It means it's data that originated from the web, that hasn't been processed in any way to make it trusted. Consider saved mail, saved by evolution, currently marked untrusted. Now mozilla can read your mail, even though you *specifically* disabled the read_mozilla_content boolean. Say solution 1 ignores this problem.
2) Stop trying to change the assumption that create implies read, and at the same time create further separation of content, beyond trusted and untrusted (as in...your saved mail is not the same thing as saved webpages, and mozilla has no business reading your mail). We might want to do that in the distant future anyway, regardless of this problem. Alter the content macros to deal with this improved level of granularity.
Any opinions, on which option is best, or anything else?
--
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.
Re: Content macros v 2 (create implies read in policy)
Quoted 7 lines
0) Fix apps so they do this printer manipulation in their private folders, whether that's in $HOME or in /tmp. This requires changing the application code, which is unfortunate. I have to investigate whether this is library code or not. If the folder is in /tmp, it might require pre-creating more folders with a script (or alternative mechanism, when implemented).
So it appears this is all library code, so it might actually not be hard to do. libgnomeprint and libgnomecups should take care of all of GNOME, and then I have to investigate how mozilla handles this...
--
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.
Re: Content macros v 2 (create implies read in policy)
In reply to Ivan GyurdievQuoted 9 lines
2) Stop trying to change the assumption that create implies read, and at the same time create further separation of content, beyond trusted and untrusted (as in...your saved mail is not the same thing as saved webpages, and mozilla has no business reading your mail). We might want to do that in the distant future anyway, regardless of this problem. Alter the content macros to deal with this improved level of granularity.
On second thought I choose this option.
It's obvious why no write_file_perms exists - it's assumed that we always want overwrite protection as well, so it makes no sense to allow create_file_perms from multiple apps on a data type that's supposed to be isolated.
It would be better to put some effort into different content types, and the way they should interact instead, so mozilla can't either read or overwrite your mail.
This is also the least intrusive option.
--
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.