in reply to Net::OpenSSH and tunnels

Read the documentation for ProxyCommand directive in the ssh_config manual.

If netcat (or socat or some similar utility) is available in machine C, then it can be done as follows:

my $ssh = Net::OpenSSH->new($host, master_opts => [-o "ProxyCommand ssh machi +neC /usr/bin/nc %h:%p"]);

Otherwise, if perl (or any other scripting language) is available on machine C, you could write a netcat clone yourself with it.

As a last resort, you can use this (not very efficient) ProxyCommand:

ProxyCommand ssh machineC ssh -p %p %h sshd -i
If you want to use password authentication between machine A and machine C, you will have to do it using an auxiliary Net::OpenSSH object.

Post the full details of your setup and I will be able to provide further instructions on how to do it.

update: oh, and of course, you can use ssh to create a tunnel from machine A to B through C if they are not administratively forbidden in machine C... in my experience, something very unlikely.