|
Chris PeBenito |
0fbfa5 |
#
|
|
Chris PeBenito |
0fbfa5 |
# Macros for mozilla/mozilla (or other browser) domains.
|
|
Chris PeBenito |
0fbfa5 |
#
|
|
Chris PeBenito |
0fbfa5 |
|
|
Chris PeBenito |
0fbfa5 |
#
|
|
Chris PeBenito |
0fbfa5 |
# Authors: Stephen Smalley <sds@epoch.ncsc.mil> and Timothy Fraser
|
|
Chris PeBenito |
0fbfa5 |
#
|
|
Chris PeBenito |
0fbfa5 |
|
|
Chris PeBenito |
0fbfa5 |
#
|
|
Chris PeBenito |
0fbfa5 |
# mozilla_domain(domain_prefix)
|
|
Chris PeBenito |
0fbfa5 |
#
|
|
Chris PeBenito |
0fbfa5 |
# Define a derived domain for the mozilla/mozilla program when executed by
|
|
Chris PeBenito |
0fbfa5 |
# a user domain.
|
|
Chris PeBenito |
0fbfa5 |
#
|
|
Chris PeBenito |
0fbfa5 |
# The type declaration for the executable type for this program is
|
|
Chris PeBenito |
0fbfa5 |
# provided separately in domains/program/mozilla.te.
|
|
Chris PeBenito |
0fbfa5 |
#
|
|
Chris PeBenito |
0fbfa5 |
define(`mozilla_domain',`
|
|
Chris PeBenito |
0fbfa5 |
x_client_domain($1, mozilla, `, web_client_domain, privlog, transitionbool')
|
|
Chris PeBenito |
0fbfa5 |
|
|
Chris PeBenito |
0fbfa5 |
# Configuration
|
|
Chris PeBenito |
0fbfa5 |
home_domain($1, mozilla)
|
|
Chris PeBenito |
0fbfa5 |
|
|
Chris PeBenito |
0fbfa5 |
# Allow mozilla to browse files
|
|
Chris PeBenito |
0fbfa5 |
file_browse_domain($1_mozilla_t)
|
|
Chris PeBenito |
0fbfa5 |
|
|
Chris PeBenito |
0fbfa5 |
allow $1_mozilla_t sound_device_t:chr_file rw_file_perms;
|
|
Chris PeBenito |
0fbfa5 |
|
|
Chris PeBenito |
0fbfa5 |
# Unrestricted inheritance from the caller.
|
|
Chris PeBenito |
0fbfa5 |
allow $1_t $1_mozilla_t:process { noatsecure siginh rlimitinh };
|
|
Chris PeBenito |
0fbfa5 |
allow $1_mozilla_t $1_t:process signull;
|
|
Chris PeBenito |
0fbfa5 |
|
|
Chris PeBenito |
0fbfa5 |
# Set resource limits and scheduling info.
|
|
Chris PeBenito |
0fbfa5 |
allow $1_mozilla_t self:process { setrlimit setsched };
|
|
Chris PeBenito |
0fbfa5 |
|
|
Chris PeBenito |
0fbfa5 |
allow $1_mozilla_t usr_t:{ lnk_file file } { getattr read };
|
|
Chris PeBenito |
0fbfa5 |
allow $1_mozilla_t var_lib_t:file { getattr read };
|
|
Chris PeBenito |
0fbfa5 |
allow $1_mozilla_t { random_device_t urandom_device_t }:chr_file { getattr ioctl read };
|
|
Chris PeBenito |
0fbfa5 |
allow $1_mozilla_t self:socket create_socket_perms;
|
|
Chris PeBenito |
0fbfa5 |
allow $1_mozilla_t self:file { getattr read };
|
|
Chris PeBenito |
0fbfa5 |
|
|
Chris PeBenito |
0fbfa5 |
# for bash
|
|
Chris PeBenito |
0fbfa5 |
allow $1_mozilla_t device_t:dir r_dir_perms;
|
|
Chris PeBenito |
0fbfa5 |
allow $1_mozilla_t devpts_t:dir r_dir_perms;
|
|
Chris PeBenito |
0fbfa5 |
allow $1_mozilla_t proc_t:file { getattr read };
|
|
Chris PeBenito |
0fbfa5 |
r_dir_file($1_mozilla_t, proc_net_t)
|
|
Chris PeBenito |
0fbfa5 |
|
|
Chris PeBenito |
0fbfa5 |
allow $1_mozilla_t { var_t var_lib_t }:dir search;
|
|
Chris PeBenito |
0fbfa5 |
|
|
Chris PeBenito |
0fbfa5 |
# interacting with gstreamer
|
|
Chris PeBenito |
0fbfa5 |
r_dir_file($1_mozilla_t, var_t)
|
|
Chris PeBenito |
0fbfa5 |
|
|
Chris PeBenito |
0fbfa5 |
# Write files to tmp
|
|
Chris PeBenito |
0fbfa5 |
tmp_domain($1_mozilla)
|
|
Chris PeBenito |
0fbfa5 |
|
|
Chris PeBenito |
0fbfa5 |
# Execute downloaded programs.
|
|
Chris PeBenito |
0fbfa5 |
can_exec($1_mozilla_t, $1_mozilla_tmp_t)
|
|
Chris PeBenito |
0fbfa5 |
|
|
Chris PeBenito |
0fbfa5 |
# Use printer
|
|
Chris PeBenito |
0fbfa5 |
ifdef(`lpr.te', `
|
|
Chris PeBenito |
0fbfa5 |
domain_auto_trans($1_mozilla_t, lpr_exec_t, $1_lpr_t)
|
|
Chris PeBenito |
0fbfa5 |
|
|
Chris PeBenito |
0fbfa5 |
# Print document
|
|
Chris PeBenito |
0fbfa5 |
allow $1_lpr_t $1_mozilla_tmp_t:file rw_file_perms;
|
|
Chris PeBenito |
0fbfa5 |
|
|
Chris PeBenito |
0fbfa5 |
# Suppress history.fop denial
|
|
Chris PeBenito |
0fbfa5 |
dontaudit $1_lpr_t $1_mozilla_home_t:file { read write };
|
|
Chris PeBenito |
0fbfa5 |
|
|
Chris PeBenito |
0fbfa5 |
dontaudit $1_lpr_t $1_mozilla_t:tcp_socket { read write };
|
|
Chris PeBenito |
0fbfa5 |
dontaudit $1_lpr_t $1_mozilla_t:unix_stream_socket { read write };
|
|
Chris PeBenito |
0fbfa5 |
')
|
|
Chris PeBenito |
0fbfa5 |
|
|
Chris PeBenito |
0fbfa5 |
# ORBit sockets
|
|
Chris PeBenito |
0fbfa5 |
file_type_auto_trans($1_mozilla_t, $1_tmp_t, $1_mozilla_tmp_t)
|
|
Chris PeBenito |
0fbfa5 |
can_unix_connect($1_t, $1_mozilla_t)
|
|
Chris PeBenito |
0fbfa5 |
allow $1_t $1_mozilla_tmp_t:sock_file write;
|
|
Chris PeBenito |
0fbfa5 |
allow $1_mozilla_t $1_tmp_t:file { read write lock };
|
|
Chris PeBenito |
0fbfa5 |
allow $1_mozilla_t $1_tmp_t:sock_file { read write };
|
|
Chris PeBenito |
0fbfa5 |
dontaudit $1_mozilla_t $1_tmp_t:dir setattr;
|
|
Chris PeBenito |
0fbfa5 |
|
|
Chris PeBenito |
0fbfa5 |
# Allow mozilla to read user home content
|
|
Chris PeBenito |
0fbfa5 |
if (mozilla_readhome || mozilla_writehome) {
|
|
Chris PeBenito |
0fbfa5 |
r_dir_file($1_mozilla_t, $1_home_t)
|
|
Chris PeBenito |
0fbfa5 |
} else {
|
|
Chris PeBenito |
0fbfa5 |
dontaudit $1_mozilla_t $1_home_t:dir setattr;
|
|
Chris PeBenito |
0fbfa5 |
dontaudit $1_mozilla_t $1_home_t:file setattr;
|
|
Chris PeBenito |
0fbfa5 |
}
|
|
Chris PeBenito |
0fbfa5 |
|
|
Chris PeBenito |
0fbfa5 |
if (mozilla_writehome) {
|
|
Chris PeBenito |
0fbfa5 |
file_type_auto_trans($1_mozilla_t, $1_home_t, $1_mozilla_home_t)
|
|
Chris PeBenito |
0fbfa5 |
allow $1_mozilla_t $1_home_t:dir setattr;
|
|
Chris PeBenito |
0fbfa5 |
allow $1_mozilla_t $1_home_t:{ file lnk_file } rw_file_perms;
|
|
Chris PeBenito |
0fbfa5 |
} dnl end if writehome
|
|
Chris PeBenito |
0fbfa5 |
|
|
Chris PeBenito |
0fbfa5 |
allow $1_mozilla_t $1_t:unix_stream_socket connectto;
|
|
Chris PeBenito |
0fbfa5 |
allow $1_mozilla_t sysctl_net_t:dir search;
|
|
Chris PeBenito |
0fbfa5 |
allow $1_mozilla_t sysctl_t:dir search;
|
|
Chris PeBenito |
0fbfa5 |
ifdef(`cups.te', `
|
|
Chris PeBenito |
0fbfa5 |
allow $1_mozilla_t cupsd_etc_t:dir search;
|
|
Chris PeBenito |
0fbfa5 |
allow $1_mozilla_t cupsd_rw_etc_t:file { getattr read };
|
|
Chris PeBenito |
0fbfa5 |
')
|
|
Chris PeBenito |
0fbfa5 |
allow $1_mozilla_t $1_t:tcp_socket { read write };
|
|
Chris PeBenito |
0fbfa5 |
|
|
Chris PeBenito |
0fbfa5 |
allow $1_mozilla_t mozilla_conf_t:file r_file_perms;
|
|
Chris PeBenito |
0fbfa5 |
dontaudit $1_mozilla_t port_type:tcp_socket name_bind;
|
|
Chris PeBenito |
0fbfa5 |
dontaudit $1_mozilla_t dri_device_t:chr_file rw_file_perms;
|
|
Chris PeBenito |
0fbfa5 |
# Mozilla tries to delete .fonts.cache-1
|
|
Chris PeBenito |
0fbfa5 |
dontaudit $1_mozilla_t $1_home_t:file unlink;
|
|
Chris PeBenito |
0fbfa5 |
allow $1_mozilla_t self:sem create_sem_perms;
|
|
Chris PeBenito |
0fbfa5 |
|
|
Chris PeBenito |
0fbfa5 |
# Java plugin
|
|
Chris PeBenito |
0fbfa5 |
ifdef(`java.te', `
|
|
Chris PeBenito |
0fbfa5 |
javaplugin_domain($1_mozilla, $1)
|
|
Chris PeBenito |
0fbfa5 |
')
|
|
Chris PeBenito |
0fbfa5 |
|
|
Chris PeBenito |
0fbfa5 |
# Mplayer plugin
|
|
Chris PeBenito |
0fbfa5 |
ifdef(`mplayer.te', `
|
|
Chris PeBenito |
0fbfa5 |
domain_auto_trans($1_mozilla_t, mplayer_exec_t, $1_mplayer_t)
|
|
Chris PeBenito |
0fbfa5 |
|
|
Chris PeBenito |
0fbfa5 |
# Read mozilla content in /tmp
|
|
Chris PeBenito |
0fbfa5 |
r_dir_file($1_mplayer_t, $1_mozilla_tmp_t);
|
|
Chris PeBenito |
0fbfa5 |
|
|
Chris PeBenito |
0fbfa5 |
# FIXME: why does it need this?
|
|
Chris PeBenito |
0fbfa5 |
dontaudit $1_mplayer_t $1_mozilla_home_t:file write;
|
|
Chris PeBenito |
0fbfa5 |
allow $1_mplayer_t $1_mozilla_t:unix_stream_socket { read write };
|
|
Chris PeBenito |
0fbfa5 |
')dnl end if mplayer.te
|
|
Chris PeBenito |
0fbfa5 |
|
|
Chris PeBenito |
0fbfa5 |
if (allow_execmem) {
|
|
Chris PeBenito |
0fbfa5 |
allow $1_mozilla_t self:process { execmem };
|
|
Chris PeBenito |
0fbfa5 |
}
|
|
Chris PeBenito |
0fbfa5 |
if (allow_execmod) {
|
|
Chris PeBenito |
0fbfa5 |
allow $1_mozilla_t texrel_shlib_t:file execmod;
|
|
Chris PeBenito |
0fbfa5 |
}
|
|
Chris PeBenito |
0fbfa5 |
dbusd_client(system, $1_mozilla)
|
|
Chris PeBenito |
0fbfa5 |
|
|
Chris PeBenito |
0fbfa5 |
')dnl end mozilla macro
|
|
Chris PeBenito |
0fbfa5 |
|