From 80d52aa4f672c9a9ab9e5b61c45e1c0bafca057b Mon Sep 17 00:00:00 2001 From: Grzegorz Filo <gf578@wp.pl> Date: Wed, 10 May 2023 16:15:07 +0200 Subject: [PATCH] Keep context of blkid file/dir when created by zpool. Signed-off-by: Grzegorz Filo <gf578@wp.pl> --- policy/modules/services/zfs.te | 5 +++++ policy/modules/system/fstools.if | 28 ++++++++++++++++++++++++++++ 2 files changed, 33 insertions(+) diff --git a/policy/modules/services/zfs.te b/policy/modules/services/zfs.te index 6cb494219..c2b09142c 100644 --- a/policy/modules/services/zfs.te +++ b/policy/modules/services/zfs.te @@ -128,6 +128,11 @@ userdom_use_user_terminals(zfs_t) zfs_rw_zpool_cache(zfs_t) +optional_policy(` + fstools_manage_runtime_files(zfs_t) + fstools_runtime_filetrans(zfs_t, dir, "blkid") +') + optional_policy(` kernel_rw_rpc_sysctls(zfs_t) diff --git a/policy/modules/system/fstools.if b/policy/modules/system/fstools.if index 71ffbd02c..188a74000 100644 --- a/policy/modules/system/fstools.if +++ b/policy/modules/system/fstools.if @@ -321,3 +321,31 @@ interface(`fstools_manage_swap_files',` allow $1 swapfile_t:file manage_file_perms; ') +######################################## +## <summary> +## Create objects in the runtime directory with an automatic type transition to the fsadm runtime type. +## </summary> +## <param name="domain"> +## <summary> +## Domain allowed access. +## </summary> +## </param> +## <param name="object"> +## <summary> +## The object class of the object being created. +## </summary> +## </param> +## <param name="name" optional="true"> +## <summary> +## The name of the object being created. +## </summary> +## </param> +# +interface(`fstools_runtime_filetrans',` + gen_require(` + type fsadm_run_t; + ') + + files_runtime_filetrans($1, fsadm_run_t, $2, $3) +') +