Browse Source

fix: 修复自动生成公钥优先使用dss格式的问题(默认优先使用rsa)

pull/6105/head
Bai 4 years ago committed by Jiangjie.Bai
parent
commit
0ecd9fa32a
  1. 5
      apps/common/utils/encode.py

5
apps/common/utils/encode.py

@ -75,11 +75,16 @@ def ssh_key_string_to_obj(text, password=None):
key = paramiko.RSAKey.from_private_key(StringIO(text), password=password) key = paramiko.RSAKey.from_private_key(StringIO(text), password=password)
except paramiko.SSHException: except paramiko.SSHException:
pass pass
else:
return key
try: try:
key = paramiko.DSSKey.from_private_key(StringIO(text), password=password) key = paramiko.DSSKey.from_private_key(StringIO(text), password=password)
except paramiko.SSHException: except paramiko.SSHException:
pass pass
else:
return key
return key return key

Loading…
Cancel
Save