Skip to content
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

Can't use FileZilla Client under macOS, Can't download file from chrome. #74

Closed
nifflin opened this issue Mar 9, 2018 · 6 comments
Closed

Comments

@nifflin
Copy link

nifflin commented Mar 9, 2018

I compile and run the main.go with latest golang under latest macOS version.
FileZilla can't list dir after auth.
Chrome can list dir but can't download file.

@fclairamb
Copy link
Owner

fclairamb commented Mar 9, 2018

I just tested it and it seems to work fine:
image

Can you give more details ?

@nifflin
Copy link
Author

nifflin commented Mar 10, 2018

filezilla version: 3.31.0
macOS version: 10.13.3
compile and run param is default

Terminal logs:

level=debug ts=2018-03-10T01:24:26.392273Z caller=sample_driver.go:77 component=driver msg="Fetching our external IP address..."
level=debug ts=2018-03-10T01:24:26.98076Z caller=sample_driver.go:81 component=driver msg="Fetched our external IP address" ipAddress=36.149.204.189
level=info ts=2018-03-10T01:24:26.981025Z caller=server.go:132 component=server msg=Listening... action=ftp.listening address=[::]:2121
level=info ts=2018-03-10T01:24:26.981103Z caller=server.go:158 component=server msg=Starting... action=ftp.starting
level=info ts=2018-03-10T01:24:32.611071Z caller=server.go:198 component=server clientId=1 msg="FTP Client connected" action=ftp.connected clientIp=127.0.0.1:53236
level=debug ts=2018-03-10T01:24:32.611127Z caller=client_handler.go:194 component=server clientId=1 msg="FTP SEND" action=ftp.cmd_send line="220 Welcome on ftpserver, you're on dir /var/folders/rn/jqhb880175ng7mv28ld55fcw0000gn/T/ftpserver087115208, your ID is 1, your IP:port is 127.0.0.1:53236, we currently have 1 clients connected"
level=debug ts=2018-03-10T01:24:32.611253Z caller=client_handler.go:159 component=server clientId=1 msg="FTP RECV" action=ftp.cmd_recv line="AUTH TLS\r\n"
level=info ts=2018-03-10T01:24:32.61128Z caller=sample_driver.go:96 component=driver msg="Loading certificate"
level=info ts=2018-03-10T01:24:32.611293Z caller=sample_driver.go:113 component=driver msg="Creating certificate"
level=debug ts=2018-03-10T01:24:32.770226Z caller=client_handler.go:194 component=server clientId=1 msg="FTP SEND" action=ftp.cmd_send line="234 AUTH command ok. Expecting TLS Negotiation."
level=debug ts=2018-03-10T01:24:34.002522Z caller=client_handler.go:159 component=server clientId=1 msg="FTP RECV" action=ftp.cmd_recv line="USER test\r\n"
level=debug ts=2018-03-10T01:24:34.00258Z caller=client_handler.go:194 component=server clientId=1 msg="FTP SEND" action=ftp.cmd_send line="331 OK"
level=debug ts=2018-03-10T01:24:34.002843Z caller=client_handler.go:159 component=server clientId=1 msg="FTP RECV" action=ftp.cmd_recv line="PASS test\r\n"
level=debug ts=2018-03-10T01:24:34.00303Z caller=client_handler.go:194 component=server clientId=1 msg="FTP SEND" action=ftp.cmd_send line="230 Password ok, continue"
level=debug ts=2018-03-10T01:24:34.003187Z caller=client_handler.go:159 component=server clientId=1 msg="FTP RECV" action=ftp.cmd_recv line="OPTS UTF8 ON\r\n"
level=debug ts=2018-03-10T01:24:34.003217Z caller=client_handler.go:194 component=server clientId=1 msg="FTP SEND" action=ftp.cmd_send line="200 I'm in UTF8 only anyway"
level=debug ts=2018-03-10T01:24:34.003349Z caller=client_handler.go:159 component=server clientId=1 msg="FTP RECV" action=ftp.cmd_recv line="PBSZ 0\r\n"
level=debug ts=2018-03-10T01:24:34.017579Z caller=client_handler.go:194 component=server clientId=1 msg="FTP SEND" action=ftp.cmd_send line="200 Whatever"
level=debug ts=2018-03-10T01:24:34.017794Z caller=client_handler.go:159 component=server clientId=1 msg="FTP RECV" action=ftp.cmd_recv line="PROT P\r\n"
level=debug ts=2018-03-10T01:24:34.01782Z caller=client_handler.go:194 component=server clientId=1 msg="FTP SEND" action=ftp.cmd_send line="200 OK"
level=debug ts=2018-03-10T01:24:34.026368Z caller=client_handler.go:159 component=server clientId=1 msg="FTP RECV" action=ftp.cmd_recv line="PWD\r\n"
level=debug ts=2018-03-10T01:24:34.026428Z caller=client_handler.go:194 component=server clientId=1 msg="FTP SEND" action=ftp.cmd_send line="257 \"/\" is the current directory"
level=debug ts=2018-03-10T01:24:34.027145Z caller=client_handler.go:159 component=server clientId=1 msg="FTP RECV" action=ftp.cmd_recv line="TYPE I\r\n"
level=debug ts=2018-03-10T01:24:34.062415Z caller=client_handler.go:194 component=server clientId=1 msg="FTP SEND" action=ftp.cmd_send line="200 Type set to binary"
level=debug ts=2018-03-10T01:24:34.062609Z caller=client_handler.go:159 component=server clientId=1 msg="FTP RECV" action=ftp.cmd_recv line="PASV\r\n"
level=debug ts=2018-03-10T01:24:34.062702Z caller=client_handler.go:194 component=server clientId=1 msg="FTP SEND" action=ftp.cmd_send line="227 Entering Passive Mode (36,149,204,189,8,97)"
level=debug ts=2018-03-10T01:24:34.063016Z caller=client_handler.go:159 component=server clientId=1 msg="FTP RECV" action=ftp.cmd_recv line="MLSD\r\n"
level=debug ts=2018-03-10T01:24:34.06313Z caller=client_handler.go:194 component=server clientId=1 msg="FTP SEND" action=ftp.cmd_send line="150 Using transfer connection"
level=info ts=2018-03-10T01:24:54.147999Z caller=server.go:198 component=server clientId=2 msg="FTP Client connected" action=ftp.connected clientIp=127.0.0.1:53244
level=debug ts=2018-03-10T01:24:54.148066Z caller=client_handler.go:194 component=server clientId=2 msg="FTP SEND" action=ftp.cmd_send line="220 Welcome on ftpserver, you're on dir /var/folders/rn/jqhb880175ng7mv28ld55fcw0000gn/T/ftpserver087115208, your ID is 2, your IP:port is 127.0.0.1:53244, we currently have 2 clients connected"
level=debug ts=2018-03-10T01:24:54.148186Z caller=client_handler.go:159 component=server clientId=2 msg="FTP RECV" action=ftp.cmd_recv line="AUTH TLS\r\n"
level=debug ts=2018-03-10T01:24:54.148209Z caller=client_handler.go:194 component=server clientId=2 msg="FTP SEND" action=ftp.cmd_send line="234 AUTH command ok. Expecting TLS Negotiation."

