commit: 108f2dabb313b5b946cd3bd98977a5adc1683d1f Author: Rahul Sandhu <rahul <AT> sandhuservices <DOT> dev> AuthorDate: Thu Nov 28 18:05:01 2024 +0000 Commit: Jason Zaman <perfinion <AT> gentoo <DOT> org> CommitDate: Sun Dec 15 00:19:42 2024 +0000 URL: https://gitweb.gentoo.org/proj/hardened-refpolicy.git/commit/?id=108f2dab
systemd_homed_record_t: new type for user records As systemd identity files contain sensitive data, such as password hashes, let's create a new type systemd_homed_record_t for them. As systemd_homework_t needs to be able to read, create, and delete these files, let's give it permissions to do so. Signed-off-by: Rahul Sandhu <rahul <AT> sandhuservices.dev> Signed-off-by: Jason Zaman <perfinion <AT> gentoo.org> policy/modules/system/systemd.fc | 2 ++ policy/modules/system/systemd.te | 7 +++++++ 2 files changed, 9 insertions(+) diff --git a/policy/modules/system/systemd.fc b/policy/modules/system/systemd.fc index ce48c7d09..6a770c502 100644 --- a/policy/modules/system/systemd.fc +++ b/policy/modules/system/systemd.fc @@ -64,6 +64,8 @@ HOME_DIR/\.config/systemd(/.*)? gen_context(system_u:object_r:systemd_conf_home HOME_DIR/\.local/share/systemd(/.*)? gen_context(system_u:object_r:systemd_data_home_t,s0) # homed files +HOME_DIR/\.identity -- gen_context(system_u:object_r:systemd_homed_record_t,s0) +HOME_DIR/\.identity-blob(/.*)? gen_context(system_u:object_r:systemd_homed_record_t,s0) HOME_ROOT/(.+)\.home -- gen_context(system_u:object_r:systemd_homed_storage_t,s0) /usr/lib/systemd/user(/.*)? gen_context(system_u:object_r:systemd_user_unit_t,s0) diff --git a/policy/modules/system/systemd.te b/policy/modules/system/systemd.te index edc192609..fbace192f 100644 --- a/policy/modules/system/systemd.te +++ b/policy/modules/system/systemd.te @@ -126,6 +126,9 @@ domain_type(systemd_homework_t) domain_entry_file(systemd_homework_t, systemd_homework_exec_t) role system_r types systemd_homework_t; +type systemd_homed_record_t; +files_auth_file(systemd_homed_record_t) + type systemd_homed_runtime_t; files_runtime_file(systemd_homed_runtime_t) @@ -791,6 +794,10 @@ systemd_log_parse_environment(systemd_homework_t) udev_read_runtime_files(systemd_homework_t) +read_files_pattern(systemd_homework_t, systemd_homed_runtime_work_dir_t, systemd_homed_record_t) +create_files_pattern(systemd_homework_t, systemd_homed_runtime_work_dir_t, systemd_homed_record_t) +delete_files_pattern(systemd_homework_t, systemd_homed_runtime_work_dir_t, systemd_homed_record_t) + ####################################### # # Hostnamed policy
