-
Notifications
You must be signed in to change notification settings - Fork 359
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix hang when using ExplicitTLS to certain servers. #283
Conversation
Can you please add a comment in the code to explain why we setup the connection with tls.Client and not tls.Dial ? |
9095978
to
2ead61e
Compare
I've put a comment in explaining the reasoning. |
Encountered this bug today with pure-ftpd server - the proposed fix worked for me. |
Tackled this as well - any chance we can merge the PR ? |
2ead61e
to
c31e428
Compare
I have updated the code with a bit more documentation. Unfortunately I'm going to have to hard fork flaffaye for the rclone v1.60 release with this patch in - I'll move the rclone back as soon as this gets merged and released. |
In jlaffaye#282 it was discovered that doing the tls Handshake immediately on connection causes some FTP servers (proftpd and pureftpd) to hang. The exact cause of this is unknown, but this patch works around the problem by not doing the Handsake initially, and only doing it at the end if we were attempting to upload a zero length file. Doing the Handshake at the end was originally added in a4e9650 however it got reverted in 212daf2 which used tls.DialWithDialer to do the handshake. Unfortunately tls.DialWithDialer seems to trigger the hanging bug. See: https://forum.rclone.org/t/rclone-ftps-explicit-rclone-touch-empty-files-proftpd-unable-to-build-data-connection-operation-not-permitted/22522 See: rclone/rclone#6426 (comment) Fixes jlaffaye#282
c31e428
to
5da3769
Compare
It was discovered that doing the tls Handshake immediately on connection causes some FTP servers (proftpd and pureftpd) to hang. This imports a fix for it by temporarily hard forking jlaffaye/ftp to include the fix submitted as a pull request. See: https://forum.rclone.org/t/rclone-ftps-explicit-rclone-touch-empty-files-proftpd-unable-to-build-data-connection-operation-not-permitted/22522 See: #6426 (comment) See: jlaffaye/ftp#283 See: jlaffaye/ftp#282
facing the same issue, @ncw When are you planning to merge this one? |
@mohsek not my call! I have merged a fix for this in rclone 1.60 github.com/rclone/[email protected] |
I had the same error with the hanging connection So i tried to use this one Server is pureftp ` 220-Local time is now 17:46. Server port: 21. 220-This is a private system - No anonymous login 220-IPv6 connections are also welcome on this server. 220 You will be disconnected after 15 minutes of inactivity. AUTH TLS 234 AUTH TLS OK. USER xxxx 331 User admin OK. Password required PASS xxxx 230 OK. Current directory is / FEAT 211-Extensions supported: EPRT IDLE MDTM SIZE MFMT REST STREAM MLST type*;size*;sizd*;modify*;UNIX.mode*;UNIX.uid*;UNIX.gid*;unique*; MLSD AUTH TLS PBSZ PROT UTF8 TVFS ESTA PASV EPSV SPSV 211 End. TYPE I 200 TYPE is now 8-bit binary OPTS UTF8 ON 200 OK, UTF-8 enabled PBSZ 0 200 PBSZ=0 PROT P 200 Data protection level set to "private" EPSV 229 Extended Passive mode OK (|||30005|) STOR myfile 150 Accepted data connection 1 error occurred: |
@jlaffaye any chance we could get this merged? |
Oops totally forgot about this PR |
In #282 it was discovered that doing the tls Handshake immediately on connection causes some FTP servers (proftpd and pureftpd) to hang.
The exact cause of this is unknown, but this patch works around the problem by not doing the Handsake initially, and only doing it at the end if we were attempting to upload a zero length file.
Doing the Handshake at the end was originally added in a4e9650 however it got reverted in 212daf2 which used tls.DialWithDialer to do the handshake. Unfortunately tls.DialWithDialer seems to trigger the hanging bug.
See: https://forum.rclone.org/t/rclone-ftps-explicit-rclone-touch-empty-files-proftpd-unable-to-build-data-connection-operation-not-permitted/22522
See: rclone/rclone#6426 (comment)
Fixes #282