Chris PeBenito 31b7c0
#DESC Getty - Manage ttys
Chris PeBenito 31b7c0
#
Chris PeBenito 31b7c0
# Authors:  Stephen Smalley <sds@epoch.ncsc.mil> and Timothy Fraser  
Chris PeBenito 31b7c0
# X-Debian-Packages: util-linux fbgetty mingetty mgetty rungetty
Chris PeBenito 31b7c0
#
Chris PeBenito 31b7c0
Chris PeBenito 31b7c0
#################################
Chris PeBenito 31b7c0
#
Chris PeBenito 31b7c0
# Rules for the getty_t domain.
Chris PeBenito 31b7c0
#
Chris PeBenito 31b7c0
init_service_domain(getty, `, privfd, privmail, mlsfileread, mlsfilewrite')
Chris PeBenito 31b7c0
Chris PeBenito 31b7c0
etcdir_domain(getty)
Chris PeBenito 31b7c0
Chris PeBenito 31b7c0
allow getty_t console_device_t:chr_file setattr;
Chris PeBenito 31b7c0
Chris PeBenito 31b7c0
tmp_domain(getty)
Chris PeBenito 31b7c0
log_domain(getty)
Chris PeBenito 31b7c0
Chris PeBenito 31b7c0
allow getty_t { etc_t etc_runtime_t }:file { getattr read };
Chris PeBenito 31b7c0
allow getty_t etc_t:lnk_file read;
Chris PeBenito 31b7c0
allow getty_t self:process { getpgid getsession };
Chris PeBenito 31b7c0
allow getty_t self:unix_dgram_socket create_socket_perms;
Chris PeBenito 31b7c0
allow getty_t self:unix_stream_socket create_socket_perms;
Chris PeBenito 31b7c0
Chris PeBenito 31b7c0
# Use capabilities.
Chris PeBenito 31b7c0
allow getty_t self:capability { dac_override chown sys_resource sys_tty_config };
Chris PeBenito 31b7c0
Chris PeBenito 31b7c0
read_locale(getty_t)
Chris PeBenito 31b7c0
Chris PeBenito 31b7c0
# Run login in local_login_t domain.
Chris PeBenito 31b7c0
allow getty_t { sbin_t bin_t }:dir search;
Chris PeBenito 31b7c0
domain_auto_trans(getty_t, login_exec_t, local_login_t)
Chris PeBenito 31b7c0
Chris PeBenito 31b7c0
# Write to /var/run/utmp.
Chris PeBenito 31b7c0
allow getty_t { var_t var_run_t }:dir search;
Chris PeBenito 31b7c0
allow getty_t initrc_var_run_t:file rw_file_perms;
Chris PeBenito 31b7c0
Chris PeBenito 31b7c0
# Write to /var/log/wtmp.
Chris PeBenito 31b7c0
allow getty_t wtmp_t:file rw_file_perms;
Chris PeBenito 31b7c0
Chris PeBenito 31b7c0
# Chown, chmod, read and write ttys.
Chris PeBenito 31b7c0
allow getty_t tty_device_t:chr_file { setattr rw_file_perms };
Chris PeBenito 31b7c0
allow getty_t ttyfile:chr_file { setattr rw_file_perms };
Chris PeBenito 31b7c0
dontaudit getty_t initrc_devpts_t:chr_file rw_file_perms; 
Chris PeBenito 31b7c0
Chris PeBenito 31b7c0
# for error condition handling
Chris PeBenito 31b7c0
allow getty_t fs_t:filesystem getattr;
Chris PeBenito 31b7c0
Chris PeBenito 31b7c0
lock_domain(getty)
Chris PeBenito 31b7c0
r_dir_file(getty_t, sysfs_t)
Chris PeBenito 31b7c0
# for mgetty
Chris PeBenito 31b7c0
var_run_domain(getty)
Chris PeBenito 31b7c0
allow getty_t self:capability { fowner fsetid };
Chris PeBenito 31b7c0
Chris PeBenito 31b7c0
#
Chris PeBenito 31b7c0
# getty needs to be able to run pppd
Chris PeBenito 31b7c0
#
Chris PeBenito 31b7c0
ifdef(`pppd.te', `
Chris PeBenito 31b7c0
domain_auto_trans(getty_t, pppd_exec_t, pppd_t)
Chris PeBenito 31b7c0
')