From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp11.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms5.migadu.com with LMTPS id QN5lF0pdLWPmRAAAbAwnHQ (envelope-from ) for ; Fri, 23 Sep 2022 09:16:26 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp11.migadu.com with LMTPS id iN14F0pdLWPdXQEA9RJhRA (envelope-from ) for ; Fri, 23 Sep 2022 09:16:26 +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 F2F823E177 for ; Fri, 23 Sep 2022 09:16:25 +0200 (CEST) Received: from localhost ([::1]:48808 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1obcvB-0007eE-3r for larch@yhetil.org; Fri, 23 Sep 2022 03:16:25 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:53058) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1obcu6-0007d2-3y for bug-guix@gnu.org; Fri, 23 Sep 2022 03:15:18 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:40165) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1obctq-0006p1-BY for bug-guix@gnu.org; Fri, 23 Sep 2022 03:15:11 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1obctp-0002PD-R3 for bug-guix@gnu.org; Fri, 23 Sep 2022 03:15:01 -0400 X-Loop: help-debbugs@gnu.org Subject: bug#57217: home-openssh-service-type creates .ssh/config with wrong permissions Resent-From: Ludovic =?UTF-8?Q?Court=C3=A8s?= Original-Sender: "Debbugs-submit" Resent-CC: bug-guix@gnu.org Resent-Date: Fri, 23 Sep 2022 07:15:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 57217 X-GNU-PR-Package: guix X-GNU-PR-Keywords: To: Elias Kueny Cc: 57217@debbugs.gnu.org Received: via spool by 57217-submit@debbugs.gnu.org id=B57217.16639172529166 (code B ref 57217); Fri, 23 Sep 2022 07:15:01 +0000 Received: (at 57217) by debbugs.gnu.org; 23 Sep 2022 07:14:12 +0000 Received: from localhost ([127.0.0.1]:39241 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1obct0-0002Nk-BJ for submit@debbugs.gnu.org; Fri, 23 Sep 2022 03:14:12 -0400 Received: from eggs.gnu.org ([209.51.188.92]:42546) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1obcsv-0002N5-4K for 57217@debbugs.gnu.org; Fri, 23 Sep 2022 03:14:09 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:39036) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1obcsp-0006gz-T7; Fri, 23 Sep 2022 03:13:59 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:In-Reply-To:Date:References:Subject:To: From; bh=tUu9SBVEUVCyTQZdxy61WlNReeLWbj6bcWK+EhT/ynQ=; b=jGqhft35SnXWAQ5OKvPR tPeHUuQUJuwgdVdNtaZdYbHp9PIgoa6h0Use2p3XT6msOTm28O4Teoxdv5plQmavOzgAnigR0L+tN 6f9y2DVDcTHDrtYeQEITHL2zB7/+XHjwmYyHa1hGm59rNDnI8tt1JYGWezrz88STRfBdedcwmLLso 2A361iWibRf8aRQqXQklFL5BMr/8bofrPE0n4evG1CWlcVEeqAz2FnRFkLitymyaR9zzmki7teVMH gPuYmq/mck1FaS1pWjedBWpxB/zTbyvcADpEhvhZ63LKHkVrF1fweahWtUfywnsNcSZH77qdPTSs/ 2Iv9Jtq/IRf4xg==; Received: from [89.207.171.75] (port=32996 helo=ribbon) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1obcso-0007jK-5B; Fri, 23 Sep 2022 03:13:59 -0400 From: Ludovic =?UTF-8?Q?Court=C3=A8s?= References: <877d3ais5w.fsf@posteo.net> Date: Fri, 23 Sep 2022 09:13:47 +0200 In-Reply-To: <877d3ais5w.fsf@posteo.net> (Elias Kueny's message of "Sun, 14 Aug 2022 18:04:14 +0000") Message-ID: <8735ciftqs.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.1 (gnu/linux) 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" 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=1663917386; 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-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=tUu9SBVEUVCyTQZdxy61WlNReeLWbj6bcWK+EhT/ynQ=; b=X1o42pqrlqLAsei8dNWaIWOkeBzyn7TjrexLyqRqfl49CbIH1m2pJhjFhB9d4WAxMIVQrz 55TbsiT4eBt3a2PDEt/xWtfCYl8zfxRqTK/X4Us4W/o622qXWbTirtTROiDa/1aVNSAgFi RCzeugt58GPI3Tz7XNUd0uXPfUhgR0hZyAxMbTxt38t7rIJeOLDa4vIM+Nu1RVQnu6+SqE yo3iDNXEo+JY5M0rYQK7dZmKmFljdmw8QJIyRimhnNn5TKGpOfbVCzjeITR6Mg4+M7nDEm y4iNl7KbTZXWLDEBxf45oXWEkh/GXpH9laTYEFFCdkA/bUcFOxKEoatP5XFYMQ== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1663917386; a=rsa-sha256; cv=none; b=q7LQ7pZXuZIsFlZyAhGQ1abBRnPH9iby/OwApkwswA/I8oqfCVrBQZgwV0xywaiVyoaHCp Uz3f5X5mPnjBHuFhfZ+2WJAm+ZpPQIBLCLI5dSaab03PcGkEY+22rT5TqDMsszUzdUOhbo hDZbMD/p8+WHgcR9IfO25HqzsARNl/zd5CaYXeDVIosxoZ0eaTYWFbXZmFVYsBi1hgHrzW 3IqRP5vvS2U91Ry9txHhOX/VVteJtw8TVNogXIaUiCGdkHjsp28/QkS6I3CebYeXvzkZQN N5585qeD0RIjjeihsbHOQ1ycDB788BZZsEMzENGjqhaRvsH48PkCg/KIENxbdA== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gnu.org header.s=fencepost-gnu-org header.b=jGqhft35; dmarc=pass (policy=none) header.from=gnu.org; 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" X-Migadu-Spam-Score: -1.05 Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gnu.org header.s=fencepost-gnu-org header.b=jGqhft35; dmarc=pass (policy=none) header.from=gnu.org; 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" X-Migadu-Queue-Id: F2F823E177 X-Spam-Score: -1.05 X-Migadu-Scanner: scn0.migadu.com X-TUID: zbij3Wz5ibpH Hi Elias, Elias Kueny skribis: > The files are created with too open permissions, so ssh refuses to run: > > $ ssh xxx > Bad owner or permissions on ~/.ssh/config > > $ ls -l .ssh > lrwxrwxrwx 1 user users 59 Aug 14 18:17 authorized_keys -> /gnu/store/y8= g2d9kmlrhfna23r26cfgp5mr1sxl72-authorized_keys > lrwxrwxrwx 1 user users 52 Aug 14 18:17 config -> /gnu/store/dnnzwrz4hp= 1z6wnr76a6j57v95vyrbf3-ssh.conf Here=E2=80=99s what I see in a container: --8<---------------cut here---------------start------------->8--- $ ls -ld .ssh drwx------ 2 ludo users 80 Sep 23 06:39 .ssh/ $ ls -l .ssh/config lrwxrwxrwx 1 ludo users 52 Sep 23 06:39 .ssh/config -> /gnu/store/5lksmnx3m= lyinlja2lhd84p0jkp06bg5-ssh.conf $ ls -l $(readlink .ssh/config) -r--r--r-- 1 65534 overflow 6219 Jan 1 1970 /gnu/store/5lksmnx3mlyinlja2l= hd84p0jkp06bg5-ssh.conf --8<---------------cut here---------------end--------------->8--- The relevant check in OpenSSH is this: --8<---------------cut here---------------start------------->8--- if (fstat(fileno(f), &sb) =3D=3D -1) fatal("fstat %s: %s", filename, strerror(errno)); if (((sb.st_uid !=3D 0 && sb.st_uid !=3D getuid()) || (sb.st_mode & 022) !=3D 0)) fatal("Bad owner or permissions on %s", filename); --8<---------------cut here---------------end--------------->8--- That is, if ~/.ssh/config is owned by root, it=E2=80=99s fine; and this is exactly what happens outside the container: --8<---------------cut here---------------start------------->8--- $ ls -l $(readlink ~/.ssh/config) -r--r--r-- 1 root root 6219 Jan 1 1970 /gnu/store/5lksmnx3mlyinlja2lhd84p= 0jkp06bg5-ssh.conf --8<---------------cut here---------------end--------------->8--- So =E2=80=98ssh=E2=80=99 works fine outside the container, but not inside. To address the issue at hand, we would need to map UID 0 of the host as UID 0 of the guest, but I=E2=80=99m not sure this can be done. To be continued=E2=80=A6 Ludo=E2=80=99.