【发布时间】:2016-05-08 22:22:35
【问题描述】:
我们有一个构建脚本,它使用 Ant <scp> 任务将文件上传到 Mac 服务器。这在运行 OSX 10.8 (Mountain Lion) 的服务器上运行良好一年或更长时间,但我们最近将其升级到 OSX 10.11 (El Capitan),现在 <scp> 任务失败,出现以下异常:
com.jcraft.jsch.JSchException: Algorithm negotiation fail
开启详细模式,日志如下:
[scp] Connecting to **SERVER-ADDRESS**:2220
[scp] Connecting to **SERVER-ADDRESS** port 2220
[scp] Connection established
[scp] Remote version string: SSH-2.0-OpenSSH_6.9
[scp] Local version string: SSH-2.0-JSCH-0.1.51
[scp] CheckCiphers: aes256-ctr,aes192-ctr,aes128-ctr,aes256-cbc,aes192-cbc,aes128-cbc,3des-ctr,arcfour,arcfour128,arcfour256
[scp] CheckKexes: diffie-hellman-group14-sha1
[scp] diffie-hellman-group14-sha1 is not available.
[scp] SSH_MSG_KEXINIT sent
[scp] SSH_MSG_KEXINIT received
[scp] kex: server: curve25519-sha256@libssh.org,ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha256,diffie-hellman-group14-sha1
[scp] kex: server: ssh-rsa,ssh-dss,ecdsa-sha2-nistp256,ssh-ed25519
[scp] kex: server: chacha20-poly1305@openssh.com,aes128-ctr,aes192-ctr,aes256-ctr,aes128-gcm@openssh.com,aes256-gcm@openssh.com
[scp] kex: server: chacha20-poly1305@openssh.com,aes128-ctr,aes192-ctr,aes256-ctr,aes128-gcm@openssh.com,aes256-gcm@openssh.com
[scp] kex: server: umac-64-etm@openssh.com,umac-128-etm@openssh.com,hmac-sha2-256-etm@openssh.com,hmac-sha2-512-etm@openssh.com,hmac-sha1-etm@openssh.com,umac-64@openssh.com,umac-128@openssh.com,hmac-sha2-256,hmac-sha2-512,hmac-sha1
[scp] kex: server: umac-64-etm@openssh.com,umac-128-etm@openssh.com,hmac-sha2-256-etm@openssh.com,hmac-sha2-512-etm@openssh.com,hmac-sha1-etm@openssh.com,umac-64@openssh.com,umac-128@openssh.com,hmac-sha2-256,hmac-sha2-512,hmac-sha1
[scp] kex: server: none,zlib@openssh.com
[scp] kex: server: none,zlib@openssh.com
[scp] kex: server:
[scp] kex: server:
[scp] kex: client: diffie-hellman-group1-sha1,diffie-hellman-group-exchange-sha1
[scp] kex: client: ssh-rsa,ssh-dss
[scp] kex: client: aes128-ctr,aes128-cbc,3des-ctr,3des-cbc,blowfish-cbc,aes192-cbc,aes256-cbc
[scp] kex: client: aes128-ctr,aes128-cbc,3des-ctr,3des-cbc,blowfish-cbc,aes192-cbc,aes256-cbc
[scp] kex: client: hmac-md5,hmac-sha1,hmac-sha2-256,hmac-sha1-96,hmac-md5-96
[scp] kex: client: hmac-md5,hmac-sha1,hmac-sha2-256,hmac-sha1-96,hmac-md5-96
[scp] kex: client: none
[scp] kex: client: none
[scp] kex: client:
[scp] kex: client:
[scp] Disconnecting from **SERVER-ADDRESS** port 2220
所以问题是客户端和服务器都不支持单一算法,正如在类似的 SO 帖子中所讨论的那样:JSchException: Algorithm negotiation fail 和其他地方。但是,从日志来看,在我看来,客户端和服务器 确实 都支持至少一种算法,即“aes128-ctr”:
[scp] kex: 服务器: chacha20-poly1305@openssh.com,aes128-ctr,aes192-ctr,aes256-ctr,aes128-gcm@openssh.com,aes256-gcm@openssh.com和
[scp] kex:客户端:aes128-ctr,aes128-cbc,3des-ctr,3des-cbc,blowfish-cbc,aes192-cbc,aes256-cbc所以我不明白他们为什么不能协商算法,但即便如此,我还是按照其他 SO 问题中的建议安装了 JCE Unlimited Strength Jurisdiction Policy 文件 - 您可以在上面的行中看到客户端现在支持 256 位算法。这没有什么区别,大概是因为服务器支持“aes256-ctr”而客户端支持“aes256-cbc”。但是我还是不明白为什么不能使用“aes128-ctr”
注意,客户端机器运行的是 Windows,所以根据我在其他地方读到的东西(不记得确切的位置),我还尝试清除 Putty 的 SSH 密钥缓存 - 这也没有任何区别(不是我期待的它到 - 我现在只是在尝试一些东西......)
令人沮丧的是,看起来这个 SO 帖子 - Algorithm negotiation fail deploying iOS app in OSX "El Capitan" - 处理相同的问题,并且有一个解决方案,但回答者只是说问题已在他的产品中得到解决,而没有解释修复是什么,我没有足够的声望发表评论要求更多细节
【问题讨论】: