Skip to content
This repository has been archived by the owner on Jul 8, 2020. It is now read-only.

Incompatible with ncftp? #27

Closed
matti777 opened this issue May 25, 2017 · 7 comments
Closed

Incompatible with ncftp? #27

matti777 opened this issue May 25, 2017 · 7 comments
Labels
Milestone

Comments

@matti777
Copy link

matti777 commented May 25, 2017

Hi, I just implemented a server with this framework. I love the clear API by the way.

I couldnt really make it work with any FTP client I had at hand; the one I tried most is NcFTP. When I log in and try to send a file, I get the following output from NcFTP:

[matti@babylon tmp] 20:52:45 % ncftp -P 8021 -u asd -p asd localhost
NcFTP 3.2.6 (Dec 04, 2016) by Mike Gleason (http://www.NcFTP.com/contact/).
Connecting to 127.0.0.1...                                                                                        
Welcome msg
Logging in...                                                                                                     
Password ok, continue
Invalid reply: " EPSV"                                                                                            
Logged in to localhost.                                                                                           
Invalid reply: " EPRT"
ncftp / > put foo.bin
Protocol violation by server: blank line on control.
Passive mode refused.
foo.bin:                          ETA:   0:00    9.54/  9.54 MB  278.26 kB/s = 

So there are some errors (Invalid reply: .. ).. from my logs on the server I can tell the file was received, but NcFTP never sees any progress and the PUT command gets stuck .. ?

Server logs the following for the same session (login + PUT foo.bin):

2017/05/25 20:52:49 53969ae8352a3308d6cb  Connection Established
2017/05/25 20:52:49 53969ae8352a3308d6cb < 220 Welcome msg
2017/05/25 20:52:49 53969ae8352a3308d6cb > USER asd
2017/05/25 20:52:49 53969ae8352a3308d6cb < 331 User name ok, password required
2017/05/25 20:52:49 53969ae8352a3308d6cb > PASS ****
2017/05/25 20:52:49 53969ae8352a3308d6cb < 230 Password ok, continue
2017/05/25 20:52:49 53969ae8352a3308d6cb > PWD 
2017/05/25 20:52:49 53969ae8352a3308d6cb < 257 "/" is the current directory
2017/05/25 20:52:49 53969ae8352a3308d6cb > FEAT 
2017/05/25 20:52:49 53969ae8352a3308d6cb < 211 211-Extensions supported:
 EPSV
 EPRT
211 END
2017/05/25 20:52:49 53969ae8352a3308d6cb > HELP SITE
2017/05/25 20:52:49 53969ae8352a3308d6cb < 500 Command not found
2017/05/25 20:52:49 53969ae8352a3308d6cb > CLNT NcFTP 3.2.6 macosx10.12.2
2017/05/25 20:52:49 53969ae8352a3308d6cb < 500 Command not found
2017/05/25 20:52:58 53969ae8352a3308d6cb > TYPE I
2017/05/25 20:52:58 53969ae8352a3308d6cb < 200 Type set to binary
2017/05/25 20:52:58 53969ae8352a3308d6cb > REST 1
2017/05/25 20:52:58 53969ae8352a3308d6cb < 350 Start transfer from 1
2017/05/25 20:52:58 53969ae8352a3308d6cb > MLST foo.bin
2017/05/25 20:52:58 53969ae8352a3308d6cb < 500 Command not found
2017/05/25 20:52:58 53969ae8352a3308d6cb > SIZE foo.bin
2017/05/25 20:52:58 53969ae8352a3308d6cb < 213 0
2017/05/25 20:52:58 53969ae8352a3308d6cb > MDTM foo.bin
2017/05/25 20:52:58 53969ae8352a3308d6cb < 213 20170101000000
2017/05/25 20:52:58 53969ae8352a3308d6cb > PASV 
2017/05/25 20:52:58 53969ae8352a3308d6cb < 227 Entering Passive Mode (127,0,0,1:8021,31,86)
2017/05/25 20:52:58 53969ae8352a3308d6cb > PORT 127,0,0,1,219,236
2017/05/25 20:52:58 53969ae8352a3308d6cb  Opening active data connection to 127.0.0.1:56300
2017/05/25 20:52:58 53969ae8352a3308d6cb < 200 Connection established (56300)
2017/05/25 20:52:58 53969ae8352a3308d6cb > STOR foo.bin
2017/05/25 20:52:58 53969ae8352a3308d6cb < 150 Data transfer starting
2017/05/25 20:52:58 53969ae8352a3308d6cb < 226 OK, received 10006420 bytes

Looks to me like the passive mode connection is not being set up properly? Instead it seems to be using active mode and opening a socket towards the client?

I am running it on a 64-bit OSX PC (Macbook Pro) with Go 1.8.1. This is how I create my server:

	opts := &ftpd.ServerOpts{
		Factory:        &MyDriverFactory{},
		Auth:           &MyAuth{server: s},
		Port:           port,
		PublicIp:       "127.0.0.1",
		PassivePorts:   "8022-8023",
		WelcomeMessage: "Welcome msg",
	}
	server := ftpd.NewServer(opts)

.. could just be my FTP skills are incredibly rusty.

@lunny
Copy link
Member

lunny commented May 26, 2017

I haven't tested ncftp, I have tested Transmit & chrome browser on macOS, both are work. You can visit http://github.com/goftp/ftpd to find the example

@matti777
Copy link
Author

Hmm ok. I also tried OSX's "native" command line ftp utility and could not make that work at all either. I'm trying to build a kind of an in-memory Driver which would later on perhaps later actually do something with the data, but for now I'm just trying to figure out how to make things work with (any) FTP client.

Any idea why the passive mode setup doesnt seem to work?

@matti777
Copy link
Author

Also, could you please perhaps test it with NcFTP which has been the de facto FTP client cli for over a decade?

@matti777
Copy link
Author

And when I try to do the same with the OSX's 'native' ftp cli, the following happens (im logging in and trying to do ls / dir):

[matti@babylon tmp] 09:37:27 % ftp localhost 8021
Trying ::1...
Connected to localhost.
220 Welcome msg
Name (localhost:matti): asd
331 User name ok, password required
Password: 
230 Password ok, continue
Remote system type is UNIX.
Using binary mode to transfer files.
ftp> ls
211 END
Passive mode address scan failure. Shouldn't happen!
ftp> dir
257 "/" is the current directory
parse error!
ftp> 

And the server output is:

2017/05/26 09:37:29 0fed8c5ea7530be039f0  Connection Established
2017/05/26 09:37:29 0fed8c5ea7530be039f0 < 220 Welcome msg
2017/05/26 09:37:32 0fed8c5ea7530be039f0 > USER asd
2017/05/26 09:37:32 0fed8c5ea7530be039f0 < 331 User name ok, password required
2017/05/26 09:37:33 0fed8c5ea7530be039f0 > PASS ****
2017/05/26 09:37:33 0fed8c5ea7530be039f0 < 230 Password ok, continue
2017/05/26 09:37:33 0fed8c5ea7530be039f0 > SYST 
2017/05/26 09:37:33 0fed8c5ea7530be039f0 < 215 UNIX Type: L8
2017/05/26 09:37:33 0fed8c5ea7530be039f0 > FEAT 
2017/05/26 09:37:33 0fed8c5ea7530be039f0 < 211 211-Extensions supported:
 EPRT
 EPSV
211 END
2017/05/26 09:37:33 0fed8c5ea7530be039f0 > PWD 
2017/05/26 09:37:33 0fed8c5ea7530be039f0 < 257 "/" is the current directory
2017/05/26 09:37:35 0fed8c5ea7530be039f0 > EPSV 
2017/05/26 09:37:35 0fed8c5ea7530be039f0 < 425 Data connection failed
2017/05/26 09:37:35 0fed8c5ea7530be039f0 > LPSV 
2017/05/26 09:37:35 0fed8c5ea7530be039f0 < 500 Command not found
2017/05/26 09:37:36 0fed8c5ea7530be039f0 > EPSV 
2017/05/26 09:37:36 0fed8c5ea7530be039f0 < 425 Data connection failed
  • Matti

@lunny
Copy link
Member

lunny commented May 26, 2017

It seems command EPSV is failed and LPSV is not supported.

@matti777
Copy link
Author

To me it appears your implementation for PASV mode is broken; I could not get this to work with any of the 4 clients I tried.

I did get the PORT mode to work on one, though. This however is not suitable to my needs.

@lunny lunny added the bug label May 26, 2017
@lunny lunny added this to the 0.3 milestone May 26, 2017
@lunny
Copy link
Member

lunny commented Jun 13, 2017

closed by #28

@lunny lunny closed this as completed Jun 13, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants