Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW

Net::SFTP::Foreign via proxy

by mmittiga17 (Scribe)
on Nov 14, 2011 at 20:27 UTC ( #938019=perlquestion: print w/replies, xml ) Need Help??

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

Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://938019]
Approved by keszler
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (5)
As of 2023-02-01 16:15 GMT
Find Nodes?
    Voting Booth?
    I prefer not to run the latest version of Perl because:

    Results (11 votes). Check out past polls.