shutdown: add tunable to control user exec domain access

Signed-off-by: Kenton Groombridge <me@concord.sh>
This commit is contained in:
Kenton Groombridge 2021-10-08 16:02:50 -04:00
parent 580248ee48
commit d260220709
2 changed files with 23 additions and 3 deletions

View File

@ -28,13 +28,23 @@
# #
template(`shutdown_role',` template(`shutdown_role',`
gen_require(` gen_require(`
attribute_role shutdown_roles;
type shutdown_t; type shutdown_t;
') ')
shutdown_run($3, $4) roleattribute $4 shutdown_roles;
allow $3 shutdown_t:process { ptrace signal_perms }; tunable_policy(`shutdown_allow_user_exec_domains',`
ps_process_pattern($3, shutdown_t) shutdown_domtrans($3)
allow $3 shutdown_t:process { ptrace signal_perms };
ps_process_pattern($3, shutdown_t)
',`
shutdown_domtrans($2)
allow $2 shutdown_t:process { ptrace signal_perms };
ps_process_pattern($2, shutdown_t)
')
optional_policy(` optional_policy(`
systemd_user_app_status($1, shutdown_t) systemd_user_app_status($1, shutdown_t)

View File

@ -1,5 +1,15 @@
policy_module(shutdown, 1.7.0) policy_module(shutdown, 1.7.0)
## <desc>
## <p>
## Determine whether the user application exec
## domain attribute should be respected for
## shutdown access. If not enabled, only user
## domains themselves may use shutdown.
## </p>
## </desc>
gen_tunable(shutdown_allow_user_exec_domains, false)
######################################## ########################################
# #
# Declarations # Declarations