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