Challenge: scripting ssh tunnels between Linux/Windows
Edit: my scenario got a lot easier. Please read the third post.
Who wants a challenge? I'm not entirely sure this is possible, so that's why I'm asking for help. This is my scenario, though.
I have four servers, some Windows, some Linux. I have an apt-mirror running in the core of our network. However, due to firewalls, I have to use jump-boxes to access certain machines, and normal ports aren't open. During certain points of the day, one of the services on a jump box shuts down and opens one of the ports. I want to use SSH tunnels to allow apt to connect back to my internal mirror. Here's what things look like:
LinuxVM --any:any-- WinVMHost1 --3802-> WinJump --any:any-- WinVMHost2 --any:any-- LinuxApt
I need to do two SSH tunnels:
-From WinVMHost1 to WinJump on port 3802
-From WinJump to LinuxApt using any port
(Note that I can't go straight from LinuxVM to WinJump - the firewall only permits WinVMHost1 to talk back to WinJump on 3802).
Here's what I'd like to do. I'd like to ball up a pre-made OpenSSH/Cygwin bundle and push it out to each box along the chain, establishing connections along the way. Then, I want to tear it down. In more detail, WinVMHost2 has Cygwin on it already. I can SSH to that, transfer my bundle, and use Cygwin's UNC capabilities to push the bundle to WinJump and start OpenSSH. Then, I'd create the tunnel to WinJump. From the Cygwin bundle now on WinJump, I can push the bundle to WinVMHost1, start OpenSSH, and create the second tunnel. Then, I can connect to the Linux VM. Once the work is done, it can all be torn out and taken back to normal.
Note that I have to use Cygwin because it's what is approved for use here at work. Is this feasible?