SSH to intranet hosts from outside – SSH gateway
For some of the latest projects I’m working on, it is required that I quite frequently access various machines that are located behing a corporate firewall, on a privately adressed subnet inside a company.
One option I had but got fed up with quite fast was :
outside$ ssh nicolas@gateway gateway$ ssh root@box1 box1# or ssh -t nicolas@gateway ssh root@box1
Once again, SSH came in handy and I found that everything was there for me to have that first hop and re-ssh done automatically. Just added the following to my ~/.ssh/config
Host gateway Hostname gateway.example.org User nicolas Host box1 Hostname 192.168.0.1 User root ProxyCommand ssh gateway nc -w 1 %h 22
This, coupled to ssh’s passwordless authentication made my day a lot easier ;)
Tags: SSH, Technical