【问题标题】:Slow public key authentication with paramiko使用 paramiko 进行慢速公钥认证
【发布时间】:2012-05-22 05:52:16
【问题描述】:

我正在使用 paramiko 通过 ssh 连接到远程服务器。使用公钥进行身份验证时,性能很慢(约 90 秒)。以下是相关的日志输出:

2012-05-14 17:37:21,378 Ciphers agreed: local=aes128-ctr, remote=aes128-ctr 
2012-05-14 17:37:21,378 using kex diffie-hellman-group1-sha1; server key type ssh-rsa; cipher: local aes128-ctr, remote aes128-ctr; mac: local hmac-sha1, remote hmac-sha1; compression: local none, remote none 
2012-05-14 17:37:21,481 Switch to new keys ... 
2012-05-14 17:37:21,483 Adding ssh-rsa host key for 10.12.34.56: 8a05c68a0707a9fad19290c22542a338 
2012-05-14 17:37:21,485 Trying discovered key 3793c7b9c500f52c12e190e92e21713f in /home/david/.ssh/id_rsa 
2012-05-14 17:37:21,513 userauth is OK 
2012-05-14 17:38:54,370 Authentication (publickey) successful!

注意最后两行日志输出之间的延迟。当使用 ssh 从命令行连接同一用户和远程服务器时,连接是即时的。任何想法是什么导致延迟?

【问题讨论】:

    标签: python paramiko ssh-keys


    【解决方案1】:

    pycrypto>=2.5 很慢。降级到pycrypto==2.4.1 后,我看到了 25 倍的提升。

    【讨论】:

    • 这是唯一对我有用的加快 Fabric(使用 pycrypto)的方法。很大的进步。
    【解决方案2】:

    经过大量实验后,延迟似乎与密钥的长度有关。我使用的第一个密钥是 4096 位。当我切换到更短的(2048 位)密钥时,身份验证所需的时间急剧下降(

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2014-11-13
      • 2021-01-06
      • 2012-01-13
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-05-25
      相关资源
      最近更新 更多