0

我最近没有更新任何我能想到的会影响 nacl 和 paramiko 签名过程的东西,但现在它不起作用。我已经重新安装了 paramiko 和 netmiko,并确保所有的加密库都是最新的。我不知道还能做什么,有什么想法吗?

from netmiko import ConnectHandler
...
def main(device_list):                                        
    username = input("\nWhat is your username? -> ")          
    password = getpass.getpass("\nWhat is your password? -> ")
    for host in device_list:                                  
        juniper_device = {                                    
        'device_type': 'juniper',                             
        'ip': host,                                           
        'username': username,                                 
        'password': password,                                 
        'verbose': False                                   
    }                                                     

Netmiko 使用 Paramiko 库建立 SSH 连接。这段代码用于设置设备定义。

这是与设备创建和 ssh 连接打开相关的堆栈跟踪。

Traceback (most recent call last):
  File "./get_running-config.py", line 5, in <module>
    from netmiko import ConnectHandler
  File "/usr/local/lib/python3.4/dist-packages/netmiko/__init__.py", line 8, in <module>
from netmiko.ssh_dispatcher import ConnectHandler
  File "/usr/local/lib/python3.4/dist-packages/netmiko/ssh_dispatcher.py", line 4, in <module>
from netmiko.a10 import A10SSH
  File "/usr/local/lib/python3.4/dist-packages/netmiko/a10/__init__.py", line 2, in <module>
from netmiko.a10.a10_ssh import A10SSH
  File "/usr/local/lib/python3.4/dist-packages/netmiko/a10/a10_ssh.py", line 4, in <module>
from netmiko.cisco_base_connection import CiscoSSHConnection
  File "/usr/local/lib/python3.4/dist-packages/netmiko/cisco_base_connection.py", line 3, in <module>
from netmiko.base_connection import BaseConnection
  File "/usr/local/lib/python3.4/dist-packages/netmiko/base_connection.py", line 13, in <module>
import paramiko
  File "/usr/local/lib/python3.4/dist-packages/paramiko/__init__.py", line 22, in <module>
from paramiko.transport import SecurityOptions, Transport
  File "/usr/local/lib/python3.4/dist-packages/paramiko/transport.py", line 57, in <module>
from paramiko.ed25519key import Ed25519Key
  File "/usr/local/lib/python3.4/dist-packages/paramiko/ed25519key.py", line 22, in <module>
import nacl.signing
  File "/usr/local/lib/python3.4/dist-packages/nacl/signing.py", line 19, in <module>
import nacl.bindings
  File "/usr/local/lib/python3.4/dist-packages/nacl/bindings/__init__.py", line 17, in <module>
from nacl.bindings.crypto_box import (
  File "/usr/local/lib/python3.4/dist-packages/nacl/bindings/crypto_box.py", line 27, in <module>
crypto_box_SEEDBYTES = lib.crypto_box_seedbytes()
AttributeError: cffi library '_sodium' has no function, constant or global variable named 'crypto_box_seedbytes'
4

2 回答 2

1

在对密码学和后续模块进行了大量修改之后,我刚刚安装了所有相关的库,现在一切正常。不幸的是,不确定它是如何进入这种状态的,但重新开始会更容易。

于 2018-03-20T19:56:49.747 回答
0

除非您发布代码,否则需要一些猜测:

也许问题类似于https://github.com/mitmproxy/mitmproxy/issues/2372,通过cryptography在 1.9 版中安装包解决了它。

于 2018-03-20T14:46:30.773 回答