From mboxrd@z Thu Jan 1 00:00:00 1970 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 Subject: [bug#38478] [PATCH 2/4] ssh: Always authenticate the server [security fix]. Resent-Message-ID: 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> In-Reply-To: <20191203211557.21145-1-ludo@gnu.org> References: <20191203211557.21145-1-ludo@gnu.org> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+kyle=kyleam.com@gnu.org Sender: "Guix-patches" To: 38478@debbugs.gnu.org Cc: Ludovic =?UTF-8?Q?Court=C3=A8s?= 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 -- 2.24.0