mirror of https://github.com/jumpserver/jumpserver
fix: 修复非 ssh 协议的系统用户存在错误私钥,引发的解析问题
parent
8979228e0b
commit
f7f9fb1bdf
|
@ -63,6 +63,7 @@ class AuthMixin:
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def ssh_key_fingerprint(self):
|
def ssh_key_fingerprint(self):
|
||||||
|
public_key = None
|
||||||
if self.public_key:
|
if self.public_key:
|
||||||
public_key = self.public_key
|
public_key = self.public_key
|
||||||
elif self.private_key:
|
elif self.private_key:
|
||||||
|
@ -70,9 +71,8 @@ class AuthMixin:
|
||||||
public_key = parse_ssh_public_key_str(self.private_key, password=self.password)
|
public_key = parse_ssh_public_key_str(self.private_key, password=self.password)
|
||||||
except IOError as e:
|
except IOError as e:
|
||||||
return str(e)
|
return str(e)
|
||||||
else:
|
if not public_key:
|
||||||
return ''
|
return ''
|
||||||
|
|
||||||
public_key_obj = sshpubkeys.SSHKey(public_key)
|
public_key_obj = sshpubkeys.SSHKey(public_key)
|
||||||
fingerprint = public_key_obj.hash_md5()
|
fingerprint = public_key_obj.hash_md5()
|
||||||
return fingerprint
|
return fingerprint
|
||||||
|
|
Loading…
Reference in New Issue