拨号失败:握手失败:ssh:没有通用算法golang的ssh客户端错误

我正在使用 goftp 上传到服务器,但是(由于这里的友善),我将使用更安全的方法。 </ p>

我计划改用ssh,并在golang中找到此ssh客户端,发现此处。 </ p>

我已经设置了ssh服务器(freeSSHd),并且可以通过PuTTY在本地和另一台计算机上成功连接。</ p>

我仅更改了此部分 客户端用我自己的变量替换变量</ p>

  var(
服务器=“ 127.0.0.1:22"
用户名=”用户名“
密码= clientPassword( “ password”)

</ code> </ pre>

当我执行ssh客户端时,ssh.Dial返回一个错误,并且恐慌显示如下:
拨号失败:握手失败:ssh:没有通用算法” </ strong> </ p>

  client,err:= ssh.Dial(“ tcp”,“ 127.0.0.1:22  “,config)
if err!= nil {
panic(”拨号失败:“ + err.Error())
}
</ code> </ pre>

我是 是golang的新手,因此如果能为我指明正确的方向,我将不胜感激。 预先感谢。</ p>
</ div>

展开原文

原文

I'm working on a project that is using goftp to upload to a server, but (thanks to the kind people here) I will use a more secure method.

I plan to use ssh instead and found this ssh client in golang found here.

I have setup an ssh server (freeSSHd) and can successfully connect through PuTTY both locally and on another machine.

I have only changed this part of the client to replace the variables with my own

var (
    server = "127.0.0.1:22"
    username = "username"
    password = clientPassword("password")
)

When I execute the ssh client, ssh.Dial returns an error, and the panic displays this: "Failed to dial: handshake failed: ssh: no common algorithms"

client, err := ssh.Dial("tcp", "127.0.0.1:22", config)
if err != nil {
    panic("Failed to dial: " + err.Error())
}

I am new to golang so I would appreciate any help to point me in the right direction. Thanks in advance.

ssh
duanhunlou7051
duanhunlou7051 该线程可能会有所帮助:groups.google.com/d/msg/golang-nuts/UftJqQcJ1nA/_MufYD1ODw4J简而言之-好像goland不支持freeSSHd使用的算法
接近 7 年之前 回复

2个回答



包的#L95“ rel =” nofollow“>源代码,我们可以看到支持的密码如下:</ p>


  • AES128-CTR </ LI>
  • AES192-CTR </ LI>
  • AES256-CTR </ LI>
  • arcfour128 </ LI> \ n
  • arcfour256 </ li>
    </ ul>

    虽然freeSSHd支持:</ p>


    • aes128-cbc </ li> \ ñ
    • AES192-CBC </ LI>
    • AES256-CBC </ LI>
    • 3DES-CBC </ LI>
    • 河豚-CBC </ LI>
      < LI> rijndael128-CBC </ LI>
    • rijndael192-CBC </ LI>
    • rijndael256-CBC </ LI>
    • rijndael-cbc@lysator.liu.se </ LI >
      </ ul>

      由于客户端和服务器不共享通用密码,因此您会收到错误消息。 ssh软件包不支持CBC模式的原因很可能是由于漏洞</ golang-nuts线程中进行了讨论。 / p>

      解决此问题的方法可能是尝试安装其他SSH服务器,例如 OpenSSH 对于Windows 。</ p>
      </ div>

展开原文

原文

In the source code for the go.crypto/ssh package, we can see that the supported ciphers are the following:

  • aes128-ctr
  • aes192-ctr
  • aes256-ctr
  • arcfour128
  • arcfour256

While freeSSHd supports:

  • aes128-cbc
  • aes192-cbc
  • aes256-cbc
  • 3des-cbc
  • blowfish-cbc
  • rijndael128-cbc
  • rijndael192-cbc
  • rijndael256-cbc
  • rijndael-cbc@lysator.liu.se

Because the client and server shares no common cipher, you will get the error message. The reason why CBC mode is not supported in the ssh package is most likely because of a vulnerability, as discussed in this golang-nuts thread.

A solution to your problem might be to try install a different SSH server, such as OpenSSH for Windows.

dongmi4720
dongmi4720 大! 我将尝试Windows的OpenSSH。
接近 7 年之前 回复



尽管不安全,但您可以使用goSSH的库来使用freeSSH支持的密码。</ p>

   sshConfig.Config.Ciphers = append(sshConfig.Config.Ciphers,“ aes128-cbc”)
</ code> </ pre>
</ div>

展开原文

原文

Though it is insecure you can get go's library to use a cypher supported by freeSSH.

sshConfig.Config.Ciphers = append(sshConfig.Config.Ciphers, "aes128-cbc")

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
立即提问