可能检测到DNS欺骗。远程主机标识已更改。

6

我最近更换了服务器,因此我的IP地址发生了改变。当我尝试使用git fetch [远程仓库]时,会出现以下情况:

> C:\Users\[path]\app>git fetch [remote repository]
> @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@      
> @ WARNING: POSSIBLE DNS SPOOFING DETECTED!                @
> @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
> The RSA host key for example.net has changed, and the key for the
> corresponding IP address [IP address of new server] is unknown. This
> could either mean that DNS SPOOFING is happening or the IP address for
> the host and its host key have changed at the same time.
> @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@   
> WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED!          @
> @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
> IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY! Someone could be
> eavesdropping on you right now (man-in-the-middle attack)! It is also
> possible that a host key has just been changed. The fingerprint for
> the RSA key sent by the remote host is
> SHA256:ep0A2t+sVMSaIEbS8wt8ptfmdHSr1kNocWsBNab0tsI. Please contact
> your system administrator. Add correct host key in
> /c/Users/[username]/.ssh/known_hosts to get rid of this message.
> Offending RSA key in /c/Users/[username]/.ssh/known_hosts:1 RSA host
> key for example.net has changed and you have requested strict
> checking. Host key verification failed. fatal: Could not read from
> remote repository. Please make sure you have the correct access rights
> and the repository exists. C:\Users\[path]\app>

我只需要从新服务器获取一个新的SSH密钥,然后将其放入我的本地计算机中以解决这个问题,是吗?谢谢。

3个回答

8
如果您新建了一个服务器,但使用与旧服务器相同的名称或IP地址进行引用,则很可能ssh证书不同,并且会收到欺骗警告信息。在消息中,您可以看到ssh指向旧证书信息所在的行:/ c / Users / [username] / .ssh / known_hosts:1 。长话短说:如果更改了服务器,则ssh证书应该是不同的。只需从ssh known_hosts中删除旧服务器的一行(在这种情况下为文件的第一行),您就可以放心使用了。

6
警告信息在这里提供更好的解释。example.net的RSA主机密钥已更改,相应IP地址[新服务器的IP地址]的密钥未知。
让我们比较在更改example.net的IP之前(10.0.0.0)和更改example.net的IP之后(10.0.0.1)的两种情况。
更改之前:example.net - 10.0.0.0
10.0.0.2>> ssh user@example.net 服务器10.0.0.0的主机指纹存储在服务器10.0.0.2的known hosts文件中。
更改之后:example.net - 10.0.0.1
10.0.0.2>> ssh user@example.net 现在,example.net指向10.0.0.1,但在known hosts文件中,example.net仍具有10.0.0.0的主机指纹。因此,每当您尝试ssh到example.net时,都会收到警告,因为主机密钥已更改,这是一个新服务器。根据ssh,它认为其他人已经访问了您的DNS,并可能将DNS的终点更改为任何错误的服务器,因此您面临DNS欺骗警告。
为确认身份,您需要告诉ssh您是有意更改它的人。只需从服务器10.0.0.2的known_host文件中删除旧的主机密钥条目并删除10.0.0.0的条目即可。
查找服务器的指纹:
ssh-keygen -F example.net
删除服务器的指纹:
ssh-keygen -R example.net

0
我的旧设置接受了kay类型设置为rsa,但新服务器有其他的ssh密钥类型。因此解决方案是删除那个有问题的配置。

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接