SSH with a Bastion Host – stdio forwarding failed

PROXYssh

I'm setting up a Bastion Host on AWS (some details here: https://www.nadeau.tv/ssh-with-a-bastion-host/), to allow me secure access to my other EC2 instances I have on AWS.

I'm running into a few issues when trying to proxy through the bastion host.

My SSH Config file is follows:

# 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

Below is the verbose output from the command line:

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

I'm stuck, getting an error 'stdio forwarding failed', any help appreciated.

Regards

Best Answer

I didn't have SSH security group configured correctly, when it was changed to accept incoming SSH requests from the Bastion Server's private IP, everything worked as expected.