0 votes
by (260 points)


We are integrating Rebex FTP/SSL component into our application, StockSubmitter. This component is awesome, best of all managed FTP/SSL components I've seen so far. FTP uploads to all the microstock agencies work just fine, except one. Veer's FTP server is using explicit SSL, and is working in any FTP/SSL compatible client, but I couldn't get it to work with Rebex FTP/SSL component.

I am using following code (actually, I am using async version, but it shouldn't make any difference):

ftp.Connect('upload.veer.com', 21, null, FtpSecurity.Explicit);
ftp.Login('login', 'password');

Following code does not matter, since it fails on Connect(). I found out what problem is Veer's FTP closing connection silently for some reason after following dialog:

[2012-03-05 18:04:12] [upload.veer.com] State changed from Disconnected to Connecting
[2012-03-05 18:04:12] [upload.veer.com] State changed from Connecting to Reading
[2012-03-05 18:04:13] [upload.veer.com] Response read: 220 Veer
[2012-03-05 18:04:13] [upload.veer.com] State changed from Reading to Ready
[2012-03-05 18:04:13] [upload.veer.com] State changed from Ready to Sending
[2012-03-05 18:04:13] [upload.veer.com] Command sent: AUTH TLS
[2012-03-05 18:04:13] [upload.veer.com] State changed from Sending to Reading
[2012-03-05 18:04:13] [upload.veer.com] Response read: 234 AUTH command ok. Expecting TLS Negotiation.
[2012-03-05 18:04:13] [upload.veer.com] State changed from Reading to Ready
[2012-03-05 18:04:13] [upload.veer.com] State changed from Ready to Disconnected

Exception with message "Secure connection was closed by the remote connection end." is being thrown during Connect(). TlsDebug() is called twice, both for Connection: Control, first is state change to Negotiating, next is state change to Closed.

It seems the problem is on server side, but FileZilla and other clients work correctly. So there should be some workaround to make this FTP working properly.

At the moment, this issue is only one stopping us from buying full version of the component and removing integration with libcurl we used previously.

If anyone seen same issues and knows how to work around it, please tell me how :)

Applies to: Rebex FTP/SSL

1 Answer

+1 vote
by (147k points)
Best answer

I just tried connecting to this FTP server using the WinFormClient sample and apart from a problem with server's certificate, everything seems to be working fine. This is the log produced by the sample:

15:45:17.708 Info Info: Connecting to upload.veer.com:21 using Ftp 3.0.4086.0.
15:45:17.713 Info Info: Using proxy none.
15:45:18.234 Debug Info: Connection succeeded.
15:45:18.410 Info Response: 220 Veer
15:45:18.424 Info Command: AUTH TLS
15:45:18.600 Info Response: 234 AUTH command ok. Expecting TLS Negotiation.
15:45:18.605 Debug Info: Upgrading control connection to TLS/SSL.
15:45:18.817 Info TLS: State StateChange:Negotiating
15:45:18.819 Debug TLS: HandshakeMessage:ClientHello was sent.
15:45:19.026 Debug TLS: HandshakeMessage:ServerHello was received.
15:45:19.046 Debug TLS: HandshakeMessage:Certificate was received.
15:45:19.048 Debug TLS: HandshakeMessage:ServerHelloDone was received.
15:45:19.054 Debug TLS: Verifying server certificate ('CN=upload.veer.com, OU=Corbis, O=Corbis Corporation, L=Seattle, S=Washington, C=US').
15:45:20.137 Debug TLS: Certificate verification result: Accept
15:45:20.177 Debug TLS: HandshakeMessage:ClientKeyExchange was sent.
15:45:20.206 Debug TLS: CipherSpec:ChangeCipherSpec was sent.
15:45:20.211 Debug TLS: HandshakeMessage:Finished was sent.
15:45:20.396 Debug TLS: CipherSpec:ChangeCipherSpec was received.
15:45:20.401 Debug TLS: HandshakeMessage:Finished was received.
15:45:20.403 Info TLS: State StateChange:Secured
15:45:20.406 Info TLS: Connection secured using cipher: TLS 1.0, RSA, 128bit AES in CBC mode, SHA1
15:45:20.410 Debug TLS: Session ID: 
15:45:20.412 Debug Info: Control connection upgraded to TLS/SSL.
15:45:20.427 Info Command: USER login
15:45:20.609 Info Response: 331 Password required for login.
15:45:20.613 Info Command: PASS ********
15:45:20.795 Info Response: 530 User cannot log in.
15:45:20.799 Error Info: Rebex.Net.FtpException: User cannot log in (530).
   at Rebex.Net.Ftp.Login(String userName, String password, String account)
15:45:20.807 Debug TLS: Closing TLS socket.
15:45:20.810 Info TLS: Alert Alert:Alert was sent.
15:45:20.811 Info TLS: State StateChange:Closed

Could you please try this as well and post the log created by your copy of WinFormClient sample? (Make sure to select 'Debug' log-level instead of 'Info'.)

by (260 points)

Well, it seems problem was with my internet connection. I am trying it now from another one, and it works just like you described. Thanks for your help anyway, it is working now, after I added "always-accept" CertificateVerifier.

by (147k points)

What kind of internet connection was that? Some customers have reported issues with some GPRS/3G carriers that block FTP over SSL in explicit mode. See the following post for details: http://forum.rebex.net/questions/1814/ftp-ssl-login-handshake-problem

by (260 points)

No, it wasnt mobile internet connection. It was wired (LAN) connection. Not sure why it was blocked, may be ISP was blocking it for some reason.