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,URIBL_BLOCKED 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 98C9AC10F06 for ; Tue, 12 Mar 2019 01:01:22 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 660242087F for ; Tue, 12 Mar 2019 01:01:22 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=ieee.org header.i=@ieee.org header.b="TxNOm+qP" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726532AbfCLBBV (ORCPT ); Mon, 11 Mar 2019 21:01:21 -0400 Received: from mail-qt1-f194.google.com ([209.85.160.194]:42546 "EHLO mail-qt1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726167AbfCLBBU (ORCPT ); Mon, 11 Mar 2019 21:01:20 -0400 Received: by mail-qt1-f194.google.com with SMTP id u7so751227qtg.9 for ; Mon, 11 Mar 2019 18:01:18 -0700 (PDT) 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=MGo229KCWDwxc/eabILb0Hq5iL/BC6ZLcaWrLCm6Jj8=; b=TxNOm+qPMzwiunlnUT5+H3awgeF/QJALmd4nX82hKhwf+Xx9TcpwVCn2RnrGktNwin nAVzI61Y62CL6FXGrnW3jAiPtD9O6oppdHM9oqZwEgCVDj1XK0g2JZUnL38dQF9GsCyd CxqkWniA8n458g2U8gJorMMr/8m5RlW80HYPc= 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=MGo229KCWDwxc/eabILb0Hq5iL/BC6ZLcaWrLCm6Jj8=; b=QfuJoy/POXfL+LQjda7CUBRoIJG65k4TO8PON0Lzv3LTYbOnRgm2JidKqDlLXWk2v3 vWCiVOA8cGvJjcfCSejrQIYpMQIi2NIasytzXhoBXD3Js3h0BG36GxUzcEI55Y1dPuub W7WHmpcZjlItWeVxUovBYGQypTd09vwcc/L1iAcc4E1owEbQxrHpdBVSAm1ZUfaXLHHH 23wLyGJqwhOEXnfTq25EIiIWohk3SkFukGg8DGSRU8XBbIBvnQZiVk3hSLjoMMtIpE4i YJIUy+1U0hbxQMsVwMVT/OhtUBaGEYb13vYVMN4xL1rPGsc5MDYT1b5J4O75BdgI+m5G eTww== X-Gm-Message-State: APjAAAXc5q8iRFFkTZl/OG1w1evAwJqh/7mxqaqEwaBd1YFm8zHgc+K7 jTG95P9Tc5sh5DZiEBtx8u6uHzvbLD0= X-Google-Smtp-Source: APXvYqxq+54HAvizNgqbKMTZMHl6Q1WNyCb4IfkP2uoVagXR7adKDi683renWjkh9vfS/CJMJc3FkA== X-Received: by 2002:a0c:9848:: with SMTP id e8mr28558826qvd.80.1552352477595; Mon, 11 Mar 2019 18:01:17 -0700 (PDT) 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 y16sm576726qki.49.2019.03.11.18.01.16 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 11 Mar 2019 18:01:16 -0700 (PDT) Subject: Re: [PATCH v2] Allow additional map permission when reading hwdb To: "Sugar, David" , "selinux-refpolicy@vger.kernel.org" References: <20190309035757.5443-1-dsugar@tresys.com> From: Chris PeBenito Message-ID: <87cd6825-2850-632c-2b1d-c2eaaaf41ace@ieee.org> Date: Mon, 11 Mar 2019 20:53:39 -0400 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: <20190309035757.5443-1-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 3/8/19 10:58 PM, Sugar, David wrote: > I'm seeing a denial for udev to map /etc/udev/hwdb.bin. > This creates and uses a new interface to allow the needed > permission for udev. > > type=AVC msg=audit(1551886176.948:642): avc: denied { map } for pid=5187 comm="systemd-udevd" path="/etc/udev/hwdb.bin" dev="dm-1" ino=6509618 scontext=system_u:system_r:udev_t:s0-s0:c0.c1023 tcontext=system_u:object_r:systemd_hwdb_t:s0 tclass=file permissive=1 > > Updated from previous to create a new interface. > > Signed-off-by: Dave Sugar > --- > policy/modules/system/systemd.if | 18 ++++++++++++++++++ > policy/modules/system/udev.te | 1 + > 2 files changed, 19 insertions(+) > > diff --git a/policy/modules/system/systemd.if b/policy/modules/system/systemd.if > index 8d2bb8da..6353ca69 100644 > --- a/policy/modules/system/systemd.if > +++ b/policy/modules/system/systemd.if > @@ -37,6 +37,24 @@ interface(`systemd_read_hwdb',` > read_files_pattern($1, systemd_hwdb_t, systemd_hwdb_t) > ') > > +####################################### > +## > +## Allow domain to map udev hwdb file > +## > +## > +## > +## domain allowed access > +## > +## > +# > +interface(`systemd_map_hwdb',` > + gen_require(` > + type systemd_hwdb_t; > + ') > + > + allow $1 systemd_hwdb_t:file map; > +') > + > ###################################### > ## > ## Read systemd_login PID files. > diff --git a/policy/modules/system/udev.te b/policy/modules/system/udev.te > index 88bff272..d0496258 100644 > --- a/policy/modules/system/udev.te > +++ b/policy/modules/system/udev.te > @@ -250,6 +250,7 @@ ifdef(`init_systemd',` > init_get_generic_units_status(udev_t) > init_stream_connect(udev_t) > > + systemd_map_hwdb(udev_t) > systemd_read_hwdb(udev_t) > systemd_read_logind_sessions_files(udev_t) > systemd_read_logind_pids(udev_t) Merged. -- Chris PeBenito