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