Skip to content

Commit

Permalink
only log the key warning if we failed to load it
Browse files Browse the repository at this point in the history
git-svn-id: https://xpra.org/svn/Xpra/trunk@25648 3bb7dfac-3a0b-4e04-842a-767bc560f471
  • Loading branch information
totaam committed Mar 15, 2020
1 parent 2c090dd commit 0a2b405
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/xpra/net/ssh.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"):
Expand All @@ -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:
Expand Down

0 comments on commit 0a2b405

Please sign in to comment.