Chris PeBenito 0fbfa5
#DESC LOCATE - Security Enhanced version of the GNU Locate
Chris PeBenito 0fbfa5
#
Chris PeBenito 0fbfa5
# Author:  Dan Walsh <dwalsh@redhat.com>
Chris PeBenito 0fbfa5
#
Chris PeBenito 0fbfa5
# Depends: inetd.te
Chris PeBenito 0fbfa5
Chris PeBenito 0fbfa5
#################################
Chris PeBenito 0fbfa5
#
Chris PeBenito 0fbfa5
# Rules for the locate_t domain.
Chris PeBenito 0fbfa5
#
Chris PeBenito 0fbfa5
# locate_exec_t is the type of the locate executable.
Chris PeBenito 0fbfa5
#
Chris PeBenito 0fbfa5
daemon_base_domain(locate)
Chris PeBenito 0fbfa5
Chris PeBenito 0fbfa5
allow locate_t fs_t:filesystem getattr;
Chris PeBenito 0fbfa5
Chris PeBenito 0fbfa5
ifdef(`crond.te', `
Chris PeBenito 0fbfa5
system_crond_entry(locate_exec_t, locate_t)
Chris PeBenito 0fbfa5
allow system_crond_t locate_log_t:dir rw_dir_perms;
Chris PeBenito 0fbfa5
allow system_crond_t locate_log_t:file { create append getattr };
Chris PeBenito 0fbfa5
allow system_crond_t locate_etc_t:file { getattr read };
Chris PeBenito 0fbfa5
')
Chris PeBenito 0fbfa5
Chris PeBenito 0fbfa5
allow locate_t { userpty_type admin_tty_type }:chr_file rw_file_perms;
Chris PeBenito 0fbfa5
Chris PeBenito 0fbfa5
allow locate_t { fs_type file_type }:dir r_dir_perms;
Chris PeBenito 0fbfa5
allow locate_t file_type:lnk_file r_file_perms;
Chris PeBenito 0fbfa5
allow locate_t { file_type -shadow_t }:{ lnk_file sock_file fifo_file file } getattr;
Chris PeBenito 0fbfa5
dontaudit locate_t { file_type -shadow_t }:{ lnk_file sock_file fifo_file file } read;
Chris PeBenito 0fbfa5
dontaudit locate_t security_t:dir getattr;
Chris PeBenito 0fbfa5
dontaudit locate_t shadow_t:file getattr;
Chris PeBenito 0fbfa5
Chris PeBenito 0fbfa5
allow locate_t { ttyfile device_type device_t }:{ chr_file blk_file } getattr;
Chris PeBenito 0fbfa5
allow locate_t unlabeled_t:dir_file_class_set getattr;
Chris PeBenito 0fbfa5
allow locate_t unlabeled_t:dir read;
Chris PeBenito 0fbfa5
Chris PeBenito 0fbfa5
logdir_domain(locate)
Chris PeBenito 0fbfa5
etcdir_domain(locate)
Chris PeBenito 0fbfa5
typealias locate_etc_t alias etc_locate_t;
Chris PeBenito 0fbfa5
Chris PeBenito 0fbfa5
type var_lib_locate_t, file_type, sysadmfile;
Chris PeBenito 0fbfa5
Chris PeBenito 0fbfa5
create_dir_file(locate_t, var_lib_locate_t)
Chris PeBenito 0fbfa5
dontaudit locate_t sysadmfile:file getattr;
Chris PeBenito 0fbfa5
Chris PeBenito 0fbfa5
allow locate_t proc_t:file { getattr read };
Chris PeBenito 0fbfa5
allow locate_t self:unix_stream_socket create_socket_perms;
Chris PeBenito 0fbfa5
#
Chris PeBenito 0fbfa5
# Need to be able to exec renice
Chris PeBenito 0fbfa5
#
Chris PeBenito 0fbfa5
can_exec(locate_t, bin_t)
Chris PeBenito 0fbfa5
Chris PeBenito 0fbfa5
dontaudit locate_t rpc_pipefs_t:dir r_dir_perms;
Chris PeBenito 0fbfa5
dontaudit locate_t rpc_pipefs_t:file getattr;
Chris PeBenito 0fbfa5
Chris PeBenito 0fbfa5
#
Chris PeBenito 0fbfa5
# Read Mtab file
Chris PeBenito 0fbfa5
#
Chris PeBenito 0fbfa5
allow locate_t etc_runtime_t:file { getattr read };
Chris PeBenito 0fbfa5
Chris PeBenito 0fbfa5
#
Chris PeBenito 0fbfa5
# Read nsswitch file
Chris PeBenito 0fbfa5
#
Chris PeBenito 0fbfa5
allow locate_t etc_t:file { getattr read };
Chris PeBenito 0fbfa5
dontaudit locate_t self:capability dac_override;
Chris PeBenito 0fbfa5
allow locate_t self:capability dac_read_search;
Chris PeBenito 0fbfa5
Chris PeBenito 0fbfa5
# sysadm_t runs locate in his own domain.
Chris PeBenito 0fbfa5
# We use a type alias to simplify the rest of the policy,
Chris PeBenito 0fbfa5
# which often refers to $1_locate_t for the user domains.
Chris PeBenito 0fbfa5
typealias sysadm_t alias sysadm_locate_t;
Chris PeBenito 0fbfa5
Chris PeBenito 0fbfa5
allow locate_t userdomain:fd use;
Chris PeBenito 0fbfa5
ifdef(`cardmgr.te', `
Chris PeBenito 0fbfa5
allow locate_t cardmgr_var_run_t:chr_file getattr;
Chris PeBenito 0fbfa5
')