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 6E033C282C4 for ; Thu, 7 Feb 2019 21:15:38 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 31A2B21907 for ; Thu, 7 Feb 2019 21:15:38 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=tresys.onmicrosoft.com header.i=@tresys.onmicrosoft.com header.b="tMaGWL6G" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726379AbfBGVPh (ORCPT ); Thu, 7 Feb 2019 16:15:37 -0500 Received: from mail-eopbgr740102.outbound.protection.outlook.com ([40.107.74.102]:64759 "EHLO NAM01-BN3-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726691AbfBGVPh (ORCPT ); Thu, 7 Feb 2019 16:15:37 -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=EvJIy6HmWYZT++JgsfUdovILkiegz/hSnIDAx5wnYQM=; b=tMaGWL6GSmIooz/RiWw+pN/G3BymkaevHMfioQt4qoniy5jmsrPj21zeNlRj4qocDFLFV9V8pSGA6TCw2fdEceAeV8o9ULtQ+SjZ9/7ucurdp3P1XHpStuH9dHYaTKYjf9GRipQv8t9GyQY5sSRwM0BQCiSA7Wj+LRepkKLBv+M= Received: from BN6PR15MB1507.namprd15.prod.outlook.com (10.172.151.147) by BN6PR15MB1265.namprd15.prod.outlook.com (10.172.205.146) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1601.21; Thu, 7 Feb 2019 21:15:33 +0000 Received: from BN6PR15MB1507.namprd15.prod.outlook.com ([fe80::f1c7:33d:34ac:bdce]) by BN6PR15MB1507.namprd15.prod.outlook.com ([fe80::f1c7:33d:34ac:bdce%3]) with mapi id 15.20.1601.016; Thu, 7 Feb 2019 21:15:33 +0000 From: "Sugar, David" To: "selinux-refpolicy@vger.kernel.org" Subject: [PATCH] Separate domain for systemd-modules-load Thread-Topic: [PATCH] Separate domain for systemd-modules-load Thread-Index: AQHUvypCjUmzBSPFoU+h5sEZu78Fvw== Date: Thu, 7 Feb 2019 21:15:32 +0000 Message-ID: <20190207211422.10855-2-dsugar@tresys.com> References: <20190207211422.10855-1-dsugar@tresys.com> In-Reply-To: <20190207211422.10855-1-dsugar@tresys.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [96.244.17.66] x-clientproxiedby: BN6PR14CA0011.namprd14.prod.outlook.com (2603:10b6:404:79::21) 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;BN6PR15MB1265;6:k3JEtGp2wQ1ct722GHV94RAcTWlxImspyc4Cuc6F8KERwZLJp92XFc7p+wlV/k2K1XDK8C7e4jaA4WMhrl+2LsspAkVLkjPlt6Gsei9MayMyxvQwFhksY65cT8BLUpZb24Cw42cPgFcqiFRe+8M803PEZmwYXPaQFA/UiHkKL0jQwc6RyyDaI4J42g+mUxp1mEfKXsrrphscYhck8haUtnkSoxZkVSAr6QjeVVizhFFiCmbUXCl2/YgbGT3jqfyDBe4Z7y8TZ4OUXcKgFbaMs2qPbiIzuNTQoNW6NYPfnwZvXlW3JXO9XK4RthstHLeO9CMQpeFTsa6Y+/1Zuydpg030sfRKRKS0bbxQrrrp2kXwtPJgfMhGdTOaxJQ6+QXtjfvfJvLafxrhn4fNqf1bznQARhyVSpz9QVbXGKciUPGKL9h8MtOlwz0zIS3a0WwQKBQw+f+JSgiZZJ4uNAQRvA==;5:elKja/Vy92HFuz0v+N9bPYRdbmpz0zvuyUQTJ0nB8MasyACJnn2PCNTKtBYIdzbjV+f8ucKTqILLuYybxC5AULx2wsZZwYHA3MEILYxQ4x0s24XMaHnuXyoDBdZZE6mrFJVOQT6sw+elDL3M2lodiLHZW/ZOJOnmv8Hpdzrs3cbOQap0D+R+VqKYxsOoZvAVsqBNBD9p3h4PaH7LMWLFmQ==;7:ogJVPvwixW8OoYZUQD3xupEuTF2/mzEYugwI/UqLD8cNr+oWwQyav6m008oTBAL+6br6SNRkzOo44vq31gF/GY2fPyaLzf2vBT3UtQapxSJw8SNJF7xyReVNvI6B3OXsHy1YW8P2Cuf4D9zhxW/SrA== x-ms-office365-filtering-correlation-id: f7bbb177-70c9-4bfa-3b12-08d68d4164f6 x-microsoft-antispam: BCL:0;PCL:0;RULEID:(2390118)(7020095)(4652040)(7021145)(8989299)(4534185)(7022145)(4603075)(4627221)(201702281549075)(8990200)(7048125)(7024125)(7027125)(7023125)(5600110)(711020)(4605077)(2017052603328)(7153060)(7193020);SRVR:BN6PR15MB1265; x-ms-traffictypediagnostic: BN6PR15MB1265: x-microsoft-antispam-prvs: x-forefront-prvs: 0941B96580 x-forefront-antispam-report: SFV:NSPM;SFS:(10019020)(366004)(136003)(396003)(346002)(376002)(39830400003)(189003)(199004)(6436002)(52116002)(76176011)(316002)(25786009)(6512007)(6486002)(2906002)(99286004)(5640700003)(2501003)(6506007)(386003)(486006)(446003)(11346002)(26005)(186003)(14454004)(97736004)(508600001)(71200400001)(106356001)(102836004)(2616005)(105586002)(2351001)(71190400001)(256004)(36756003)(86362001)(7736002)(50226002)(68736007)(8676002)(305945005)(81166006)(81156014)(8936002)(1076003)(6116002)(3846002)(6916009)(66066001)(476003)(53936002);DIR:OUT;SFP:1102;SCL:1;SRVR:BN6PR15MB1265;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: ANcwJrW6uDRX8kbYFgILFyrv7qgDQrw3+Lfgho4XNhphsjMKraHzcGPB775CQJlxTlslL46v5XUBGViQFXmBQ/JgwVj3h/atzDRfuiQx9GVjeUA+PYmGPK8trmfT7zvXzwBmKVeM8yG5Kmt322ufePVe9dVve3QVj6neoPfiJSeU2q1PoI3aOfKGJpgFozs2dGYJ3E0V1IRGOvwuoiBhIJxvkYqZbRNoJLXR7CIJ/afjtpuwUXeUvu3wKvrBsNYtgIU/R4DoyC8L57HnpJ3wnf6niyws6fP0tJv8OW9WZZ2FkONIXrEgz/h8twYoFIuCTfUCl4oNGeXLL2syOkELXxRsfpG8iw+gfW4kmEGH67P4c+rYnv5VQaD2QIvsd+YEgBNaiFg0RaIAr+aBXHh6S122buTdq6CcxQ/SImKjDBE= 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: f7bbb177-70c9-4bfa-3b12-08d68d4164f6 X-MS-Exchange-CrossTenant-originalarrivaltime: 07 Feb 2019 21:15:32.5232 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-id: a0d45667-6c07-4e88-868f-4ac9af95c7ed X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN6PR15MB1265 Sender: selinux-refpolicy-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: selinux-refpolicy@vger.kernel.org systemd-modules-load is used to pre-load kernal modules as the system comes= up. It was running initc_t which didn't have permissions to actually load kerne= l modules. This change sets up a new domain for this service and grants perm= ission necessary to load kernel modules. Feb 05 03:38:20 4c4c4544-0052-5410-8043-b1c04f503232 kernel: type=3D1400 au= dit(1549337898.886:10): avc: denied { read } for pid=3D4257 comm=3D"syst= emd-modules" name=3D"fuse.ko.xz" dev=3D"dm-1" ino=3D2390271 scontext=3Dsyst= em_u:system_r:initrc_t:s0 tcontext=3Dsystem_u:object_r:modules_object_t:s0 = tclass=3Dfile permissive=3D1 Feb 05 03:38:20 4c4c4544-0052-5410-8043-b1c04f503232 kernel: type=3D1400 au= dit(1549337898.886:11): avc: denied { open } for pid=3D4257 comm=3D"syst= emd-modules" path=3D"/usr/lib/modules/3.10.0-957.1.3.el7.x86_64/kernel/fs/f= use/fuse.ko.xz" dev=3D"dm-1" ino=3D2390271 scontext=3Dsystem_u:system_r:ini= trc_t:s0 tcontext=3Dsystem_u:object_r:modules_object_t:s0 tclass=3Dfile per= missive=3D1 Signed-off-by: Dave Sugar --- policy/modules/system/systemd.fc | 1 + policy/modules/system/systemd.te | 15 +++++++++++++++ 2 files changed, 16 insertions(+) diff --git a/policy/modules/system/systemd.fc b/policy/modules/system/syste= md.fc index 22cfe4e6..3b0302b6 100644 --- a/policy/modules/system/systemd.fc +++ b/policy/modules/system/systemd.fc @@ -26,6 +26,7 @@ /usr/lib/systemd/systemd-localed -- gen_context(system_u:object_r:systemd_= locale_exec_t,s0) /usr/lib/systemd/systemd-logind -- gen_context(system_u:object_r:systemd_= logind_exec_t,s0) /usr/lib/systemd/systemd-machined -- gen_context(system_u:object_r:systemd= _machined_exec_t,s0) +/usr/lib/systemd/systemd-modules-load -- gen_context(system_u:object_r:sys= temd_modules_load_exec_t,s0) /usr/lib/systemd/systemd-networkd -- gen_context(system_u:object_r:systemd= _networkd_exec_t,s0) /usr/lib/systemd/systemd-resolved -- gen_context(system_u:object_r:systemd= _resolved_exec_t,s0) /usr/lib/systemd/systemd-rfkill -- gen_context(system_u:object_r:systemd_= rfkill_exec_t,s0) diff --git a/policy/modules/system/systemd.te b/policy/modules/system/syste= md.te index a6f09dfd..64e36c66 100644 --- a/policy/modules/system/systemd.te +++ b/policy/modules/system/systemd.te @@ -119,6 +119,10 @@ type systemd_machined_var_run_t; files_pid_file(systemd_machined_var_run_t) init_daemon_pid_file(systemd_machined_var_run_t, dir, "machines") =20 +type systemd_modules_load_t; +type systemd_modules_load_exec_t; +init_daemon_domain(systemd_modules_load_t, systemd_modules_load_exec_t) + type systemd_networkd_t; type systemd_networkd_exec_t; init_system_domain(systemd_networkd_t, systemd_networkd_exec_t) @@ -606,6 +610,17 @@ optional_policy(` dbus_system_bus_client(systemd_machined_t) ') =20 +######################################## +# +# modules-load local policy +# + +files_load_kernel_modules(systemd_modules_load_t) +files_read_etc_files(systemd_modules_load_t) + +init_read_state(systemd_modules_load_t) +init_search_run(systemd_modules_load_t) + ######################################## # # networkd local policy --=20 2.20.1