Received: by 2002:ab2:6816:0:b0:1f9:5764:f03e with SMTP id t22csp1747932lqo; Sat, 18 May 2024 18:29:01 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXWDocNZe3+kNY/J4mNdvtaoxAmNDAAaZRW2lJWgNQZPnl1jxoYlSIVNtaRVuqAkVfKkYk01TZmIGqSFK2sFAM894QM3x9k/wRCm/fvnw== X-Google-Smtp-Source: AGHT+IGduTviJPglmXUbbR48KPXU1nc8JfBK0cCqx8YOTdHUjLLSmE6rNl3pIPZUidbVJkRmlS9w X-Received: by 2002:a05:6a00:845:b0:6f3:368d:6f64 with SMTP id d2e1a72fcca58-6f4e026b863mr34925541b3a.2.1716082141200; Sat, 18 May 2024 18:29:01 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1716082141; cv=pass; d=google.com; s=arc-20160816; b=CANlxgQCUTKyb/BK+A4XsbyrPcA5N70EFIQgtbt7e0FajgwKH3J8Tvm3PG3RuK5buw E5BkAdtqan062RGSrBJ8xr0fAhCqmryYLk5re8WHBRRuMgXhnguPamMDeDt/ZxWRbrvV V3D391gWJ/7X5JPI9f8feMCjCdQ8QT8TLPBUIytLcMEyGxorUtZcP94PCWVYMP0sVHS+ 7l4cR6Cgg1xTlseWDKcVwaZ9hCFz+aTETpMbK90nF5Z4ZJUrOH4OXeFcEnQjMabUhG97 aHaZ6REqvUdTHO0Bk2+y/w5JR6DzCE1ZVMnu3lBqwJ4loxQGe3uY4myVMwPrF3cazpic RKZA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:feedback-id:dkim-signature:dkim-signature; bh=okNdeP1Ev4hSO4ZAkeKtTmX/46s631+dJ7jzdCCcfBw=; fh=aYHgdWDhzP1lnx+FsrEt6dDNN4N37HbmQdKRiYMnEi0=; b=eZHt5KTWml0a2LynfJyKZIavqqIRs7f3CBZMMpsJJRfluKW32eG6CAQvRTVytWJmg9 Ih44ZkTtuKBA3+xkXo5s0jpocvi10KC6qR7aJ47tOpVpqXz28rkzP9k0oDydXIRSIOgE y+aC6L9q9heaOP/Mg8ivT/B9bf0o29hWvwCwmbBiG3GnbbulnVVlPqXTxZZelfPkwlE8 S0jhlUFeNFY+P0060dNucFjAtoGwQu/9Wxz6miTLijMnvscKI577Z8mWlDeHPePLYIw4 XvJMvh5caVgm5eHLYjwKufz2kOwmx4AvDYe1x5ts7zQwG32RMLagGD9H+ZdAD4BCvBNN LJeQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@3xx0.net header.s=fm1 header.b=LBQjTwYS; dkim=pass header.i=@messagingengine.com header.s=i76614979.fm1 header.b=DWCOv+tG; arc=pass (i=1 spf=pass spfdomain=3xx0.net dkim=pass dkdomain=3xx0.net dkim=pass dkdomain=messagingengine.com dmarc=pass fromdomain=3xx0.net); spf=pass (google.com: domain of linux-kernel+bounces-183015-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-183015-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=3xx0.net Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id 41be03b00d2f7-63413d72a41si21806512a12.818.2024.05.18.18.29.00 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 18 May 2024 18:29:01 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-183015-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@3xx0.net header.s=fm1 header.b=LBQjTwYS; dkim=pass header.i=@messagingengine.com header.s=i76614979.fm1 header.b=DWCOv+tG; arc=pass (i=1 spf=pass spfdomain=3xx0.net dkim=pass dkdomain=3xx0.net dkim=pass dkdomain=messagingengine.com dmarc=pass fromdomain=3xx0.net); spf=pass (google.com: domain of linux-kernel+bounces-183015-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-183015-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=3xx0.net Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 2D14AB20FBB for ; Sun, 19 May 2024 01:28:55 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 680089450; Sun, 19 May 2024 01:28:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=3xx0.net header.i=@3xx0.net header.b="LBQjTwYS"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="DWCOv+tG" Received: from flow6-smtp.messagingengine.com (flow6-smtp.messagingengine.com [103.168.172.141]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7AAA839B; Sun, 19 May 2024 01:28:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=103.168.172.141 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716082121; cv=none; b=dhJXJtwRxX0PMqeehBIoikpEyygq6pUi+rRn3ztmsP6v/2swfBr8gY+IY60DN+YSgHUsC1m46ukzlPivoAi466YrqbpjEy7lghMt2Bi12egr7nZjrT3cjPZRwQVuQaIQAtDTK00t4DOIFMAeL45Os76czncyHsg8wZnVJpr5sk0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716082121; c=relaxed/simple; bh=cx8p0aOrLv2aKH95V35JoNaCc3yz4DZ2hH/JWbzkDI0=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=bdaLxY9oY2AOek0aJ1swgEbuTDmHpr2tuN24hihKZEYYKP/tuq5jaqAl9Ttf6aTc4Xdll7yyc+mx3ag3Ss9HAuEpwyAtW52UbrP64bTlMMzhgDxLF6mu0PKEB3V8cloofrMOLFfJABYtRKc81HAJUAnO92/G0QxQAWCVA9RdYM4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=3xx0.net; spf=pass smtp.mailfrom=3xx0.net; dkim=pass (2048-bit key) header.d=3xx0.net header.i=@3xx0.net header.b=LBQjTwYS; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b=DWCOv+tG; arc=none smtp.client-ip=103.168.172.141 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=3xx0.net Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=3xx0.net Received: from compute6.internal (compute6.nyi.internal [10.202.2.47]) by mailflow.nyi.internal (Postfix) with ESMTP id 9272720031D; Sat, 18 May 2024 21:28:38 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute6.internal (MEProxy); Sat, 18 May 2024 21:28:38 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=3xx0.net; h=cc :cc:content-type:content-type:date:date:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to:subject :subject:to:to; s=fm1; t=1716082118; x=1716085718; bh=okNdeP1Ev4 hSO4ZAkeKtTmX/46s631+dJ7jzdCCcfBw=; b=LBQjTwYSdvWxEy5IFww/witrrq f2zthnzYB98kLozA7r0nGJJPOqFkmd8+O7xTujRohXJkGn4QHL0//h0jom2SHrlT kGS1fzNhTrNVEG6QKmHyxgYxFGkTRX4LKmVILsXNsFPLbYQ8oL8klyfVE51GxFwH 91+VFOk8f8ChW5fgn1OCmRCnen6fzkCIWA3FMuGSCtOxpGNjL/nzDAmL7kM9eNCs lfwif7rtZayFkiEJbRUGwNdJU8vffhsUtYBG9wDUNVRA0t5kmRZmm7VhuD+LiUEt nvjA7AIKQ0qblHu/IHNcS1ui2BwYowDvaUVgJc3e/10jbXQTO8cer7m4Ls0g== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:content-type:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:subject:subject:to :to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= i76614979.fm1; t=1716082118; x=1716085718; bh=okNdeP1Ev4hSO4ZAke KtTmX/46s631+dJ7jzdCCcfBw=; b=DWCOv+tGUkL/OxqC8+UmzU3Ust/5P3jJ5O pC2Umtldj+oCgfK+mqPhvZF7koo5yAVhfwcHI6rB/MFVMzrsEzR7ttp5uZh3TKSq mpbaLGIWQ1awSobD1os4Uq32YCMe0PoqQg3EvHuhGEL6svO6KRFgveyDWaOLVj1c a0isprNF7bEtsUG9MMe5GtJU6OmFveZhpa7andcVpohFezE/n1zdonoEz8D7Mddw zIJdXlNw44MNv+uKiQ4WTNQseY51GPtgK+K6YeqP8lrnof33THj+4PGF5VHYyYKH 6sCw0w5s5l2PLeeNLkTXhiV7kSaWCUizJNr05LqHdJbEspxt7Njg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvledrvdehjedggeeiucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepfffhvfevuffkfhggtggujgesthdtsfdttddtjeenucfhrhhomheplfhonhgr thhhrghnucevrghlmhgvlhhsuceojhgtrghlmhgvlhhsseefgiigtddrnhgvtheqnecugg ftrfgrthhtvghrnhepkeekteegfefgvdefgfefffeufeffjedvudeijeehjeehffekjeek leffueelgffgnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrh homhepjhgtrghlmhgvlhhsseefgiigtddrnhgvth X-ME-Proxy: Feedback-ID: i76614979:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Sat, 18 May 2024 21:28:35 -0400 (EDT) Date: Sat, 18 May 2024 18:33:37 -0700 From: Jonathan Calmels To: John Johansen Cc: brauner@kernel.org, ebiederm@xmission.com, Luis Chamberlain , Kees Cook , Joel Granados , Serge Hallyn , Paul Moore , James Morris , David Howells , Jarkko Sakkinen , containers@lists.linux.dev, linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-security-module@vger.kernel.org, keyrings@vger.kernel.org Subject: Re: [PATCH 1/3] capabilities: user namespace capabilities Message-ID: References: <20240516092213.6799-1-jcalmels@3xx0.net> <20240516092213.6799-2-jcalmels@3xx0.net> <641a34bd-e702-4f02-968e-4f71e0957af1@canonical.com> <7f94cb03-d573-4cc5-b288-038e44bc1318@canonical.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <7f94cb03-d573-4cc5-b288-038e44bc1318@canonical.com> On Sat, May 18, 2024 at 05:27:27AM GMT, John Johansen wrote: > On 5/17/24 20:50, Jonathan Calmels wrote: > > As mentioned above, userspace doesn't necessarily have to change. I'm > > also not sure what you mean by easy to by-pass? If I mask off some > > capabilities system wide or in a given process tree, I know for a fact > > that no namespace will ever get those capabilities. > > so by-pass will very much depend on the system but from a distro pov > we pretty much have to have bwrap enabled if users want to use flatpaks > (and they do), same story for several other tools. Since this basically > means said tools need to be available by default, most systems the > distro is installed on are vulnerable by default. The trivial by-pass > then becomes the exploit running its payload through one of these tools, > and yes I have tested it. > > Could a distro disable these tools by default, and require the user/admin > to enable them, yes though there would be a lot of friction, push back, > and in the end most systems would still end up with them enabled. > > With the capibilities approach can a user/admin make their system > more secure than the current situation, absolutely. > > Note, that regardless of what happens with patch 1, and 2. I think we > either need the big sysctl toggle, or a version of your patch 3 Ah ok, I get you concerns. Unfortunately, I can't really speak for distros or tooling about how this gets leveraged. I've never claimed this was going to be bulletproof day 1. All I'm saying is that they now have the option to do so. As you pointed out, we're coming from a model where today it's open-bar. Only now they can put a bouncer in front of it, so to speak :) Regarding distros: Maybe they ship with an empty userns mask by default and admins have to tweak it, understanding full well the consequences of doing so. Maybe they ship with a conservative mask and use pam rules to adjust it. Maybe they introduce something like a wheel/sudo group that you need to be part of to gain extra privileges in your userns. Maybe only some system services (e.g. dockerd, lxd/incusd, machined) get confined. Maybe they need highly specific policies, and this is where you'll would want LSM support. Say an Apparmor profile targetting unshare(1) specifically. Regarding tools: Maybe bwrap has its own group you need to be part of to get full caps. Maybe docker uses this set behind `--cap-add` `--cap-drop`. Maybe lxd/incusd imlement ACL restricting who can do what. Maybe steam always drops everything it doesn't need, I'm sure this won't cover every single corner cases, but as stated in the headline, this is a start, a simple framework we can always extend if needed in the future.