From 1e00f00d2cb83e91681848e552be2d1333148366 Mon Sep 17 00:00:00 2001 From: Zdenek Pytela Date: Thu, 16 Jan 2025 20:45:23 +0100 Subject: [PATCH] Allow virtnodedev create /etc/mdevctl.d/scripts.d with bin_t type --- policy/modules/contrib/virt.te | 1 + policy/modules/kernel/corecommands.if | 33 +++++++++++++++++++++++++++ policy/modules/kernel/files.if | 18 +++++++++++++++ 3 files changed, 52 insertions(+) diff --git a/policy/modules/contrib/virt.te b/policy/modules/contrib/virt.te index ebfcc8a28c..ea608c6100 100644 --- a/policy/modules/contrib/virt.te +++ b/policy/modules/contrib/virt.te @@ -2016,6 +2016,7 @@ dev_write_sysfs_dirs(virtnodedevd_t) files_map_var_lib_files(virtnodedevd_t) files_etc_filetrans_mdevctl_conf(virtnodedevd_t) +files_etc_filetrans_mdevctl_conf_scripts(virtnodedevd_t) files_manage_mdevctl_conf_files(virtnodedevd_t) files_watch_mdevctl_conf_dirs(virtnodedevd_t) diff --git a/policy/modules/kernel/corecommands.if b/policy/modules/kernel/corecommands.if index d88c5c015c..80a88f4b42 100644 --- a/policy/modules/kernel/corecommands.if +++ b/policy/modules/kernel/corecommands.if @@ -1235,3 +1235,36 @@ interface(`corecmd_bin_filetrans',` filetrans_pattern($1, bin_t, $2, $3, $4) ') + +######################################## +## +## Create objects with the bin_t type +## +## +## +## Domain allowed access. +## +## +## +## +## The type of the object to be created +## +## +## +## +## The object class. +## +## +## +## +## The name of the object being created. +## +## +# +interface(`corecmd_bin_filetrans_to',` + gen_require(` + type bin_t; + ') + + filetrans_pattern($1, $2, bin_t, $3, $4) +') diff --git a/policy/modules/kernel/files.if b/policy/modules/kernel/files.if index 7359713055..b3852f7dd3 100644 --- a/policy/modules/kernel/files.if +++ b/policy/modules/kernel/files.if @@ -6139,6 +6139,24 @@ interface(`files_etc_filetrans_mdevctl_conf',` filetrans_pattern($1, etc_t, mdevctl_conf_t, dir, "mdevctl.d") ') +################################### +## +## Create /etc/mdevctl.d/scripts.d with the bin_t type +## +## +## +## Domain allowed access. +## +## +# +interface(`files_etc_filetrans_mdevctl_conf_scripts',` + gen_require(` + type mdevctl_conf_t; + ') + + corecmd_bin_filetrans_to($1, mdevctl_conf_t, dir, "scripts.d") +') + ####################################### ## ## Read manageable system configuration files in /etc