I have a server in a private subnet to which I want to connect via a machine that faces the Internet. There are some tutorials for this. I used this one: https://heipei.github.io/2015/02/26/SSH-Agent-Forwarding-considered-harmful/
The problem with it is that it assumes I can edit the ~/.ssh/config
file. If I am however running code on CI, I would rather use the config file shipped in my repository and use -F
switch. In this case the above strategy stops working as the ssh
command used as ProxyCommand
doesn't load the the same configuration file and doesn't know the aliases. What I did was:
Host ansible
User ubuntu
Hostname xxx.compute.amazonaws.com
Host app
User ubuntu
Hostname 10.0.2.40
ProxyCommand ssh -F test-ssh.cfg -W %h:%p ansible
This works but is a little dirty, as I need to put the name of the file into the file itself and it would break if someone changes the filename. So my question is: is there a cleaner way to create a configuration file with aliases and ProxyCommand
that could be used with -F
?