Blob Blame History Raw

policy_module(libraries,1.0)

########################################
#
# Declarations
#

#
# ld_so_cache_t is the type of /etc/ld.so.cache.
#
type ld_so_cache_t;
files_file_type(ld_so_cache_t)

#
# ld_so_t is the type of the system dynamic loaders.
#
type ld_so_t;
files_file_type(ld_so_t)

#
# lib_t is the type of files in the system lib directories.
#
type lib_t;
files_file_type(lib_t)

#
# shlib_t is the type of shared objects in the system lib
# directories.
#
type shlib_t;
files_file_type(shlib_t)

#
# texrel_shlib_t is the type of shared objects in the system lib
# directories, which require text relocation.
#
type texrel_shlib_t;
files_file_type(texrel_shlib_t)

########################################
#
# ldconfig local policy
#
type ldconfig_t;
type ldconfig_exec_t;
init_system_domain(ldconfig_t,ldconfig_exec_t)
role system_r types ldconfig_t;

allow ldconfig_t ld_so_cache_t:file create_file_perms;
files_create_etc_config(ldconfig_t,ld_so_cache_t,file)

allow ldconfig_t lib_t:dir rw_dir_perms;
allow ldconfig_t lib_t:lnk_file { getattr create read unlink };
allow ldconfig_t ld_so_t:lnk_file r_file_perms;
allow ldconfig_t ld_so_t:file rx_file_perms;
allow ldconfig_t ld_so_cache_t:file r_file_perms;
allow ldconfig_t { shlib_t texrel_shlib_t }:lnk_file r_file_perms;
allow ldconfig_t { shlib_t texrel_shlib_t }:file rx_file_perms;

kernel_read_system_state(ldconfig_t)

fs_getattr_xattr_fs(ldconfig_t)

domain_use_wide_inherit_fd(ldconfig_t)

files_read_generic_etc_files(ldconfig_t)
# for when /etc/ld.so.cache is mislabeled:
files_delete_generic_etc_files(ldconfig_t)

init_use_script_pty(ldconfig_t)

logging_send_syslog_msg(ldconfig_t)

userdom_use_all_user_fd(ldconfig_t)


ifdef(`TODO',`

allow ldconfig_t tmp_t:dir search;

ifdef(`apache.te', `
	# dontaudit access to /usr/lib/apache, normal programs cannot read these libs anyway
	dontaudit ldconfig_t httpd_modules_t:dir search;
')

allow ldconfig_t { var_t var_lib_t }:dir search;

ifdef(`hide_broken_symptoms', `
	ifdef(`unconfined.te',`
		dontaudit ldconfig_t unconfined_t:tcp_socket { read write };
	')
')

ifdef(`targeted_policy', `
	allow ldconfig_t lib_t:file r_file_perms;
	unconfined_domain(ldconfig_t) 
')

') dnl end TODO