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