xpra icon
Bug tracker and wiki

Opened 5 weeks ago

Last modified 5 weeks ago

#2307 assigned defect

paramiko does not support the new openssh key format

Reported by: Antoine Martin Owned by: Antoine Martin
Priority: critical Milestone: 3.0
Component: network Version: 2.5.x
Keywords: Cc:

Description

It reports:

$ python -c "from paramiko import RSAKey;RSAKey.from_private_key_file('./test.rsa')"
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/usr/lib/python2.7/site-packages/paramiko/pkey.py", line 206, in from_private_key_file
    key = cls(filename=filename, password=password)
  File "/usr/lib/python2.7/site-packages/paramiko/rsakey.py", line 55, in __init__
    self._from_private_key_file(filename, password)
  File "/usr/lib/python2.7/site-packages/paramiko/rsakey.py", line 175, in _from_private_key_file
    data = self._read_private_key_file("RSA", filename, password)
  File "/usr/lib/python2.7/site-packages/paramiko/pkey.py", line 279, in _read_private_key_file
    data = self._read_private_key(tag, f, password)
  File "/usr/lib/python2.7/site-packages/paramiko/pkey.py", line 289, in _read_private_key
    raise SSHException("not a valid " + tag + " private key file")
paramiko.ssh_exception.SSHException: not a valid RSA private key file

With a key file generated using a recent ssh-keygen, the file looks like this:

-----BEGIN OPENSSH PRIVATE KEY-----
(key data)
-----END OPENSSH PRIVATE KEY-----

Instead of the older pem format:

-----BEGIN RSA PRIVATE KEY-----
Proc-Type: 4,ENCRYPTED
DEK-Info: DES-EDE3-CBC,48F3BB90CF126AB9

(key data)
-----END RSA PRIVATE KEY-----

And so the connection fails with the message: not a valid RSA private key file.
r22779 improves things and will continue and try other keyfiles, password auth, etc but this doesn't help loading this new key format.

Change History (1)

comment:1 Changed 5 weeks ago by Antoine Martin

Status: newassigned
Summary: paramiko does not support openssh's new key formatparamiko does not support the new openssh key format

We need paramiko to add support for loading this new type of keyfile: Support for the new OpenSSH format and add support for new OpenSSH private key format. (no working implementation in those tickets at time of writing)
See SSH key generated by ssh-keygen is not recognized by Paramiko.

Pointers:

Related code updates:

  • r22783 will print a warning when we find a key using the unsupported "new openssh format"
  • r22784 tries to support more private key formats
Note: See TracTickets for help on using tickets.