commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Michael Seganti (JIRA)" <j...@apache.org>
Subject [jira] [Created] (NET-637) FTPSClient not using the Socks Proxy when opening passive data connection
Date Thu, 01 Jun 2017 18:06:04 GMT
Michael Seganti created NET-637:
-----------------------------------

             Summary: FTPSClient not using the Socks Proxy when opening passive data connection
                 Key: NET-637
                 URL: https://issues.apache.org/jira/browse/NET-637
             Project: Commons Net
          Issue Type: Bug
          Components: FTP
    Affects Versions: 3.6, 3.5
         Environment: Windows
            Reporter: Michael Seganti
            Priority: Minor


I'm routing FTPS traffic through a SOCKS proxy host.  I setup the proxy using: 

FTPSClient ftps = new FTPSClient("TLS", false);
InetSocketAddress sa = new InetSocketAddress(proxyHost,proxyPort);
Proxy proxy = new Proxy(Proxy.Type.SOCKS, sa);
System.out.println("Using Proxy Server: " + proxy);
ftps.setProxy(proxy);
...
ftps.enterLocalPassiveMode();
for (FTPFile f : ftps.listFiles()) {
	System.out.println(f.getRawListing());
}

When establishing the connection, the above code does go through the proxy and I'm able to
login.  When I try to do anything, say listFiles, It does the SYST and then attempts to enter
passive mode, but the connection times out:
227 Entering Passive Mode (123,45,678,9,11,243)
java.net.ConnectException: Connection timed out: connect
	at java.net.DualStackPlainSocketImpl.connect0(Native Method)
	at java.net.DualStackPlainSocketImpl.socketConnect(Unknown Source)
	at java.net.AbstractPlainSocketImpl.doConnect(Unknown Source)
	at java.net.AbstractPlainSocketImpl.connectToAddress(Unknown Source)
	at java.net.AbstractPlainSocketImpl.connect(Unknown Source)
	at java.net.PlainSocketImpl.connect(Unknown Source)
	at java.net.SocksSocketImpl.connect(Unknown Source)
	at java.net.Socket.connect(Unknown Source)
	at sun.security.ssl.SSLSocketImpl.connect(Unknown Source)
	at org.apache.commons.net.ftp.FTPClient._openDataConnection_(FTPClient.java:920)
	at org.apache.commons.net.ftp.FTPSClient._openDataConnection_(FTPSClient.java:627)
	at org.apache.commons.net.ftp.FTPClient._openDataConnection_(FTPClient.java:785)
	at org.apache.commons.net.ftp.FTPClient.initiateListParsing(FTPClient.java:3409)
	at org.apache.commons.net.ftp.FTPClient.initiateListParsing(FTPClient.java:3339)
	at org.apache.commons.net.ftp.FTPClient.listFiles(FTPClient.java:3016)
	at gov.nyc.ftputils.FTPConnection.listFiles(FTPConnection.java:1270)
	at gov.nyc.ftputils.FTPClientUtil.main(FTPClientUtil.java:572)

I then comment out the proxy code and added: 

System.getProperties().put( "socksProxyPort", proxyPort);
System.getProperties().put( "socksProxyHost" ,proxyHost);

And then I'm able to get the listing, get files, etc.

Adding -DsocksProxyHost=myproxy.host to the java command line also works.  




--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

Mime
View raw message