SSH 与堡垒主机 - stdio 转发失败

Ste*_*hen 7 ssh proxy

我正在 AWS 上设置堡垒主机(这里有一些详细信息:https : //www.nadeau.tv/ssh-with-a-bastion-host/),以允许我安全访问我拥有的其他 EC2 实例亚马逊。

我在尝试通过堡垒主机进行代理时遇到了一些问题。

我的 SSH 配置文件如下:

# Bastion Host
Host bastion
User ec2-user
Hostname XX.XX.XX.XXX
IdentityFile ~/.ssh/keys/bastion.pem

# EC2 Instance
Host 172.*
User ec2-user
IdentityFile ~/.ssh/keys/bastion.pem
ProxyCommand ssh bastion -W %h:%p
Run Code Online (Sandbox Code Playgroud)

以下是命令行的详细输出:

Jeff-Bezos-iMac:tmp jeff$ ssh 172.xx.x.xx -v
OpenSSH_7.4p1, LibreSSL 2.5.0
debug1: Reading configuration data /Users/jeff/.ssh/config
debug1: /Users/jeff/.ssh/config line 9: Applying options for 172.*
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: Executing proxy command: exec ssh bastion -W 172.xx.x.xx:22
debug1: key_load_public: No such file or directory
debug1: identity file /Users/jeff/.ssh/keys/bastion.pem type -1
debug1: key_load_public: No such file or directory
debug1: identity file /Users/jeff/.ssh/keys/bastion.pem-cert type -1
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_7.4
debug1: permanently_drop_suid: 503
channel 0: open failed: connect failed: Connection timed out
stdio forwarding failed
ssh_exchange_identification: Connection closed by remote host
Run Code Online (Sandbox Code Playgroud)

我被卡住了,收到错误“stdio 转发失败”,任何帮助表示赞赏。

问候

Ste*_*hen 2

我没有正确配置 SSH 安全组,当将其更改为接受来自堡垒服务器的私有 IP 的传入 SSH 请求时,一切都按预期工作。

  • 你能分享一下你所做的事情的细节吗?我也有类似的问题。 (8认同)