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