golang ssh 包的时候思科设备可以 ssh 上去 华为不行 各位大佬指点一下 - V2EX
The Go Programming Language
http://golang.org/
Go Playground
Go Projects
Revel Web Framework
mangwen

golang ssh 包的时候思科设备可以 ssh 上去 华为不行 各位大佬指点一下

  •  
  •   mangwen Nov 1, 2019 7307 views
    This topic created in 2404 days ago, the information mentioned may be changed or developed.

    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) 

    }

    6 replies    2019-12-11 10:03:34 +08:00
    leezii
        1
    leezii  
       Nov 1, 2019
    这不就是说算法不一致吗
    lc7029
        2
    lc7029  
       Nov 1, 2019
    你看看设备是不是用的 ssh1,而程序不支持 ssh1。
    有些较老的设备只支持 ssh1 且不支持 ssh2。
    heijiaotuan
        3
    heijiaotuan  
       Nov 1, 2019
    客户端支持的 ssh 算法也太少了吧
    reus
        4
    reus  
       Nov 1, 2019
    搜索 "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 好。
    TOUJOURSER
        5
    TOUJOURSER  
       Dec 9, 2019
    请问这个问题解决了吗
    mangwen
        6
    mangwen  
    OP
       Dec 11, 2019
    @TOUJOURSER 没有 就是算法不一致 ,包不支持,换 python 操作交换机了 。
    About     Help     Advertise     Blog     API     FAQ     Solana     954 Online   Highest 6679       Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 33ms UTC 21:16 PVG 05:16 LAX 14:16 JFK 17:16
    Do have faith in what you're dong.
    ubao msn snddm index pchome yahoo rakuten mypaper meadowduck bidyahoo youbao zxmzxm asda bnvcg cvbfg dfscv mmhjk xxddc yybgb zznbn ccubao uaitu acv GXCV ET GDG YH FG BCVB FJFH CBRE CBC GDG ET54 WRWR RWER WREW WRWER RWER SDG EW SF DSFSF fbbs ubao fhd dfg ewr dg df ewwr ewwr et ruyut utut dfg fgd gdfgt etg dfgt dfgd ert4 gd fgg wr 235 wer3 we vsdf sdf gdf ert xcv sdf rwer hfd dfg cvb rwf afb dfh jgh bmn lgh rty gfds cxv xcv xcs vdas fdf fgd cv sdf tert sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf shasha9178 shasha9178 shasha9178 shasha9178 shasha9178 liflif2 liflif2 liflif2 liflif2 liflif2 liblib3 liblib3 liblib3 liblib3 liblib3 zhazha444 zhazha444 zhazha444 zhazha444 zhazha444 dende5 dende denden denden2 denden21 fenfen9 fenf619 fen619 fenfe9 fe619 sdf sdf sdf sdf sdf zhazh90 zhazh0 zhaa50 zha90 zh590 zho zhoz zhozh zhozho zhozho2 lislis lls95 lili95 lils5 liss9 sdf0ty987 sdft876 sdft9876 sdf09876 sd0t9876 sdf0ty98 sdf0976 sdf0ty986 sdf0ty96 sdf0t76 sdf0876 df0ty98 sf0t876 sd0ty76 sdy76 sdf76 sdf0t76 sdf0ty9 sdf0ty98 sdf0ty987 sdf0ty98 sdf6676 sdf876 sd876 sd876 sdf6 sdf6 sdf9876 sdf0t sdf06 sdf0ty9776 sdf0ty9776 sdf0ty76 sdf8876 sdf0t sd6 sdf06 s688876 sd688 sdf86