Chris PeBenito 48e0db
## <module name="libraries" layer="system">
Chris PeBenito 48e0db
## <summary>Policy for system libraries.</summary>
Chris PeBenito 48e0db
Chris PeBenito 48e0db
########################################
Chris PeBenito 48e0db
## <interface name="libraries_ldconfig_transition">
Chris PeBenito 48e0db
##	<description>
Chris PeBenito 48e0db
##		Execute ldconfig in the ldconfig domain.
Chris PeBenito 48e0db
##	</description>
Chris PeBenito 48e0db
##	<parameter name="domain">
Chris PeBenito 48e0db
##		The type of the process performing this action.
Chris PeBenito 48e0db
##	</parameter>
Chris PeBenito 48e0db
## </interface>
Chris PeBenito 48e0db
#
Chris PeBenito 48e0db
define(`libraries_ldconfig_transition',`
Chris PeBenito 0c73cd
	requires_block_template(`$0'_depend)
Chris PeBenito 0c73cd
Chris PeBenito dd8229
	allow $1 ldconfig_exec_t:file rx_file_perms;
Chris PeBenito 0c73cd
	allow $1 ldconfig_t:process transition;
Chris PeBenito 0c73cd
	type_transition $1 ldconfig_exec_t:process ldconfig_t;
Chris PeBenito 0c73cd
	dontaudit $1 ldconfig_t:process { noatsecure siginh rlimitinh };
Chris PeBenito 0c73cd
Chris PeBenito 0c73cd
	allow $1 ldconfig_t:fd use;
Chris PeBenito 0c73cd
	allow ldconfig_t $1:fd use;
Chris PeBenito 0c73cd
	allow ldconfig_t $1:fifo_file rw_file_perms;
Chris PeBenito 0c73cd
	allow ldconfig_t $1:process sigchld;
Chris PeBenito 48e0db
')
Chris PeBenito 48e0db
Chris PeBenito 48e0db
define(`libraries_ldconfig_transition_depend',`
Chris PeBenito 0c73cd
	type ldconfig_t, ldconfig_exec_t;
Chris PeBenito 0c73cd
Chris PeBenito dd8229
	class file rx_file_perms;
Chris PeBenito 0c73cd
	class process { transition noatsecure siginh rlimitinh sigchld };
Chris PeBenito 0c73cd
	class fd use;
Chris PeBenito 0c73cd
	class fifo_file rw_file_perms;
Chris PeBenito 48e0db
')
Chris PeBenito 48e0db
Chris PeBenito 48e0db
########################################
Chris PeBenito 48e0db
## <interface name="libraries_ldconfig_transition_add_role_use_terminal">
Chris PeBenito 48e0db
##	<description>
Chris PeBenito 48e0db
##		Execute ldconfig in the ldconfig domain.
Chris PeBenito 48e0db
##	</description>
Chris PeBenito 48e0db
##	<parameter name="domain">
Chris PeBenito 48e0db
##		The type of the process performing this action.
Chris PeBenito 48e0db
##	</parameter>
Chris PeBenito 48e0db
##	<parameter name="role">
Chris PeBenito 48e0db
##		The role to allow the ldconfig domain.
Chris PeBenito 48e0db
##	</parameter>
Chris PeBenito 48e0db
##	<parameter name="terminal">
Chris PeBenito 48e0db
##		The type of the terminal allow the ldconfig domain to use.
Chris PeBenito 48e0db
##	</parameter>
Chris PeBenito 48e0db
## </interface>
Chris PeBenito 48e0db
#
Chris PeBenito 48e0db
define(`libraries_ldconfig_transition_add_role_use_terminal',`
Chris PeBenito 0c73cd
	requires_block_template(`$0'_depend)
Chris PeBenito 0c73cd
Chris PeBenito 0c73cd
	libraries_ldconfig_transition($1)
Chris PeBenito 0c73cd
	role $2 types ldconfig_t;
Chris PeBenito 0c73cd
	allow ldconfig_t $3:chr_file { getattr read write ioctl };
Chris PeBenito 48e0db
')
Chris PeBenito 48e0db
Chris PeBenito 48e0db
define(`libraries_ldconfig_transition_add_role_use_terminal_depend',`
Chris PeBenito 0c73cd
	type ldconfig_t;
Chris PeBenito 0c73cd
Chris PeBenito 0c73cd
	class chr_file { getattr read write ioctl };
Chris PeBenito 48e0db
')
Chris PeBenito e181fe
Chris PeBenito b4cd15
########################################
Chris PeBenito f5c42b
## <interface name="libraries_use_dynamic_loader">
Chris PeBenito f5c42b
##	<description>
Chris PeBenito f5c42b
##		Use the dynamic link/loader for automatic loading
Chris PeBenito f5c42b
##		of shared libraries.
Chris PeBenito f5c42b
##	</description>
Chris PeBenito f5c42b
##	<parameter name="domain">
Chris PeBenito f5c42b
##		The type of the process performing this action.
Chris PeBenito f5c42b
##	</parameter>
Chris PeBenito f5c42b
## </interface>
Chris PeBenito b4cd15
#
Chris PeBenito b4cd15
define(`libraries_use_dynamic_loader',`
Chris PeBenito 0c73cd
	requires_block_template(`$0'_depend)
Chris PeBenito 0c73cd
Chris PeBenito 0c73cd
	files_read_general_system_config_directory($1)
Chris PeBenito 0c73cd
	allow $1 lib_t:dir r_dir_perms;
Chris PeBenito 0c73cd
	allow $1 lib_t:lnk_file r_file_perms;
Chris PeBenito 0c73cd
	allow $1 ld_so_t:lnk_file r_file_perms;
Chris PeBenito 0c73cd
	allow $1 ld_so_t:file rx_file_perms;
Chris PeBenito 0c73cd
	allow $1 ld_so_cache_t:file r_file_perms;
Chris PeBenito b4cd15
')
Chris PeBenito b4cd15
Chris PeBenito b4cd15
define(`libraries_use_dynamic_loader_depend',`
Chris PeBenito 0c73cd
	type lib_t, ld_so_t, ld_so_cache_t;
Chris PeBenito 0c73cd
Chris PeBenito 0c73cd
	class dir r_dir_perms;
Chris PeBenito 0c73cd
	class lnk_file r_file_perms;
Chris PeBenito 0c73cd
	class file rx_file_perms;
Chris PeBenito b4cd15
')
Chris PeBenito b4cd15
Chris PeBenito b4cd15
########################################
Chris PeBenito f5c42b
## <interface name="libraries_legacy_use_dynamic_loader">
Chris PeBenito f5c42b
##	<description>
Chris PeBenito f5c42b
##		Use the dynamic link/loader for automatic loading
Chris PeBenito f5c42b
##		of shared libraries with legacy support.
Chris PeBenito f5c42b
##	</description>
Chris PeBenito f5c42b
##	<parameter name="domain">
Chris PeBenito f5c42b
##		The type of the process performing this action.
Chris PeBenito f5c42b
##	</parameter>
Chris PeBenito f5c42b
## </interface>
Chris PeBenito 8beec8
#
Chris PeBenito 8beec8
define(`libraries_legacy_use_dynamic_loader',`
Chris PeBenito 0c73cd
	requires_block_template(`$0'_depend)
Chris PeBenito 0c73cd
Chris PeBenito 0c73cd
	libraries_use_dynamic_loader($1)
Chris PeBenito 0c73cd
	allow $1 ld_so_t:file execmod;
Chris PeBenito 0c73cd
	allow $1 ld_so_cache_t:file execute;
Chris PeBenito 8beec8
')
Chris PeBenito 8beec8
Chris PeBenito 8beec8
define(`libraries_legacy_use_dynamic_loader_depend',`
Chris PeBenito 0c73cd
	type ld_so_t, ld_so_cache_t;
Chris PeBenito 0c73cd
Chris PeBenito 0c73cd
	class file { execute execmod };
Chris PeBenito 8beec8
')
Chris PeBenito 8beec8
Chris PeBenito 8beec8
########################################
Chris PeBenito f5c42b
## <interface name="libraries_execute_dynamic_loader">
Chris PeBenito f5c42b
##	<description>
Chris PeBenito f5c42b
##		Execute the dynamic link/loader in the caller's
Chris PeBenito f5c42b
##		domain.  This is commonly needed for the
Chris PeBenito f5c42b
##		/usr/bin/ldd program.  Note: this can be used
Chris PeBenito f5c42b
##		to execute any binary that the caller can
Chris PeBenito f5c42b
##		read, even if the caller does not have execute
Chris PeBenito f5c42b
##		permissions.
Chris PeBenito f5c42b
##	</description>
Chris PeBenito f5c42b
##	<parameter name="domain">
Chris PeBenito f5c42b
##		The type of the process performing this action.
Chris PeBenito f5c42b
##	</parameter>
Chris PeBenito f5c42b
## </interface>
Chris PeBenito 075c4f
#
Chris PeBenito 075c4f
define(`libraries_execute_dynamic_loader',`
Chris PeBenito 0c73cd
	requires_block_template(`$0'_depend)
Chris PeBenito 0c73cd
Chris PeBenito 0c73cd
	allow $1 lib_t:dir r_dir_perms;
Chris PeBenito 0c73cd
	allow $1 lib_t:lnk_file r_file_perms;
Chris PeBenito 0c73cd
	allow $1 ld_so_t:lnk_file r_file_perms;
Chris PeBenito 0c73cd
	allow $1 ld_so_t:file { r_file_perms execute execute_no_trans };
Chris PeBenito 075c4f
')
Chris PeBenito 075c4f
Chris PeBenito 075c4f
define(`libraries_execute_dynamic_loader_depend',`
Chris PeBenito 0c73cd
	type lib_t, ld_so_t;
Chris PeBenito 0c73cd
Chris PeBenito 0c73cd
	class dir r_dir_perms;
Chris PeBenito 0c73cd
	class lnk_file r_file_perms;
Chris PeBenito 0c73cd
	class file { r_file_perms execute execute_no_trans };
Chris PeBenito 075c4f
')
Chris PeBenito 075c4f
Chris PeBenito 075c4f
########################################
Chris PeBenito f5c42b
## <interface name="libraries_modify_dynamic_loader_cache">
Chris PeBenito f5c42b
##	<description>
Chris PeBenito f5c42b
##		Modify the dynamic link/loader's cached listing
Chris PeBenito f5c42b
##		of shared libraries.
Chris PeBenito f5c42b
##	</description>
Chris PeBenito f5c42b
##	<parameter name="domain">
Chris PeBenito f5c42b
##		The type of the process performing this action.
Chris PeBenito f5c42b
##	</parameter>
Chris PeBenito f5c42b
## </interface>
Chris PeBenito b4cd15
#
Chris PeBenito b4cd15
define(`libraries_modify_dynamic_loader_cache',`
Chris PeBenito 0c73cd
	requires_block_template(`$0'_depend)
Chris PeBenito 0c73cd
Chris PeBenito 0c73cd
	files_read_general_system_config_directory($1)
Chris PeBenito dd8229
	allow $1 ld_so_cache_t:file rw_file_perms;
Chris PeBenito b4cd15
')
Chris PeBenito b4cd15
Chris PeBenito b4cd15
define(`libraries_modify_dynamic_loader_cache_depend',`
Chris PeBenito 0c73cd
	type ld_so_cache_t;
Chris PeBenito 0c73cd
Chris PeBenito dd8229
	class file rw_file_perms;
Chris PeBenito b4cd15
')
Chris PeBenito b4cd15
Chris PeBenito b4cd15
########################################
Chris PeBenito f5c42b
## <interface name="libraries_read_library_resources">
Chris PeBenito f5c42b
##	<description>
Chris PeBenito f5c42b
##		Read files in the library directories, such
Chris PeBenito f5c42b
##		as static libraries.
Chris PeBenito f5c42b
##	</description>
Chris PeBenito f5c42b
##	<parameter name="domain">
Chris PeBenito f5c42b
##		The type of the process performing this action.
Chris PeBenito f5c42b
##	</parameter>
Chris PeBenito f5c42b
## </interface>
Chris PeBenito b4cd15
#
Chris PeBenito f5c42b
define(`libraries_read_library_resources',`
Chris PeBenito 0c73cd
	requires_block_template(`$0'_depend)
Chris PeBenito 0c73cd
Chris PeBenito dd8229
	allow $1 lib_t:dir r_dir_perms;
Chris PeBenito dd8229
	allow $1 lib_t:{ file lnk_file } r_file_perms;
Chris PeBenito f5c42b
')
Chris PeBenito f5c42b
Chris PeBenito f5c42b
define(`libraries_read_library_resources_depend',`
Chris PeBenito 0c73cd
	type lib_t;
Chris PeBenito 0c73cd
Chris PeBenito dd8229
	class dir r_dir_perms;
Chris PeBenito dd8229
	class lnk_file r_file_perms;
Chris PeBenito dd8229
	class file r_file_perms;
Chris PeBenito f5c42b
')
Chris PeBenito f5c42b
Chris PeBenito f5c42b
########################################
Chris PeBenito f5c42b
## <interface name="libraries_execute_library_scripts">
Chris PeBenito f5c42b
##	<description>
Chris PeBenito f5c42b
##		Execute library scripts in the caller domain.
Chris PeBenito f5c42b
##	</description>
Chris PeBenito f5c42b
##	<parameter name="domain">
Chris PeBenito f5c42b
##		The type of the process performing this action.
Chris PeBenito f5c42b
##	</parameter>
Chris PeBenito f5c42b
## </interface>
Chris PeBenito f5c42b
#
Chris PeBenito f5c42b
define(`libraries_execute_library_scripts',`
Chris PeBenito 0c73cd
	requires_block_template(`$0'_depend)
Chris PeBenito 0c73cd
Chris PeBenito dd8229
	allow $1 lib_t:dir r_dir_perms;
Chris PeBenito dd8229
	allow $1 lib_t:lnk_file r_file_perms
Chris PeBenito 0c73cd
	allow $1 lib_t:file { getattr read execute execute_no_trans };
Chris PeBenito f5c42b
')
Chris PeBenito f5c42b
Chris PeBenito f5c42b
define(`libraries_execute_library_scripts_depend',`
Chris PeBenito 0c73cd
	type lib_t;
Chris PeBenito 0c73cd
Chris PeBenito dd8229
	class dir r_dir_perms;
Chris PeBenito dd8229
	class lnk_file r_file_perms;
Chris PeBenito 0c73cd
	class file { getattr read execute execute_no_trans };
Chris PeBenito f5c42b
')
Chris PeBenito f5c42b
Chris PeBenito f5c42b
########################################
Chris PeBenito f5c42b
## <interface name="libraries_use_shared_libraries">
Chris PeBenito f5c42b
##	<description>
Chris PeBenito f5c42b
##		Load and execute functions from shared libraries.
Chris PeBenito f5c42b
##	</description>
Chris PeBenito f5c42b
##	<parameter name="domain">
Chris PeBenito f5c42b
##		The type of the process performing this action.
Chris PeBenito f5c42b
##	</parameter>
Chris PeBenito f5c42b
## </interface>
Chris PeBenito b4cd15
#
Chris PeBenito dd14d0
define(`libraries_use_shared_libraries',`
Chris PeBenito 0c73cd
	requires_block_template(`$0'_depend)
Chris PeBenito 0c73cd
Chris PeBenito 0c73cd
	files_search_general_application_resources_dir($1)
Chris PeBenito 0c73cd
	allow $1 lib_t:dir r_dir_perms;
Chris PeBenito 0c73cd
	allow $1 lib_t:lnk_file r_file_perms;
Chris PeBenito 0c73cd
	allow $1 { shlib_t texrel_shlib_t }:lnk_file r_file_perms;
Chris PeBenito 0c73cd
	allow $1 { shlib_t texrel_shlib_t }:file rx_file_perms;
Chris PeBenito b4cd15
')
Chris PeBenito b4cd15
Chris PeBenito dd14d0
define(`libraries_use_shared_libraries_depend',`
Chris PeBenito 0c73cd
	type lib_t, shlib_t, texrel_shlib_t;
Chris PeBenito 0c73cd
Chris PeBenito 0c73cd
	class dir r_dir_perms;
Chris PeBenito 0c73cd
	class lnk_file r_file_perms;
Chris PeBenito 0c73cd
	class file rx_dir_perms;
Chris PeBenito b4cd15
')
Chris PeBenito b4cd15
Chris PeBenito b4cd15
########################################
Chris PeBenito f5c42b
## <interface name="libraries_legacy_use_shared_libraries">
Chris PeBenito f5c42b
##	<description>
Chris PeBenito f5c42b
##		Load and execute functions from shared libraries,
Chris PeBenito f5c42b
##		with legacy support.
Chris PeBenito f5c42b
##	</description>
Chris PeBenito f5c42b
##	<parameter name="domain">
Chris PeBenito f5c42b
##		The type of the process performing this action.
Chris PeBenito f5c42b
##	</parameter>
Chris PeBenito f5c42b
## </interface>
Chris PeBenito 8beec8
#
Chris PeBenito dd14d0
define(`libraries_legacy_use_shared_libraries',`
Chris PeBenito 0c73cd
	requires_block_template(`$0'_depend)
Chris PeBenito 0c73cd
Chris PeBenito 0c73cd
	libraries_use_shared_libraries($1)
Chris PeBenito 0c73cd
	allow $1 { shlib_t texrel_shlib_t }:file execmod;
Chris PeBenito 8beec8
')
Chris PeBenito 8beec8
Chris PeBenito dd14d0
define(`libraries_legacy_use_shared_libraries_depend',`
Chris PeBenito 0c73cd
	type shlib_t, texrel_shlib_t;
Chris PeBenito 0c73cd
Chris PeBenito 0c73cd
	class file execmod;
Chris PeBenito 8beec8
')
Chris PeBenito 8beec8
Chris PeBenito 48e0db
## </module>