Chris PeBenito ab58ad
#
Chris PeBenito ab58ad
# Authors:  Dan Walsh <dwalsh@redhat.com> 
Chris PeBenito ab58ad
#
Chris PeBenito ab58ad
# Macros for javaplugin (java plugin) domains.
Chris PeBenito ab58ad
#
Chris PeBenito ab58ad
#
Chris PeBenito ab58ad
# javaplugin_domain(domain_prefix, role)
Chris PeBenito ab58ad
#
Chris PeBenito ab58ad
# Define a derived domain for the javaplugin program when executed by
Chris PeBenito ab58ad
# a web browser.  
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/java.te. 
Chris PeBenito ab58ad
#
Chris PeBenito ab58ad
define(`javaplugin_domain',`
Chris PeBenito ab58ad
type $1_javaplugin_t, domain, privlog , nscd_client_domain, transitionbool;
Chris PeBenito ab58ad
Chris PeBenito ab58ad
# The user role is authorized for this domain.
Chris PeBenito ab58ad
role $2_r types $1_javaplugin_t;
Chris PeBenito ab58ad
domain_auto_trans($1_t, java_exec_t, $1_javaplugin_t)
Chris PeBenito ab58ad
Chris PeBenito ab58ad
allow $1_javaplugin_t sound_device_t:chr_file rw_file_perms;
Chris PeBenito ab58ad
# Unrestricted inheritance from the caller.
Chris PeBenito ab58ad
allow $1_t $1_javaplugin_t:process { noatsecure siginh rlimitinh };
Chris PeBenito ab58ad
allow $1_javaplugin_t $1_t:process signull;
Chris PeBenito ab58ad
Chris PeBenito ab58ad
can_unix_connect($1_javaplugin_t, $1_t)
Chris PeBenito ab58ad
allow $1_javaplugin_t $1_t:unix_stream_socket { read write };
Chris PeBenito ab58ad
Chris PeBenito ab58ad
# This domain is granted permissions common to most domains (including can_net)
Chris PeBenito ab58ad
can_network_client($1_javaplugin_t)
Chris PeBenito ab58ad
allow $1_javaplugin_t port_type:tcp_socket name_connect;
Chris PeBenito ab58ad
can_ypbind($1_javaplugin_t)
Chris PeBenito ab58ad
allow $1_javaplugin_t self:process { fork signal_perms getsched setsched };
Chris PeBenito ab58ad
allow $1_javaplugin_t self:fifo_file rw_file_perms;
Chris PeBenito ab58ad
allow $1_javaplugin_t etc_runtime_t:file { getattr read };
Chris PeBenito ab58ad
allow $1_javaplugin_t fs_t:filesystem getattr;
Chris PeBenito ab58ad
r_dir_file($1_javaplugin_t, { proc_t proc_net_t })
Chris PeBenito ab58ad
allow $1_javaplugin_t self:dir search;
Chris PeBenito ab58ad
allow $1_javaplugin_t self:lnk_file read;
Chris PeBenito ab58ad
allow $1_javaplugin_t self:file { getattr read };
Chris PeBenito ab58ad
Chris PeBenito ab58ad
read_sysctl($1_javaplugin_t)
Chris PeBenito ab58ad
allow $1_javaplugin_t sysctl_vm_t:dir search;
Chris PeBenito ab58ad
Chris PeBenito ab58ad
tmp_domain($1_javaplugin)
Chris PeBenito ab58ad
read_fonts($1_javaplugin_t, $2)
Chris PeBenito ab58ad
r_dir_file($1_javaplugin_t,{ usr_t etc_t })
Chris PeBenito ab58ad
Chris PeBenito ab58ad
# Search bin directory under javaplugin for javaplugin executable
Chris PeBenito ab58ad
allow $1_javaplugin_t bin_t:dir search;
Chris PeBenito ab58ad
can_exec($1_javaplugin_t, java_exec_t)
Chris PeBenito ab58ad
Chris PeBenito ab58ad
# libdeploy.so legacy
Chris PeBenito ab58ad
allow $1_javaplugin_t texrel_shlib_t:file execmod;
Chris PeBenito ab58ad
if (allow_execmem) {
Chris PeBenito ab58ad
allow $1_javaplugin_t self:process execmem;
Chris PeBenito ab58ad
}
Chris PeBenito ab58ad
Chris PeBenito ab58ad
# Connect to X server
Chris PeBenito ab58ad
x_client_domain($1_javaplugin, $2) 
Chris PeBenito ab58ad
Chris PeBenito ab58ad
uses_shlib($1_javaplugin_t)
Chris PeBenito ab58ad
read_locale($1_javaplugin_t)
Chris PeBenito ab58ad
rw_dir_file($1_javaplugin_t, $1_home_t)
Chris PeBenito ab58ad
Chris PeBenito ab58ad
if (allow_java_execstack) {
Chris PeBenito ab58ad
legacy_domain($1_javaplugin)
Chris PeBenito ab58ad
allow $1_javaplugin_t lib_t:file execute;
Chris PeBenito ab58ad
allow $1_javaplugin_t locale_t:file execute;
Chris PeBenito ab58ad
allow $1_javaplugin_t $1_javaplugin_tmp_t:file execute;
Chris PeBenito ab58ad
allow $1_javaplugin_t fonts_t:file execute;
Chris PeBenito ab58ad
allow $1_javaplugin_t sound_device_t:chr_file execute;
Chris PeBenito ab58ad
}
Chris PeBenito ab58ad
Chris PeBenito ab58ad
allow $1_javaplugin_t { random_device_t urandom_device_t }:chr_file ra_file_perms;
Chris PeBenito ab58ad
Chris PeBenito ab58ad
allow $1_javaplugin_t home_root_t:dir { getattr search };
Chris PeBenito ab58ad
file_type_auto_trans($1_javaplugin_t, $2_home_dir_t, $1_home_t)
Chris PeBenito ab58ad
allow $1_javaplugin_t $2_xauth_home_t:file { getattr read };
Chris PeBenito ab58ad
allow $1_javaplugin_t $2_tmp_t:sock_file write;
Chris PeBenito ab58ad
allow $1_javaplugin_t $2_t:fd use;
Chris PeBenito ab58ad
Chris PeBenito ab58ad
allow $1_javaplugin_t var_t:dir getattr;
Chris PeBenito ab58ad
allow $1_javaplugin_t var_lib_t:dir { getattr search };
Chris PeBenito ab58ad
Chris PeBenito ab58ad
dontaudit $1_javaplugin_t $2_devpts_t:chr_file { read write };
Chris PeBenito ab58ad
dontaudit $1_javaplugin_t sysadm_devpts_t:chr_file { read write };
Chris PeBenito ab58ad
dontaudit $1_javaplugin_t devtty_t:chr_file { read write };
Chris PeBenito ab58ad
dontaudit $1_javaplugin_t tmpfs_t:file { execute read write };
Chris PeBenito ab58ad
dontaudit $1_javaplugin_t $1_home_t:file { execute setattr };
Chris PeBenito ab58ad
Chris PeBenito ab58ad
')