mmittiga17 has asked for the wisdom of the Perl Monks concerning the following question:

quick question I hope. Is there a way to connect to an external sftp box if you first have to go through a local http proxy? I have a script that works to push and pull files via sftp but now I need to make the ssh connection to the sftp box route through a proxy. I have been searching high and low for a solution. Also, the proxy requires user authentication. Any help will be appreciated.

Replies are listed 'Best First'.
Re: Net::SFTP::Foreign via proxy
by salva (Canon) on Nov 14, 2011 at 21:35 UTC
    Which kind of proxy?

    For an HTTPS proxy you can use ProxyTunnel (you may also need to get the SSH server listening on port 443 as most HTTPS proxies forbid connections to port 22). For a SOCKS4/SOCKS5 proxy (unlikely) you can use socat.

    In any case, first find the particular ProxyCommand directive that allows OpenSSH to connect to the remote server through the proxy using any of these utilities.

    Then, pass it to Net::SFTP::Foreign on the constructor call as follows:

    my $sftp = Net::SFTP::Foreign->new(..., more => [-o => 'ProxyCommand=. +..']);
Re: Net::SFTP::Foreign via proxy
by keszler (Priest) on Nov 14, 2011 at 20:57 UTC