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