From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp12.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms5.migadu.com with LMTPS id CLyOFnFaYmJLzAAAbAwnHQ (envelope-from ) for ; Fri, 22 Apr 2022 09:34:09 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp12.migadu.com with LMTPS id 6CyEFnFaYmIW2gAAauVa8A (envelope-from ) for ; Fri, 22 Apr 2022 09:34:09 +0200 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 C778397FF for ; Fri, 22 Apr 2022 09:34:08 +0200 (CEST) Received: from localhost ([::1]:53110 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nhnnr-0002s0-SW for larch@yhetil.org; Fri, 22 Apr 2022 03:34:07 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:58390) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nhnnm-0002rq-IK for guix-patches@gnu.org; Fri, 22 Apr 2022 03:34:02 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:57487) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nhnnm-0004Z9-71 for guix-patches@gnu.org; Fri, 22 Apr 2022 03:34:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1nhnnm-0006MN-2y for guix-patches@gnu.org; Fri, 22 Apr 2022 03:34:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#55034] [PATCH 0/1] Let openssh trust /gnu/store Resent-From: Alexey Abramov Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Fri, 22 Apr 2022 07:34:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 55034 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: Tobias Geerinckx-Rice Cc: 55034@debbugs.gnu.org Received: via spool by 55034-submit@debbugs.gnu.org id=B55034.165061283824434 (code B ref 55034); Fri, 22 Apr 2022 07:34:02 +0000 Received: (at 55034) by debbugs.gnu.org; 22 Apr 2022 07:33:58 +0000 Received: from localhost ([127.0.0.1]:51384 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nhnni-0006M1-Ey for submit@debbugs.gnu.org; Fri, 22 Apr 2022 03:33:58 -0400 Received: from mail.mmer.org ([178.22.65.174]:42642) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nhnng-0006Li-Iy for 55034@debbugs.gnu.org; Fri, 22 Apr 2022 03:33:57 -0400 Received: from mail.mmer.org (localhost [127.0.0.1]) by mail.mmer.org (OpenSMTPD) with ESMTP id b2551833; Fri, 22 Apr 2022 07:33:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed; d=mmer.org; h=from:to:cc :subject:references:date:in-reply-to:message-id:mime-version :content-type; s=dkim; bh=OYXiKdzmjE+/+0f+uzfN21+8zhbt6FIdhZutes HIAM0=; b=PxhF15d2tajdJ/oDh6ivCqZCAA+D2sfBrY+0XEJi2vndUP8UGryeLw rbBl2Akd5XLmFbF7tJ6qmYIQ1WWPLK+6/MXjtpqelJsExXQc08wxP5ZTHwv77SMk 0CI9+G9lkQpqqGy3DoD4j5J6N7UTmZRUlgU0b+0qiOeWjH+uN2vXU= Received: from delta.lan (j74182.upc-j.chello.nl [24.132.74.182]) by mail.mmer.org (OpenSMTPD) with ESMTPSA id a5dca439 (TLSv1.3:AEAD-AES256-GCM-SHA384:256:NO); Fri, 22 Apr 2022 07:33:46 +0000 (UTC) References: <20220420084724.3514-1-levenson@mmer.org> <7684D647-31F8-4509-A18A-283DE789F0B3@tobias.gr> Date: Fri, 22 Apr 2022 09:33:45 +0200 In-Reply-To: <7684D647-31F8-4509-A18A-283DE789F0B3@tobias.gr> (Tobias Geerinckx-Rice's message of "Wed, 20 Apr 2022 10:17:16 +0000") Message-ID: <87mtgdinc6.fsf@delta.lan> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+larch=yhetil.org@gnu.org Sender: "Guix-patches" Reply-to: Alexey Abramov X-ACL-Warn: , Alexey Abramov via Guix-patches From: Alexey Abramov via Guix-patches via X-Migadu-Flow: FLOW_IN X-Migadu-To: larch@yhetil.org X-Migadu-Country: US ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1650612848; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:resent-cc: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=Vn9HvAmxVcb6oZZz0+PiF67DijLKQUrBn8/MKZWhyPE=; b=Q0bxf8r9jYIAGFCf9Z41b+UmmkiTiAYW9fwzAqQoxroQXMgRDsiXryZAev2IXY+4obfVLK UPMBn+2X9y3hLsHVpdquqPQuHVBKsvAAMxWV3r5VOIxX64t9/F0A6CASwq8aCJ+ytSaPDF 0tmHxHtOUSHPisk3JqnrrQvm9KXmMcxnvuVOPbk4Ud2F1cNVuFxZrnPgXNCqhi6ta+l4Uf jiWIixgsMNuubrijdcuzKkniBjETbQkexyXsY0iyFAMweNF5TDgc82oBtjbz3iH4J7SuGQ 4XUxmeEypUe74A4Z/0g6pi/uH5npq2rqT3/ICiNIHkCDePp9HcHmndFTs7vfIQ== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1650612848; a=rsa-sha256; cv=none; b=De/uqC+Li+UDyVxyyLv/rY4wHk4itoWetf6mVN3jQvyXDF2V+uzW81TZnFDEpdaggKll1F uT/SFQyYeKl4gysQRsd7R7oGRp0AiJoN1lEFpaTRtwh54sa3GgOTYtEEsNpb8HsPgF5tJh LIzz6ClTgB49eX6PwbSWiD+jJJiWi0m3HjqSepcmL3QTZPqSB2j7dt+yW82jwil4RSu/Yp 6uHPS2fCT1MyrAFj52tMpAowvuBKPTLOqIiQyWxGZcadOnpJxOxM4Sm6mDCnurzc1Hbvzk h6hd7P8Cd0Wlrq5tOyttR9FLt3LuuA5FGuaXhtVnwZgChmjfaZONyVySUaW21Q== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=mmer.org header.s=dkim header.b=PxhF15d2; dmarc=pass (policy=none) header.from=gnu.org; spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org" X-Migadu-Spam-Score: -4.63 Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=mmer.org header.s=dkim header.b=PxhF15d2; dmarc=pass (policy=none) header.from=gnu.org; spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org" X-Migadu-Queue-Id: C778397FF X-Spam-Score: -4.63 X-Migadu-Scanner: scn0.migadu.com X-TUID: GiQ0NS7rGMoA Hi Tobias, Thanks for the review. Tobias Geerinckx-Rice writes: [...] > The RO bind mount is not a hard guarantee, and a footgun protector > against accidental writes, not primarily a security feature (IMO). > > By design, *anyone* can write *anything* to the store by talking to > the daemon. They just can't choose the file name. A much weaker > guarantee than OpenSSH assumes, at the very least. Even though I knew how the daemon works, I find your explanation very nice and clear. Thank you. [...] > > Why is 'RO location' relevant here? > > If the snippet you quote above is complete, which requirement does the > un-bind-mounted store not meet? I can't think of one off the top o' > me head? Here is a comment from safe_path function --8<---------------cut here---------------start------------->8--- /* * Check a given path for security. This is defined as all components of * the path to the file must be owned by either the owner of of the file * or root and no directories must be group or world writable. * * XXX Should any specific check be done for sym links ? * * Takes a file name, its stat information (preferably from fstat() to * avoid races), the uid of the expected owner, their home directory and * an error buffer plus max size as arguments. * * Returns 0 on success and -1 on failure / --8<---------------cut here---------------end--------------->8--- I probably had to post it first, to avoid misunderstanding. sshd_config(5) is not that clear unfortunately. Due to group write permissions on the /gnu/store directory, safe_path doesn't allow openssh execute it. Couple of months ago I posted this problem on IRC, and you mentioned the read-only mount thingy. So I was trying to take advantage of that. What other options do I have? > That's a lot of trust. Tens of gigabytes on average. =) > We explicitly rejected that idea in IceCat for example, instead > whitelisting only specific store subdirectories. Why is OpenSSH > different? I didn't know that. I don't treat OpenSSH any different than other software either. Whitelist some specific directory is a really good option here, even though It introduces some secret knowledge. > The rationale and its assumptions (also) belong in the patch itself, > not just a separate mail. True. Let me put some more context on what I am trying to do. We have LDAP server which also holds users' ssh keys. I package a simple wrapper for LDAP search which returns them. I would like to use it with OpenSSH, however due to the way it checks executable in the configuration, I don't see the way to use it. I assume it is possible to copy that store object somewhere, but it doesn't look right to me. -- Alexey