FTP-сервер через SOCKS5 Proxy можно перечислить только с Firefox, без FTP-клиентов

2655
jolivier

Я пытаюсь получить папку с FTP-сервера, к которому я подключаюсь через прокси-сервер SOCKS5 (ssh -D). При настройке Firefox (v20, v22) для использования прокси-сервера SOCKS5 я могу без проблем изучить содержимое сервера ftp. Однако мне нужно скачать папку с большим количеством контента, а пользовательский интерфейс Firefox обеспечивает загрузку только одного файла, что в этой ситуации болезненно. Поэтому я пытаюсь подключиться к этому ftp-серверу с помощью filezilla, используя пассивный режим, и все работает нормально, пока filezilla не выдаст команду MLSD, в этот момент ftp-сервер не отвечает.

Status: Connecting to XXX through proxy Status: Connecting to 127.0.0.1:9999... Status: Connection with proxy established, performing handshake... Status: Connection established, waiting for welcome message... Response: 220 ProFTPD 1.3.4a Server (TiNT) [::X] Command: USER anonymous Response: 331 Authentification anonyme OK, envoyez votre adresse de courriel complète comme mot de passe Command: PASS ************** Response: 230 Accès anonyme autorisé, application des restrictions Command: SYST Response: 215 UNIX Type: L8 Command: FEAT Response: 211-Features: Response: LANG fr-FR.UTF-8*;fr-FR Response: MDTM Response: MFMT Response: TVFS Response: UTF8 Response: MFF modify;UNIX.group;UNIX.mode; Response: MLST modify*;perm*;size*;type*;unique*;UNIX.group*;UNIX.mode*;UNIX.owner*; Response: SITE MKDIR Response: SITE RMDIR Response: SITE UTIME Response: SITE SYMLINK Response: REST STREAM Response: SITE COPY Response: SIZE Response: 211 Fin Command: OPTS UTF8 ON Response: 200 UTF-8 activé Status: Connected Status: Retrieving directory listing... Command: CWD Y Response: 250 Commande CWD exécutée avec succès Command: PWD Response: 257 Y" est le répertoire courant Command: TYPE I Response: 200 Type paramétré à I Command: PASV Response: 227 Entering Passive Mode (X,224,74). Command: MLSD Status: Connecting to 127.0.0.1:9999... Status: Connection with proxy established, performing handshake... Error: Connection timed out Error: Failed to retrieve directory listing 

Обнюхивая firefox с помощью wireshark, я сказал, что firefox использует LIST вместо MLSD в качестве первой команды, но я не смог найти специализированный анализатор ftp-клиентов, дающий мне чистый список команд, используемых firefox, и я не знаю, на что обратить внимание в wireshark.

Любые идеи о том, как заставить filezilla работать? На что посмотреть в wireshark, чтобы попытаться понять разницу в поведении firefox и filezilla?

(Я не являюсь администратором ftp-сервера, поэтому не вижу его журналов и не изменяю его конфигурацию. Этот ftp-сервер находится в той же подсети, что и компьютер, на котором я использую ssh -D.

0

1 ответ на вопрос

0
Shi

You should check if Firefox uses active mode (PORT) or passive mode (PASV). It should be PASV as well as if PORT is used, the data connection will likely be done outside the proxy connection.

In the given example, the server/proxy replied to PASV with X,224,74 which translates to X:57418 (224 * 256 + 74). You should check that the connection through the proxy is properly forwarded, so you should see a connection request to X, port 57418 from the other end of the proxy/tunnel - you can check with tcpdump on that end.

The only difference between LIST and MLSD is the directory list formatting. LIST basically is free-form text which is a pain to parse whereas MLSD is a well-defined format which is suited to machine parsing.

I did a local test, by running ssh -D 12345 localhost and configuring a generic proxy on localhost port 12345 in FileZilla 3.5.3 (pretty old version). Connecting to ftp.kernel.org just works.

Status: Connecting to 127.0.0.1:12345... Status: Connection with proxy established, performing handshake... Status: Connection established, waiting for welcome message... Response: 220 Welcome to kernel.org Command: USER anonymous Response: 331 Please specify the password. Command: PASS ************** Response: 230 Login successful. Command: SYST Response: 215 UNIX Type: L8 Command: FEAT Response: 211-Features: Response: EPRT Response: EPSV Response: MDTM Response: PASV Response: REST STREAM Response: SIZE Response: TVFS Response: UTF8 Response: 211 End Command: OPTS UTF8 ON Response: 200 Always in UTF8 mode. Status: Connected Status: Retrieving directory listing... Command: CWD /pub Response: 250 Directory successfully changed. Command: PWD Response: 257 "/pub" Command: TYPE I Response: 200 Switching to Binary mode. Command: PASV Response: 227 Entering Passive Mode (198,145,20,140,120,140). Command: LIST Status: Connecting to 127.0.0.1:12345... Status: Connection with proxy established, performing handshake... Response: 150 Here comes the directory listing. Response: 226 Directory send OK. Status: Directory listing successful