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=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 73FD8C43381 for ; Wed, 27 Mar 2019 22:53:32 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 333042070B for ; Wed, 27 Mar 2019 22:53:32 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=ieee.org header.i=@ieee.org header.b="e8ShNC1n" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727876AbfC0Wxc (ORCPT ); Wed, 27 Mar 2019 18:53:32 -0400 Received: from mail-qt1-f195.google.com ([209.85.160.195]:33275 "EHLO mail-qt1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727832AbfC0Wxb (ORCPT ); Wed, 27 Mar 2019 18:53:31 -0400 Received: by mail-qt1-f195.google.com with SMTP id k14so20975437qtb.0 for ; Wed, 27 Mar 2019 15:53:31 -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=MyAXOev/GozxxCtDzC8dDzQ1kCEI24XaaH8v+R7cqps=; b=e8ShNC1n5BDA2OX0ybk1SmSZvc8o+l0psejVHFeP+MKtBgq5DwFmi47hejZtIYAzyK wwRSjFt1Ypt3ydWGGqp0M209223OHpzYXV6m7WSt1MZgBVY3BbOdC/fc66ctPHp8Hw7Y af/N1RsudJ7eRXa35Dm5Sj/cx1o8toeCIikm0= 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=MyAXOev/GozxxCtDzC8dDzQ1kCEI24XaaH8v+R7cqps=; b=rrRd4ldnT9cDD+TQGr4zBexHPNEOb7qiuFObARTXY7ccQeTI256lW70J2W36KBNNjy X1+gwVRAG3Jn4f2Qb3UxXQ27/QM2kO7+XOCGBqtrkvwe7T+OTRcq8+AqsoSSaGLBqH5D +gEYRAvRXnfGERWLluWgzTho+8BGpluu99MyDeqyBwGskYmlKPgTaEGMryxxgieQgIcz OM18BKkVFwNZPvt8g8SCimNVOMUXeHX5vA/vtyIHHYNJR4ANYsWdOJrSH6tBcVIT8kbr d8QkUmx5VcIkZfAaGBAR18bTheGXTyHnlZsBNWzejhZuOo9aKkb00NjO8etHjyFA+3q0 1d1A== X-Gm-Message-State: APjAAAXpDUIXtFbLEJA9vlGoy3W0O8W0NA/R6by4+3rfaUhRe8SaLSny clRxq86PtDTZMhqpIBsiIh7a532ZezA= X-Google-Smtp-Source: APXvYqxKRQ9HgKLRmPHtzMH32C3iram/qInXEWY1l30Cb/0la1kUTEZaBiHP1S7ZqUN/Zp/XWOyFow== X-Received: by 2002:a0c:b501:: with SMTP id d1mr33554692qve.115.1553727210919; Wed, 27 Mar 2019 15:53:30 -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 i11sm11222972qkg.33.2019.03.27.15.53.29 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 27 Mar 2019 15:53:30 -0700 (PDT) Subject: Re: [PATCH 4/4-v2] Allow ntpd to read unit files To: "Sugar, David" , "selinux-refpolicy@vger.kernel.org" References: <20190326220014.31256-1-dsugar@tresys.com> From: Chris PeBenito Message-ID: <6a9c5db9-ce95-77cb-e355-50dc83d2985d@ieee.org> Date: Wed, 27 Mar 2019 18:50:42 -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: <20190326220014.31256-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/26/19 6:00 PM, Sugar, David wrote: > Adding missing documenation (sorry about that). > > type=AVC msg=audit(1553013917.359:9935): avc: denied { read } for pid=16326 comm="systemd-timedat" name="50-chronyd.list" dev="dm-1" ino=4870675 scontext=system_u:system_r:ntpd_t:s0 tcontext=system_u:object_r:ntpd_unit_t:s0 tclass=file permissive=1 > type=AVC msg=audit(1553013917.359:9935): avc: denied { open } for pid=16326 comm="systemd-timedat" path="/usr/lib/systemd/ntp-units.d/50-chronyd.list" dev="dm-1" ino=4870675 scontext=system_u:system_r:ntpd_t:s0 tcontext=system_u:object_r:ntpd_unit_t:s0 tclass=file permissive=1 > type=AVC msg=audit(1553013917.359:9936): avc: denied { getattr } for pid=16326 comm="systemd-timedat" path="/usr/lib/systemd/ntp-units.d/50-chronyd.list" dev="dm-1" ino=4870675 scontext=system_u:system_r:ntpd_t:s0 tcontext=system_u:object_r:ntpd_unit_t:s0 tclass=file permissive=1 > > type=AVC msg=audit(1553013821.622:9902): avc: denied { getattr } for pid=16281 comm="systemd-timedat" path="/usr/lib/systemd/ntp-units.d" dev="dm-1" ino=4700094 scontext=system_u:system_r:ntpd_t:s0 tcontext=system_u:object_r:systemd_unit_t:s0 tclass=dir permissive=1 > type=AVC msg=audit(1553013821.622:9903): avc: denied { read } for pid=16281 comm="systemd-timedat" name="ntp-units.d" dev="dm-1" ino=4700094 scontext=system_u:system_r:ntpd_t:s0 tcontext=system_u:object_r:systemd_unit_t:s0 tclass=dir permissive=1 > type=AVC msg=audit(1553013821.622:9903): avc: denied { open } for pid=16281 comm="systemd-timedat" path="/usr/lib/systemd/ntp-units.d" dev="dm-1" ino=4700094 scontext=system_u:system_r:ntpd_t:s0 tcontext=system_u:object_r:systemd_unit_t:s0 tclass=dir permissive=1 > > Signed-off-by: Dave Sugar > --- > policy/modules/services/ntp.te | 3 +++ > policy/modules/system/init.if | 20 ++++++++++++++++++++ > 2 files changed, 23 insertions(+) > > diff --git a/policy/modules/services/ntp.te b/policy/modules/services/ntp.te > index a95bf21d..982d6a4c 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) > > 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..be2c0a70 100644 > --- a/policy/modules/system/init.if > +++ b/policy/modules/system/init.if > @@ -2960,6 +2960,26 @@ interface(`init_search_units',` > fs_search_tmpfs($1) > ') > > +###################################### > +## > +## List systemd unit dirs. > +## > +## > +## > +## Domain allowed access. > +## > +## > +# > +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 Merged. -- Chris PeBenito