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.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 261D0C43387 for ; Wed, 16 Jan 2019 23:19:49 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id E858120652 for ; Wed, 16 Jan 2019 23:19:48 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=ieee.org header.i=@ieee.org header.b="EOoKMbNA" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727150AbfAPXTs (ORCPT ); Wed, 16 Jan 2019 18:19:48 -0500 Received: from mail-qk1-f196.google.com ([209.85.222.196]:37966 "EHLO mail-qk1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727082AbfAPXTs (ORCPT ); Wed, 16 Jan 2019 18:19:48 -0500 Received: by mail-qk1-f196.google.com with SMTP id a1so4932081qkc.5 for ; Wed, 16 Jan 2019 15:19:47 -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=7XQ5uLmtOCNDgELh9SPTJRtytxb89lTdRPe3FXQpW/A=; b=EOoKMbNAa5Ck/ipfTLgmI2+4MBEOEL+FkFWb2aMKHWy0RAvEw1R9NTGWrjn8tRp06W zouNwo8+LOrNjrx7Ec74mUu68h+TZb6wM2jXcYInNaRxwyCwSlgVrICMoZf8cziqyS87 jZXVB2U7QG18gISSUe/GtWh4T8qvcZX9IikE4= 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=7XQ5uLmtOCNDgELh9SPTJRtytxb89lTdRPe3FXQpW/A=; b=igvh98HpSYcZDjjOOCBpD6k5WmFJxJ3X7x/WHxZD+2mMQtBiy1awIib1VM5RVmMmW0 v10Pen3mCAyZFGOz4qonaj271xfsWloHfuX5dAie3HGYzW0KQ6NL8qfZA4y4+GO7Cdy9 FX2EyWvE0TEutZ2J8Bagy9aQBnWwcg8FQU+UaNZdcyAgjZqIbtxiNHDa11nmkqcyULoA Yk7v1rYvNiY69hgL6CLPZUm+QhQpQFMJAQyPlWz5pWkgS0l211n4rLpSmHcJHafqp3FI pNtbPfUhcsgW0IctqzCHfZ3HcPnDvLTMftuiadgRr+UN5Pk4YKqy7W44Gmw0ZmOaESW4 SCJA== X-Gm-Message-State: AJcUukdOAsd/jNXz7kS0Oxk97jWgDWhcFSax68lh3o/QRVdop1mfEg3I SOvfLeds9NE6JwCtCBMMbBfP0q5+uGo= X-Google-Smtp-Source: ALg8bN4bTGnXmJ4yBckYgmKHhc0X0WGB1fFglbuhxoIRcgSapbMAXIBWwbW4X+E/TA4a+fNDyW899Q== X-Received: by 2002:a37:8846:: with SMTP id k67mr8762034qkd.214.1547680786935; Wed, 16 Jan 2019 15:19:46 -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 m41sm68866866qtc.58.2019.01.16.15.19.46 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 16 Jan 2019 15:19:46 -0800 (PST) Subject: Re: [PATCH 2/2 v2] Modify type for /etc/hostname To: "Sugar, David" , "selinux-refpolicy@vger.kernel.org" References: <20190115032018.28662-1-dsugar@tresys.com> <20190115032018.28662-4-dsugar@tresys.com> From: Chris PeBenito Message-ID: <1c340a9f-036e-cd58-262b-8fe14a9a56c0@ieee.org> Date: Wed, 16 Jan 2019 18:13:56 -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: <20190115032018.28662-4-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 1/14/19 10:20 PM, Sugar, David wrote: > hostnamectl updates /etc/hostname > This change is setting the type for the file /etc/hostname to > net_conf_t and granting hostnamectl permission to edit this file. > Note that hostnamectl is initially creating a new file .#hostname* > which is why the create permissions are requied. > > type=AVC msg=audit(1547039052.041:563): avc: denied { write } for pid=7564 comm="systemd-hostnam" name="etc" dev="dm-1" ino=101 scontext=system_u:system_r:systemd_hostnamed_t:s0 tcontext=system_u:object_r:etc_t:s0 tclass=dir permissive=1 > type=AVC msg=audit(1547039052.041:563): avc: denied { add_name } for pid=7564 comm="systemd-hostnam" name=".#hostnamezyqZ9t" scontext=system_u:system_r:systemd_hostnamed_t:s0 tcontext=system_u:object_r:etc_t:s0 tclass=dir permissive=1 > type=AVC msg=audit(1547039052.041:563): avc: denied { create } for pid=7564 comm="systemd-hostnam" name=".#hostnamezyqZ9t" scontext=system_u:system_r:systemd_hostnamed_t:s0 tcontext=system_u:object_r:etc_t:s0 tclass=file permissive=1 > type=AVC msg=audit(1547039052.041:563): avc: denied { write } for pid=7564 comm="systemd-hostnam" path="/etc/.#hostnamezyqZ9t" dev="dm-1" ino=1094726 scontext=system_u:system_r:systemd_hostnamed_t:s0 tcontext=system_u:object_r:etc_t:s0 tclass=file permissive=1 > type=SYSCALL msg=audit(1547039052.041:563): arch=c000003e syscall=2 success=yes exit=8 a0=560d0bba34b0 a1=800c2 a2=180 a3=5c35f14c items=2 ppid=1 pid=7564 auid=4294967295 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 tty=(none) ses=4294967295 comm="systemd-hostnam" exe="/usr/lib/systemd/systemd-hostnamed" subj=system_u:system_r:systemd_hostnamed_t:s0 key=(null) > type=AVC msg=audit(1547039052.041:564): avc: denied { setattr } for pid=7564 comm="systemd-hostnam" name=".#hostnamezyqZ9t" dev="dm-1" ino=1094726 scontext=system_u:system_r:systemd_hostnamed_t:s0 tcontext=system_u:object_r:etc_t:s0 tclass=file permissive=1 > type=SYSCALL msg=audit(1547039052.041:564): arch=c000003e syscall=91 success=yes exit=0 a0=8 a1=1a4 a2=fbad2484 a3=24 items=1 ppid=1 pid=7564 auid=4294967295 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 tty=(none) ses=4294967295 comm="systemd-hostnam" exe="/usr/lib/systemd/systemd-hostnamed" subj=system_u:system_r:systemd_hostnamed_t:s0 key=(null) > type=AVC msg=audit(1547039052.041:565): avc: denied { remove_name } for pid=7564 comm="systemd-hostnam" name=".#hostnamezyqZ9t" dev="dm-1" ino=1094726 scontext=system_u:system_r:systemd_hostnamed_t:s0 tcontext=system_u:object_r:etc_t:s0 tclass=dir permissive=1 > type=AVC msg=audit(1547039052.041:565): avc: denied { rename } for pid=7564 comm="systemd-hostnam" name=".#hostnamezyqZ9t" dev="dm-1" ino=1094726 scontext=system_u:system_r:systemd_hostnamed_t:s0 tcontext=system_u:object_r:etc_t:s0 tclass=file permissive=1 > type=AVC msg=audit(1547039052.041:565): avc: denied { unlink } for pid=7564 comm="systemd-hostnam" name="hostname" dev="dm-1" ino=1094712 scontext=system_u:system_r:systemd_hostnamed_t:s0 tcontext=system_u:object_r:etc_t:s0 tclass=file permissive=1 > > Signed-off-by: Dave Sugar > --- > policy/modules/system/sysnetwork.fc | 1 + > policy/modules/system/systemd.te | 3 +++ > 2 files changed, 4 insertions(+) > > diff --git a/policy/modules/system/sysnetwork.fc b/policy/modules/system/sysnetwork.fc > index cd528938..1e5432a4 100644 > --- a/policy/modules/system/sysnetwork.fc > +++ b/policy/modules/system/sysnetwork.fc > @@ -18,6 +18,7 @@ ifdef(`distro_debian',` > /etc/hosts -- gen_context(system_u:object_r:net_conf_t,s0) > /etc/hosts\.allow.* -- gen_context(system_u:object_r:net_conf_t,s0) > /etc/hosts\.deny.* -- gen_context(system_u:object_r:net_conf_t,s0) > +/etc/hostname -- gen_context(system_u:object_r:net_conf_t,s0) > /etc/denyhosts.* -- gen_context(system_u:object_r:net_conf_t,s0) > /etc/resolv\.conf.* -- gen_context(system_u:object_r:net_conf_t,s0) > /etc/yp\.conf.* -- gen_context(system_u:object_r:net_conf_t,s0) > diff --git a/policy/modules/system/systemd.te b/policy/modules/system/systemd.te > index abcc52f5..75ee4310 100644 > --- a/policy/modules/system/systemd.te > +++ b/policy/modules/system/systemd.te > @@ -325,6 +325,9 @@ files_read_etc_files(systemd_hostnamed_t) > > seutil_read_file_contexts(systemd_hostnamed_t) > > +sysnet_etc_filetrans_config(systemd_hostnamed_t) > +sysnet_manage_config(systemd_hostnamed_t) > + > systemd_log_parse_environment(systemd_hostnamed_t) > > optional_policy(` Merged. -- Chris PeBenito