Received: by 2002:a05:6a10:a841:0:0:0:0 with SMTP id d1csp3643138pxy; Mon, 26 Apr 2021 06:36:00 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz2ZT92OlIInAu+WSss4Yr0TXddCD94s9596chvBbTAqZHA1LbjXU+jcTRVjLCnZNzLBmrv X-Received: by 2002:a63:4d8:: with SMTP id 207mr17141735pge.261.1619444160468; Mon, 26 Apr 2021 06:36:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1619444160; cv=none; d=google.com; s=arc-20160816; b=WMSr/e6gOgTVBGcRYhXlTEuvTCHLCSniE0Q9n9vEBt/ynE9mwL4NJxXHI+KHg13hX3 RWISUJbkkqO6Mo+9r3CFIXS2e8yxtwcp3cx+1j4MYtrMUtdBXe6/rM48VcBiMRfwPSbb ZEFiLsDEZp1Ma0ZJntMK8a+Yxn1Eb38nVgyCWlzjQ2Slac+RPez/AqYMSXt+3ZOAv7r4 ncCE9O7Q5I+iOzdJFywdqr8I7vbgGjCM59IycRwpitvvPYU9bSVbDry8WboHp5MbQGe1 kRLo8+38jIdsNPlLGs7EYYS+Hl9nYqjvNtpHnF7JXWUiygD5TxxXNOd6NYqwYNOp0K+D r2DQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:subject :references:cc:to:from:dkim-signature:dkim-filter; bh=S2Psh5AFb/qQHzmkfI1LDMfWTUF2CI7rqO+mUPpI9B8=; b=bF8e5jI4aJrKHpQUG/ZTt7zJSZP5HgwkbqDCtOTy17BkE4Qb9cWTAFqVYhKqjqb1cd bARXTOXi3fqaUGJDJO1V9vkpP4xrrXmGoGz0N5VjIKG/+7rCYfFNflNIl8v1fg3reVZk q1lD+Busqro1gGRQHl5JiF8+R0bbQfhRfj6gScbXCxSB7ocpSNEvIdPlQFf1Kp1ctE8x 3mXyUJfnY+l8QswjS6yQoGkAgWslEdZBmYNNqKb2mlBYCzfdfgxur3OmKmIry3MQ+Im+ 5r8IDOggUYEdWIo/NtLy5scDDrE4APny3EwomoP/SEtSU1udqbyP5B4TiwNt7Oot7+Ns UZNQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@defensec.nl header.s=default header.b=Mpqxjlv9; spf=pass (google.com: domain of selinux-refpolicy-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=selinux-refpolicy-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id e184si18787999pfe.58.2021.04.26.06.35.56; Mon, 26 Apr 2021 06:36:00 -0700 (PDT) Received-SPF: pass (google.com: domain of selinux-refpolicy-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@defensec.nl header.s=default header.b=Mpqxjlv9; spf=pass (google.com: domain of selinux-refpolicy-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=selinux-refpolicy-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233218AbhDZNfZ (ORCPT + 17 others); Mon, 26 Apr 2021 09:35:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34576 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230250AbhDZNfY (ORCPT ); Mon, 26 Apr 2021 09:35:24 -0400 Received: from agnus.defensec.nl (agnus.defensec.nl [IPv6:2001:985:d55d::711]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 13C67C061574 for ; Mon, 26 Apr 2021 06:34:43 -0700 (PDT) Received: from [IPv6:2001:985:d55d::438] (brutus.lan [IPv6:2001:985:d55d::438]) by agnus.defensec.nl (Postfix) with ESMTPSA id 198152A06F9; Mon, 26 Apr 2021 15:34:41 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 agnus.defensec.nl 198152A06F9 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=defensec.nl; s=default; t=1619444082; bh=S2Psh5AFb/qQHzmkfI1LDMfWTUF2CI7rqO+mUPpI9B8=; h=From:To:Cc:References:Subject:Date:In-Reply-To:From; b=Mpqxjlv9IaCA4nzTrFFX9eROG8KEmdXqx0/InmoZCl1ZLqLoBMgZe9WlHO0BBvY4i 9cZYWHJd65MW13+MkHAKOSolHi6QTBIq8tsjBwnleCBY/xHzhCl1Vhupvjf6Epw7ph 8qY+/4NXl1dL3lRZcpo7sKkCdW70hxMM1LcV9daw= From: Dominick Grift To: Chris PeBenito , Russell Coker Cc: selinux-refpolicy@vger.kernel.org, Matej Marusak References: <574c5faf-0c19-8b9a-3bfe-a71d82a1f2e6@ieee.org> <3f123c6d-d01a-a032-956e-c88dbde91468@defensec.nl> Subject: Re: [PATCH] cockpit web admin system Message-ID: <7c0018b0-e6fc-87e4-8a93-e7f51d947f88@defensec.nl> Date: Mon, 26 Apr 2021 15:34:40 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.8.1 MIME-Version: 1.0 In-Reply-To: <3f123c6d-d01a-a032-956e-c88dbde91468@defensec.nl> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: selinux-refpolicy@vger.kernel.org On 4/26/21 3:22 PM, Dominick Grift wrote: > > > On 4/26/21 2:47 PM, Chris PeBenito wrote: >> On 4/20/21 9:49 AM, Dominick Grift wrote: >>> Russell Coker writes: >>> >>>> I took this from the rawhide policy and adapted it to work with >>>> refpolicy. >>>> >>>> Probably not ready for merging yet, let me know what should be changed. >>> >>> Its been a while since I played with cockpit >>> >>> Theres one thing that I want to mention though, instead of login the >>> confined users in with their login shell domain consider confining the >>> cockpit-bridge instead and make it log users in with bridge context >>> instead of the login shell context. >> >> Do you have an example of permissions that would be concerning? > > The wide direct dbus access might be concerning. > > cockpit-bridge (at least when I used it) seems to chat directly with > various system services like firewalld,tuned,udisks but also various > systemd components including pid1 (although not sure if the latter are > direct or via systemctl. > > There's a bunch of other access that I can't explain anymore and some of > it does not make sense. Theres network access (connects to vnc and binds > tcp sockets to ephemeral ports) It is not binding sockets to ports but it is connecting. That no big deal since refpolicy already allows that access. It does execute gpg though. if it runs in the shell domain then it has access to gpg data (either via the gpg command or directly) and it seems to not need that (but it still runs gpg probably with a different $GPG_HOME) It does not look too terrible, but things like tcp_socket/udp_socket, dbus, and service access are things i would try not to associate with confined shells (but refpolicy already allows quite a bit of that access anyway) > > I also allowed it to mapread shadow unconditionally but that does not > make sense as shadow is mode 000 and even if the bridge would be run by > a root login it still seems to not have cap_dac_read_search access ... > > https://git.defensec.nl/?p=dssp2.git;a=blob;f=policy/services/c/cockpit.cil;h=f09d5084ba0c9f1b671b26772b29eb383c40e60a;hb=HEAD#l95 > > Things may have changed since then as well. I just wanted to give a > heads-up, it may be nothing to worry about. > >> >> >>> Because otherwise you'll end up extending the login shell domain with >>> permissions needed by the bridge. You can still allow the bridge to open >>> up a shell with a transition back to the login shell domain (but then >>> you will get into domain prefixes >>> >>> ie: staff_bridge_t -> shell_exec_t -> staff_t vs. user_bridge_t -> >>> shell_exec_t -> user_t etc. >> >> >> Otherwise I only see some style cleanup needed.  Also there is an >> optional block in the admin interface for systemd calls.  Systemd is >> required for cockpit, so it shouldn't be optional, right? >>