GoLang: “无公共密钥交换算法”错误

huangapple go评论93阅读模式
英文:

GoLang : "No common algorithm for key exchange" error

问题

我是你的中文翻译助手,以下是翻译好的内容:

我是GoLang的新手,我正在尝试使用Go语言连接到远程服务器。但是我一直遇到以下错误:

连接失败:ssh: 握手失败:ssh: 密钥交换没有共同算法;客户端提供的算法:[curve2****-sh****@libssh.org ****-sha*-nis****ecdh-sha2-nistp384 ecdh-sha2-nistp**** diffie-hellman-group14-sha1 diffie-hellman-group1-sha1];服务器提供的算法:[diffie-hellman-group-exchange-sha***]

以下是我用于连接的配置:

 config := &ssh.ClientConfig{

    User: user,

    HostKeyCallback: nil,

    Auth: []ssh.AuthMethod{

    publicKey,
    },
}
英文:

I am new to GoLang and I am trying to connect to a remote server using go. But I keep getting the following error

Failed to dial: ssh: handshake failed: ssh: no common algorithm for key exchange; client offered: [curve2****-sh****@libssh.org ****-sha*-nis****ecdh-sha2-nistp384 ecdh-sha2-nistp**** diffie-hellman-group14-sha1 diffie-hellman-group1-sha1], server offered: [diffie-hellman-group-exchange-sha***]

below is the config that I use to connect

 config := &ssh.ClientConfig{

    User: user,

    HostKeyCallback: nil,

    Auth: []ssh.AuthMethod{

    publicKey,
    },
}

答案1

得分: 2

好的,以下是翻译好的内容:

嗯,就像错误信息所说的那样,客户端和服务器没有任何它们愿意达成一致的算法,所以它们无法通信。Go提供的六种算法是它支持的所有算法(在openssh的12种算法中);而服务器只提供了一种不属于这些算法的算法。你有以下几个选择:

  1. 说服服务器接受更多的KEX算法;有可能服务器支持更多算法,只是有人将其配置得非常严格。
  2. 自己为x/crypto/ssh实现DH Group Exchange,并将补丁提交上游。
  3. 寻找其他的客户端。
英文:

Well, like the error says, the client and the server don't have any algorithms they're willing to agree on, so they can't talk. The six that Go is offering are all the ones it supports (out of the 12 that openssh does); the server is only offering one that isn't any of those. Your options:

  1. Convince the server to accept more KEX algorithms; it's possible that it supports more, and someone just configured it super restrictively.
  2. Implement DH Group Exchange for x/crypto/ssh yourself, and send the patch upstream.
  3. Find a different client.

答案2

得分: 0

请看一下这个问题

我还在解决这个问题,但VonC提供了一些有趣的提示来解决它。

希望对你有帮助。

英文:

take a look at this question

I'm still working on that but VonC put some interesting tips in order to resolve it.

hope it helps.

huangapple
  • 本文由 发表于 2017年5月31日 04:09:02
  • 转载请务必保留本文链接:https://go.coder-hub.com/44271041.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定