Blob Blame History Raw
#
# Macros for screen domains.
#

#
# Author: Russell Coker <russell@coker.com.au>
# Based on the work of Stephen Smalley <sds@epoch.ncsc.mil>
# and Timothy Fraser
#

#
# screen_domain(domain_prefix)
#
# Define a derived domain for the screen program when executed
# by a user domain.
#
# The type declaration for the executable type for this program is
# provided separately in domains/program/screen.te. 
#
undefine(`screen_domain')
ifdef(`screen.te', `
define(`screen_domain',`
# Derived domain based on the calling user domain and the program.
type $1_screen_t, domain, privlog, privfd;

# Transition from the user domain to this domain.
domain_auto_trans($1_t, screen_exec_t, $1_screen_t)

tmp_domain($1_screen, `', `{ dir file fifo_file }')
base_file_read_access($1_screen_t)
# The user role is authorized for this domain.
role $1_r types $1_screen_t;

uses_shlib($1_screen_t)

# for SSP
allow $1_screen_t urandom_device_t:chr_file read;

# Revert to the user domain when a shell is executed.
domain_auto_trans($1_screen_t, { shell_exec_t bin_t }, $1_t)
domain_auto_trans($1_screen_t, $1_home_t, $1_t)
if (use_nfs_home_dirs) {
domain_auto_trans($1_screen_t, nfs_t, $1_t)
}
if (use_samba_home_dirs) {
domain_auto_trans($1_screen_t, cifs_t, $1_t)
}

# Inherit and use descriptors from gnome-pty-helper.
ifdef(`gnome-pty-helper.te', `allow $1_screen_t $1_gph_t:fd use;')

home_domain_ro($1, screen)

allow $1_screen_t privfd:fd use;

# Write to utmp.
allow $1_screen_t initrc_var_run_t:file rw_file_perms;
ifdef(`utempter.te', `
dontaudit $1_screen_t utempter_exec_t:file execute;
')

# create pty devices
can_create_other_pty($1_screen, $1)
allow $1_screen_t $1_tty_device_t:chr_file rw_file_perms;
allow $1_screen_t device_t:dir { getattr read };

allow $1_screen_t fs_t:filesystem getattr;

# Create fifo
allow $1_screen_t var_t:dir search;
file_type_auto_trans($1_screen_t, var_run_t, screen_dir_t, dir)
type $1_screen_var_run_t, file_type, sysadmfile, pidfile;
file_type_auto_trans($1_screen_t, screen_dir_t, $1_screen_var_run_t, fifo_file)

allow $1_screen_t self:process { fork signal_perms };
allow $1_t $1_screen_t:process signal;
allow $1_screen_t $1_t:process signal;
allow $1_screen_t self:capability { setuid setgid fsetid };

dontaudit $1_screen_t shadow_t:file read;

allow $1_screen_t tmp_t:dir search;
can_network($1_screen_t)
can_ypbind($1_screen_t)

# get stats
allow $1_screen_t proc_t:dir search;
allow $1_screen_t proc_t:file { getattr read };
allow $1_screen_t proc_t:lnk_file read;
allow $1_screen_t etc_t:{ file lnk_file } { read getattr };
allow $1_screen_t self:dir { search read };
allow $1_screen_t self:lnk_file read;
allow $1_screen_t device_t:dir search;
allow $1_screen_t { home_root_t $1_home_dir_t }:dir search;

# Internal screen networking
allow $1_screen_t self:fd use;
allow $1_screen_t self:unix_stream_socket create_socket_perms;
allow $1_screen_t self:unix_dgram_socket create_socket_perms;

allow $1_screen_t bin_t:dir search;
allow $1_screen_t bin_t:lnk_file read;
read_locale($1_screen_t)

dontaudit $1_screen_t file_type:{ chr_file blk_file } getattr;
')dnl end screen_domain

', `

define(`screen_domain',`')

')