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