Blob Blame History Raw
## <module name="modutils" layer="system">
## <summary>Policy for kernel module utilities</summary>

########################################
## <interface name="modutils_read_kernel_module_dependencies">
##	<description>
##		Read the dependencies of kernel modules.
##	</description>
##	<parameter name="domain">
##		The type of the process performing this action.
##	</parameter>
## </interface>
#
define(`modutils_read_kernel_module_dependencies',`
	requires_block_template(`$0'_depend)

	bootloader_list_kernel_modules($1)
	allow $1 modules_dep_t:file r_file_perms;
')

define(`modutils_read_kernel_module_dependencies_depend',`
	type modules_dep_t;

	class file { getattr create read write setattr unlink };
	class dir { search read write add_name remove_name };
')

########################################
## <interface name="modutils_read_module_conf">
##	<description>
##		Read the configuration options used when
##		loading modules.
##	</description>
##	<parameter name="domain">
##		The type of the process performing this action.
##	</parameter>
## </interface>
#
define(`modutils_read_module_conf',`
	requires_block_template(`$0'_depend)

	allow $1 modules_conf_t:file r_file_perms;
')

define(`modutils_read_module_conf_depend',`
	type modules_conf_t;

	class file r_file_perms;
')

########################################
## <interface name="modutils_domtrans_insmod">
##	<description>
##		Execute insmod in the insmod domain.  Has a
##		sigchld backchannel.
##	</description>
##	<parameter name="domain">
##		The type of the process performing this action.
##	</parameter>
## </interface>
#
define(`modutils_domtrans_insmod',`
	requires_block_template(`$0'_depend)

	domain_auto_trans($1, insmod_exec_t, insmod_t)

	allow $1 insmod_t:fd use;
	allow insmod_t $1:fd use;
	allow insmod_t $1:fifo_file rw_file_perms;
	allow insmod_t $1:process sigchld;
')

define(`modutils_domtrans_insmod_depend',`
	type insmod_t;

	class file { getattr read execute };
	class process { transition noatsecure siginh rlimitinh sigchld };
	class fd use;
	class fifo_file rw_file_perms;
')

########################################
## <interface name="modutils_run_insmod">
##	<description>
##		Execute insmod in the insmod domain, and
##		allow the specified role the insmod domain,
##		and use the caller's terminal.  Has a sigchld
##		backchannel.
##	</description>
##	<parameter name="domain">
##		The type of the process performing this action.
##	</parameter>
##	<parameter name="role">
##		The role to be allowed the insmod domain.
##	</parameter>
##	<parameter name="terminal">
##		The type of the terminal allow the insmod domain to use.
##	</parameter>
## </interface>
#
define(`modutils_run_insmod',`
	requires_block_template(`$0'_depend)

	modutils_domtrans_insmod($1)
	role $2 types insmod_t;
	allow insmod_t $3:chr_file { getattr read write ioctl };
')

define(`modutils_run_insmod_depend',`
	type insmod_t;

	class chr_file { getattr read write ioctl };
')

########################################
#
# modutils_exec_insmod(domain)
#
define(`modutils_exec_insmod',`
	requires_block_template(`$0'_depend)

	can_exec($1, insmod_exec_t)
')

define(`modutils_exec_insmod_depend',`
	type insmod_t;

	class file { getattr read execute execute_no_trans };
')

########################################
## <interface name="modutils_domtrans_depmod">
##	<description>
##		Execute depmod in the depmod domain.
##	</description>
##	<parameter name="domain">
##		The type of the process performing this action.
##	</parameter>
## </interface>
#
define(`modutils_domtrans_depmod',`
	requires_block_template(`$0'_depend)

	domain_auto_trans($1, depmod_exec_t, depmod_t)

	allow $1 depmod_t:fd use;
	allow depmod_t $1:fd use;
	allow depmod_t $1:fifo_file rw_file_perms;
	allow depmod_t $1:process sigchld;
')

define(`modutils_domtrans_depmod_depend',`
	type depmod_t;

	class file { getattr read execute };
	class process { transition noatsecure siginh rlimitinh sigchld };
	class fd use;
	class fifo_file rw_file_perms;
')

########################################
## <interface name="modutils_run_depmod">
##	<description>
##		Execute depmod in the depmod domain.
##	</description>
##	<parameter name="domain">
##		The type of the process performing this action.
##	</parameter>
##	<parameter name="role">
##		The role to be allowed the depmod domain.
##	</parameter>
##	<parameter name="terminal">
##		The type of the terminal allow the depmod domain to use.
##	</parameter>
## </interface>
#
define(`modutils_run_depmod',`
	requires_block_template(`$0'_depend)

	modutils_domtrans_depmod($1)
	role $2 types insmod_t;
	allow insmod_t $3:chr_file { getattr read write ioctl };
')

define(`modutils_run_depmod_depend',`
	type depmod_t;

	class chr_file { getattr read write ioctl };
')

########################################
#
# modutils_exec_depmod(domain)
#
define(`modutils_exec_depmod',`
	requires_block_template(`$0'_depend)

	can_exec($1, depmod_exec_t)
')

define(`modutils_exec_depmod_depend',`
	type depmod_t;

	class file { getattr read execute execute_no_trans };
')

########################################
## <interface name="modutils_domtrans_update_mods">
##	<description>
##		Execute depmod in the depmod domain.
##	</description>
##	<parameter name="domain">
##		The type of the process performing this action.
##	</parameter>
## </interface>
#
define(`modutils_domtrans_update_mods',`
	requires_block_template(`$0'_depend)

	domain_auto_trans($1, update_modules_exec_t, update_modules_t)

	allow $1 update_modules_t:fd use;
	allow update_modules_t $1:fd use;
	allow update_modules_t $1:fifo_file rw_file_perms;
	allow update_modules_t $1:process sigchld;
')

define(`modutils_domtrans_update_mods_depend',`
	type update_modules_t;

	class file { getattr read execute };
	class process { transition noatsecure siginh rlimitinh signal };
	class fd use;
	class fifo_file rw_file_perms;
')

########################################
## <interface name="modutils_run_update_mods">
##	<description>
##		Execute update_modules in the update_modules domain.
##	</description>
##	<parameter name="domain">
##		The type of the process performing this action.
##	</parameter>
##	<parameter name="role">
##		The role to be allowed the update_modules domain.
##	</parameter>
##	<parameter name="terminal">
##		The type of the terminal allow the update_modules domain to use.
##	</parameter>
## </interface>
#
define(`modutils_run_update_mods',`
	requires_block_template(`$0'_depend)

	modutils_domtrans_update_mods($1)
	role $2 types update_modules_t;
	allow update_modules_t $3:chr_file rw_file_perms;
')

define(`modutils_run_update_mods_depend',`
	type update_modules_t;

	class chr_file rw_file_perms;
')

########################################
#
# modutils_exec_update_mods(domain)
#
define(`modutils_exec_update_mods',`
	requires_block_template(`$0'_depend)

	can_exec($1, update_modules_exec_t)
')

define(`modutils_exec_update_mods_depend',`
	type update_modules_t;

	class file { getattr read execute execute_no_trans };
')

## </module>