ssh: handshake failed: ssh: no common algorithm for key exchange; client offered: [[email protected] ecdh-sha2-nistp256 ecdh-sha2-nistp384 ecdh-sha2-nistp521 diffie-hellman-group14-sha1], server offered: [diffie-hellman-group1-sha1 diffie-hellman-group-exchange-sha1] RunCommands result:
package main
import ( "fmt" "github.com/shenbowei/switch-ssh-go" )
func main() { user := "test" password := "QWX@123x" ipPort := "192.168.16.234:22"
//get the switch brand(vendor), include h3c,huawei and cisco
brand, err := ssh.GetSSHBrand(user, password, ipPort)
if err != nil {
fmt.Println("GetSSHBrand err:\n", err.Error())
}
fmt.Println("Device brand is:\n", brand)
//run the cmds in the switch, and get the execution results
cmds := make([]string, 0)
cmds = append(cmds, "dis clock")
cmds = append(cmds, "dis vlan")
result, err := ssh.RunCommands(user, password, ipPort, cmds...)
if err != nil {
fmt.Println("RunCommands err:\n", err.Error())
}
fmt.Println("RunCommands result:\n", result)
}
1
leezii 2019-11-01 17:36:26 +08:00
这不就是说算法不一致吗
|
2
lc7029 2019-11-01 17:40:16 +08:00
你看看设备是不是用的 ssh1,而程序不支持 ssh1。
有些较老的设备只支持 ssh1 且不支持 ssh2。 |
3
heijiaotuan 2019-11-01 17:40:52 +08:00
客户端支持的 ssh 算法也太少了吧
|
4
reus 2019-11-01 17:58:55 +08:00
搜索 "golang diffie-hellman-group1-sha1"
你会得到: https://github.com/golang/crypto/commit/36a967d3212260ed1abea70bb749e710e26457a 搜索 "golang diffie-hellman-group-exchange-sha1" 你会得到: https://github.com/golang/go/issues/17230 问搜索引擎显然比问 V2EX 好。 |
5
TOUJOURSER 2019-12-09 14:46:39 +08:00
请问这个问题解决了吗
|
6
mangwen OP @TOUJOURSER 没有 就是算法不一致 ,包不支持,换 python 操作交换机了 。
|