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=-7.1 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_PASS 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 73347C282CB for ; Sat, 9 Feb 2019 14:07:45 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 3FEC92084D for ; Sat, 9 Feb 2019 14:07:45 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=ieee.org header.i=@ieee.org header.b="GyjYnpyP" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726844AbfBIOHp (ORCPT ); Sat, 9 Feb 2019 09:07:45 -0500 Received: from mail-qt1-f195.google.com ([209.85.160.195]:36481 "EHLO mail-qt1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726791AbfBIOHo (ORCPT ); Sat, 9 Feb 2019 09:07:44 -0500 Received: by mail-qt1-f195.google.com with SMTP id r9so7230090qtt.3 for ; Sat, 09 Feb 2019 06:07:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ieee.org; s=google; h=subject:to:references:from:message-id:date:user-agent:mime-version :in-reply-to:content-language:content-transfer-encoding; bh=36dIUGLUSo7PSvhgG49PgSeXpQsJUXx0fU3XZzPZ/U8=; b=GyjYnpyPESS51ljLoTDVzK8BPqasa/55ZUv2b/Q7d823REizWxymQMe8qd0mm9PEt3 2QLX7qmjziKKUGiUsRXTAgyEu3Q8Klfahf/inwXD49eLuHdNxVJFRB0nY7os4QosCgP8 hmpiqnrr1NrFoHVbAPj7XzXK1jyFrIsum+xcA= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=36dIUGLUSo7PSvhgG49PgSeXpQsJUXx0fU3XZzPZ/U8=; b=Go/wKDWgaHsKBbJHyboXt9URh6AwuJ6AMvqEivc99R//RmhrwYAbkoO3YlMQUzsn6y BHYDT6xuuoeazhKh8E/8QE36ASjl6YlVWVDRAGNvNtmBb5x9bNB8WMDgGOGUz5+6eWB7 3HLgi7QUFbbhTCeNRvtzgnyjaSOMRMneZA6kU8RJ1p9QVEnVd20ypF32Qac5K+SsYUqK BVWehSZPoRTXGEiJ5nRJYUgsxAAyTyw4XevTVfFpKYVdpID8G7Zf0q6zK+Di+CAugF5c uWVGrbrAPs6Aw6g9We0jFnng7TQPspcWXNUDUjEnTZFf/tDjHGhbzB0Tln9FLklXL3o5 uYvA== X-Gm-Message-State: AHQUAuZnlfhCMxJb6FbAtRqA6pju3bRp5LU623KWa54+DlGKuaKJlIku TPUOTCAnUjarSFV/SfB39w6M+tgp8aw= X-Google-Smtp-Source: AHgI3IZHIoZBfqbng9rXhfvXpMAVp/gNcAQvvWrNVhGqYp0SHbAjGK42/4soVYPEo4zOFqPVyi8X0w== X-Received: by 2002:a0c:b5c8:: with SMTP id o8mr20838108qvf.213.1549721263541; Sat, 09 Feb 2019 06:07:43 -0800 (PST) Received: from [192.168.1.190] (pool-108-15-23-247.bltmmd.fios.verizon.net. [108.15.23.247]) by smtp.gmail.com with ESMTPSA id r19sm1362753qkl.58.2019.02.09.06.07.43 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 09 Feb 2019 06:07:43 -0800 (PST) Subject: Re: [PATCH] Separate domain for systemd-modules-load To: "Sugar, David" , "selinux-refpolicy@vger.kernel.org" References: <20190207211422.10855-1-dsugar@tresys.com> <20190207211422.10855-2-dsugar@tresys.com> From: Chris PeBenito Message-ID: <7d900ab7-d237-d75c-ee98-232531ecf82f@ieee.org> Date: Sat, 9 Feb 2019 09:07:20 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.3.0 MIME-Version: 1.0 In-Reply-To: <20190207211422.10855-2-dsugar@tresys.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: selinux-refpolicy-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: selinux-refpolicy@vger.kernel.org On 2/7/19 4:15 PM, Sugar, David wrote: > 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 kernel > modules. This change sets up a new domain for this service and grants permission > necessary to load kernel modules. > > Feb 05 03:38:20 4c4c4544-0052-5410-8043-b1c04f503232 kernel: type=1400 audit(1549337898.886:10): avc: denied { read } for pid=4257 comm="systemd-modules" name="fuse.ko.xz" dev="dm-1" ino=2390271 scontext=system_u:system_r:initrc_t:s0 tcontext=system_u:object_r:modules_object_t:s0 tclass=file permissive=1 > Feb 05 03:38:20 4c4c4544-0052-5410-8043-b1c04f503232 kernel: type=1400 audit(1549337898.886:11): avc: denied { open } for pid=4257 comm="systemd-modules" path="/usr/lib/modules/3.10.0-957.1.3.el7.x86_64/kernel/fs/fuse/fuse.ko.xz" dev="dm-1" ino=2390271 scontext=system_u:system_r:initrc_t:s0 tcontext=system_u:object_r:modules_object_t:s0 tclass=file permissive=1 > > 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/systemd.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:systemd_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/systemd.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") > > +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) > ') > > +######################################## > +# > +# 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 Merged. -- Chris PeBenito