mickael-kerjean / filestash

🦄 A file manager / web client for SFTP, S3, FTP, WebDAV, Git, Minio, LDAP, CalDAV, CardDAV, Mysql, Backblaze, ...
https://www.filestash.app/
GNU Affero General Public License v3.0
10.64k stars 791 forks source link

[bug] vsftpd download issue #672

Open vincentDcmps opened 9 months ago

vincentDcmps commented 9 months ago

vsftpd download issue

When I use filestash witth vsftpd I can't download any file

log on filestash

2024/02/24 19:59:42 SYST DEBUG plg_backend_ftp::vacuum
2024/02/24 20:02:20 SYST DEBUG cat::backend 'unexpected LIST response: []'
2024/02/24 20:02:20 HTTP 500 GET 10266.2ms /api/files/cat?path=%2Fdownload%2F60%20Millions%20de%20consommateurs%20-%20HS%20-%2002-03.2024.pdf
2024/02/24 20:02:20 SYST DEBUG cat::backend 'unexpected LIST response: []'
2024/02/24 20:02:20 HTTP 500 GET 6715.7ms /api/files/cat?path=%2Fdownload%2F60%20Millions%20de%20consommateurs%20-%20HS%20-%2002-03.2024.pdf
2024/02/24 20:02:55 HTTP 200 GET    2.2ms /api/files/ls?path=%2Fdownload%2F
2024/02/24 20:04:42 SYST DEBUG plg_backend_ftp::vacuum

vsftpd log

Sat Feb 24 21:02:15 2024 [pid 3] [vincent] FTP response: Client "192.168.1.40", "211-Features:"
Sat Feb 24 21:02:15 2024 [pid 3] [vincent] FTP response: Client "192.168.1.40", " EPRT??"
Sat Feb 24 21:02:15 2024 [pid 3] [vincent] FTP response: Client "192.168.1.40", " EPSV??"
Sat Feb 24 21:02:15 2024 [pid 3] [vincent] FTP response: Client "192.168.1.40", " MDTM??"
Sat Feb 24 21:02:15 2024 [pid 3] [vincent] FTP response: Client "192.168.1.40", " PASV??"
Sat Feb 24 21:02:15 2024 [pid 3] [vincent] FTP response: Client "192.168.1.40", " REST STREAM??"
Sat Feb 24 21:02:15 2024 [pid 3] [vincent] FTP response: Client "192.168.1.40", " SIZE??"
Sat Feb 24 21:02:15 2024 [pid 3] [vincent] FTP response: Client "192.168.1.40", " TVFS??"
Sat Feb 24 21:02:15 2024 [pid 3] [vincent] FTP response: Client "192.168.1.40", " UTF8??"
Sat Feb 24 21:02:15 2024 [pid 3] [vincent] FTP response: Client "192.168.1.40", "211 End"
Sat Feb 24 21:02:15 2024 [pid 3] [vincent] FTP command: Client "192.168.1.40", "MLSD /"
Sat Feb 24 21:02:15 2024 [pid 3] [vincent] FTP response: Client "192.168.1.40", "500 Unknown command."
Sat Feb 24 21:02:15 2024 [pid 3] [vincent] FTP command: Client "192.168.1.40", "EPSV"
Sat Feb 24 21:02:15 2024 [pid 3] [vincent] FTP command: Client "192.168.1.40", "EPSV"
Sat Feb 24 21:02:15 2024 [pid 3] [vincent] FTP response: Client "192.168.1.40", "229 Entering Extended Passive Mode (|||54244|)"
Sat Feb 24 21:02:15 2024 [pid 3] [vincent] FTP response: Client "192.168.1.40", "229 Entering Extended Passive Mode (|||55209|)"
Sat Feb 24 21:02:15 2024 [pid 3] [vincent] FTP command: Client "192.168.1.40", "LIST /"
Sat Feb 24 21:02:15 2024 [pid 3] [vincent] FTP command: Client "192.168.1.40", "MLSD /"
Sat Feb 24 21:02:15 2024 [pid 3] [vincent] FTP response: Client "192.168.1.40", "500 Unknown command."
Sat Feb 24 21:02:15 2024 [pid 3] [vincent] FTP response: Client "192.168.1.40", "150 Here comes the directory listing."
Sat Feb 24 21:02:15 2024 [pid 3] [vincent] FTP command: Client "192.168.1.40", "EPSV"
Sat Feb 24 21:02:15 2024 [pid 3] [vincent] FTP response: Client "192.168.1.40", "229 Entering Extended Passive Mode (|||28429|)"
Sat Feb 24 21:02:15 2024 [pid 3] [vincent] FTP response: Client "192.168.1.40", "226 Directory send OK."
Sat Feb 24 21:02:15 2024 [pid 3] [vincent] FTP command: Client "192.168.1.40", "LIST /"
Sat Feb 24 21:02:15 2024 [pid 3] [vincent] FTP response: Client "192.168.1.40", "150 Here comes the directory listing."
Sat Feb 24 21:02:15 2024 [pid 3] [vincent] FTP response: Client "192.168.1.40", "226 Directory send OK."

