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