In filezilla GUI:
It is blocked in reading dir list, then timeout and retry.

@asv
Copy link
Collaborator

asv commented Mar 11, 2018

@fclairamb In sample_driver there is no handler for /virtual/file2.txt, so sample server tries to find it in BaseDir (temporary-folder/shared). Does not find it there and returns an error, which is observed @nifflerfox

@pyama86
Copy link

pyama86 commented Mar 11, 2018

After that it seems to behave like this when the directory is empty.

func (driver *ClientDriver) ListFiles(cc server.ClientContext) ([]os.FileInfo, error) {
	path := driver.BaseDir + cc.Path()
	files, err := ioutil.ReadDir(path)
	if err != nil {
		return nil, err
	}
	files = append(files, virtualFileInfo{
		name: ".",
		mode: os.FileMode(0666) | os.ModeDir,
		size: 4096,
	})
	return files, err
}

You can suppress it if there is a current directory object like this

@ohko
Copy link

ohko commented Mar 15, 2018

@nifflerfox you use "127.0.0.1", but @fclairamb use "localhost"
i have same error, change to "localhost" is ok!
please fix this bug, @fclairamb

@fclairamb
Copy link
Owner

I don't think we can consider it as a bug, but we can still fix it.

Not a bug

Explanation

When you connect to localhost, on all modern systems you're in IPv6 and FileZilla opens the passive connection with the ESPV command, the server replies only with a port (the target host stays the same).
When you connect to 127.0.0.1, you're on IPv4 and FileZilla opens the passive connection with the PASV command, the server replies with an IP and port. But in our case, the replied IP is the external one.

Examples

localhost --> ESPV

action=ftp.cmd_recv line="EPSV\r\n"
action=ftp.cmd_send line="229 Entering Extended Passive Mode (|||2145|)"

127.0.0.1 --> PASV

action=ftp.cmd_recv line="PASV\r\n"
action=ftp.cmd_send line="227 Entering Passive Mode (176,175,130,7,8,97)"

Still... Not cool

As it breaks the tests people are performing on the server.

The fix

With #53, we have the ability to declare a dynamic IP resolver to change the target IP address depending on the client. So what we can do is that all the loopback clients can have a loopback server address.
So I'll create a fix for that.

fclairamb pushed a commit that referenced this issue Aug 23, 2018
This fixes the issue #74.
fclairamb added a commit that referenced this issue Oct 14, 2018
Issue #74: Loopback clients handling
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants