|
Chris PeBenito |
ab58ad |
#
|
|
Chris PeBenito |
ab58ad |
# Macros for mozilla/mozilla (or other browser) domains.
|
|
Chris PeBenito |
ab58ad |
#
|
|
Chris PeBenito |
ab58ad |
|
|
Chris PeBenito |
ab58ad |
#
|
|
Chris PeBenito |
ab58ad |
# Authors: Stephen Smalley <sds@epoch.ncsc.mil> and Timothy Fraser
|
|
Chris PeBenito |
ab58ad |
#
|
|
Chris PeBenito |
ab58ad |
|
|
Chris PeBenito |
ab58ad |
#
|
|
Chris PeBenito |
ab58ad |
# mozilla_domain(domain_prefix)
|
|
Chris PeBenito |
ab58ad |
#
|
|
Chris PeBenito |
ab58ad |
# Define a derived domain for the mozilla/mozilla program when executed by
|
|
Chris PeBenito |
ab58ad |
# a user domain.
|
|
Chris PeBenito |
ab58ad |
#
|
|
Chris PeBenito |
ab58ad |
# The type declaration for the executable type for this program is
|
|
Chris PeBenito |
ab58ad |
# provided separately in domains/program/mozilla.te.
|
|
Chris PeBenito |
ab58ad |
#
|
|
Chris PeBenito |
ab58ad |
|
|
Chris PeBenito |
ab58ad |
# FIXME: Rules were removed to centralize policy in a gnome_app macro
|
|
Chris PeBenito |
ab58ad |
# A similar thing might be necessary for mozilla compiled without GNOME
|
|
Chris PeBenito |
ab58ad |
# support (is this possible?).
|
|
Chris PeBenito |
ab58ad |
|
|
Chris PeBenito |
ab58ad |
define(`mozilla_domain',`
|
|
Chris PeBenito |
ab58ad |
|
|
Chris PeBenito |
ab58ad |
type $1_mozilla_t, domain, web_client_domain, nscd_client_domain, privlog;
|
|
Chris PeBenito |
ab58ad |
|
|
Chris PeBenito |
ab58ad |
# Type transition
|
|
Chris PeBenito |
ab58ad |
if (! disable_mozilla_trans) {
|
|
Chris PeBenito |
ab58ad |
domain_auto_trans($1_t, mozilla_exec_t, $1_mozilla_t)
|
|
Chris PeBenito |
ab58ad |
}
|
|
Chris PeBenito |
ab58ad |
role $1_r types $1_mozilla_t;
|
|
Chris PeBenito |
ab58ad |
|
|
Chris PeBenito |
ab58ad |
# X access, Home files
|
|
Chris PeBenito |
ab58ad |
home_domain($1, mozilla)
|
|
Chris PeBenito |
ab58ad |
x_client_domain($1_mozilla, $1)
|
|
Chris PeBenito |
ab58ad |
|
|
Chris PeBenito |
ab58ad |
# GNOME integration
|
|
Chris PeBenito |
ab58ad |
ifdef(`gnome.te', `
|
|
Chris PeBenito |
ab58ad |
gnome_application($1_mozilla, $1)
|
|
Chris PeBenito |
ab58ad |
gnome_file_dialog($1_mozilla, $1)
|
|
Chris PeBenito |
ab58ad |
')
|
|
Chris PeBenito |
ab58ad |
|
|
Chris PeBenito |
ab58ad |
# Look for plugins
|
|
Chris PeBenito |
ab58ad |
allow $1_mozilla_t bin_t:dir { getattr read search };
|
|
Chris PeBenito |
ab58ad |
|
|
Chris PeBenito |
ab58ad |
# Browse the web, connect to printer
|
|
Chris PeBenito |
ab58ad |
can_resolve($1_mozilla_t)
|
|
Chris PeBenito |
ab58ad |
can_network_client_tcp($1_mozilla_t, { http_port_t http_cache_port_t ftp_port_t ipp_port_t } )
|
|
Chris PeBenito |
ab58ad |
allow $1_mozilla_t { http_port_t http_cache_port_t ftp_port_t ipp_port_t }:tcp_socket name_connect;
|
|
Chris PeBenito |
ab58ad |
|
|
Chris PeBenito |
ab58ad |
# Should not need other ports
|
|
Chris PeBenito |
ab58ad |
dontaudit $1_mozilla_t port_t:tcp_socket { name_connect name_bind };
|
|
Chris PeBenito |
ab58ad |
|
|
Chris PeBenito |
ab58ad |
allow $1_mozilla_t sound_device_t:chr_file rw_file_perms;
|
|
Chris PeBenito |
ab58ad |
dontaudit $1_mozilla_t dri_device_t:chr_file rw_file_perms;
|
|
Chris PeBenito |
ab58ad |
|
|
Chris PeBenito |
ab58ad |
# Unrestricted inheritance from the caller.
|
|
Chris PeBenito |
ab58ad |
allow $1_t $1_mozilla_t:process { noatsecure siginh rlimitinh };
|
|
Chris PeBenito |
ab58ad |
allow $1_mozilla_t $1_t:process signull;
|
|
Chris PeBenito |
ab58ad |
|
|
Chris PeBenito |
ab58ad |
# Allow the user domain to signal/ps.
|
|
Chris PeBenito |
ab58ad |
can_ps($1_t, $1_mozilla_t)
|
|
Chris PeBenito |
ab58ad |
allow $1_t $1_mozilla_t:process signal_perms;
|
|
Chris PeBenito |
ab58ad |
|
|
Chris PeBenito |
ab58ad |
# Access /proc, sysctl
|
|
Chris PeBenito |
ab58ad |
allow $1_mozilla_t proc_t:dir search;
|
|
Chris PeBenito |
ab58ad |
allow $1_mozilla_t proc_t:file { getattr read };
|
|
Chris PeBenito |
ab58ad |
allow $1_mozilla_t proc_t:lnk_file read;
|
|
Chris PeBenito |
ab58ad |
allow $1_mozilla_t sysctl_net_t:dir search;
|
|
Chris PeBenito |
ab58ad |
allow $1_mozilla_t sysctl_t:dir search;
|
|
Chris PeBenito |
ab58ad |
|
|
Chris PeBenito |
ab58ad |
# /var/lib
|
|
Chris PeBenito |
ab58ad |
allow $1_mozilla_t var_lib_t:dir search;
|
|
Chris PeBenito |
ab58ad |
allow $1_mozilla_t var_lib_t:file { getattr read };
|
|
Chris PeBenito |
ab58ad |
|
|
Chris PeBenito |
ab58ad |
# Self permissions
|
|
Chris PeBenito |
ab58ad |
allow $1_mozilla_t self:socket create_socket_perms;
|
|
Chris PeBenito |
ab58ad |
allow $1_mozilla_t self:file { getattr read };
|
|
Chris PeBenito |
ab58ad |
allow $1_mozilla_t self:sem create_sem_perms;
|
|
Chris PeBenito |
ab58ad |
|
|
Chris PeBenito |
ab58ad |
# for bash - old mozilla binary
|
|
Chris PeBenito |
ab58ad |
can_exec($1_mozilla_t, mozilla_exec_t)
|
|
Chris PeBenito |
ab58ad |
can_exec($1_mozilla_t, shell_exec_t)
|
|
Chris PeBenito |
ab58ad |
can_exec($1_mozilla_t, bin_t)
|
|
Chris PeBenito |
ab58ad |
allow $1_mozilla_t bin_t:lnk_file read;
|
|
Chris PeBenito |
ab58ad |
allow $1_mozilla_t device_t:dir r_dir_perms;
|
|
Chris PeBenito |
ab58ad |
allow $1_mozilla_t self:dir search;
|
|
Chris PeBenito |
ab58ad |
allow $1_mozilla_t self:lnk_file read;
|
|
Chris PeBenito |
ab58ad |
r_dir_file($1_mozilla_t, proc_net_t)
|
|
Chris PeBenito |
ab58ad |
|
|
Chris PeBenito |
ab58ad |
# interacting with gstreamer
|
|
Chris PeBenito |
ab58ad |
r_dir_file($1_mozilla_t, var_t)
|
|
Chris PeBenito |
ab58ad |
|
|
Chris PeBenito |
ab58ad |
# Uploads, local html
|
|
Chris PeBenito |
ab58ad |
read_content($1_mozilla_t, $1, mozilla)
|
|
Chris PeBenito |
ab58ad |
|
|
Chris PeBenito |
ab58ad |
# Save web pages
|
|
Chris PeBenito |
ab58ad |
write_untrusted($1_mozilla_t, $1)
|
|
Chris PeBenito |
ab58ad |
|
|
Chris PeBenito |
ab58ad |
# Mozpluggerrc
|
|
Chris PeBenito |
ab58ad |
allow $1_mozilla_t mozilla_conf_t:file r_file_perms;
|
|
Chris PeBenito |
ab58ad |
|
|
Chris PeBenito |
ab58ad |
######### Java plugin
|
|
Chris PeBenito |
ab58ad |
ifdef(`java.te', `
|
|
Chris PeBenito |
ab58ad |
javaplugin_domain($1_mozilla, $1)
|
|
Chris PeBenito |
ab58ad |
') dnl java.te
|
|
Chris PeBenito |
ab58ad |
|
|
Chris PeBenito |
ab58ad |
######### Print web content
|
|
Chris PeBenito |
ab58ad |
ifdef(`cups.te', `
|
|
Chris PeBenito |
ab58ad |
allow $1_mozilla_t cupsd_etc_t:dir search;
|
|
Chris PeBenito |
ab58ad |
allow $1_mozilla_t cupsd_rw_etc_t:file { getattr read };
|
|
Chris PeBenito |
ab58ad |
')
|
|
Chris PeBenito |
ab58ad |
ifdef(`lpr.te', `
|
|
Chris PeBenito |
ab58ad |
domain_auto_trans($1_mozilla_t, lpr_exec_t, $1_lpr_t)
|
|
Chris PeBenito |
ab58ad |
dontaudit $1_lpr_t $1_mozilla_home_t:file { read write };
|
|
Chris PeBenito |
ab58ad |
dontaudit $1_lpr_t $1_mozilla_t:tcp_socket { read write };
|
|
Chris PeBenito |
ab58ad |
') dnl if lpr.te
|
|
Chris PeBenito |
ab58ad |
|
|
Chris PeBenito |
ab58ad |
######### Launch mplayer
|
|
Chris PeBenito |
ab58ad |
ifdef(`mplayer.te', `
|
|
Chris PeBenito |
ab58ad |
domain_auto_trans($1_mozilla_t, mplayer_exec_t, $1_mplayer_t)
|
|
Chris PeBenito |
ab58ad |
dontaudit $1_mplayer_t $1_mozilla_home_t:file { read write };
|
|
Chris PeBenito |
ab58ad |
dontaudit $1_mplayer_t $1_mozilla_t:unix_stream_socket { read write };
|
|
Chris PeBenito |
ab58ad |
dontaudit $1_mplayer_t $1_mozilla_home_t:file { read write };
|
|
Chris PeBenito |
ab58ad |
')dnl end if mplayer.te
|
|
Chris PeBenito |
ab58ad |
|
|
Chris PeBenito |
ab58ad |
######### Launch email client, and make webcal links work
|
|
Chris PeBenito |
ab58ad |
ifdef(`evolution.te', `
|
|
Chris PeBenito |
ab58ad |
domain_auto_trans($1_mozilla_t, evolution_exec_t, $1_evolution_t)
|
|
Chris PeBenito |
ab58ad |
domain_auto_trans($1_mozilla_t, evolution_webcal_exec_t, $1_evolution_webcal_t)
|
|
Chris PeBenito |
ab58ad |
') dnl if evolution.te
|
|
Chris PeBenito |
ab58ad |
|
|
Chris PeBenito |
ab58ad |
ifdef(`thunderbird.te', `
|
|
Chris PeBenito |
ab58ad |
domain_auto_trans($1_mozilla_t, thunderbird_exec_t, $1_thunderbird_t)
|
|
Chris PeBenito |
ab58ad |
') dnl if evolution.te
|
|
Chris PeBenito |
ab58ad |
|
|
Chris PeBenito |
ab58ad |
if (allow_execmem) {
|
|
Chris PeBenito |
ab58ad |
allow $1_mozilla_t self:process { execmem execstack };
|
|
Chris PeBenito |
ab58ad |
}
|
|
Chris PeBenito |
ab58ad |
allow $1_mozilla_t texrel_shlib_t:file execmod;
|
|
Chris PeBenito |
ab58ad |
|
|
Chris PeBenito |
ab58ad |
ifdef(`dbusd.te', `
|
|
Chris PeBenito |
ab58ad |
dbusd_client(system, $1_mozilla)
|
|
Chris PeBenito |
ab58ad |
allow $1_mozilla_t system_dbusd_t:dbus send_msg;
|
|
Chris PeBenito |
ab58ad |
ifdef(`cups.te', `
|
|
Chris PeBenito |
ab58ad |
allow cupsd_t $1_mozilla_t:dbus send_msg;
|
|
Chris PeBenito |
ab58ad |
')
|
|
Chris PeBenito |
ab58ad |
')
|
|
Chris PeBenito |
ab58ad |
|
|
Chris PeBenito |
ab58ad |
ifdef(`apache.te', `
|
|
Chris PeBenito |
ab58ad |
ifelse($1, sysadm, `', `
|
|
Chris PeBenito |
ab58ad |
r_dir_file($1_mozilla_t, { httpd_$1_script_exec_t httpd_$1_content_t })
|
|
Chris PeBenito |
ab58ad |
')
|
|
Chris PeBenito |
ab58ad |
')
|
|
Chris PeBenito |
ab58ad |
|
|
Chris PeBenito |
ab58ad |
')dnl end mozilla macro
|
|
Chris PeBenito |
ab58ad |
|