|
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 |
typealias getty_etc_t alias etc_getty_t;
|
|
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 |
# to allow w to display everyone...
|
|
Chris PeBenito |
0fbfa5 |
bool user_ttyfile_stat false;
|
|
Chris PeBenito |
0fbfa5 |
if (user_ttyfile_stat) {
|
|
Chris PeBenito |
0fbfa5 |
allow userdomain ttyfile:chr_file getattr;
|
|
Chris PeBenito |
0fbfa5 |
}
|
|
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 |
# fbgetty needs fsetid for some reason
|
|
Chris PeBenito |
0fbfa5 |
#allow getty_t self:capability fsetid;
|
|
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 |
0fbfa5 |
allow getty_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 |
0fbfa5 |
|
|
Chris PeBenito |
0fbfa5 |
# for error condition handling
|
|
Chris PeBenito |
0fbfa5 |
allow getty_t fs_t:filesystem getattr;
|
|
Chris PeBenito |
0fbfa5 |
|
|
Chris PeBenito |
0fbfa5 |
rw_dir_create_file(getty_t, var_lock_t)
|
|
Chris PeBenito |
0fbfa5 |
r_dir_file(getty_t, sysfs_t)
|