gpt4 book ai didi

go - 使用 crypto/ssh 连接到 Cisco 交换机

转载 作者:IT王子 更新时间:2023-10-29 00:40:21 30 4
gpt4 key购买 nike

我正在使用此代码 https://gist.github.com/svett/b7f56afc966a6b6ac2fc作为起点。

使用它并将其指向 cisco 路由器会得到以下错误消息:

拨号失败:ssh:握手失败:ssh:客户端到服务器密码没有通用算法;客户端提供:[aes128-ctr aes192-ctr aes256-ctr aes128-gcm@openssh.com arcfour256 arcfour128],服务器提供:[aes128-cbc 3des-cbc aes192-cbc aes256-cbc]

经过一些阅读,我了解到我可以通过自定义配置来启用 aes128-cbc:

// CBC mode is insecure and so is not included in the default config.
// (See http://www.isg.rhul.ac.uk/~kp/SandPfinal.pdf). If absolutely
// needed, it's possible to specify a custom Config to enable it.

所以我补充说:

HostKeyAlgorithms: []string{"aes128cbcID"},

到我的 ssh.ClientConfig,我得到了一个不同的错误:

拨号失败:ssh:握手失败:ssh:主机 key 没有通用算法;客户端提供:[aes128cbcID],服务器提供:[ssh-rsa]

这基本上让我觉得当我需要指定客户端到服务器密码时我正在指定 HostKeyAlgorithm,但我找不到足够好的方法来弄清楚如何这样做。

有什么想法吗?

最佳答案

您想要的是在客户端配置中设置Ciphers 字段。这是共同的 ssh.Config结构,嵌入在 ssh.ClientConfig

sshConfig.Ciphers = []string{"aes128-cbc"}

关于go - 使用 crypto/ssh 连接到 Cisco 交换机,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35493528/

30 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com