From b1babb9212f8aa4252b56e070841b3731f19ef9b Mon Sep 17 00:00:00 2001 From: Rahul Sandhu Date: Thu, 28 Nov 2024 02:56:31 +0000 Subject: [PATCH] systemd_homed_runtime_work_dir_t: new type for systemd-homed workdir As systemd-homed's workdir is an internal one, and external domains may be (reasonably) expected to connect to systemd_homed_runtime_t in the future, let's create a new domain for systemd-homed's internal work to differentiate between the two. Signed-off-by: Rahul Sandhu --- policy/modules/system/systemd.fc | 1 + policy/modules/system/systemd.te | 6 +++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/policy/modules/system/systemd.fc b/policy/modules/system/systemd.fc index bde53a3c9..163447c6a 100644 --- a/policy/modules/system/systemd.fc +++ b/policy/modules/system/systemd.fc @@ -109,6 +109,7 @@ HOME_ROOT/(.+)\.home -- gen_context(system_u:object_r:systemd_homed_storage_t,s0 /run/systemd/ask-password(/.*)? gen_context(system_u:object_r:systemd_passwd_runtime_t,s0) /run/systemd/ask-password-block(/.*)? gen_context(system_u:object_r:systemd_passwd_runtime_t,s0) /run/systemd/home(/.*)? gen_context(system_u:object_r:systemd_homed_runtime_t,s0) +/run/systemd/user-home-mount -d gen_context(system_u:object_r:systemd_homed_runtime_work_dir_t,s0) /run/systemd/network(/.*)? gen_context(system_u:object_r:systemd_networkd_runtime_t,s0) /run/systemd/notify -s gen_context(system_u:object_r:systemd_runtime_notify_t,s0) /run/systemd/resolve(/.*)? gen_context(system_u:object_r:systemd_resolved_runtime_t,s0) diff --git a/policy/modules/system/systemd.te b/policy/modules/system/systemd.te index f02dcb1b2..a5955243b 100644 --- a/policy/modules/system/systemd.te +++ b/policy/modules/system/systemd.te @@ -129,6 +129,10 @@ role system_r types systemd_homework_t; type systemd_homed_runtime_t; files_runtime_file(systemd_homed_runtime_t) +type systemd_homed_runtime_work_dir_t; +files_runtime_file(systemd_homed_runtime_work_dir_t) +files_mountpoint(systemd_homed_runtime_work_dir_t) + type systemd_homed_storage_t; files_type(systemd_homed_storage_t) @@ -732,7 +736,7 @@ init_runtime_filetrans(systemd_homework_t, systemd_homed_runtime_t, dir) files_read_etc_runtime(systemd_homework_t) # mount on /run/systemd/user-home-mount -allow systemd_homework_t systemd_homed_runtime_t:dir mounton; +allow systemd_homework_t systemd_homed_runtime_work_dir_t:dir mounton; allow systemd_homework_t systemd_homed_storage_t:file manage_file_perms; files_home_filetrans(systemd_homework_t, systemd_homed_storage_t, file)