diff --git a/policy/modules/system/modutils.if b/policy/modules/system/modutils.if
index 880730c96..9f487e1c7 100644
--- a/policy/modules/system/modutils.if
+++ b/policy/modules/system/modutils.if
@@ -121,6 +121,77 @@ interface(`modutils_manage_module_config',`
manage_files_pattern($1, modules_conf_t, modules_conf_t)
')
+########################################
+##
+## Execute any modutil,
+## like insmod, kmod, depmod or updates-modules,
+## in the kmod domain.
+##
+##
+##
+## Domain allowed to transition.
+##
+##
+#
+interface(`modutils_domtrans',`
+ gen_require(`
+ type kmod_t, kmod_exec_t;
+ ')
+
+ corecmd_search_bin($1)
+ domtrans_pattern($1, kmod_exec_t, kmod_t)
+')
+
+########################################
+##
+## Execute any modutil,
+## like insmod, kmod, depmod or updates-modules,
+## in the kmod domain, and allow the specified role
+## the kmod domain, and use the caller's terminal.
+## Has a sigchld backchannel.
+##
+##
+##
+## Domain allowed to transition.
+##
+##
+##
+##
+## Role allowed access.
+##
+##
+##
+#
+interface(`modutils_run',`
+ gen_require(`
+ attribute_role kmod_roles;
+ ')
+
+ modutils_domtrans_insmod($1)
+ roleattribute $2 kmod_roles;
+')
+
+########################################
+##
+## Execute any modutil,
+## like insmod, kmod, depmod or updates-modules,
+## in the caller domain.
+##
+##
+##
+## Domain allowed access.
+##
+##
+#
+interface(`modutils_exec',`
+ gen_require(`
+ type kmod_exec_t;
+ ')
+
+ corecmd_search_bin($1)
+ can_exec($1, kmod_exec_t)
+')
+
########################################
##
## Unconditionally execute insmod in the insmod domain.
@@ -134,12 +205,8 @@ interface(`modutils_manage_module_config',`
# cjp: this is added for pppd, due to nested
# conditionals not working.
interface(`modutils_domtrans_insmod_uncond',`
- gen_require(`
- type insmod_t, insmod_exec_t;
- ')
-
- corecmd_search_bin($1)
- domtrans_pattern($1, insmod_exec_t, insmod_t)
+ refpolicywarn(`$0($*) has been deprecated, please use modutils_domtrans() instead.')
+ modutils_domtrans($1)
')
########################################
@@ -153,12 +220,8 @@ interface(`modutils_domtrans_insmod_uncond',`
##
#
interface(`modutils_domtrans_insmod',`
- gen_require(`
- type insmod_t, insmod_exec_t;
- ')
-
- corecmd_search_bin($1)
- domtrans_pattern($1, insmod_exec_t, insmod_t)
+ refpolicywarn(`$0($*) has been deprecated, please use modutils_domtrans() instead.')
+ modutils_domtrans($1)
')
########################################
@@ -181,12 +244,8 @@ interface(`modutils_domtrans_insmod',`
##
#
interface(`modutils_run_insmod',`
- gen_require(`
- type insmod_t;
- ')
-
- modutils_domtrans_insmod($1)
- role $2 types insmod_t;
+ refpolicywarn(`$0($*) has been deprecated, please use modutils_run() instead.')
+ modutils_run($1, $2)
')
########################################
@@ -200,12 +259,8 @@ interface(`modutils_run_insmod',`
##
#
interface(`modutils_exec_insmod',`
- gen_require(`
- type insmod_exec_t;
- ')
-
- corecmd_search_bin($1)
- can_exec($1, insmod_exec_t)
+ refpolicywarn(`$0($*) has been deprecated, please use modutils_exec() instead.')
+ modutils_exec($1)
')
########################################
@@ -219,12 +274,8 @@ interface(`modutils_exec_insmod',`
##
#
interface(`modutils_domtrans_depmod',`
- gen_require(`
- type depmod_t, depmod_exec_t;
- ')
-
- corecmd_search_bin($1)
- domtrans_pattern($1, depmod_exec_t, depmod_t)
+ refpolicywarn(`$0($*) has been deprecated, please use modutils_domtrans() instead.')
+ modutils_domtrans($1)
')
########################################
@@ -244,12 +295,8 @@ interface(`modutils_domtrans_depmod',`
##
#
interface(`modutils_run_depmod',`
- gen_require(`
- type depmod_t, insmod_t;
- ')
-
- modutils_domtrans_depmod($1)
- role $2 types depmod_t;
+ refpolicywarn(`$0($*) has been deprecated, please use modutils_run() instead.')
+ modutils_run($1, $2)
')
########################################
@@ -263,12 +310,8 @@ interface(`modutils_run_depmod',`
##
#
interface(`modutils_exec_depmod',`
- gen_require(`
- type depmod_exec_t;
- ')
-
- corecmd_search_bin($1)
- can_exec($1, depmod_exec_t)
+ refpolicywarn(`$0($*) has been deprecated, please use modutils_exec() instead.')
+ modutils_exec($1)
')
########################################
@@ -282,12 +325,8 @@ interface(`modutils_exec_depmod',`
##
#
interface(`modutils_domtrans_update_mods',`
- gen_require(`
- type update_modules_t, update_modules_exec_t;
- ')
-
- corecmd_search_bin($1)
- domtrans_pattern($1, update_modules_exec_t, update_modules_t)
+ refpolicywarn(`$0($*) has been deprecated, please use modutils_domtrans() instead.')
+ modutils_domtrans($1)
')
########################################
@@ -307,12 +346,8 @@ interface(`modutils_domtrans_update_mods',`
##
#
interface(`modutils_run_update_mods',`
- gen_require(`
- attribute_role update_modules_roles;
- ')
-
- modutils_domtrans_update_mods($1)
- roleattribute $2 update_modules_roles;
+ refpolicywarn(`$0($*) has been deprecated, please use modutils_run() instead.')
+ modutils_run($1, $2)
')
########################################
@@ -326,12 +361,8 @@ interface(`modutils_run_update_mods',`
##
#
interface(`modutils_exec_update_mods',`
- gen_require(`
- type update_modules_exec_t;
- ')
-
- corecmd_search_bin($1)
- can_exec($1, update_modules_exec_t)
+ refpolicywarn(`$0($*) has been deprecated, please use modutils_exec() instead.')
+ modutils_exec($1)
')
########################################
diff --git a/policy/modules/system/modutils.te b/policy/modules/system/modutils.te
index f9c396002..133c5e02e 100644
--- a/policy/modules/system/modutils.te
+++ b/policy/modules/system/modutils.te
@@ -5,12 +5,15 @@ policy_module(modutils, 1.17.2)
# Declarations
#
+attribute_role kmod_roles;
+
type kmod_t alias { insmod_t depmod_t update_modules_t };
type kmod_exec_t alias { insmod_exec_t depmod_exec_t update_modules_exec_t };
application_domain(kmod_t, kmod_exec_t)
kernel_domtrans_to(kmod_t, kmod_exec_t)
mls_file_write_all_levels(kmod_t)
-role system_r types kmod_t;
+roleattribute system_r kmod_roles;
+role kmod_roles types kmod_t;
# module loading config
type modules_conf_t;