vsftpd config

# Allow anonymous FTP? (Disabled by default)
anonymous_enable=NO
#
# Uncomment this to allow local users to log in.
local_enable=YES

write_enable=YES
dirmessage_enable=YES
use_localtime=YES
xferlog_enable=YES
connect_from_port_20=YES
chroot_local_user=YES
pam_service_name=vsftpd
local_root=/exports
seccomp_sandbox=NO
session_support=YES
vsftpd_log_file=/var/log/vsftpd.log
log_ftp_protocol=YES

other operation : create folder remove work correctly

Observed behavior

can't view or download file

Expected behavior

be able to download file

vincentDcmps commented 9 months ago

I have Try to list file directly via ftp command seem return some data

ftp> ls investir.pdf
200 PORT command successful. Consider using PASV.
150 Here comes the directory listing.
-rwxr--r--    1 1000001  1000001  10602241 Aug 10  2023 investir.pdf
226 Directory send OK.
Sat Feb 24 21:16:41 2024 [pid 3] [vincent] FTP response: Client "192.168.1.15", "200 PORT command successful. Consider using PASV."
Sat Feb 24 21:16:41 2024 [pid 3] [vincent] FTP command: Client "192.168.1.15", "LIST investir.pdf"
Sat Feb 24 21:16:41 2024 [pid 3] [vincent] FTP response: Client "192.168.1.15", "150 Here comes the directory listing."
Sat Feb 24 21:16:41 2024 [pid 3] [vincent] FTP response: Client "192.168.1.15", "226 Directory send OK."
vincentDcmps commented 9 months ago

seem provide from vsftpd

if I do

ls /download/investir.pdf

ftp> ls /download/investir.pdf
200 PORT command successful. Consider using PASV.
150 Here comes the directory listing.
226 Directory send OK.

if I go in the folder I get correct data with same command

ftp> cd download
250 Directory successfully changed.
ftp> ls /download/investir.pdf
200 PORT command successful. Consider using PASV.
150 Here comes the directory listing.
-rwxr--r--    1 1000001  1000001  10602241 Aug 10  2023 investir.pdf
226 Directory send OK.
vincentDcmps commented 9 months ago

seem that vsftp always use current path to stat some file, somebody have already use filestash with this ftp software?

kolserdav commented 7 months ago

I have the similar issue in Docker when is use ftp server https://hub.docker.com/r/delfer/alpine-ftp-server:

HTTP 500 GET  102.5ms /api/files/cat?path=%2Fftp%2Fusername%2F3GP%2FFILE001.3GP&transcode=hls
{"message": "Unexpected LIST response: []"}

Here is my compose file:

services:
  app:
    container_name: filestash
    image: machines/filestash
    restart: always
    environment:
    - APPLICATION_URL=
    - GDRIVE_CLIENT_ID=<gdrive_client>
    - GDRIVE_CLIENT_SECRET=<gdrive_secret>
    - DROPBOX_CLIENT_ID=<dropbox_key>
    - ONLYOFFICE_URL=http://onlyoffice
    ports:
    - "8334:8334"
    volumes:
    - filestash:/app/data/state/

  onlyoffice:
    container_name: filestash_oods
    image: onlyoffice/documentserver
    restart: always
    security_opt:
      - seccomp:unconfined

  alpine-ftp-server:
    image: delfer/alpine-ftp-server
    container_name: ftp
    restart: always
    ports:
      - "21:21"
      - 21000-21010:21000-21010
    environment:
      - USERS=one|strongpassword
      - ADDRESS=192.168.0.4
    volumes:
      - F:\Videos:/ftp/one

volumes:
    filestash: {}
kolserdav commented 7 months ago

My issue only occurs when I try to mount a btrfs drive running containers from Windows. And btrfs itself works in Windows under the control of this driver https://github.com/maharmstone/btrfs .

vincentDcmps commented 7 months ago

Hi from my side I meet this issue only with vsftp I have switched on pure-ftpd and everything works with it

kolserdav commented 7 months ago

Hi from my side I meet this issue only with vsftp I have switched on pure-ftpd and everything works with it

Thanks for your reply a lot, the pure-ftpd has resolved my issue.