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.3 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=no 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 981D7C433ED for ; Mon, 26 Apr 2021 13:34:44 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 5134561157 for ; Mon, 26 Apr 2021 13:34:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233218AbhDZNfZ (ORCPT ); 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? >>