Chris PeBenito 0fbfa5
#DESC Utempter - Privileged helper for utmp/wtmp updates
Chris PeBenito 0fbfa5
#
Chris PeBenito 0fbfa5
# Authors:  Stephen Smalley <sds@epoch.ncsc.mil> and Timothy Fraser  
Chris PeBenito 0fbfa5
# X-Debian-Packages:
Chris PeBenito 0fbfa5
#
Chris PeBenito 0fbfa5
Chris PeBenito 0fbfa5
#################################
Chris PeBenito 0fbfa5
#
Chris PeBenito 0fbfa5
# Rules for the utempter_t domain.
Chris PeBenito 0fbfa5
#
Chris PeBenito 0fbfa5
# This is the domain for the utempter program.  utempter is
Chris PeBenito 0fbfa5
# executed by xterm to update utmp and wtmp.
Chris PeBenito 0fbfa5
# utempter_exec_t is the type of the utempter binary.
Chris PeBenito 0fbfa5
#
Chris PeBenito 0fbfa5
type utempter_t, domain, nscd_client_domain;
Chris PeBenito 0fbfa5
in_user_role(utempter_t)
Chris PeBenito 0fbfa5
role sysadm_r types utempter_t;
Chris PeBenito 0fbfa5
uses_shlib(utempter_t)
Chris PeBenito 0fbfa5
type utempter_exec_t, file_type, sysadmfile, exec_type;
Chris PeBenito 0fbfa5
domain_auto_trans(userdomain, utempter_exec_t, utempter_t)
Chris PeBenito 0fbfa5
Chris PeBenito 0fbfa5
# Use capabilities.
Chris PeBenito 0fbfa5
allow utempter_t self:capability setgid;
Chris PeBenito 0fbfa5
Chris PeBenito 0fbfa5
allow utempter_t etc_t:file { getattr read };
Chris PeBenito 0fbfa5
Chris PeBenito 0fbfa5
# Update /var/run/utmp and /var/log/wtmp.
Chris PeBenito 0fbfa5
allow utempter_t initrc_var_run_t:file rw_file_perms;
Chris PeBenito 0fbfa5
allow utempter_t var_log_t:dir search;
Chris PeBenito 0fbfa5
allow utempter_t wtmp_t:file rw_file_perms;
Chris PeBenito 0fbfa5
Chris PeBenito 0fbfa5
# dontaudit access to /dev/ptmx.
Chris PeBenito 0fbfa5
dontaudit utempter_t ptmx_t:chr_file rw_file_perms;
Chris PeBenito 0fbfa5
dontaudit utempter_t sysadm_devpts_t:chr_file { read write };
Chris PeBenito 0fbfa5
Chris PeBenito 0fbfa5
# Allow utemper to write to /tmp/.xses-*
Chris PeBenito 0fbfa5
allow utempter_t user_tmpfile:file { getattr write append };
Chris PeBenito 0fbfa5
Chris PeBenito 0fbfa5
# Inherit and use descriptors from login.
Chris PeBenito 0fbfa5
allow utempter_t privfd:fd use;
Chris PeBenito 0fbfa5
ifdef(`xdm.te', `
Chris PeBenito 0fbfa5
allow utempter_t xdm_t:fd use;
Chris PeBenito 0fbfa5
allow utempter_t xdm_t:fifo_file { write getattr };
Chris PeBenito 0fbfa5
')
Chris PeBenito 0fbfa5
Chris PeBenito 0fbfa5
allow utempter_t self:unix_stream_socket create_stream_socket_perms;
Chris PeBenito 0fbfa5
Chris PeBenito 0fbfa5
# Access terminals.
Chris PeBenito 0fbfa5
allow utempter_t ttyfile:chr_file getattr;
Chris PeBenito 0fbfa5
allow utempter_t ptyfile:chr_file getattr;
Chris PeBenito 0fbfa5
allow utempter_t devpts_t:dir search;
Chris PeBenito 0fbfa5
dontaudit utempter_t {ttyfile ptyfile}:chr_file { read write };