Chris PeBenito ab58ad
#
Chris PeBenito ab58ad
# Macros for screen domains.
Chris PeBenito ab58ad
#
Chris PeBenito ab58ad
Chris PeBenito ab58ad
#
Chris PeBenito ab58ad
# Author: Russell Coker <russell@coker.com.au>
Chris PeBenito ab58ad
# Based on the work of Stephen Smalley <sds@epoch.ncsc.mil>
Chris PeBenito ab58ad
# and Timothy Fraser
Chris PeBenito ab58ad
#
Chris PeBenito ab58ad
Chris PeBenito ab58ad
#
Chris PeBenito ab58ad
# screen_domain(domain_prefix)
Chris PeBenito ab58ad
#
Chris PeBenito ab58ad
# Define a derived domain for the screen program when executed
Chris PeBenito ab58ad
# by 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/screen.te. 
Chris PeBenito ab58ad
#
Chris PeBenito ab58ad
undefine(`screen_domain')
Chris PeBenito ab58ad
ifdef(`screen.te', `
Chris PeBenito ab58ad
define(`screen_domain',`
Chris PeBenito ab58ad
# Derived domain based on the calling user domain and the program.
Chris PeBenito ab58ad
type $1_screen_t, domain, privlog, privfd, nscd_client_domain;
Chris PeBenito ab58ad
Chris PeBenito ab58ad
# Transition from the user domain to this domain.
Chris PeBenito ab58ad
domain_auto_trans($1_t, screen_exec_t, $1_screen_t)
Chris PeBenito ab58ad
Chris PeBenito ab58ad
tmp_domain($1_screen, `', `{ dir file fifo_file }')
Chris PeBenito ab58ad
base_file_read_access($1_screen_t)
Chris PeBenito ab58ad
# The user role is authorized for this domain.
Chris PeBenito ab58ad
role $1_r types $1_screen_t;
Chris PeBenito ab58ad
Chris PeBenito ab58ad
uses_shlib($1_screen_t)
Chris PeBenito ab58ad
Chris PeBenito ab58ad
# for SSP
Chris PeBenito ab58ad
allow $1_screen_t urandom_device_t:chr_file read;
Chris PeBenito ab58ad
Chris PeBenito ab58ad
# Revert to the user domain when a shell is executed.
Chris PeBenito ab58ad
domain_auto_trans($1_screen_t, { shell_exec_t bin_t }, $1_t)
Chris PeBenito ab58ad
domain_auto_trans($1_screen_t, $1_home_t, $1_t)
Chris PeBenito ab58ad
if (use_nfs_home_dirs) {
Chris PeBenito ab58ad
domain_auto_trans($1_screen_t, nfs_t, $1_t)
Chris PeBenito ab58ad
}
Chris PeBenito ab58ad
if (use_samba_home_dirs) {
Chris PeBenito ab58ad
domain_auto_trans($1_screen_t, cifs_t, $1_t)
Chris PeBenito ab58ad
}
Chris PeBenito ab58ad
Chris PeBenito ab58ad
# Inherit and use descriptors from gnome-pty-helper.
Chris PeBenito ab58ad
ifdef(`gnome-pty-helper.te', `allow $1_screen_t $1_gph_t:fd use;')
Chris PeBenito ab58ad
Chris PeBenito ab58ad
home_domain_ro($1, screen)
Chris PeBenito ab58ad
Chris PeBenito ab58ad
allow $1_screen_t privfd:fd use;
Chris PeBenito ab58ad
Chris PeBenito ab58ad
# Write to utmp.
Chris PeBenito ab58ad
allow $1_screen_t initrc_var_run_t:file rw_file_perms;
Chris PeBenito ab58ad
ifdef(`utempter.te', `
Chris PeBenito ab58ad
dontaudit $1_screen_t utempter_exec_t:file execute;
Chris PeBenito ab58ad
')
Chris PeBenito ab58ad
Chris PeBenito ab58ad
# create pty devices
Chris PeBenito ab58ad
can_create_other_pty($1_screen, $1)
Chris PeBenito ab58ad
allow $1_screen_t $1_tty_device_t:chr_file rw_file_perms;
Chris PeBenito ab58ad
allow $1_screen_t device_t:dir { getattr read };
Chris PeBenito ab58ad
Chris PeBenito ab58ad
allow $1_screen_t fs_t:filesystem getattr;
Chris PeBenito ab58ad
Chris PeBenito ab58ad
# Create fifo
Chris PeBenito ab58ad
allow $1_screen_t var_t:dir search;
Chris PeBenito ab58ad
file_type_auto_trans($1_screen_t, var_run_t, screen_dir_t, dir)
Chris PeBenito ab58ad
type $1_screen_var_run_t, file_type, sysadmfile, pidfile;
Chris PeBenito ab58ad
file_type_auto_trans($1_screen_t, screen_dir_t, $1_screen_var_run_t, fifo_file)
Chris PeBenito ab58ad
Chris PeBenito ab58ad
allow $1_screen_t self:process { fork signal_perms };
Chris PeBenito ab58ad
allow $1_t $1_screen_t:process signal;
Chris PeBenito ab58ad
allow $1_screen_t $1_t:process signal;
Chris PeBenito ab58ad
allow $1_screen_t self:capability { setuid setgid fsetid };
Chris PeBenito ab58ad
Chris PeBenito ab58ad
dontaudit $1_screen_t shadow_t:file read;
Chris PeBenito ab58ad
Chris PeBenito ab58ad
allow $1_screen_t tmp_t:dir search;
Chris PeBenito ab58ad
can_network($1_screen_t)
Chris PeBenito ab58ad
allow $1_screen_t port_type:tcp_socket name_connect;
Chris PeBenito ab58ad
can_ypbind($1_screen_t)
Chris PeBenito ab58ad
Chris PeBenito ab58ad
# get stats
Chris PeBenito ab58ad
allow $1_screen_t proc_t:dir search;
Chris PeBenito ab58ad
allow $1_screen_t proc_t:file { getattr read };
Chris PeBenito ab58ad
allow $1_screen_t proc_t:lnk_file read;
Chris PeBenito ab58ad
allow $1_screen_t etc_t:{ file lnk_file } { read getattr };
Chris PeBenito ab58ad
allow $1_screen_t self:dir { search read };
Chris PeBenito ab58ad
allow $1_screen_t self:lnk_file read;
Chris PeBenito ab58ad
allow $1_screen_t device_t:dir search;
Chris PeBenito ab58ad
allow $1_screen_t { home_root_t $1_home_dir_t }:dir search;
Chris PeBenito ab58ad
Chris PeBenito ab58ad
# Internal screen networking
Chris PeBenito ab58ad
allow $1_screen_t self:fd use;
Chris PeBenito ab58ad
allow $1_screen_t self:unix_stream_socket create_socket_perms;
Chris PeBenito ab58ad
allow $1_screen_t self:unix_dgram_socket create_socket_perms;
Chris PeBenito ab58ad
Chris PeBenito ab58ad
allow $1_screen_t bin_t:dir search;
Chris PeBenito ab58ad
allow $1_screen_t bin_t:lnk_file read;
Chris PeBenito ab58ad
read_locale($1_screen_t)
Chris PeBenito ab58ad
Chris PeBenito ab58ad
dontaudit $1_screen_t file_type:{ chr_file blk_file } getattr;
Chris PeBenito ab58ad
')dnl end screen_domain
Chris PeBenito ab58ad
Chris PeBenito ab58ad
', `
Chris PeBenito ab58ad
Chris PeBenito ab58ad
define(`screen_domain',`')
Chris PeBenito ab58ad
Chris PeBenito ab58ad
')