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.2 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 9DF4FC43381 for ; Wed, 20 Feb 2019 03:31:47 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 556C42146F for ; Wed, 20 Feb 2019 03:31:47 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=ieee.org header.i=@ieee.org header.b="RuSXbvH4" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726208AbfBTDbq (ORCPT ); Tue, 19 Feb 2019 22:31:46 -0500 Received: from mail-pg1-f194.google.com ([209.85.215.194]:36717 "EHLO mail-pg1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725916AbfBTDbq (ORCPT ); Tue, 19 Feb 2019 22:31:46 -0500 Received: by mail-pg1-f194.google.com with SMTP id r124so11142216pgr.3 for ; Tue, 19 Feb 2019 19:31:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ieee.org; s=google; h=message-id:subject:from:to:date:in-reply-to:references:user-agent :mime-version:content-transfer-encoding; bh=k0pCpstTiPQuvNUC4UCoyTtDFR4LqIuBeuoL3TEQE1g=; b=RuSXbvH48O5819lWrqL2OzNvSuArnjgxGJ2PyuZUQoA82nItyuiu0q0mirdKFyrg10 t+MpTP1hi+qH28WwnsyM8wLGFjmKh041oh9rzz9FkTa5ldpG3ShQ89cl4C1lCXjyXAeD jjnAhucN9n9nYfFDWf/iQreYMRf4CR85L/oTY= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:message-id:subject:from:to:date:in-reply-to :references:user-agent:mime-version:content-transfer-encoding; bh=k0pCpstTiPQuvNUC4UCoyTtDFR4LqIuBeuoL3TEQE1g=; b=RU5+Rhoa9O2eYJOzziaAthTm4hh158U2CxihR9vRmpIHkxyRUFAVAMMDR9281eX0nu KKf8ZW2NypjjzBBCMgMHLeROYBlOpE9Pd8jlVJZKYNYdt2GRlRM5uCKHmRrvlfF/Soiu joJRQb8xwtZSxI7PesZJL2RRER3O7vHU6mzSKjRrEStHmdl97NophY0RJIURSWXCPmxx MmjamGM/5SwKkFD7wOK75FxLmo9h10jyTbviPwUyPnATR6fpolY54EkG86wpYjVtgsoG 5j2qcarEz+00SsNjSnl4A1GYse6NIRHbN0ZcUqdC/Hkv0mEtqzBDm1mjhO28ZanGrHe5 L0ww== X-Gm-Message-State: AHQUAubNJ1X3YVhzAbH9CogAxd0V9R5YvfYWx60yh5SvjSmvPZom4zLs mXMXXeNOkk0iJUO5U+ox1LJ/3xGlbseeF8zn X-Google-Smtp-Source: AHgI3IZC0sKKA2oUQyzvFyp/6k7rIf+BXUoUChslVKtlijnX7LPGHlDI+AeOKNimb1SSY2GIuMAD8g== X-Received: by 2002:a65:6658:: with SMTP id z24mr31106588pgv.189.1550633505969; Tue, 19 Feb 2019 19:31:45 -0800 (PST) Received: from lenovo.pebenito.net ([173.239.195.26]) by smtp.gmail.com with ESMTPSA id j8sm24026710pfe.130.2019.02.19.19.31.44 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 19 Feb 2019 19:31:44 -0800 (PST) Message-ID: <6a5ef8dd7e9fa097ce13f807a10e1d9a1f7b8928.camel@ieee.org> Subject: Re: [PATCH] Allow systemd-hostnamed to set the hostname From: Chris PeBenito To: "Sugar, David" , "selinux-refpolicy@vger.kernel.org" Date: Tue, 19 Feb 2019 19:31:43 -0800 In-Reply-To: <20190218151450.13208-2-dsugar@tresys.com> References: <20190218151450.13208-1-dsugar@tresys.com> <20190218151450.13208-2-dsugar@tresys.com> Content-Type: text/plain; charset="UTF-8" User-Agent: Evolution 3.30.5 (3.30.5-1.fc29) MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: selinux-refpolicy-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: selinux-refpolicy@vger.kernel.org On Mon, 2019-02-18 at 15:15 +0000, Sugar, David wrote: > When calling hostnamectl to set the hostname it needs sys_admin > capability to actually set the hostname. > > Feb 13 11:47:14 localhost.localdomain systemd-hostnamed[7221]: Failed > to set host name: Operation not permitted > type=AVC msg=audit(1550058524.656:1988): avc: denied { sys_admin } > for pid=7873 comm="systemd-hostnam" > capability=21 scontext=system_u:system_r:systemd_hostnamed_t:s0 > tcontext=system_u:system_r:systemd_hostnamed_t:s0 tclass=capability > permissive=0 > > Signed-off-by: Dave Sugar > --- > policy/modules/system/systemd.te | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/policy/modules/system/systemd.te > b/policy/modules/system/systemd.te > index 2b25a7d5..b88bf232 100644 > --- a/policy/modules/system/systemd.te > +++ b/policy/modules/system/systemd.te > @@ -331,6 +331,8 @@ > seutil_search_default_contexts(systemd_coredump_t) > # Hostnamed policy > # > > +allow systemd_hostnamed_t self:capability { sys_admin }; > + > kernel_read_kernel_sysctls(systemd_hostnamed_t) > > dev_read_sysfs(systemd_hostnamed_t) Merged. -- Chris PeBenito