Skip to content

Commit

Permalink
Merge pull request #30 from mykola-panoply/ssh-fix
Browse files Browse the repository at this point in the history
Added support of Ed25519Key and password-protected keys.
  • Loading branch information
Mykola authored May 18, 2021
2 parents f953af4 + b999214 commit 8d14b90
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
2 changes: 1 addition & 1 deletion panoply/constants.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
__version__ = "2.0.4"
__version__ = "2.0.5"
__package_name__ = "panoply-python-sdk"
9 changes: 7 additions & 2 deletions panoply/ssh.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
Module for storing SSH related stuff
"""
from typing import Dict
from paramiko import RSAKey
from paramiko import RSAKey, Ed25519Key, SSHException
from sshtunnel import SSHTunnelForwarder
from io import StringIO

Expand Down Expand Up @@ -132,7 +132,12 @@ def _get_server(self, platform_ssh: bool):
if platform_ssh:
return None

pkey = RSAKey.from_private_key(StringIO(self.tunnel["privateKey"]))
try:
pkey = RSAKey.from_private_key(StringIO(self.tunnel["privateKey"]),
password=self.tunnel.get("password"))
except SSHException:
pkey = Ed25519Key.from_private_key(StringIO(self.tunnel["privateKey"]),
password=self.tunnel.get("password"))

server = SSHTunnelForwarder(
ssh_address_or_host=(self.tunnel["host"], self.tunnel["port"]),
Expand Down

0 comments on commit 8d14b90

Please sign in to comment.