我试图SSH通过一个跳转,但SSH似乎意图检查跳箱的主机密钥,即使我不告诉它,使用正常-o StrictHostKeyChecking=no -o UserKnownHostsFile=no命令行选项。
如果我直接SSH到跳转,我可以让SSH忽略错误,如预期的那样:
ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -i ~/.ssh/id_jumpuser_rsa jumpuser@jumpbox
但是,如果我添加代理跳转选项,我突然得到错误。 错误不是来自跳转框跳转框上的任何.ssh目录中没有known_hosts文件,也不是以jumpuser身份login:
ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -i ~/.ssh/id_jumpuser_rsa -J jumpuser@jumpbox [email protected]
错误消息:
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ @ 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 ECDSA key sent by the remote host is <redacted>. Please contact your system administrator. Add correct host key in /home/user/.ssh/known_hosts to get rid of this message. Offending ECDSA key in /home/user/.ssh/known_hosts:10 remove with: ssh-keygen -f "/home/user/.ssh/known_hosts" -R jumpbox ECDSA host key for jumpbox has changed and you have requested strict checking. Host key verification failed. ssh_exchange_identification: Connection closed by remote host
user是我的普通用户,而不是我正在尝试SSH的用户。
我不知道这里发生了什么。 SSH有一个特殊的覆盖强制主机密钥检查代理跳转情况? 如果是这样,这是非常恼人的,因为它会使本地虚拟机configuration真正的痛苦。
ProxyJump发出另一个ssh进程,它不会inheritance在第一个ssh命令的命令行中指定的命令行参数。 有两种可能的出路:
在~/.ssh/configconfiguration文件中使用这些选项 – 它可以为您节省很多打字!
Host jumpbox User jumpuser StrictHostKeyChecking=no UserKnownHostsFile=/dev/null IdentityFile ~/.ssh/id_jumpuser_rsa
然后你可以像ssh -J jumpbox [email protected]那样连接。
使用ProxyCommand选项 – 它做同样的工作,但更透明,所以你可以看到实际上在那里:
ssh -o ProxyCommand="ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -i ~/.ssh/id_jumpuser_rsa -W %h:%p jumpuser@jumpbox" -i ~/.ssh/id_jumpuser_rsa [email protected]