From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp1.migadu.com ([2001:41d0:303:e224::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms13.migadu.com with LMTPS id ICnlCEnuMmdqtwAA62LTzQ:P1 (envelope-from ) for ; Tue, 12 Nov 2024 05:57:29 +0000 Received: from aspmx1.migadu.com ([2001:41d0:303:e224::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp1.migadu.com with LMTPS id ICnlCEnuMmdqtwAA62LTzQ (envelope-from ) for ; Tue, 12 Nov 2024 06:57:29 +0100 X-Envelope-To: larch@yhetil.org Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=debbugs.gnu.org header.s=debbugs-gnu-org header.b=SON93WB6; dkim=fail ("headers rsa verify failed") header.d=gmail.com header.s=20230601 header.b=mWJ22R9L; dmarc=fail reason="SPF not aligned (relaxed), DKIM not aligned (relaxed)" header.from=gmail.com (policy=none); spf=pass (aspmx1.migadu.com: domain of "bug-guix-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="bug-guix-bounces+larch=yhetil.org@gnu.org" ARC-Seal: i=1; s=key1; d=yhetil.org; t=1731391049; a=rsa-sha256; cv=none; b=PZu5/iTxDPOmKYJZhNbARM+8c4Dfp/MlFSnVigvP59flH/FISGFPvoeMp6NGRxBEV9hFrf Zsn5H5AhVEx4y/ye1OjNhj4mILC0w76RAZJGRz3oPVBNESahVJI9piCph6V3uHS8CbdoJ8 hLtrGdU4RU3c9phpqWxAnSUrWc4dw+oCjpJjCZa0jFnzJbi9qlRb0E/vnsyzt8uGvGQMBC RKRaF15AgI3pi+WiM3ckwHCDOxJ9/OWnVaUJ6eBsNRue7vxkoFHTDlRkVmAHJeahOTNBDS DmplCwDcqEtGMoG/7zTuzYQi2iazoJn7+ec423F5C4NvZI/35S6t6JH5eZhy2w== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=debbugs.gnu.org header.s=debbugs-gnu-org header.b=SON93WB6; dkim=fail ("headers rsa verify failed") header.d=gmail.com header.s=20230601 header.b=mWJ22R9L; dmarc=fail reason="SPF not aligned (relaxed), DKIM not aligned (relaxed)" header.from=gmail.com (policy=none); spf=pass (aspmx1.migadu.com: domain of "bug-guix-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="bug-guix-bounces+larch=yhetil.org@gnu.org" ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1731391049; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding:resent-to: resent-from:resent-sender:resent-message-id:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=HrqNdHSGgeFbLNrEo9UpQUpC54aqOzTHlXWnxTPMqRE=; b=Mo0ASV3DpTBaU0DmGFwxaif6jsH6GkwKpLrFz/VjFT0vgj142tNldmA0to8ih356OdBkef KrV2T8Djd2Mp00bWT8DyAaj0BMoFZcUuEX5OKQcvy6IlUYlZT/QV7XLzVzBhwdJBNndFY2 IiifLZvBuy/L8bXLQp3rgYOWroR5RaYFmyI9MGpSB0dPRfMt/lTDsCbQqVeWdTExPRclUj 4Wz/sjsJ99p2+v7p6+V9Unl2GWA0T8LbwZrmGksuRiN1d3TmJDCyHVDOvgjzCzkI28GwlN X98Azf8lim/8K+A0j5Ice1StB0sqGC1wDWS1cG7j6pLE6vQZ0p4IKdYdq9DKBQ== Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id A028464EFD for ; Tue, 12 Nov 2024 06:57:28 +0100 (CET) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tAjtg-0001Q8-P5; Tue, 12 Nov 2024 00:57:04 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tAjte-0001Pn-SK for bug-guix@gnu.org; Tue, 12 Nov 2024 00:57:02 -0500 Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tAjte-0007Gp-JG for bug-guix@gnu.org; Tue, 12 Nov 2024 00:57:02 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=MIME-Version:Date:References:In-Reply-To:From:To:Subject; bh=HrqNdHSGgeFbLNrEo9UpQUpC54aqOzTHlXWnxTPMqRE=; b=SON93WB6wQmWc4aURIWTmqYjMen1Rp/VzuFjdKlKGOqVFqflrDWSLHnIsdwWFlHy2lwI83QF5VPmlD6wnT0YRdVZDazMX3FZitVNO4gvQD5Thn50QQTQetl/ptzsOZhqNuiWhk+QhW28lrIELEP/dAQny46sEEZjBUff0+Q/yxzweKSFB9Q/ebvV0PlRmorbzITFNrqPvLCELMdZxqGKVq00Sdd8KOk7wF7t0e9eNfocrZABFpm94vJfTVbzvUW5Qp5AbJiNEagcf3kT8DEOHSxDjXROA5VgH3Eg9EUq/uFpNKxnjKIVwjHVc1wGTqkgxOYSXxmcXFoChjhpT6YSng==; Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1tAjte-0003Xl-7c for bug-guix@gnu.org; Tue, 12 Nov 2024 00:57:02 -0500 Subject: bug#60890: least-authority-wrapper and make-forkexec-constructor composition problem Resent-From: Maxim Cournoyer Original-Sender: "Debbugs-submit" Resent-To: bug-guix@gnu.org Resent-Date: Tue, 12 Nov 2024 05:57:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: cc-closed 60890 X-GNU-PR-Package: guix X-GNU-PR-Keywords: To: Ludovic =?UTF-8?Q?Court=C3=A8s?= Cc: 60890-done@debbugs.gnu.org Mail-Followup-To: 60890@debbugs.gnu.org, maxim.cournoyer@gmail.com, maxim.cournoyer@gmail.com Received: via spool by 60890-done@debbugs.gnu.org id=D60890.173139097413541 (code D ref 60890); Tue, 12 Nov 2024 05:57:01 +0000 Received: (at 60890-done) by debbugs.gnu.org; 12 Nov 2024 05:56:14 +0000 Received: from localhost ([127.0.0.1]:60161 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tAjss-0003WL-AV for submit@debbugs.gnu.org; Tue, 12 Nov 2024 00:56:14 -0500 Received: from mail-pl1-f177.google.com ([209.85.214.177]:53626) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tAjsp-0003W1-BF for 60890-done@debbugs.gnu.org; Tue, 12 Nov 2024 00:56:12 -0500 Received: by mail-pl1-f177.google.com with SMTP id d9443c01a7336-21116b187c4so41267195ad.3 for <60890-done@debbugs.gnu.org>; Mon, 11 Nov 2024 21:56:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1731390904; x=1731995704; darn=debbugs.gnu.org; h=content-transfer-encoding:mime-version:user-agent:message-id:date :references:in-reply-to:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=HrqNdHSGgeFbLNrEo9UpQUpC54aqOzTHlXWnxTPMqRE=; b=mWJ22R9LBmNNULW2Kj45s5VZsWFxPhCoy2WkFYqROJ3/GJZ4bzxtuhz0/q+v/LinPA /GgtYtNfCuGNkKlzgE+o2Su6de9jbf8vNS7/cs7rhR81av8EbHD0mIFiWP9AKiiFDU5s O18HXbIiDykhpYY5SWrge6GaZpSsJi7R33taNRflIk2W6h80U7jiML1wcPILoc5UEHcH ZojKFxnnWdA1PNwQLBYSCNcK1jV40UHDdJ/OIFbsV8vy7ZiIL3WUUUijjvjkIQHHXF8z CVvH+YZ3VrzCdfH4N4weeZ5ZCw+ZLRoYIkqx3wf3CWgOaDOK+iLJAItlDnXeUpsbk4cv KA7g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1731390904; x=1731995704; h=content-transfer-encoding:mime-version:user-agent:message-id:date :references:in-reply-to:subject:cc:to:from:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=HrqNdHSGgeFbLNrEo9UpQUpC54aqOzTHlXWnxTPMqRE=; b=IhvKQAZasNdhtIPoL7dPeIO0pL/dZYZfklEC79DqifDnucSJXxrZo2G9yU/VKRE4yI +R0UNcGnu8Gl7GgZXYf/t/bJ1X+3aoisSAEpLXbc9Kkol1NLxT8oCBSqcFNso1ZhaXaT VpyyugEzILvi97/pmVaBBozH72bO2cd26Tt04nWDCYnQrvfE+K4x5xSs5jcqtl2V+pE0 ue6pTVPQ0R8tmFrdrnRxLg4VC+8BsTLcFPVAX5o0gQA22PllZuAKoD9L6OGkOuqu6VAB Mws92uYtAd2v/ddLPAno8/37Vh+TNLbVB88dXkVVB121bvksW0UCgPGRLucJBe1bSnA4 FFnQ== X-Gm-Message-State: AOJu0YwyzOa8MZwE5Ujw4H42yn+jgBTmLSPnmYPb6vc5RyF6KL36T607 +3QyMjdRbVW0ZJA3uiBfWxs0I2bN0A08hcHHOtMqDnhypU9ykyqZnKHJeZ71 X-Google-Smtp-Source: AGHT+IFo+uYkzO4t0icNG4rBk7jhkt/mqZgHbHokfoa1cUnVWXvJMlsQGwSQl5VVAZMu50nkY++cNw== X-Received: by 2002:a17:902:e5d2:b0:20b:b21e:db21 with SMTP id d9443c01a7336-21183e47713mr215703525ad.47.1731390904518; Mon, 11 Nov 2024 21:55:04 -0800 (PST) Received: from terra ([2405:6586:be0:0:c8ff:1707:9b9:af89]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-21177dde6basm86305385ad.82.2024.11.11.21.55.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 Nov 2024 21:55:03 -0800 (PST) From: Maxim Cournoyer In-Reply-To: <87lelxcofy.fsf@gmail.com> (Maxim Cournoyer's message of "Fri, 20 Jan 2023 08:42:25 -0500") References: <87zgahyn5w.fsf@gmail.com> <87pmba8nhp.fsf@gnu.org> <87lelxcofy.fsf@gmail.com> Date: Tue, 12 Nov 2024 14:54:57 +0900 Message-ID: <877c99809a.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-guix@gnu.org List-Id: Bug reports for GNU Guix List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-guix-bounces+larch=yhetil.org@gnu.org Sender: bug-guix-bounces+larch=yhetil.org@gnu.org X-Migadu-Flow: FLOW_IN X-Migadu-Country: US X-Migadu-Spam-Score: -1.31 X-Spam-Score: -1.31 X-Migadu-Queue-Id: A028464EFD X-Migadu-Scanner: mx12.migadu.com X-TUID: h9vmVg2wIK6M Hello, Maxim Cournoyer writes: > Hi, > > Ludovic Court=C3=A8s writes: > >> Hello! >> >> Maxim Cournoyer skribis: >> >>> It was found that using something like: >>> >>> (make-forkexec-constructor >>> (least-authority >>> (list (file-append coreutils "/bin/true")) >>> (mappings (delq 'user %namespaces)) >>> #:user "nobody" >>> #:group "nobody")) >>> >>> Would fail with EPERM, because in order to be able to drop the user >>> namespace, the CAP_SYS_ADMIN capability is required, but in the above >>> case, make-forkexec-constructor has already changed the user to >>> "nobody", which lacks such capability. >> >> Thanks for the reminder! >> >> I guess the problem is limited to cases where you need the program to >> run in the global user namespace. > > Yes, it's limited to that case, because when clone(2) is called without > CLONE_NEWUSER, the child process does *not* start with a complete set of > capabilities (CAP_SYS_ADMIN), quoting my original investigation from > [0]: > >> The problem then seems to be that since we need CAP_SYS_ADMIN when >> dropping the user namespace, as CLONE_NEWUSER is what gives us >> superpowers. Per 'man user_namespaces': > >> The child process created by clone(2) with the CLONE_NEWUSER flag starts >> out with a complete set of capabilities in the new user namespace. > > [0] https://issues.guix.gnu.org/54786#16 I believe this issue was addressed in commits 7578c25b93 ("least-authority: Add support for changing UIDs/GIDs before exec.") and ca81317389 ("shepherd: Remove =E2=80=98make-forkexec-constructor/container= =E2=80=99."). Closing! --=20 Thanks, Maxim