Chris PeBenito 0fbfa5
#
Chris PeBenito 0fbfa5
# Macros for xauth domains.
Chris PeBenito 0fbfa5
#
Chris PeBenito 0fbfa5
Chris PeBenito 0fbfa5
#
Chris PeBenito 0fbfa5
# Author:  Russell Coker <russell@coker.com.au>
Chris PeBenito 0fbfa5
#
Chris PeBenito 0fbfa5
Chris PeBenito 0fbfa5
#
Chris PeBenito 0fbfa5
# xauth_domain(domain_prefix)
Chris PeBenito 0fbfa5
#
Chris PeBenito 0fbfa5
# Define a derived domain for the xauth program when executed
Chris PeBenito 0fbfa5
# by a user domain.
Chris PeBenito 0fbfa5
#
Chris PeBenito 0fbfa5
# The type declaration for the executable type for this program is
Chris PeBenito 0fbfa5
# provided separately in domains/program/xauth.te. 
Chris PeBenito 0fbfa5
#
Chris PeBenito 0fbfa5
undefine(`xauth_domain')
Chris PeBenito 0fbfa5
ifdef(`xauth.te', `
Chris PeBenito 0fbfa5
define(`xauth_domain',`
Chris PeBenito 0fbfa5
# Derived domain based on the calling user domain and the program.
Chris PeBenito 0fbfa5
type $1_xauth_t, domain;
Chris PeBenito 0fbfa5
Chris PeBenito 0fbfa5
allow $1_xauth_t self:process signal;
Chris PeBenito 0fbfa5
Chris PeBenito 0fbfa5
home_domain($1, xauth)
Chris PeBenito 0fbfa5
Chris PeBenito 0fbfa5
# Transition from the user domain to this domain.
Chris PeBenito 0fbfa5
domain_auto_trans($1_t, xauth_exec_t, $1_xauth_t)
Chris PeBenito 0fbfa5
ifdef(`ssh.te', `
Chris PeBenito 0fbfa5
domain_auto_trans($1_ssh_t, xauth_exec_t, $1_xauth_t)
Chris PeBenito 0fbfa5
allow $1_xauth_t sshd_t:fifo_file { getattr read };
Chris PeBenito 0fbfa5
dontaudit $1_xauth_t $1_ssh_t:tcp_socket { read write };
Chris PeBenito 0fbfa5
allow $1_xauth_t sshd_t:process sigchld;
Chris PeBenito 0fbfa5
')dnl end if ssh
Chris PeBenito 0fbfa5
Chris PeBenito 0fbfa5
# The user role is authorized for this domain.
Chris PeBenito 0fbfa5
role $1_r types $1_xauth_t;
Chris PeBenito 0fbfa5
Chris PeBenito 0fbfa5
# Inherit and use descriptors from gnome-pty-helper.
Chris PeBenito 0fbfa5
ifdef(`gnome-pty-helper.te', `
Chris PeBenito 0fbfa5
allow $1_xauth_t $1_gph_t:fd use;
Chris PeBenito 0fbfa5
')
Chris PeBenito 0fbfa5
Chris PeBenito 0fbfa5
allow $1_xauth_t privfd:fd use;
Chris PeBenito 0fbfa5
allow $1_xauth_t ptmx_t:chr_file { read write };
Chris PeBenito 0fbfa5
Chris PeBenito 0fbfa5
# allow ps to show xauth
Chris PeBenito 0fbfa5
can_ps($1_t, $1_xauth_t)
Chris PeBenito 0fbfa5
allow $1_t $1_xauth_t:process signal;
Chris PeBenito 0fbfa5
Chris PeBenito 0fbfa5
uses_shlib($1_xauth_t)
Chris PeBenito 0fbfa5
Chris PeBenito 0fbfa5
# allow DNS lookups...
Chris PeBenito 0fbfa5
can_resolve($1_xauth_t)
Chris PeBenito 0fbfa5
can_ypbind($1_xauth_t)
Chris PeBenito 0fbfa5
ifdef(`named.te', `
Chris PeBenito 0fbfa5
can_udp_send($1_xauth_t, named_t)
Chris PeBenito 0fbfa5
can_udp_send(named_t, $1_xauth_t)
Chris PeBenito 0fbfa5
')dnl end if named.te
Chris PeBenito 0fbfa5
Chris PeBenito 0fbfa5
allow $1_xauth_t self:unix_stream_socket create_stream_socket_perms;
Chris PeBenito 0fbfa5
allow $1_xauth_t etc_t:file { getattr read };
Chris PeBenito 0fbfa5
allow $1_xauth_t fs_t:filesystem getattr;
Chris PeBenito 0fbfa5
Chris PeBenito 0fbfa5
# Write to the user domain tty.
Chris PeBenito 0fbfa5
access_terminal($1_xauth_t, $1)
Chris PeBenito 0fbfa5
Chris PeBenito 0fbfa5
# Scan /var/run.
Chris PeBenito 0fbfa5
allow $1_xauth_t var_t:dir search;
Chris PeBenito 0fbfa5
allow $1_xauth_t var_run_t:dir search; 
Chris PeBenito 0fbfa5
Chris PeBenito 0fbfa5
tmp_domain($1_xauth)
Chris PeBenito 0fbfa5
allow $1_xauth_t $1_tmp_t:file { getattr ioctl read };
Chris PeBenito 0fbfa5
Chris PeBenito 0fbfa5
')dnl end xauth_domain macro
Chris PeBenito 0fbfa5
Chris PeBenito 0fbfa5
', `
Chris PeBenito 0fbfa5
Chris PeBenito 0fbfa5
define(`xauth_domain',`')
Chris PeBenito 0fbfa5
Chris PeBenito 0fbfa5
')dnl end if xauth.te