You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@commons.apache.org by Suleiman Alrosan <su...@pontiflex.com> on 2012/07/27 00:30:29 UTC

[net] Problem with the FTPSClient and data connection ports

Hi,

I've been unsuccessfully trying to use
org.apache.commons.net.ftp.FTPSClient to upload a file to FTPS server.
The FTPS server is using command port 990, and data ports are the
range between 23580 and 23590. Also, this is FTP over implicit
TLS/SSL. However, I'm able run transfer successfully using a curl
client. Is there any way to emulate this with the FTPSClient class,
and could anyone provide an example code of this session.

Below is the log of the curl session with the command line options

Thank you for help.

curl -v -T /path/to/file/test.txt --insecure --tlsv1 --ftp-ssl
--ftp-pasv -u "user:passwd" -Q "CWD /" "ftp.myftpserver.com"

* About to connect() to ftp.myftpserver.com port 990 (#0)
*   Trying 216.158.176.132...   % Total    % Received % Xferd  Average
Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:--
--:--:--     0connected
* Connected to ftp.myftpserver.com (1.2.3.4) port 990 (#0)
* successfully set certificate verify locations:
*   CAfile: none
  CApath: /etc/ssl/certs
* SSLv3, TLS handshake, Client hello (1):
} [data not shown]
* SSLv3, TLS handshake, Server hello (2):
{ [data not shown]
* SSLv3, TLS handshake, CERT (11):
{ [data not shown]
* SSLv3, TLS handshake, Server finished (14):
{ [data not shown]
* SSLv3, TLS handshake, Client key exchange (16):
} [data not shown]
* SSLv3, TLS change cipher, Client hello (1):
} [data not shown]
* SSLv3, TLS handshake, Finished (20):
} [data not shown]
* SSLv3, TLS change cipher, Client hello (1):
{ [data not shown]
* SSLv3, TLS handshake, Finished (20):
{ [data not shown]
* SSL connection using RC4-SHA
* Server certificate:
*      subject: CN=ftp.myftpserver.com; L=New York; ST=New York; O=XYZ
Worldwide; C=US; emailAddress=operations@XYZ.com; OU=s8760w01
*      start date: 2006-04-13 22:45:04 GMT
*      expire date: 2016-04-10 22:45:04 GMT
*      common name: ftp.myftpserver.com (matched)
*      issuer: CN=ftp.myftpserver.com; L=New York; ST=New York; O=XYZ
Worldwide; C=US; emailAddress=operations@XYZ.com; OU=s8760w01
*      SSL certificate verify result: self signed certificate (18),
continuing anyway.
< 220-Serv-U FTP Server v6.2 for WinSock ready...
< 220 This is a XYZ Worldwide FTP site. Authorized usage only.
Unauthorized usage will be punished to the fullest extent allowed by
law.
> USER xxxxxxxx
< 331 User name okay, need password.
> PASS xxxxxxxx
< 230 User logged in, proceed.
> PBSZ 0
< 200 PBSZ command OK. Protection buffer size set to 0.
> PROT P
< 200 PROT command OK. Using private data connection.
> PWD
< 257 "/" is current directory.
* Entry path is '/'
> CWD /
< 250 Directory changed to /
> EPSV
* Connect data stream passively
< 500 'EPSV': command not understood.
* disabling EPSV usage
> PASV
< 227 Entering Passive Mode (1,2,3,4,92,34)
*   Trying 1.2.3.4... connected
* Connecting to 1.2.3.4 (1.2.3.4) port 23586
> TYPE I
< 200 Type set to I.
> STOR fileName
  0     0    0     0    0     0      0      0 --:--:-- --:--:--
--:--:--     0< 150 Opening BINARY mode data connection for fileName.
* Doing the SSL/TLS handshake on the data stream
* successfully set certificate verify locations:
*   CAfile: none
  CApath: /etc/ssl/certs
* SSL re-using session ID
* SSLv3, TLS handshake, Client hello (1):
} [data not shown]
* SSLv3, TLS handshake, Server hello (2):
{ [data not shown]
* SSLv3, TLS change cipher, Client hello (1):
{ [data not shown]
* SSLv3, TLS handshake, Finished (20):
{ [data not shown]
* SSLv3, TLS change cipher, Client hello (1):
} [data not shown]
* SSLv3, TLS handshake, Finished (20):
} [data not shown]
* SSL connection using RC4-SHA
* Server certificate:
*      subject: CN=ftp.myftpserver.com; L=New York; ST=New York;
O=XYZ; C=US; emailAddress=operations@XYZ.com; OU=s8760w01
*      start date: 2006-04-13 22:45:04 GMT
*      expire date: 2016-04-10 22:45:04 GMT
*      common name: ftp.myftpserver.com (matched)
*      issuer: CN=ftp.myftpserver.com; L=New York; ST=New York; O=XYZ;
C=US; emailAddress=operations@XYZ.com; OU=s8760w01
*      SSL certificate verify result: self signed certificate (18),
continuing anyway.
} [data not shown]
* We are completely uploaded and fine
* Remembering we are in dir ""
* SSLv3, TLS alert, Client hello (1):
} [data not shown]
< 226 Transfer complete.
100   470    0     0  100   470      0    523 --:--:-- --:--:-- --:--:--   557
* Connection #0 to host ftp.myftpserver.com left intact
> QUIT
< 221  Please verify all transfers with your account representative!
* Closing connection #0
* SSLv3, TLS alert, Client hello (1):
} [data not shown]

--
Suleiman Alrosan
Software Engineer

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
For additional commands, e-mail: user-help@commons.apache.org