Chris PeBenito 0fbfa5
#
Chris PeBenito 0fbfa5
# Macros for locate 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
# locate_domain(domain_prefix)
Chris PeBenito 0fbfa5
#
Chris PeBenito 0fbfa5
# Define a derived domain for the locate 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/locate.te. 
Chris PeBenito 0fbfa5
#
Chris PeBenito 0fbfa5
undefine(`locate_domain')
Chris PeBenito 0fbfa5
ifdef(`slocate.te', `
Chris PeBenito 0fbfa5
define(`locate_domain',`
Chris PeBenito 0fbfa5
# Derived domain based on the calling user domain and the program.
Chris PeBenito 0fbfa5
type $1_locate_t, domain;
Chris PeBenito 0fbfa5
Chris PeBenito 0fbfa5
allow $1_locate_t self:process signal;
Chris PeBenito 0fbfa5
Chris PeBenito 0fbfa5
allow $1_locate_t etc_t:file { getattr read };
Chris PeBenito 0fbfa5
allow $1_locate_t self:unix_stream_socket create_socket_perms;
Chris PeBenito 0fbfa5
r_dir_file($1_locate_t,var_lib_locate_t)
Chris PeBenito 0fbfa5
allow $1_locate_t var_lib_t:dir search;
Chris PeBenito 0fbfa5
Chris PeBenito 0fbfa5
# Transition from the user domain to this domain.
Chris PeBenito 0fbfa5
domain_auto_trans($1_t, locate_exec_t, $1_locate_t)
Chris PeBenito 0fbfa5
Chris PeBenito 0fbfa5
# The user role is authorized for this domain.
Chris PeBenito 0fbfa5
role $1_r types $1_locate_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_locate_t $1_gph_t:fd use;
Chris PeBenito 0fbfa5
')
Chris PeBenito 0fbfa5
Chris PeBenito 0fbfa5
allow $1_locate_t privfd:fd use;
Chris PeBenito 0fbfa5
Chris PeBenito 0fbfa5
# allow ps to show locate
Chris PeBenito 0fbfa5
can_ps($1_t, $1_locate_t)
Chris PeBenito 0fbfa5
allow $1_t $1_locate_t:process signal;
Chris PeBenito 0fbfa5
Chris PeBenito 0fbfa5
uses_shlib($1_locate_t)
Chris PeBenito 0fbfa5
access_terminal($1_locate_t, $1)
Chris PeBenito 0fbfa5
Chris PeBenito 0fbfa5
allow $1_locate_t { home_root_t $1_home_dir_t $1_file_type }:dir { getattr search };
Chris PeBenito 0fbfa5
allow $1_locate_t $1_file_type:{ file lnk_file } { getattr read };
Chris PeBenito 0fbfa5
Chris PeBenito 0fbfa5
base_file_read_access($1_locate_t)
Chris PeBenito 0fbfa5
r_dir_file($1_locate_t, { etc_t lib_t var_t })
Chris PeBenito 0fbfa5
dontaudit $1_locate_t { fs_type file_type }:dir r_dir_perms;
Chris PeBenito 0fbfa5
dontaudit $1_locate_t { fs_type file_type -shadow_t}:file { getattr read };
Chris PeBenito 0fbfa5
')
Chris PeBenito 0fbfa5
Chris PeBenito 0fbfa5
', `
Chris PeBenito 0fbfa5
Chris PeBenito 0fbfa5
define(`locate_domain',`')
Chris PeBenito 0fbfa5
Chris PeBenito 0fbfa5
')