Эта проблема появляется в paramiko v2 (2.4.2), а не в paramiko v1 (1.18.5).
Ключи хранятся в файле known_hosts.
Я используюследующий код
import paramiko
ssh_client = paramiko.SSHClient()
ssh_client.load_system_host_keys()
ssh_client.connect(hostname='hostname', username='user', password='pass')
load_system_host_keys () завершается ошибкой, и я получаю эту трассировку:
Traceback (most recent call last):
File "/snap/pycharm-community/85/helpers/pydev/pydevd.py", line 1664, in <module>
main()
File "/snap/pycharm-community/85/helpers/pydev/pydevd.py", line 1658, in main
globals = debugger.run(setup['file'], None, None, is_module)
File "/snap/pycharm-community/85/helpers/pydev/pydevd.py", line 1068, in run
pydev_imports.execfile(file, globals, locals) # execute the script
File "/home/administrator/rs_autolabs/utils/test.py", line 9, in <module>
ssh_client.load_system_host_keys()
File "/usr/local/lib/python2.7/dist-packages/paramiko/client.py", line 104, in load_system_host_keys
self._system_host_keys.load(filename)
File "/usr/local/lib/python2.7/dist-packages/paramiko/hostkeys.py", line 97, in load
e = HostKeyEntry.from_line(line, lineno)
File "/usr/local/lib/python2.7/dist-packages/paramiko/hostkeys.py", line 356, in from_line
key = RSAKey(data=decodebytes(key))
File "/usr/local/lib/python2.7/dist-packages/paramiko/rsakey.py", line 69, in __init__
).public_key(default_backend())
File "/usr/local/lib/python2.7/dist-packages/cryptography/hazmat/backends/__init__.py", line 15, in default_backend
from cryptography.hazmat.backends.openssl.backend import backend
File "/usr/local/lib/python2.7/dist-packages/cryptography/hazmat/backends/openssl/__init__.py", line 7, in <module>
from cryptography.hazmat.backends.openssl.backend import backend
File "/usr/local/lib/python2.7/dist-packages/cryptography/hazmat/backends/openssl/backend.py", line 16, in <module>
from cryptography import utils, x509
File "/usr/local/lib/python2.7/dist-packages/cryptography/x509/__init__.py", line 8, in <module>
from cryptography.x509.base import (
File "/usr/local/lib/python2.7/dist-packages/cryptography/x509/base.py", line 16, in <module>
from cryptography.x509.extensions import Extension, ExtensionType
File "/usr/local/lib/python2.7/dist-packages/cryptography/x509/extensions.py", line 24, in <module>
from cryptography.x509.general_name import GeneralName, IPAddress, OtherName
File "/usr/local/lib/python2.7/dist-packages/cryptography/x509/general_name.py", line 18, in <module>
from cryptography.x509.name import Name
File "/usr/local/lib/python2.7/dist-packages/cryptography/x509/name.py", line 28, in <module>
_ASN1_TYPE_TO_ENUM = dict((i.value, i) for i in _ASN1Type)
File "/usr/local/lib/python2.7/dist-packages/cryptography/x509/name.py", line 28, in <genexpr>
_ASN1_TYPE_TO_ENUM = dict((i.value, i) for i in _ASN1Type)
AttributeError: 'int' object has no attribute 'value'