Windows 上的 ssh - 输入时 MAC 损坏

Rao*_*aze 19 windows powershell ssh openssl

我已经在 Windows 上安装了 OpenSSH。

我可以从这台 Windows 机器上使用 Putty 通过 ssh 成功连接到我的远程服务器。

但是当打开 PowerShell 并尝试时

ssh my_user@1.2.3.4
Run Code Online (Sandbox Code Playgroud)

我有错误:

debug3: send packet: type 5                                                                    
Corrupted MAC on input.                                                                        
ssh_dispatch_run_fatal: Connection to 1.2.3.4 port 22: message authentication code incorrect
Run Code Online (Sandbox Code Playgroud)

在安全日志中查看我的远程服务器时,我有:

Dec  7 03:20:22 allo-01 sshd[10102]: Connection from 4.3.2.1 port 49869 on 1.2.3.4 port 22
Dec  7 03:20:23 allo-01 sshd[10102]: Connection reset by 4.3.2.1 port 49869 [preauth]
Run Code Online (Sandbox Code Playgroud)

你知道怎么回事吗?为什么我在 windows 上来自 openssl 的 ssh 命令的行为与 PuTTY 不同?

Jak*_*ake 22

Raoul 对他自己问题的回答是正确的。我遇到了同样的问题,并在-m选项起作用后添加了正确的算法名称(在我的情况下,该选项是-m hmac-sha2-512从 PowerShell 连接到运行 Ubuntu 18.04 的机器)。

我不确定要使用哪种算法,但您可以通过运行列出所有可用的算法:

ssh -Q mac
Run Code Online (Sandbox Code Playgroud)

我随机选择了一个,尝试了一下,远程服务器返回说不支持该算法,但它轻松地告诉我是哪个,以便我可以修改我的命令。使用这个命令,我可以通过 ssh 进入远程机器:

ssh -m hmac-sha2-512 <user_name>@<remote_address>
Run Code Online (Sandbox Code Playgroud)

如果你也需要使用scp,参数不同:

scp -o MACs=hmac-sha2-512 <and the rest of your scp command>
Run Code Online (Sandbox Code Playgroud)


Rao*_*aze 9

出色地,

Corrupted MAC on input.
Run Code Online (Sandbox Code Playgroud)

让我想想我的以太网卡有什么问题。

确实,在ssh世界中,MAC的意思是“消息验证码”。

因此,我通过在 ssh 命令选项 -m 中添加远程可接受的算法来解决我的问题。


小智 8

我尝试了许多可用的解决方案,但以下一种有效。

将“MACs hmac-sha2-512”添加到 SSH 配置文件