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 E3D7AC4360F for ; Sun, 24 Mar 2019 18:44:02 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id B5E9720880 for ; Sun, 24 Mar 2019 18:44:02 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=ieee.org header.i=@ieee.org header.b="LgmHcIZx" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727238AbfCXSoC (ORCPT ); Sun, 24 Mar 2019 14:44:02 -0400 Received: from mail-qt1-f193.google.com ([209.85.160.193]:43420 "EHLO mail-qt1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726139AbfCXSoC (ORCPT ); Sun, 24 Mar 2019 14:44:02 -0400 Received: by mail-qt1-f193.google.com with SMTP id v32so7903229qtc.10 for ; Sun, 24 Mar 2019 11:44:01 -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=6QSbMcKRX5DisFM3FDdSSEogfGdUCpvLglec/4gwsDQ=; b=LgmHcIZxfH/5eVwvkqwLFa5UrwrOeN64Houi5gCJYaNieKN0z2xhH9+CYH0d0S+x9d 1ONxVMVmRXJbO6wZq/CociRulWLPWrIS2KUFR75KysxnvienEhhIZFo7UgZU2AMNxJDG 53YEPMuMORdlebhgVN6arqDUq/kmWS6kG51Os= 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=6QSbMcKRX5DisFM3FDdSSEogfGdUCpvLglec/4gwsDQ=; b=PJrccFC658moCcNnuGYWRySgb3KH0pVVQF+VDz4YLhR8J+YuAZdb06JOZehAUGZAEO sKAccyS2rXw6dFTbQoOhVqK8NpoaQndC+27jZTm6DIZK87LFkXzCuDr3jU6Z+izx8zhM viXDZ4AXVpcHMzXSC/H/3ziWm+FUW+IJx5DfJGi5iafQM6HxkhF45iXUf+GWWmn9EEiv W8+iA+OCtSJByIUuH0u9dBp+xd2uO8jlbGCW9ifqmE0Y01crm44BwLQGmEszbafH7bsl qYoeIHDuiOpdPyoj6oRgjNIbXN2omohcID3zBBqUOXqWvwlfQqnpBJFPE384YEFrDNGA 26hg== X-Gm-Message-State: APjAAAWhlx7dn0RXbQyV3qpNAEowb9To1AlYsB+cacMDXufgot0mUHq5 3v+Y+cGGVVsr75bXFBWBuBGEVQ3fltg= X-Google-Smtp-Source: APXvYqzwSLQbcVMqoptHIKLgqenrmmKKn17zXr5FxPGE233hejfzARIrMG9WypUOk8gCdpJm/pu6ZQ== X-Received: by 2002:a0c:87b3:: with SMTP id 48mr16932851qvj.199.1553453041215; Sun, 24 Mar 2019 11:44:01 -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 i68sm7569449qkf.42.2019.03.24.11.44.00 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 24 Mar 2019 11:44:00 -0700 (PDT) Subject: Re: [PATCH 4/4] Allow ntpd to read unit files To: "Sugar, David" , "selinux-refpolicy@vger.kernel.org" References: <20190320002012.21220-1-dsugar@tresys.com> <20190320002012.21220-5-dsugar@tresys.com> From: Chris PeBenito Message-ID: <67d9f37e-3ecc-d11e-f5db-5f494ed62501@ieee.org> Date: Sun, 24 Mar 2019 14:36:48 -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: <20190320002012.21220-5-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/19/19 8:20 PM, Sugar, David wrote: > 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 | 10 ++++++++++ > 2 files changed, 13 insertions(+) > > diff --git a/policy/modules/services/ntp.te b/policy/modules/services/ntp.te > 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) > > 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) > ') > > +interface(`init_list_unit_dirs',` > + gen_require(` > + type systemd_unit_t; > + ') > + > + allow $1 systemd_unit_t:dir list_dir_perms; > + > + init_search_units($1) > +') Missing documentation. -- Chris PeBenito