Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp1553176rwd; Thu, 1 Jun 2023 18:12:05 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5fGSy0beaV6FwDzXSMv8qG22PgcmY42Ued7sFhmjf08UOssaSYqLhTTNmDTOmqhu5gq71X X-Received: by 2002:a17:902:f809:b0:1aa:e30e:29d3 with SMTP id ix9-20020a170902f80900b001aae30e29d3mr741788plb.29.1685668325011; Thu, 01 Jun 2023 18:12:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685668324; cv=none; d=google.com; s=arc-20160816; b=aGi4g+57ZCv7EWLaD3svfoPN8fxDE7pwtaWbvQFwHeUgYXCvQ6MWDw2tmCuqU1JkJb dPAz/bE2xsUCHxulbTbFnBYvJ/Wj9Cs1SY3ZupphUxh91xIoogU9YjBRKWVMPFrkLeWW jHkWZ3BU+lPoCaMXFU0gGEUvHRT9/k8ZQ4Rq0DaZ9UoOoeXGz20Xl1a0BpGYgvubV8KM /+34a8f3BG0xPQp4yuGCMlRpApqpzfVM7LkMxUZF+pTztdA3tQnoHYLBY4UX4H8wqDAS ZBJDDf89tGvGeWv4Bh0+dFkAtnOUVFQ4sc6//lI7AjAZ72BGNP3Xrs7q/ZaVZGT6b/zp vPEQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=9o3/2D9pqXQu0Kja08e1hU2rc3ztUxCY4Eps47VldFo=; b=KQqQZL0MJEhZf4RxvXliXu1aK++nK9Wzt2nCwcpFQ+AniZOqnuuKWZ+9LmnZxadZPY UT5iCxrfrNwDXt4MxxJEOb6FWD6qEoUnTRJvQHNReO6W/4daBEyGgW/3GsMwQQp3EIg9 ow2Gmk+BvuOrOX+WGqI8MNMkvsKCSjXEJll9ZbpD5p2mGJaie6duHssv53NOPCpbFecP e+4T3PZRRzdq8qbN1VOgwhPkPaFF7xyLLgP9gin8y/UvYMxlW1RW1kNFPqocZAGByOLu oMiKzr7xrF7pep3p55FD49F/IKST1VStivM0LJQb62YNcPnMalnH49G0oZhM5ug7BBoe Eu6g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@paul-moore.com header.s=google header.b=KNkEPCsb; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=paul-moore.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id b2-20020a170902650200b001aaf7a9d7aasi50730plk.126.2023.06.01.18.11.49; Thu, 01 Jun 2023 18:12:04 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@paul-moore.com header.s=google header.b=KNkEPCsb; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=paul-moore.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232724AbjFBBCQ (ORCPT + 99 others); Thu, 1 Jun 2023 21:02:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37392 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229689AbjFBBCO (ORCPT ); Thu, 1 Jun 2023 21:02:14 -0400 Received: from mail-oa1-x31.google.com (mail-oa1-x31.google.com [IPv6:2001:4860:4864:20::31]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2FEAF19F for ; Thu, 1 Jun 2023 18:02:07 -0700 (PDT) Received: by mail-oa1-x31.google.com with SMTP id 586e51a60fabf-19a13476ffeso1717964fac.0 for ; Thu, 01 Jun 2023 18:02:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=paul-moore.com; s=google; t=1685667726; x=1688259726; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=9o3/2D9pqXQu0Kja08e1hU2rc3ztUxCY4Eps47VldFo=; b=KNkEPCsbkJxvJYdvTrUPo8kiFxyN3E0oTIVRNgXzBZ+/0ECQSM+jKwqtWrysFcjw6a DZyYom+T006pCCnXmWAqmmb2A5pJTinU18kAUM5QVhz+0QwucHpSGiqUt7p4K5CTp65m 4/0oyu60fV247yyWntwJKLXfavATpkxPNIOeA9vbm7Wxr6sVcttB9XTUAb9aZebN9FK3 Y8G09YaYrtHFLmhTVtOijFcYZkKUNBmR+hco1cQ/uP9eEQDxdmofwDaCkTgocKzFRW5Y ux4AIt4qlQGTwUnnRMG+GYwJ5Ssnwib6KYmA6fZphSCC2wT60LGkHKkIaq7Fn143dD5r X8qg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1685667726; x=1688259726; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=9o3/2D9pqXQu0Kja08e1hU2rc3ztUxCY4Eps47VldFo=; b=hTHrHKjFK+YIgK29VZyCmGJRfSRruiFO17f7GBBPZSwZVvserCaVJScsSfDWDevOSi tB7Zv+dPYOaeLx8vn9Bqqdtn0CcP32sEZlgOv/eF9ezlDzZYKo94ktWCmOUjDg/160Dq i4JBNRngw2JzXLZK85nNFn+6XhMD5sm8yhwKXVpl1WVypLajpVgTa8tAq+Ii+YnmwakB LKFsRcFjK6Zq88aVL2BqncLf2ieuo9MACg1J6OgFfFEmglvCC5HxSH/uLTVaKXdTJrU0 YekaUXfV+FRw5ocWNYjPhUFAK2cVF1VdkiYohIliEfa8rGTY6jm49nHMLSwGsOCIKzsV 8F2A== X-Gm-Message-State: AC+VfDysAIKSpliUB2ODfpovnSi6Tl1tTezx9NgP5uVlMEtYtI/r14BX KrdlTrnfcuYn9ZQ2XtVrcNOiO0+uH+wEJMVk6gZIiUO/6OyRk3A= X-Received: by 2002:a05:6870:3491:b0:19f:6711:8dfc with SMTP id n17-20020a056870349100b0019f67118dfcmr629339oah.31.1685667726423; Thu, 01 Jun 2023 18:02:06 -0700 (PDT) MIME-Version: 1.0 References: <168547265011.24337.4306067683997517082-0@git.sr.ht> <87fs7abu0f.fsf@email.froward.int.ebiederm.org> In-Reply-To: <87fs7abu0f.fsf@email.froward.int.ebiederm.org> From: Paul Moore Date: Thu, 1 Jun 2023 21:01:55 -0400 Message-ID: Subject: Re: [PATCH linux 0/3] [PATCH] userns: add sysctl "kernel.userns_group_range" To: "Eric W. Biederman" Cc: "~akihirosuda" , linux-kernel@vger.kernel.org, containers@lists.linux.dev, serge@hallyn.com, brauner@kernel.org, akihiro.suda.cz@hco.ntt.co.jp Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Jun 1, 2023 at 8:14=E2=80=AFPM Eric W. Biederman wrote: > Paul Moore writes: > > On Tue, May 30, 2023 at 2:50=E2=80=AFPM ~akihirosuda wrote: > >> > >> This sysctl limits groups who can create a new userns without > >> CAP_SYS_ADMIN in the current userns, so as to mitigate potential kerne= l > >> vulnerabilities around userns. > >> > >> The sysctl value format is same as "net.ipv4.ping_group_range". > >> > >> To disable creating new unprivileged userns, set the sysctl value to "= 1 > >> 0" in the initial userns. > >> > >> To allow everyone to create new userns, set the sysctl value to "0 > >> 4294967294". This is the default value. > >> > >> This sysctl replaces "kernel.unprivileged_userns_clone" that is found = in > >> Ubuntu [1] and Debian GNU/Linux. > >> > >> Link: https://git.launchpad.net/~ubuntu- > >> kernel/ubuntu/+source/linux/+git/jammy/commit?id=3D3422764 [1] > > > > Given the challenges around adding access controls to userns > > operations, have you considered using the LSM support that was added > > upstream last year? The relevant LSM hook can be found in commit > > 7cd4c5c2101c ("security, lsm: Introduce security_create_user_ns()"), > > Paul how have you handled the real world regression I reported against > chromium? I don't track chromium development. > Paul are you aware that the LSM hook can not be used to achieve the > objective of this patchset? /me shrugs I thought one could look into a cred struct using a BPF LSM, which would allow one to make access control decisions based on group ID, but I will be the first to admit I'm not a BPF LSM expert. Regardless, one could introduce a group ID check into a LSM if they were so inclined. I also find it slightly amusing that you are arguing against my reply that was discussing *not* adding another userns control point; of all people I thought you would be supportive of this ... /me shrugs again. > > and although only SELinux currently provides an access control > > implementation, there is no reason you couldn't add support for your > > favorite LSM, or even just a simple BPF LSM to enforce the group > > controls as you've described them here. > > Is there a publicly available SELinux policy that uses that LSM hook? I have no idea, I don't track all of the publicly available SELinux policies because frankly it doesn't matter; the SELinux feature exists, and it is my role to support and maintain it. There are LSM/SELinux features which are not widely exercised in general purpose SELinux policies for various reasons, but *are* used in specialized environments that are not often discussed on public mailing lists. --=20 paul-moore.com