From patchwork Tue Dec 3 21:15:55 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Ludovic_Court=C3=A8s?= X-Patchwork-Id: 16363 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id 432D217835; Tue, 3 Dec 2019 21:44:39 +0000 (GMT) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTP id DD03C1782E for ; Tue, 3 Dec 2019 21:44:37 +0000 (GMT) Received: from localhost ([::1]:59150 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1icFyF-0004H4-EW for patchwork@mira.cbaines.net; Tue, 03 Dec 2019 16:44:36 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:39719) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1icFXg-0000ls-Is for guix-patches@gnu.org; Tue, 03 Dec 2019 16:17:09 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1icFXb-0002gQ-Dj for guix-patches@gnu.org; Tue, 03 Dec 2019 16:17:04 -0500 Received: from debbugs.gnu.org ([209.51.188.43]:35171) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1icFXb-0002g6-9U for guix-patches@gnu.org; Tue, 03 Dec 2019 16:17:03 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1icFXb-00075k-5U for guix-patches@gnu.org; Tue, 03 Dec 2019 16:17:03 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#38478] [PATCH 2/4] ssh: Always authenticate the server [security fix]. Resent-From: Ludovic =?utf-8?q?Court=C3=A8s?= Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Tue, 03 Dec 2019 21:17:03 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 38478 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 38478@debbugs.gnu.org Cc: Ludovic =?utf-8?q?Court=C3=A8s?= Received: via spool by 38478-submit@debbugs.gnu.org id=B38478.157540778727192 (code B ref 38478); Tue, 03 Dec 2019 21:17:03 +0000 Received: (at 38478) by debbugs.gnu.org; 3 Dec 2019 21:16:27 +0000 Received: from localhost ([127.0.0.1]:41140 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1icFX0-00074L-L6 for submit@debbugs.gnu.org; Tue, 03 Dec 2019 16:16:26 -0500 Received: from eggs.gnu.org ([209.51.188.92]:57906) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1icFWy-00073n-Fi for 38478@debbugs.gnu.org; Tue, 03 Dec 2019 16:16:25 -0500 Received: from fencepost.gnu.org ([2001:470:142:3::e]:36206) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1icFWo-0001Nv-19; Tue, 03 Dec 2019 16:16:17 -0500 Received: from [102.78.164.116] (port=18308 helo=gnu.org) by fencepost.gnu.org with esmtpsa (TLS1.2:DHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1icFWi-0001Km-OE; Tue, 03 Dec 2019 16:16:12 -0500 From: Ludovic =?utf-8?q?Court=C3=A8s?= Date: Tue, 3 Dec 2019 22:15:55 +0100 Message-Id: <20191203211557.21145-2-ludo@gnu.org> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20191203211557.21145-1-ludo@gnu.org> References: <20191203211557.21145-1-ludo@gnu.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.51.188.43 X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: "Guix-patches" X-getmail-retrieved-from-mailbox: Patches Until now, users of 'open-ssh-session', including "guix deploy" and "GUIX_DAEMON_SOCKET=ssh://…" (but not "guix offload"), would not authenticate the SSH server they're talking to. * guix/ssh.scm (open-ssh-session): Call 'authenticate-server'. --- guix/ssh.scm | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/guix/ssh.scm b/guix/ssh.scm index f34e71392b..519c723155 100644 --- a/guix/ssh.scm +++ b/guix/ssh.scm @@ -125,6 +125,17 @@ Throw an error on failure." (match (connect! session) ('ok + ;; Authenticate against ~/.ssh/known_hosts. + (match (authenticate-server session) + ('ok #f) + (reason + (raise (condition + (&message + (message (format #f (G_ "failed to authenticate \ +server at '~a': ~a") + (session-get session 'host) + reason))))))) + ;; Use public key authentication, via the SSH agent if it's available. (match (userauth-public-key/auto! session) ('success