Skip to content

Commit deb8712

Browse files
packaging: Require Paramiko 4+ for SSH tunneling (#582)
Signed-off-by: Edgar Ramírez Mondragón <[email protected]>
1 parent 15014ed commit deb8712

File tree

3 files changed

+24
-11
lines changed

3 files changed

+24
-11
lines changed

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ classifiers = [
2727
"Programming Language :: Python :: Implementation :: CPython",
2828
]
2929
dependencies = [
30-
"paramiko>=3,<4",
30+
"paramiko>=4",
3131
"psycopg[binary]==3.2.10",
3232
"psycopg2-binary==2.9.10",
3333
"sqlalchemy~=2.0",

target_postgres/connector.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -943,8 +943,8 @@ def filepath_or_certificate(
943943
def guess_key_type(self, key_data: str) -> paramiko.PKey:
944944
"""Guess the type of the private key.
945945
946-
We are duplicating some logic from the ssh_tunnel package here,
947-
we could try to use their function instead.
946+
Note: DSS keys are not supported as they were removed in paramiko 4.0
947+
due to being cryptographically weak.
948948
949949
Args:
950950
key_data: The private key data to guess the type of.
@@ -957,7 +957,6 @@ def guess_key_type(self, key_data: str) -> paramiko.PKey:
957957
"""
958958
for key_class in (
959959
paramiko.RSAKey,
960-
paramiko.DSSKey,
961960
paramiko.ECDSAKey,
962961
paramiko.Ed25519Key,
963962
):
@@ -968,7 +967,11 @@ def guess_key_type(self, key_data: str) -> paramiko.PKey:
968967
else:
969968
return key
970969

971-
errmsg = "Could not determine the key type."
970+
errmsg = (
971+
"Could not determine the key type. "
972+
"Supported types: RSA, ECDSA, Ed25519. "
973+
"Note: DSS keys are no longer supported."
974+
)
972975
raise ValueError(errmsg)
973976

974977
def clean_up(self) -> None:

uv.lock

Lines changed: 16 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)