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 103A31396D9 for ; Sun, 29 Oct 2017 20:43:01 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 4FF12E0E63; Sun, 29 Oct 2017 20:43:00 +0000 (UTC) Received: from smtp.gentoo.org (mail.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 23368E0E63 for ; Sun, 29 Oct 2017 20:43:00 +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 83D173416C2 for ; Sun, 29 Oct 2017 20:42:58 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id CEB4783B for ; Sun, 29 Oct 2017 20:42:56 +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: <1509281948.52c2b105a22a89b938af9d558bbfbf4a1c8198a3.perfinion@gentoo> Subject: [gentoo-commits] proj/hardened-refpolicy:master commit in: policy/modules/system/ X-VCS-Repository: proj/hardened-refpolicy X-VCS-Files: policy/modules/system/init.te policy/modules/system/systemd.if X-VCS-Directories: policy/modules/system/ X-VCS-Committer: perfinion X-VCS-Committer-Name: Jason Zaman X-VCS-Revision: 52c2b105a22a89b938af9d558bbfbf4a1c8198a3 X-VCS-Branch: master Date: Sun, 29 Oct 2017 20:42:56 +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-Archives-Salt: 5ce5af24-2c36-4ae6-a898-06835300dcba X-Archives-Hash: bf848f2ce73d351d45822f137c2467d3 commit: 52c2b105a22a89b938af9d558bbfbf4a1c8198a3 Author: David Sugar tresys com> AuthorDate: Mon Oct 9 21:15:13 2017 +0000 Commit: Jason Zaman gentoo org> CommitDate: Sun Oct 29 12:59:08 2017 +0000 URL: https://gitweb.gentoo.org/proj/hardened-refpolicy.git/commit/?id=52c2b105 Fix problem labeling /run/log/journal/* Fix the following denials I was seeing in dmesg from init_t (systemd) when attempting to relabel /run/log/journal/* [ 4.758398] type=1400 audit(1507601754.187:3): avc: denied { relabelto } for pid=1 comm="systemd" name="log" dev="tmpfs" ino=1365 scontext=system_u:system_r:init_t:s0 tcontext=system_u:object_r:var_log_t:s0 tclass=dir [ 4.758541] systemd[1]: Unable to fix SELinux security context of /run/log: Permission denied [ 4.758736] type=1400 audit(1507601754.187:4): avc: denied { relabelto } for pid=1 comm="systemd" name="journal" dev="tmpfs" ino=7004 scontext=system_u:system_r:init_t:s0 tcontext=system_u:object_r:systemd_journal_t:s0 tclass=dir [ 4.758773] systemd[1]: Unable to fix SELinux security context of /run/log/journal: Permission denied [ 4.758928] type=1400 audit(1507601754.187:5): avc: denied { relabelto } for pid=1 comm="systemd" name="791393fb4b8f4a59af4266b634b218e2" dev="tmpfs" ino=7005 scontext=system_u:system_r:init_t:s0 tcontext=system_u:object_r:systemd_journal_t:s0 tclass=dir [ 4.758960] systemd[1]: Unable to fix SELinux security context of /run/log/journal/791393fb4b8f4a59af4266b634b218e2: Permission denied [ 4.759144] type=1400 audit(1507601754.187:6): avc: denied { relabelto } for pid=1 comm="systemd" name="system.journal" dev="tmpfs" ino=7006 scontext=system_u:system_r:init_t:s0 tcontext=system_u:object_r:systemd_journal_t:s0 tclass=file [ 4.759196] systemd[1]: Unable to fix SELinux security context of /run/log/journal/791393fb4b8f4a59af4266b634b218e2/system.journal: Permission denied Signed-off-by: Dave Sugar tresys.com> policy/modules/system/init.te | 3 +++ policy/modules/system/systemd.if | 40 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 43 insertions(+) diff --git a/policy/modules/system/init.te b/policy/modules/system/init.te index 63cec7d6..9ff247d1 100644 --- a/policy/modules/system/init.te +++ b/policy/modules/system/init.te @@ -320,12 +320,15 @@ ifdef(`init_systemd',` logging_manage_pid_sockets(init_t) logging_send_audit_msgs(init_t) logging_relabelto_devlog_sock_files(init_t) + logging_relabel_generic_log_dirs(init_t) systemd_manage_passwd_runtime_symlinks(init_t) systemd_use_passwd_agent(init_t) systemd_list_tmpfiles_conf(init_t) systemd_relabelto_tmpfiles_conf_dirs(init_t) systemd_relabelto_tmpfiles_conf_files(init_t) + systemd_relabelto_journal_dirs(init_t) + systemd_relabelto_journal_files(init_t) term_create_devpts_dirs(init_t) diff --git a/policy/modules/system/systemd.if b/policy/modules/system/systemd.if index 766f33fb..69669a1a 100644 --- a/policy/modules/system/systemd.if +++ b/policy/modules/system/systemd.if @@ -348,6 +348,46 @@ interface(`systemd_manage_journal_files',` manage_files_pattern($1, systemd_journal_t, systemd_journal_t) ') + +######################################## +## +## Relabel to systemd-journald directory type. +## +## +## +## Domain allowed access. +## +## +# +interface(`systemd_relabelto_journal_dirs',` + gen_require(` + type systemd_journal_t; + ') + + files_search_var($1) + allow $1 systemd_journal_t:dir relabelto_dir_perms; +') + +######################################## +## +## Relabel to systemd-journald file type. +## +## +## +## Domain allowed access. +## +## +# +interface(`systemd_relabelto_journal_files',` + gen_require(` + type systemd_journal_t; + ') + + files_search_var($1) + list_dirs_pattern($1,systemd_journal_t,systemd_journal_t) + allow $1 systemd_journal_t:file relabelto_file_perms; +') + ######################################## ## ## Allow systemd_logind_t to read process state for cgroup file