This is an automated email from the ASF dual-hosted git repository.

elizabeth pushed a commit to branch elizabeth/test-ssh-key
in repository https://gitbox.apache.org/repos/asf/superset.git

commit d8dd14e94b89f8799281b7b07c5292f3d1c04c01
Author: Elizabeth Thompson <[email protected]>
AuthorDate: Thu Mar 13 13:43:08 2025 -0700

    use Ed25519Key
---
 superset/extensions/ssh.py | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/superset/extensions/ssh.py b/superset/extensions/ssh.py
index a3c015b9eb..148d3df8b4 100644
--- a/superset/extensions/ssh.py
+++ b/superset/extensions/ssh.py
@@ -21,7 +21,7 @@ from typing import TYPE_CHECKING
 
 import sshtunnel
 from flask import Flask
-from paramiko import RSAKey
+from paramiko import Ed25519Key, PKey, RSAKey
 
 from superset.databases.utils import make_url_safe
 from superset.utils.class_utils import load_class_from_name
@@ -68,9 +68,15 @@ class SSHManager:
             params["ssh_password"] = ssh_tunnel.password
         elif ssh_tunnel.private_key:
             private_key_file = StringIO(ssh_tunnel.private_key)
-            private_key = RSAKey.from_private_key(
-                private_key_file, ssh_tunnel.private_key_password
-            )
+            try:
+                private_key: PKey = RSAKey.from_private_key(
+                    private_key_file, ssh_tunnel.private_key_password
+                )
+            except Exception:
+                private_key_file.seek(0)
+                private_key = Ed25519Key.from_private_key(
+                    private_key_file, ssh_tunnel.private_key_password
+                )
             params["ssh_pkey"] = private_key
 
         return sshtunnel.open_tunnel(**params)

Reply via email to