You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@superset.apache.org by hu...@apache.org on 2023/01/17 21:51:32 UTC
[superset] 01/01: setup wrapper
This is an automated email from the ASF dual-hosted git repository.
hugh pushed a commit to branch ssh-tunnel-rsa-wrap
in repository https://gitbox.apache.org/repos/asf/superset.git
commit 096610777ee2149dd5cfb6d7255780ed7c84d7c6
Author: hughhhh <hu...@gmail.com>
AuthorDate: Tue Jan 17 23:51:03 2023 +0200
setup wrapper
---
superset/extensions/ssh.py | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/superset/extensions/ssh.py b/superset/extensions/ssh.py
index 4ae8d508fc..caae3f12dd 100644
--- a/superset/extensions/ssh.py
+++ b/superset/extensions/ssh.py
@@ -16,9 +16,11 @@
# under the License.
import importlib
+from io import StringIO
from typing import TYPE_CHECKING
from flask import Flask
+from paramiko import RSAKey
from sshtunnel import open_tunnel, SSHTunnelForwarder
from superset.databases.utils import make_url_safe
@@ -59,7 +61,9 @@ class SSHManager:
if ssh_tunnel.password:
params["ssh_password"] = ssh_tunnel.password
elif ssh_tunnel.private_key:
- params["private_key"] = ssh_tunnel.private_key
+ private_key_file = StringIO(ssh_tunnel.private_key)
+ private_key = RSAKey.from_private_key(private_key_file)
+ params["private_key"] = private_key
params["private_key_password"] = ssh_tunnel.private_key_password
return open_tunnel(**params)