Chris PeBenito e181fe
Chris PeBenito 960373
policy_module(libraries,1.0)
Chris PeBenito 960373
Chris PeBenito 48e0db
########################################
Chris PeBenito 48e0db
#
Chris PeBenito 48e0db
# Declarations
Chris PeBenito 48e0db
#
Chris PeBenito 48e0db
Chris PeBenito b4cd15
#
Chris PeBenito b4cd15
# ld_so_cache_t is the type of /etc/ld.so.cache.
Chris PeBenito b4cd15
#
Chris PeBenito b4cd15
type ld_so_cache_t;
Chris PeBenito 8fd367
files_type(ld_so_cache_t)
Chris PeBenito b4cd15
Chris PeBenito 48e0db
#
Chris PeBenito b4cd15
# ld_so_t is the type of the system dynamic loaders.
Chris PeBenito b4cd15
#
Chris PeBenito b4cd15
type ld_so_t;
Chris PeBenito 8fd367
files_type(ld_so_t)
Chris PeBenito b4cd15
Chris PeBenito b4cd15
#
Chris PeBenito b4cd15
# lib_t is the type of files in the system lib directories.
Chris PeBenito b4cd15
#
Chris PeBenito b4cd15
type lib_t;
Chris PeBenito 8fd367
files_type(lib_t)
Chris PeBenito b4cd15
Chris PeBenito b4cd15
#
Chris PeBenito b4cd15
# shlib_t is the type of shared objects in the system lib
Chris PeBenito b4cd15
# directories.
Chris PeBenito b4cd15
#
Chris PeBenito b4cd15
type shlib_t;
Chris PeBenito 8fd367
files_type(shlib_t)
Chris PeBenito b4cd15
Chris PeBenito b4cd15
#
Chris PeBenito 33bc0d
# texrel_shlib_t is the type of shared objects in the system lib
Chris PeBenito b4cd15
# directories, which require text relocation.
Chris PeBenito b4cd15
#
Chris PeBenito da4fc9
Chris PeBenito da4fc9
ifdef(`targeted_policy',`
Chris PeBenito da4fc9
	typealias lib_t alias texrel_shlib_t;
Chris PeBenito da4fc9
',`
Chris PeBenito da4fc9
	type texrel_shlib_t;
Chris PeBenito da4fc9
	files_type(texrel_shlib_t)
Chris PeBenito da4fc9
')
Chris PeBenito 48e0db
Chris PeBenito 712566
kernel_use_ld_so_from(lib_t,ld_so_t,ld_so_cache_t)
Chris PeBenito 712566
kernel_use_shared_libs_from(lib_t,{ shlib_t texrel_shlib_t })
Chris PeBenito 712566
Chris PeBenito 48e0db
########################################
Chris PeBenito 48e0db
#
Chris PeBenito 48e0db
# ldconfig local policy
Chris PeBenito 48e0db
#
Chris PeBenito 48e0db
type ldconfig_t;
Chris PeBenito 48e0db
type ldconfig_exec_t;
Chris PeBenito c9428d
init_system_domain(ldconfig_t,ldconfig_exec_t)
Chris PeBenito 48e0db
role system_r types ldconfig_t;
Chris PeBenito 48e0db
Chris PeBenito dd8229
allow ldconfig_t ld_so_cache_t:file create_file_perms;
Chris PeBenito c9428d
files_create_etc_config(ldconfig_t,ld_so_cache_t,file)
Chris PeBenito 48e0db
Chris PeBenito dd8229
allow ldconfig_t lib_t:dir rw_dir_perms;
Chris PeBenito 48e0db
allow ldconfig_t lib_t:lnk_file { getattr create read unlink };
Chris PeBenito dd8229
allow ldconfig_t ld_so_t:lnk_file r_file_perms;
Chris PeBenito dd8229
allow ldconfig_t ld_so_t:file rx_file_perms;
Chris PeBenito dd8229
allow ldconfig_t ld_so_cache_t:file r_file_perms;
Chris PeBenito dd8229
allow ldconfig_t { shlib_t texrel_shlib_t }:lnk_file r_file_perms;
Chris PeBenito dd8229
allow ldconfig_t { shlib_t texrel_shlib_t }:file rx_file_perms;
Chris PeBenito 48e0db
Chris PeBenito 48e0db
kernel_read_system_state(ldconfig_t)
Chris PeBenito 48e0db
Chris PeBenito 0fd9dc
fs_getattr_xattr_fs(ldconfig_t)
Chris PeBenito 48e0db
Chris PeBenito c9428d
domain_use_wide_inherit_fd(ldconfig_t)
Chris PeBenito 48e0db
Chris PeBenito 7a2f20
files_search_var_lib(ldconfig_t)
Chris PeBenito 8fd367
files_read_etc_files(ldconfig_t)
Chris PeBenito ebdc3b
files_search_tmp(ldconfig_t)
Chris PeBenito 48e0db
# for when /etc/ld.so.cache is mislabeled:
Chris PeBenito 8fd367
files_delete_etc_files(ldconfig_t)
Chris PeBenito 48e0db
Chris PeBenito c9428d
init_use_script_pty(ldconfig_t)
Chris PeBenito 48e0db
Chris PeBenito c9428d
logging_send_syslog_msg(ldconfig_t)
Chris PeBenito 48e0db
Chris PeBenito c9428d
userdom_use_all_user_fd(ldconfig_t)
Chris PeBenito 48e0db
Chris PeBenito a42ca7
ifdef(`hide_broken_symptoms',`
Chris PeBenito a42ca7
	optional_policy(`unconfined.te',`
Chris PeBenito a42ca7
		unconfined_dontaudit_rw_tcp_socket(ldconfig_t)
Chris PeBenito 0c73cd
	')
Chris PeBenito 48e0db
')
Chris PeBenito 48e0db
Chris PeBenito a42ca7
ifdef(`targeted_policy',`
Chris PeBenito 0c73cd
	allow ldconfig_t lib_t:file r_file_perms;
Chris PeBenito a42ca7
	unconfined_domain_template(ldconfig_t) 
Chris PeBenito 48e0db
')
Chris PeBenito 48e0db
Chris PeBenito a42ca7
ifdef(`TODO',`
Chris PeBenito a42ca7
optional_policy(`apache.te',`
Chris PeBenito a42ca7
	# dontaudit access to /usr/lib/apache, normal programs cannot read these libs anyway
Chris PeBenito a42ca7
	dontaudit ldconfig_t httpd_modules_t:dir search;
Chris PeBenito a42ca7
')
Chris PeBenito 48e0db
') dnl end TODO