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,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, 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 33407C43387 for ; Sun, 6 Jan 2019 12:55:01 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id E060720878 for ; Sun, 6 Jan 2019 12:55:00 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="iDbXHuB+" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726347AbfAFMzA (ORCPT ); Sun, 6 Jan 2019 07:55:00 -0500 Received: from mail-ed1-f65.google.com ([209.85.208.65]:37960 "EHLO mail-ed1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726336AbfAFMzA (ORCPT ); Sun, 6 Jan 2019 07:55:00 -0500 Received: by mail-ed1-f65.google.com with SMTP id h50so35526702ede.5 for ; Sun, 06 Jan 2019 04:54:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version:content-transfer-encoding; bh=FZdQ+1obiJj+gfnnu+L1OLbks8Jxzj6SsOx8z4wkze8=; b=iDbXHuB+IwGWte6CS/m20P+gaO0PiuvWvzGvjqDOgBErBOPzlid1tLCiJROCP17wdK 9LWcMwixkPN+ffoafk7EOidCDFYjnoOpgw0mp4HDc+hGh1MMo0tyb7dFg3gZMRVTj9wu Kwo8T8EinjpLzOa5+c7TMIT5CUIz2BevDjxXqkNJQ9FMXCnUrOcv9XelDDoSulIBhqUs BKQREDhcDySeVjL+QasW8gPN+OxCX6cz51mC3SH7+GLjie18ymJ9E0w9Vq38G5rAuV1l 0SJ90rUZbSxzDDPfOwqfppWBVUI3StY7nP8+MS+H13xmVcAc4AGYmPvcWi9R+R8YS9UN nFRg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version:content-transfer-encoding; bh=FZdQ+1obiJj+gfnnu+L1OLbks8Jxzj6SsOx8z4wkze8=; b=SyDF1kJTtIgwZNk0NdHH+oo4w6jAUyzCDPNwijdyT9bOKbUw65+chbDfwUZi8zAnw0 GNtyZbB0oGSr3Yb9iEaQ74JBiV6aaNyMpyMZVXBjeozpnrTgz04C5u4vHJx8407zPxWF e0ELeo4gJQA+6RW8utpcELQEuBc7Z84EzOxWFsyHoyVBh2O/MJx96T6dF9fiuF4cJ+qG t2tLlvZK3O9fVRziil7JeGRSHIdDkbV2406AX2xXpv1PlFw7ZCGf3+3b+y2XZn8D5fwS 0JunfcECiHMlMcS88qfGRaUm79UWuV5s8pzLeTEiFNIez1T7pI/qmENJE+Xj1Vefcs+0 S1gA== X-Gm-Message-State: AA+aEWZTzDV+Z7L5pxU0Bj7jB5wuWEnC0uq/2XTLR4MRmM7Vj4e2eLeJ urdyUGmWq2ckuClgPCVVGfd8ux123/8= X-Google-Smtp-Source: AFSGD/W0p03ksGy8sX4032R+Stiek1FWApY2heog+lxKnVXhfr/ZrOjAKkGmdUFlRswHWKyfiDzbuQ== X-Received: by 2002:a17:906:1c86:: with SMTP id g6-v6mr43087436ejh.195.1546779296831; Sun, 06 Jan 2019 04:54:56 -0800 (PST) Received: from brutus ([2001:985:d55d::438]) by smtp.gmail.com with ESMTPSA id l17sm27067124edc.56.2019.01.06.04.54.55 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sun, 06 Jan 2019 04:54:56 -0800 (PST) From: Dominick Grift To: "Sugar\, David" Cc: "selinux-refpolicy\@vger.kernel.org" Subject: Re: [PATCH 1/2 v2] Allow greeter to start dbus References: <20190106123358.18395-1-dsugar@tresys.com> <87d0pa7ydd.fsf@gmail.com> Date: Sun, 06 Jan 2019 13:54:55 +0100 In-Reply-To: (David Sugar's message of "Sun, 6 Jan 2019 12:50:47 +0000") Message-ID: <874lam7xpc.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Sender: selinux-refpolicy-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: selinux-refpolicy@vger.kernel.org "Sugar, David" writes: > On 1/6/19 7:40 AM, Dominick Grift wrote: >> "Sugar, David" writes: >> >>> The display manager lightdm (and I think gdm) start a dbus binary. >>> >>> This adds (and uses) new interface dbus_exec to start dbus in the xdm d= omain. >>> >>> type=3DAVC msg=3Daudit(1544626796.378:201): avc: denied { execute } f= or pid=3D9973 comm=3D"dbus-launch" name=3D"dbus-daemon" dev=3D"dm-1" ino= =3D6695040 scontext=3Dsystem_u:system_r:xdm_t:s0-s0:c0.c1023 tcontext=3Dsys= tem_u:object_r:dbusd_exec_t:s0 tclass=3Dfile permissive=3D1 >>> type=3DAVC msg=3Daudit(1544626796.378:201): avc: denied { read open }= for pid=3D9973 comm=3D"dbus-launch" path=3D"/usr/bin/dbus-daemon" dev=3D"= dm-1" ino=3D6695040 scontext=3Dsystem_u:system_r:xdm_t:s0-s0:c0.c1023 tcont= ext=3Dsystem_u:object_r:dbusd_exec_t:s0 tclass=3Dfile permissive=3D1 >>> type=3DAVC msg=3Daudit(1544626796.378:201): avc: denied { execute_no_= trans } for pid=3D9973 comm=3D"dbus-launch" path=3D"/usr/bin/dbus-daemon" = dev=3D"dm-1" ino=3D6695040 scontext=3Dsystem_u:system_r:xdm_t:s0-s0:c0.c102= 3 tcontext=3Dsystem_u:object_r:dbusd_exec_t:s0 tclass=3Dfile permissive=3D1 >>> type=3DAVC msg=3Daudit(1544626796.378:201): avc: denied { map } for = pid=3D9973 comm=3D"dbus-daemon" path=3D"/usr/bin/dbus-daemon" dev=3D"dm-1" = ino=3D6695040 scontext=3Dsystem_u:system_r:xdm_t:s0-s0:c0.c1023 tcontext=3D= system_u:object_r:dbusd_exec_t:s0 tclass=3Dfile permissive=3D1 >>> type=3DAVC msg=3Daudit(1546551459.112:208): avc: denied { getcap } fo= r pid=3D6275 comm=3D"dbus-daemon" scontext=3Dsystem_u:system_r:xdm_t:s0-s0:= c0.c1023 tcontext=3Dsystem_u:system_r:xdm_t:s0-s0:c0.c1023 tclass=3Dprocess= permissive=3D1 >>> >>> Signed-off-by: Dave Sugar >>> --- >>> policy/modules/services/dbus.if | 21 +++++++++++++++++++++ >>> policy/modules/services/xserver.te | 1 + >>> 2 files changed, 22 insertions(+) >>> >>> diff --git a/policy/modules/services/dbus.if b/policy/modules/services/= dbus.if >>> index ef829e30..d0eec745 100644 >>> --- a/policy/modules/services/dbus.if >>> +++ b/policy/modules/services/dbus.if >>> @@ -17,6 +17,27 @@ interface(`dbus_stub',` >>> ') >>> ') >>>=20=20=20 >>> +######################################## >>> +## >>> +## Execute dbus in the caller domain. >>> +## >>> +## >>> +## >>> +## Domain allowed access. >>> +## >>> +## >>> +# >>> +interface(`dbus_exec',` >>> + gen_require(` >>> + type dbusd_exec_t; >>> + ') >>> + >>> + corecmd_search_bin($1) >>> + can_exec($1, dbusd_exec_t) >>> + >>> + allow $1 self:process getcap; >> I would not enclose the getcap rule here. For example I do not believe >> you need that permission to be able to `dbus-daemon --version`. Instead I >> would add that rule to xserver.te: >> >> allow xdm_t self:process getcap; > > I did it this way due to the fact that it is dbus-daemon needing the=20 > getcap permission not lightdm.=C2=A0 So other processes that use the=20 > dbus_exec interface will also need this permission.=C2=A0 I'm happy separ= ate=20 > just worry it won't be clear why getcap will be added in several places=20 > due to this. > `dbus-daemon --version` does not seem to require getcap executing dbus potentially requires many permissions but that does not mean that we should add these permissions to dbus_exec() >>> +') >>> + >>> ######################################## >>> ## >>> ## Role access for dbus. >>> diff --git a/policy/modules/services/xserver.te b/policy/modules/servic= es/xserver.te >>> index fa7ce88e..cc717e7f 100644 >>> --- a/policy/modules/services/xserver.te >>> +++ b/policy/modules/services/xserver.te >>> @@ -566,6 +566,7 @@ optional_policy(` >>> ') >>>=20=20=20 >>> optional_policy(` >>> + dbus_exec(xdm_t) >>> dbus_system_bus_client(xdm_t) >>> dbus_connect_system_bus(xdm_t) --=20 Key fingerprint =3D 5F4D 3CDB D3F8 3652 FBD8 02D5 3B6C 5F1D 2C7B 6B02 https://sks-keyservers.net/pks/lookup?op=3Dget&search=3D0x3B6C5F1D2C7B6B02 Dominick Grift