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=-8.4 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_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 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 F3E49C2D0DB for ; Wed, 22 Jan 2020 10:41:45 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id C934C2465B for ; Wed, 22 Jan 2020 10:41:45 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=ieee.org header.i=@ieee.org header.b="FElsJtCh" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729536AbgAVKlp (ORCPT ); Wed, 22 Jan 2020 05:41:45 -0500 Received: from mail-qk1-f195.google.com ([209.85.222.195]:43073 "EHLO mail-qk1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729388AbgAVKlo (ORCPT ); Wed, 22 Jan 2020 05:41:44 -0500 Received: by mail-qk1-f195.google.com with SMTP id j20so1880056qka.10 for ; Wed, 22 Jan 2020 02:41: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=+/kwy3qHJqtZlBTqFj0zjqMw58kYNpMRqGqGTYxyQbw=; b=FElsJtCh0yqmuLx8t6EQzZlCUMYEccJbLhexnHGm6wtmImV0ZjCwt/4t4XFPdgkjBk 89K2RLeBRghoZMnLQpALy/SJIJcbia6md5RXxIWl9Hrwp0kpwpmIBDr5O3s4DV2GoonZ C0RX8kUGZ/yBxSxsgFq2SU7tyfUUHUHk9PNG8= 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=+/kwy3qHJqtZlBTqFj0zjqMw58kYNpMRqGqGTYxyQbw=; b=N7P87xmy5DYMaiNo42AH4tZcykTnbHvI4ls2B0uohznHB50ZWNhRjryyToXcMb5ryS ZOe/BmMer2ynQNAmM3wsD1GwMqU2pY7YOPPLkpSYxRcDdf3t3drOda4M40gk52rwpUjp FNIj/Wcw/AT7gasPkOI5iO+44bZh2ebBMFjvswXXulwKKGlBmRd7f3ceAmG9HML/OZnr 0v6DPQD92pD6e4hTE0uOO7I5Wdgoj7356GiehzRGaP7DdXFl0eqzQSGaNTT0JHfdtkpE Pf1u9taM/FUZ6HVpIabyaNNskRkGMLYUw2F/7+Z5qmBuzbiKtA1G8pzLUn34Vhh27/dY LQyg== X-Gm-Message-State: APjAAAVWh5s5JYFAGenr6tb7X6jncYE4eZLtng9Pp60j9AkfpcYVr6DL be+CRz/fVXqtR0MsITgdwHk+YXePQks9vQ== X-Google-Smtp-Source: APXvYqxygJgszjcbPn0k9XaIE64xgSIcSQzUID+LP9k0TKw0d1wAjQF078C93TFG1yXpLdh/H8unwA== X-Received: by 2002:ae9:e901:: with SMTP id x1mr8701910qkf.117.1579689703695; Wed, 22 Jan 2020 02:41:43 -0800 (PST) Received: from fedora.pebenito.net (pool-108-15-23-247.bltmmd.fios.verizon.net. [108.15.23.247]) by smtp.gmail.com with ESMTPSA id y27sm1208606qta.50.2020.01.22.02.41.42 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 22 Jan 2020 02:41:43 -0800 (PST) Subject: Re: [PATCH v2] Allow systemd to getattr configfile To: "Sugar, David" , "selinux-refpolicy@vger.kernel.org" References: <20200113182658.3502291-1-dsugar@tresys.com> <413d1a7d-224f-49eb-6a51-dab0a6227804@ieee.org> From: Chris PeBenito Message-ID: <39df5cdf-d7c4-fd23-2c5b-71c7679a55d5@ieee.org> Date: Wed, 22 Jan 2020 05:41:42 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.3.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit Sender: selinux-refpolicy-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: selinux-refpolicy@vger.kernel.org On 1/21/20 9:22 AM, Sugar, David wrote: > On 1/21/20 8:42 AM, Chris PeBenito wrote: >> On 1/13/20 1:27 PM, Sugar, David wrote: >>> v2 update - rework, creating interface 'init_systemd_conditional' >>> as suggested.  This grants getattr access to the type provided. >>> >>> Signed-off-by: Dave Sugar >>> --- >>>   policy/modules/services/chronyd.te |  2 ++ >>>   policy/modules/system/init.if      | 26 ++++++++++++++++++++++++++ >>>   2 files changed, 28 insertions(+) >>> >>> diff --git a/policy/modules/services/chronyd.te >>> b/policy/modules/services/chronyd.te >>> index 5e680d39..7ae8bb5a 100644 >>> --- a/policy/modules/services/chronyd.te >>> +++ b/policy/modules/services/chronyd.te >>> @@ -102,6 +102,8 @@ miscfiles_read_localization(chronyd_t) >>>   chronyd_dgram_send_cli(chronyd_t) >>>   chronyd_read_config(chronyd_t) >>> +init_systemd_conditional(chronyd_conf_t) >>> + >>>   optional_policy(` >>>       gpsd_rw_shm(chronyd_t) >>>   ') >>> diff --git a/policy/modules/system/init.if >>> b/policy/modules/system/init.if >>> index 62ab4da8..5a0a78bf 100644 >>> --- a/policy/modules/system/init.if >>> +++ b/policy/modules/system/init.if >>> @@ -3232,6 +3232,32 @@ interface(`init_reload_all_units',` >>>       allow $1 { init_script_file_type systemdunit }:service reload; >>>   ') >>> + >>> +######################################## >>> +## >>> +##      Allow init_t getattr permissions.  Generally >>> +##      needed for types that are used in a Condition >>> +##      predicate. >>> +## >>> +## >>> +##      >>> +##      type accessible by init_t >>> +##      >>> +## >>> +# >>> +interface(`init_systemd_conditional',` >> >> systemd_ConditionPath is a more preferable name. >> > > I'm a little confused about the suggested name. I think this interface > belongs in init.if due to the requiring of init_t. Due to this, I think > it should have the init_ prefix. I also don't think there are any camel > case interface names. > > Is the name 'init_systemd_condition_path' acceptable? Or are some of my > assumptions wrong? No, you're right, my mistake. However, this makes me reconsider the previous discussion on this. Is it really an issue for systemd to be able to getattr all files? Condition* works in many cases already since systemd already has lots of access all over the filesystem. -- Chris PeBenito