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