|Welcome to the Monastery|
Re: Port Forwarding with Net::SSH::Expectby naChoZ (Curate)
|on Dec 21, 2007 at 21:22 UTC||Need Help??|
Although I often use ssh tunnels in curious ways such as this, I've never actually played with Net::SSH::Expect until now. I got this working just fine. I just rigged it up so that I can ssh from my workstation to box3 via localhost port 4101, I didn't bother trying other ports.
I switched the $ssh1 object method to run_ssh() because the lab machines I used to test this already have ssh keys set up already.
One thing that was very important, the sleep statements. It would not work until I put both of them in there. I'm assuming it must be some sort of race condition, but I'm not sure what the proper way to handle this.
And the $ssh_params I added are just arguments that I normally use to stuff ssh into the background when making tunnels.
Therapy is expensive. Popping bubble wrap is cheap. You choose.