# Copyright (C) 2005 Tresys Technology, LLC
########################################
##
##
## Read the dependencies of kernel modules.
##
##
## The type of the process performing this action.
##
##
##
#
define(`modutils_read_kernel_module_dependencies',`
requires_block_template(`$0'_depend)
bootloader_list_kernel_modules($1,optional)
allow $1 modules_dep_t:file { getattr read };
')
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 };
bootloader_list_kernel_modules_depend
')
########################################
##
##
## Read the configuration options used when
## loading modules.
##
##
## The type of the process performing this action.
##
##
##
#
define(`modutils_read_kernel_module_loading_config',`
requires_block_template(`$0'_depend)
allow $1 modules_conf_t:file { getattr read };
')
define(`modutils_read_kernel_module_loading_config_depend',`
type modules_conf_t;
class file { getattr create read write setattr unlink };
')
########################################
##
##
## Execute insmod in the insmod domain.
##
##
## The type of the process performing this action.
##
##
##
#
define(`modutils_insmod_transition',`
requires_block_template(`$0'_depend)
allow $1 insmod_exec_t:file { getattr read execute };
allow $1 insmod_t:process transition;
type_transition $1 insmod_exec_t:file insmod_t;
dontaudit $1 insmod_t:process { noatsecure siginh rlimitinh };
')
define(`modutils_insmod_transition_depend',`
type insmod_t;
class file { getattr read execute };
class process { transition noatsecure siginh rlimitinh };
')
########################################
##
##
## Execute insmod in the insmod domain, and
## allow the specified role the insmod domain,
## and use the caller's terminal.
##
##
## The type of the process performing this action.
##
##
## The role to be allowed the insmod domain.
##
##
## The type of the terminal allow the insmod domain to use.
##
##
##
#
define(`modutils_insmod_transition_add_role_use_terminal',`
requires_block_template(`$0'_depend)
modutils_insmod_transition($1)
role $2 types insmod_t;
allow insmod_t $3:chr_file { getattr read write ioctl };
')
define(`modutils_insmod_transition_add_role_use_terminal_depend',`
type insmod_t;
class chr_file { getattr read write ioctl };
')
########################################
#
# modutils_insmod_execute(domain)
#
define(`modutils_insmod_execute',`
requires_block_template(`$0'_depend)
allow $1 insmod_exec_t:file { getattr read execute execute_no_trans };
')
define(`modutils_insmod_execute_depend',`
type insmod_t;
class file { getattr read execute execute_no_trans };
')
########################################
##
##
## Execute depmod in the depmod domain.
##
##
## The type of the process performing this action.
##
##
##
#
define(`modutils_depmod_transition',`
requires_block_template(`$0'_depend)
allow $1 depmod_exec_t:file { getattr read execute };
allow $1 depmod_t:process transition;
type_transition $1 depmod_exec_t:file depmod_t;
dontaudit $1 depmod_t:process { noatsecure siginh rlimitinh };
')
define(`modutils_depmod_transition_depend',`
type depmod_t;
class file { getattr read execute };
class process { transition noatsecure siginh rlimitinh };
')
########################################
##
##
## Execute depmod in the depmod domain.
##
##
## The type of the process performing this action.
##
##
## The role to be allowed the depmod domain.
##
##
## The type of the terminal allow the depmod domain to use.
##
##
##
#
define(`modutils_depmod_transition_add_role_use_terminal',`
requires_block_template(`$0'_depend)
modutils_depmod_transition($1)
role $2 types insmod_t;
allow insmod_t $3:chr_file { getattr read write ioctl };
')
define(`modutils_depmod_transition_add_role_use_terminal_depend',`
type depmod_t;
class chr_file { getattr read write ioctl };
')
########################################
#
# modutils_depmod_execute(domain)
#
define(`modutils_depmod_execute',`
requires_block_template(`$0'_depend)
allow $1 depmod_exec_t:file { getattr read execute execute_no_trans };
')
define(`modutils_depmod_execute_depend',`
type depmod_t;
class file { getattr read execute execute_no_trans };
')
########################################
##
##
## Execute depmod in the depmod domain.
##
##
## The type of the process performing this action.
##
##
##
#
define(`modutils_update_modules_transition',`
requires_block_template(`$0'_depend)
allow $1 update_modules_exec_t:file { getattr read execute };
allow $1 update_modules_t:process transition;
type_transition $1 update_modules_exec_t:file update_modules_t;
dontaudit $1 update_modules_t:process { noatsecure siginh rlimitinh };
')
define(`modutils_update_modules_transition_depend',`
type update_modules_t;
class file { getattr read execute };
class process { transition noatsecure siginh rlimitinh };
')
########################################
##
##
## Execute update_modules in the update_modules domain.
##
##
## The type of the process performing this action.
##
##
## The role to be allowed the update_modules domain.
##
##
## The type of the terminal allow the update_modules domain to use.
##
##
##
#
define(`modutils_update_modules_transition_add_role_use_terminal',`
requires_block_template(`$0'_depend)
modutils_update_modules_transition($1)
role $2 types update_modules_t;
allow update_modules_t $3:chr_file { getattr read write ioctl };
')
define(`modutils_update_modules_transition_add_role_use_terminal_depend',`
type update_modules_t;
class chr_file { getattr read write ioctl };
')
########################################
#
# modutils_update_modules_execute(domain)
#
define(`modutils_update_modules_execute',`
requires_block_template(`$0'_depend)
allow $1 update_modules_exec_t:file { getattr read execute execute_no_trans };
')
define(`modutils_update_modules_execute_depend',`
type update_modules_t;
class file { getattr read execute execute_no_trans };
')