From 0a2b405b6579053d2ac5a5b0de31a5c94bd4cd43 Mon Sep 17 00:00:00 2001 From: Antoine Martin Date: Sun, 15 Mar 2020 12:30:09 +0000 Subject: [PATCH] only log the key warning if we failed to load it git-svn-id: https://xpra.org/svn/Xpra/trunk@25648 3bb7dfac-3a0b-4e04-842a-767bc560f471 --- src/xpra/net/ssh.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/xpra/net/ssh.py b/src/xpra/net/ssh.py index 31b70b7d6e..01be962a3b 100644 --- a/src/xpra/net/ssh.py +++ b/src/xpra/net/ssh.py @@ -557,13 +557,6 @@ def auth_publickey(): log("no keyfile at '%s'", keyfile_path) continue log("trying '%s'", keyfile_path) - key_data = load_binary_file(keyfile_path) - if key_data and key_data.find(b"BEGIN OPENSSH PRIVATE KEY")>=0: - log.warn("Warning: private key '%s'", keyfile_path) - log.warn(" this file seems to be using OpenSSH's own format") - log.warn(" please convert it to something more standard (ie: PEM)") - log.warn(" so it can be used with the paramiko backend") - log.warn(" or switch to the OpenSSH backend with '--ssh=ssh'") key = None import paramiko for pkey_classname in ("RSA", "DSS", "ECDSA", "Ed25519"): @@ -590,6 +583,13 @@ def auth_publickey(): break except Exception as e: log("auth_publickey() loading as %s", pkey_classname, exc_info=True) + key_data = load_binary_file(keyfile_path) + if key_data and key_data.find(b"BEGIN OPENSSH PRIVATE KEY")>=0 and paramiko.__version__<"2.7": + log.warn("Warning: private key '%s'", keyfile_path) + log.warn(" this file seems to be using OpenSSH's own format") + log.warn(" please convert it to something more standard (ie: PEM)") + log.warn(" so it can be used with the paramiko backend") + log.warn(" or switch to the OpenSSH backend with '--ssh=ssh'") if key: log("auth_publickey using %s as %s: %s", keyfile_path, pkey_classname, keymd5(key)) try: