Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.0 required=3.0 tests=DKIMWL_WL_MED,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 85A4BC61CE4 for ; Sat, 19 Jan 2019 16:19:21 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 4CC8E2084F for ; Sat, 19 Jan 2019 16:19:21 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=tresys.onmicrosoft.com header.i=@tresys.onmicrosoft.com header.b="QHd7hvuW" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728460AbfASQTV (ORCPT ); Sat, 19 Jan 2019 11:19:21 -0500 Received: from mail-eopbgr800115.outbound.protection.outlook.com ([40.107.80.115]:54414 "EHLO NAM03-DM3-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1728690AbfASQTU (ORCPT ); Sat, 19 Jan 2019 11:19:20 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tresys.onmicrosoft.com; s=selector1-tresys-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=4RZ4RrFRLF48dONcvk4/rKllsMWzIvDlzjPDcndF/Pg=; b=QHd7hvuWl7AuL8QDnzQVr753YN4gr5UleYGKtcF+hEuwgyA4evH56HH3xeuVB8gk5d36PM7gkXKk95XubwTxy6xe6c4mTTFdukon+zNou0BtAp+CFJxzzWWvvHFntEmyf6m5dOrFOHLzkGoFDifYjobnRF9N4jJO3ytj7CzaJUE= Received: from BN6PR15MB1507.namprd15.prod.outlook.com (10.172.151.147) by BN6PR15MB1569.namprd15.prod.outlook.com (10.172.152.12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1537.27; Sat, 19 Jan 2019 16:19:17 +0000 Received: from BN6PR15MB1507.namprd15.prod.outlook.com ([fe80::6d82:5bd:50b3:6a10]) by BN6PR15MB1507.namprd15.prod.outlook.com ([fe80::6d82:5bd:50b3:6a10%3]) with mapi id 15.20.1537.028; Sat, 19 Jan 2019 16:19:17 +0000 From: "Sugar, David" To: "selinux-refpolicy@vger.kernel.org" Subject: [PATCH] Add interface to read journal files Thread-Topic: [PATCH] Add interface to read journal files Thread-Index: AQHUsBK5h2fzCyUEcUeygV0T4WrYjQ== Date: Sat, 19 Jan 2019 16:19:16 +0000 Message-ID: <20190119161905.25553-2-dsugar@tresys.com> References: <20190119161905.25553-1-dsugar@tresys.com> In-Reply-To: <20190119161905.25553-1-dsugar@tresys.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [73.180.141.176] x-clientproxiedby: BN6PR2001CA0024.namprd20.prod.outlook.com (2603:10b6:404:b4::34) To BN6PR15MB1507.namprd15.prod.outlook.com (2603:10b6:404:c6::19) authentication-results: spf=none (sender IP is ) smtp.mailfrom=dsugar@tresys.com; x-ms-exchange-messagesentrepresentingtype: 1 x-mailer: git-send-email 2.20.1 x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1;BN6PR15MB1569;6:DEudBS3P7ORoUfNFpbTxjyfw26oX7qsJAxitVjF4hxN9ayXnLxTS4/SEZ3/xaKVmg7Y2NnwjLoUpzhgYkG2LA2T+xDIPPAvoWdL/2Gk5DJAyTHIBH91SfQ3OYReS/eM+ePJjl1pgM6ZrC0QDQT02wtcCgMPZCRdhbaRxFiXsCgxZDmAqSM0D7BqguPtkgmtPU8UnwGPZPW4BrUYYWG3bs2kzFhsfVUhWbwjdBmazgC/7OLZUrMaeGZsqwF6RT6g/p0SRhZc8tsDwZrV9KptWudnKSo3gzL+BixELkbSnjAoo3fYVBWn7XpZvmULtioEGR2C2h/45H+KMFXoPwxpns7zf6f02q77a1IZUebUkZjrubHq366H+ZblQ2XGNt35716k3OpEKKlBNl413WG50KZKbnWGZJK1UI9unSeDLVQSJAhZraD46T3arJ2r9x2VcPnObUM59ckmA/J8erIxhiA==;5:Psr2OrLx7oYftb2h9UUwOZ854QhNB5I0hAX6puF0zjjvnildT1eWIq+ZYswmxiLzs6B8zFJJ2S+HEPa5tkxRWVgqBO8haCyhHzB5tyY/OZf54DrcB6rdI+ciHUoc1KXwJFtnjvWdt6CEeb9LyugucswhjGDkkXWnVH7nk2z4X5PFZu6R9vcU8lpR8OCsK8mVJ77VPWAydvzPlY1R6k0arQ==;7:N9QhwIp6mAkfJjky+mtgeGazgLsknzyZ75Uhs3bpmP3FH8gStWxDYKRqjvxW4ZyNKzVYWk+lNQApao3+QgEbUoi1QsnrkSS4MMXkRsJQFqmOUUyhDNLkarj179gkLe54UcYFgt3BUeoUdOyrD0uWZw== x-ms-office365-filtering-correlation-id: 56cfa287-9949-4db8-c189-08d67e29db53 x-microsoft-antispam: BCL:0;PCL:0;RULEID:(2390118)(7020095)(4652040)(7021145)(8989299)(5600109)(711020)(4534185)(7022145)(4603075)(4627221)(201702281549075)(8990200)(7048125)(7024125)(7027125)(7023125)(2017052603328)(7153060)(7193020);SRVR:BN6PR15MB1569; x-ms-traffictypediagnostic: BN6PR15MB1569: x-microsoft-antispam-prvs: x-forefront-prvs: 09222B39F5 x-forefront-antispam-report: SFV:NSPM;SFS:(10019020)(136003)(366004)(396003)(346002)(376002)(39830400003)(189003)(199004)(52116002)(5640700003)(386003)(7736002)(476003)(53936002)(446003)(11346002)(486006)(106356001)(105586002)(6116002)(3846002)(256004)(5660300001)(6506007)(6916009)(305945005)(2501003)(2906002)(66066001)(2616005)(102836004)(25786009)(508600001)(8676002)(50226002)(316002)(26005)(6512007)(14454004)(71200400001)(71190400001)(97736004)(76176011)(81156014)(99286004)(14444005)(6486002)(8936002)(68736007)(81166006)(6436002)(2351001)(36756003)(186003)(1076003)(86362001);DIR:OUT;SFP:1102;SCL:1;SRVR:BN6PR15MB1569;H:BN6PR15MB1507.namprd15.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;MX:1;A:1; received-spf: None (protection.outlook.com: tresys.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam-message-info: TeB4tIy00aPToq/TghzXTV3fOQRv07YltH14zxw44MglQBChJG/vmP/ICkJCFv/9eHM+nDCO/hCclJu4QYkxyA4dnbmdnlQiBzVmgUZujfF7HmNV5fc3oXAvgHjGG1t3kHwjTKzNLA45tagjdIWUE4LDPMpMAM6TbWBjKCgRI8nbumo2XrOp0uTk+gesw5wm1vskXPood1Hj86FV/iAbBY9ON541NwXG9y9eDFdJsNByJQVz4PnT6+Ai/cAuWbWyloTQL14+ME9wVFHGuYddFz7CfINfrPI1h/Tu23gIek7Hs4rIY3Yxy11R9UzF+MViafvQPloQRUMI8WDRg593bCUTLsTZscloGC3ad4ROVg7/BgCKByytMsnlPMTAmWQHcF28CURQfrWc4J/M1ndImW1Qdq0UJ9u2qNxpAQUBYK0= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: tresys.com X-MS-Exchange-CrossTenant-Network-Message-Id: 56cfa287-9949-4db8-c189-08d67e29db53 X-MS-Exchange-CrossTenant-originalarrivaltime: 19 Jan 2019 16:19:15.7331 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: a0d45667-6c07-4e88-868f-4ac9af95c7ed X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN6PR15MB1569 Sender: selinux-refpolicy-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: selinux-refpolicy@vger.kernel.org When using 'systemctl status ' it will show recent log entries for the selected service. These recent log entries are coming from the journal. These rules allow the reading of the journal files. type=3DAVC msg=3Daudit(1547760159.435:864): avc: denied { read } for pid= =3D8823 comm=3D"systemctl" name=3D"journal" dev=3D"dm-14" ino=3D112 scontex= t=3Dstaff_u:staff_r:monitor_t:s0-s0:c0.c1023 tcontext=3Dsystem_u:object_r:s= ystemd_journal_t:s0 tclass=3Ddir permissive=3D1 type=3DAVC msg=3Daudit(1547760159.435:864): avc: denied { open } for pid= =3D8823 comm=3D"systemctl" path=3D"/var/log/journal" dev=3D"dm-14" ino=3D11= 2 scontext=3Dstaff_u:staff_r:monitor_t:s0-s0:c0.c1023 tcontext=3Dsystem_u:o= bject_r:systemd_journal_t:s0 tclass=3Ddir permissive=3D1 type=3DAVC msg=3Daudit(1547760159.435:865): avc: denied { getattr } for = pid=3D8823 comm=3D"systemctl" path=3D"/var/log/journal/21cf24d493e746a98477= 30f8476e1dba/system.journal" dev=3D"dm-14" ino=3D8388707 scontext=3Dstaff_u= :staff_r:monitor_t:s0-s0:c0.c1023 tcontext=3Dsystem_u:object_r:systemd_jour= nal_t:s0 tclass=3Dfile permissive=3D1 type=3DAVC msg=3Daudit(1547760159.435:866): avc: denied { read } for pid= =3D8823 comm=3D"systemctl" name=3D"system.journal" dev=3D"dm-14" ino=3D8388= 707 scontext=3Dstaff_u:staff_r:monitor_t:s0-s0:c0.c1023 tcontext=3Dsystem_u= :object_r:systemd_journal_t:s0 tclass=3Dfile permissive=3D1 type=3DAVC msg=3Daudit(1547760159.435:866): avc: denied { open } for pid= =3D8823 comm=3D"systemctl" path=3D"/var/log/journal/21cf24d493e746a9847730f= 8476e1dba/system.journal" dev=3D"dm-14" ino=3D8388707 scontext=3Dstaff_u:st= aff_r:monitor_t:s0-s0:c0.c1023 tcontext=3Dsystem_u:object_r:systemd_journal= _t:s0 tclass=3Dfile permissive=3D1 type=3DAVC msg=3Daudit(1547760159.436:867): avc: denied { map } for pid= =3D8823 comm=3D"systemctl" path=3D"/var/log/journal/21cf24d493e746a9847730f= 8476e1dba/system.journal" dev=3D"dm-14" ino=3D8388707 scontext=3Dstaff_u:st= aff_r:monitor_t:s0-s0:c0.c1023 tcontext=3Dsystem_u:object_r:systemd_journal= _t:s0 tclass=3Dfile permissive=3D1 Signed-off-by: Dave Sugar --- policy/modules/system/systemd.if | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/policy/modules/system/systemd.if b/policy/modules/system/syste= md.if index 740b3a92..c6d40b10 100644 --- a/policy/modules/system/systemd.if +++ b/policy/modules/system/systemd.if @@ -409,6 +409,24 @@ interface(`systemd_manage_journal_files',` allow $1 systemd_journal_t:file map; ') =20 +######################################## +## +## Allow domain to read systemd_journal_t files +## +## +## +## Domain allowed access. +## +## +# +interface(`systemd_read_journal_files',` + gen_require(` + type systemd_journal_t; + ') + + list_dirs_pattern($1, systemd_journal_t, systemd_journal_t) + mmap_read_files_pattern($1, systemd_journal_t, systemd_journal_t) +') =20 ######################################## ## --=20 2.20.1