paramiko.ssh_exception.SSHException: encountered RSA key, expected OPENSSH key

Author: sdarwinCreated Nov 7, 2023Updated May 31, 2024

Ubuntu 22.04 , Python 3.10

Per issue 235, I upgraded paramiko:

paramiko     3.3.1

(that version of paramiko might or might not be connected to the problem.)

bees up worked. Now at bees attack it shows

paramiko.ssh_exception.SSHException: encountered RSA key, expected OPENSSH key

The key is located in /root/.ssh/mykey.pem

-----BEGIN RSA PRIVATE KEY-----
MIIEpQIBAAKCAQEAjTPorngh1kjfjBvK5XkN5zuCbPwhB73Toz2aGvK++x9Ev4it
...
...
-----END RSA PRIVATE KEY-----

Permissions are:

ls -al /root/.ssh
total 20
drwx------ 2 root root 4096 Nov  7 20:56 .
drwx------ 1 root root 4096 Nov  7 20:55 ..
-rw------- 1 root root 1956 Nov  7 20:56 known_hosts
-rw------- 1 root root 1679 Nov  7 20:10 mykey.pem

If I manually use the key to ssh to a bee, that is alright:

ssh -i /root/.ssh/mykey.pem ubuntu@IP

Any ideas about this particular error?

paramiko.ssh_exception.SSHException: encountered RSA key, expected OPENSSH key

Source: newsapps/beeswithmachineguns