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,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 152D0C43381 for ; Wed, 20 Mar 2019 00:20:41 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id BE03B20828 for ; Wed, 20 Mar 2019 00:20:40 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=tresys.onmicrosoft.com header.i=@tresys.onmicrosoft.com header.b="Ksos9udY" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726891AbfCTAUk (ORCPT ); Tue, 19 Mar 2019 20:20:40 -0400 Received: from mail-eopbgr820115.outbound.protection.outlook.com ([40.107.82.115]:27994 "EHLO NAM01-SN1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727148AbfCTAUk (ORCPT ); Tue, 19 Mar 2019 20:20:40 -0400 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=LZocJ5Y4er+lYyyyIhxLal6sEwIdaTwWVPFx5keTgRA=; b=Ksos9udYDGzBK/DaAaSJqEIn5p6rjbzD5KDxVo42KeCKQ21aedCuxO0CCMO4cy9Tbvvs2IbDD8dHPCbP7kouhyTzAuVcFY8kK/3YgC/TLUrPvmZccd8bbiywzEuajWqqV17l4YQcWeodM65Tf86m2ynO0dxk9+PxUH8q1dDH7Nk= Received: from BN6PR15MB1507.namprd15.prod.outlook.com (10.172.151.147) by BN6PR15MB1124.namprd15.prod.outlook.com (10.172.205.14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1709.14; Wed, 20 Mar 2019 00:20:38 +0000 Received: from BN6PR15MB1507.namprd15.prod.outlook.com ([fe80::ec41:1dc7:5fd4:a07a]) by BN6PR15MB1507.namprd15.prod.outlook.com ([fe80::ec41:1dc7:5fd4:a07a%8]) with mapi id 15.20.1709.015; Wed, 20 Mar 2019 00:20:38 +0000 From: "Sugar, David" To: "selinux-refpolicy@vger.kernel.org" Subject: [PATCH 4/4] Allow ntpd to read unit files Thread-Topic: [PATCH 4/4] Allow ntpd to read unit files Thread-Index: AQHU3rK+v28KbEQ17kWkw/x4IGiIJQ== Date: Wed, 20 Mar 2019 00:20:38 +0000 Message-ID: <20190320002012.21220-5-dsugar@tresys.com> References: <20190320002012.21220-1-dsugar@tresys.com> In-Reply-To: <20190320002012.21220-1-dsugar@tresys.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [2601:154:c201:cca:6e88:14ff:fed4:292c] x-clientproxiedby: BL0PR03CA0002.namprd03.prod.outlook.com (2603:10b6:208:2d::15) 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-ms-office365-filtering-correlation-id: 295ef1a4-218d-4deb-3795-08d6acc9dfcd x-microsoft-antispam: BCL:0;PCL:0;RULEID:(2390118)(7020095)(4652040)(7021145)(8989299)(4534185)(7022145)(4603075)(4627221)(201702281549075)(8990200)(7048125)(7024125)(7027125)(7023125)(5600127)(711020)(4605104)(2017052603328)(7153060)(7193020);SRVR:BN6PR15MB1124; x-ms-traffictypediagnostic: BN6PR15MB1124: x-microsoft-antispam-prvs: x-forefront-prvs: 098291215C x-forefront-antispam-report: SFV:NSPM;SFS:(10019020)(396003)(366004)(376002)(346002)(136003)(39830400003)(199004)(189003)(21490400003)(76176011)(97736004)(6506007)(86362001)(8676002)(386003)(6436002)(6486002)(508600001)(5660300002)(6916009)(36756003)(305945005)(52116002)(186003)(102836004)(50226002)(7736002)(6116002)(25786009)(81166006)(2906002)(81156014)(256004)(2501003)(106356001)(446003)(5640700003)(71190400001)(105586002)(14454004)(11346002)(71200400001)(46003)(316002)(2351001)(8936002)(1076003)(6512007)(68736007)(99286004)(2616005)(476003)(486006)(53936002);DIR:OUT;SFP:1102;SCL:1;SRVR:BN6PR15MB1124;H:BN6PR15MB1507.namprd15.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;A:1;MX: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: 5X4PT5584u22vqpmpvcPFvlmdjK9IkPQOCRqkfNuYBTVvu06TQwISlrsIFVynrnk5xx4A4e2Ewqzh5yelwxl32ESHHxwyPiI7PjlFmUtRRRN4vcUKNNlmIfdKUCEiqsodT0hSzyK4NUchpaoA7iYrxb5vtgF4MIrbv+N9A1wlNAYSEsPyBtGSCPCUCHkDHbUY0nbzI6wKB6SGP0gO8I/nn82fGPO6Kiikd5BcOeHyV1NDNCrfc1s078dOn5nAzZdDGHPbpElHYIfpaY0F1nnxH00QHrzt89yeRPoWnGnqjktXB0DRM8Xq5/OqY5PxR4H1TjhVhxxutiK6tljK0yfqtFaUvLU768CFG9YsBsJj17OhmHbedXqMSt+3y7txa9CCjGdMfEKR0lTivkE/L0KvmnAGOgqlyxCxr1lUh4N6jg= 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: 295ef1a4-218d-4deb-3795-08d6acc9dfcd X-MS-Exchange-CrossTenant-originalarrivaltime: 20 Mar 2019 00:20:38.1472 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: a0d45667-6c07-4e88-868f-4ac9af95c7ed X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN6PR15MB1124 Sender: selinux-refpolicy-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: selinux-refpolicy@vger.kernel.org type=3DAVC msg=3Daudit(1553013917.359:9935): avc: denied { read } for pi= d=3D16326 comm=3D"systemd-timedat" name=3D"50-chronyd.list" dev=3D"dm-1" in= o=3D4870675 scontext=3Dsystem_u:system_r:ntpd_t:s0 tcontext=3Dsystem_u:obje= ct_r:ntpd_unit_t:s0 tclass=3Dfile permissive=3D1 type=3DAVC msg=3Daudit(1553013917.359:9935): avc: denied { open } for pi= d=3D16326 comm=3D"systemd-timedat" path=3D"/usr/lib/systemd/ntp-units.d/50-= chronyd.list" dev=3D"dm-1" ino=3D4870675 scontext=3Dsystem_u:system_r:ntpd_= t:s0 tcontext=3Dsystem_u:object_r:ntpd_unit_t:s0 tclass=3Dfile permissive= =3D1 type=3DAVC msg=3Daudit(1553013917.359:9936): avc: denied { getattr } for = pid=3D16326 comm=3D"systemd-timedat" path=3D"/usr/lib/systemd/ntp-units.d/= 50-chronyd.list" dev=3D"dm-1" ino=3D4870675 scontext=3Dsystem_u:system_r:nt= pd_t:s0 tcontext=3Dsystem_u:object_r:ntpd_unit_t:s0 tclass=3Dfile permissiv= e=3D1 type=3DAVC msg=3Daudit(1553013821.622:9902): avc: denied { getattr } for = pid=3D16281 comm=3D"systemd-timedat" path=3D"/usr/lib/systemd/ntp-units.d"= dev=3D"dm-1" ino=3D4700094 scontext=3Dsystem_u:system_r:ntpd_t:s0 tcontext= =3Dsystem_u:object_r:systemd_unit_t:s0 tclass=3Ddir permissive=3D1 type=3DAVC msg=3Daudit(1553013821.622:9903): avc: denied { read } for pi= d=3D16281 comm=3D"systemd-timedat" name=3D"ntp-units.d" dev=3D"dm-1" ino=3D= 4700094 scontext=3Dsystem_u:system_r:ntpd_t:s0 tcontext=3Dsystem_u:object_r= :systemd_unit_t:s0 tclass=3Ddir permissive=3D1 type=3DAVC msg=3Daudit(1553013821.622:9903): avc: denied { open } for pi= d=3D16281 comm=3D"systemd-timedat" path=3D"/usr/lib/systemd/ntp-units.d" de= v=3D"dm-1" ino=3D4700094 scontext=3Dsystem_u:system_r:ntpd_t:s0 tcontext=3D= system_u:object_r:systemd_unit_t:s0 tclass=3Ddir permissive=3D1 Signed-off-by: Dave Sugar --- policy/modules/services/ntp.te | 3 +++ policy/modules/system/init.if | 10 ++++++++++ 2 files changed, 13 insertions(+) diff --git a/policy/modules/services/ntp.te b/policy/modules/services/ntp.t= e index eff38486..85747e76 100644 --- a/policy/modules/services/ntp.te +++ b/policy/modules/services/ntp.te @@ -138,10 +138,13 @@ userdom_dontaudit_use_unpriv_user_fds(ntpd_t) userdom_list_user_home_dirs(ntpd_t) =20 ifdef(`init_systemd',` + allow ntpd_t ntpd_unit_t:file read_file_perms; + dbus_system_bus_client(ntpd_t) dbus_connect_system_bus(ntpd_t) init_dbus_chat(ntpd_t) init_get_system_status(ntpd_t) + init_list_unit_dirs(ntpd_t) # for /var/lib/systemd/timesync init_read_var_lib_links(ntpd_t) allow ntpd_t self:capability { fowner setpcap }; diff --git a/policy/modules/system/init.if b/policy/modules/system/init.if index 2a17910e..4f4d4d2c 100644 --- a/policy/modules/system/init.if +++ b/policy/modules/system/init.if @@ -2960,6 +2960,16 @@ interface(`init_search_units',` fs_search_tmpfs($1) ') =20 +interface(`init_list_unit_dirs',` + gen_require(` + type systemd_unit_t; + ') + + allow $1 systemd_unit_t:dir list_dir_perms; + + init_search_units($1) +') + ######################################## ## ## Read systemd unit links --=20 2.20.1