From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id E2CFC1382C5 for ; Sun, 21 Mar 2021 22:11:02 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 31132E086F; Sun, 21 Mar 2021 22:11:02 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [IPv6:2001:470:ea4a:1:5054:ff:fec7:86e4]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id F04ABE086F for ; Sun, 21 Mar 2021 22:11:01 +0000 (UTC) Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id A238233E695 for ; Sun, 21 Mar 2021 22:11:00 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 02D23630 for ; Sun, 21 Mar 2021 22:10:58 +0000 (UTC) From: "Jason Zaman" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Jason Zaman" Message-ID: <1613418564.b5319ac6961b49e3f3b83cd390c102cd39bb33fd.perfinion@gentoo> Subject: [gentoo-commits] proj/hardened-refpolicy:master commit in: policy/modules/kernel/, policy/modules/system/ X-VCS-Repository: proj/hardened-refpolicy X-VCS-Files: policy/modules/kernel/files.if policy/modules/system/systemd.te X-VCS-Directories: policy/modules/kernel/ policy/modules/system/ X-VCS-Committer: perfinion X-VCS-Committer-Name: Jason Zaman X-VCS-Revision: b5319ac6961b49e3f3b83cd390c102cd39bb33fd X-VCS-Branch: master Date: Sun, 21 Mar 2021 22:10:58 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-Archives-Salt: bdbe42b0-9be0-497f-822c-946b23ee3a1f X-Archives-Hash: e4b96c3a68902ffea9fca5f2bb7a5738 commit: b5319ac6961b49e3f3b83cd390c102cd39bb33fd Author: Krzysztof Nowicki op pl> AuthorDate: Wed Feb 3 14:59:22 2021 +0000 Commit: Jason Zaman gentoo org> CommitDate: Mon Feb 15 19:49:24 2021 +0000 URL: https://gitweb.gentoo.org/proj/hardened-refpolicy.git/commit/?id=b5319ac6 Allow systemd-tmpfilesd to relabel generic files inside /etc Enable this only with the systemd_tmpfilesd_factory tunable, otherwise silence the messages with a dontaudit rule. Fixes: avc: denied { relabelfrom } for comm="systemd-tmpfile" name="pam.d" dev= ino= scontext=system_u:system_r:systemd_tmpfiles_t:s0 tcontext=system_u:object_r:etc_t:s0 tclass=dir Signed-off-by: Krzysztof Nowicki op.pl> Signed-off-by: Jason Zaman gentoo.org> policy/modules/kernel/files.if | 38 ++++++++++++++++++++++++++++++++++++++ policy/modules/system/systemd.te | 4 ++++ 2 files changed, 42 insertions(+) diff --git a/policy/modules/kernel/files.if b/policy/modules/kernel/files.if index 55fbf783..0687a435 100644 --- a/policy/modules/kernel/files.if +++ b/policy/modules/kernel/files.if @@ -1611,6 +1611,25 @@ interface(`files_relabel_config_dirs',` relabel_dirs_pattern($1, configfile, configfile) ') +######################################### +## +## Do not audit attempts to relabel configuration directories +## +## +## +## Domain not to audit. +## +## +## +# +interface(`files_dontaudit_relabel_config_dirs',` + gen_require(` + attribute configfile; + ') + + dontaudit $1 configfile:dir relabel_dir_perms; +') + ######################################## ## ## Read config files in /etc. @@ -1669,6 +1688,25 @@ interface(`files_relabel_config_files',` relabel_files_pattern($1, configfile, configfile) ') +####################################### +## +## Do not audit attempts to relabel configuration files +## +## +## +## Domain not to audit. +## +## +## +# +interface(`files_dontaudit_relabel_config_files',` + gen_require(` + attribute configfile; + ') + + dontaudit $1 configfile:file relabel_file_perms; +') + ######################################## ## ## Mount a filesystem on all mount points. diff --git a/policy/modules/system/systemd.te b/policy/modules/system/systemd.te index ed2bce80..08c26078 100644 --- a/policy/modules/system/systemd.te +++ b/policy/modules/system/systemd.te @@ -1394,11 +1394,15 @@ tunable_policy(`systemd_tmpfilesd_factory', ` allow systemd_tmpfiles_t systemd_factory_conf_t:file read_file_perms; files_manage_etc_files(systemd_tmpfiles_t) + files_relabel_config_dirs(systemd_tmpfiles_t) + files_relabel_config_files(systemd_tmpfiles_t) ',` dontaudit systemd_tmpfiles_t systemd_factory_conf_t:dir list_dir_perms; dontaudit systemd_tmpfiles_t systemd_factory_conf_t:file read_file_perms; files_dontaudit_manage_etc_files(systemd_tmpfiles_t) + files_dontaudit_relabel_config_dirs(systemd_tmpfiles_t) + files_dontaudit_relabel_config_files(systemd_tmpfiles_t) ') optional_policy(`