라우터를 통해 FTP에 연결하는 중 오류가 발생했습니다.

라우터를 통해 FTP에 연결하는 중 오류가 발생했습니다.

Docker 컨테이너에 vsftpd를 설정했는데 LAN 내에서 filezilla 클라이언트에 연결할 때 모든 것이 괜찮아 보입니다. 그러나 LAN 외부에서 동일한 작업을 수행하려고 하면 다음 오류가 발생합니다.

Status: Disconnected from server
Status: Resolving address of mysite.com
Status: Connecting to 123.123.123.123:21...
Status: Connection established, waiting for welcome message...
Status: Initializing TLS...
Status: Verifying certificate...
Status: TLS connection established.
Status: Logged in
Status: Retrieving directory listing...
Command:    PWD
Response:   257 "/"
Command:    TYPE I
Response:   200 Switching to Binary mode.
Command:    PASV
Response:   550 Permission denied.
Command:    PORT 192,168,1,18,237,37
Response:   500 Illegal PORT command.
Error:  Failed to retrieve directory listing

vsftpd.conf 파일에 따르면 라우터에 필요한 모든 포트(20-21 및 21100-21110)가 열려 있다고 생각합니다.

[root@0e69f6d47359 /]# vim /etc/vsftpd/vsftpd.conf
# Run in the foreground to keep the container running:
background=NO

# Allow anonymous FTP? (Beware - allowed by default if you comment this out).
anonymous_enable=NO

# Uncomment this to allow local users to log in.
local_enable=YES

## Enable virtual users
guest_enable=YES

## Virtual users will use the same permissions as anonymous
virtual_use_local_privs=YES

# Uncomment this to enable any form of FTP write command.
write_enable=YES

## PAM file name
pam_service_name=vsftpd_virtual

## Home Directory for virtual users
user_sub_token=$USER
local_root=/home/vsftpd/$USER

# You may specify an explicit list of local users to chroot() to their home
# directory. If chroot_local_user is YES, then this list becomes a list of
# users to NOT chroot().
chroot_local_user=YES

# Workaround chroot check.
# See https://www.benscobie.com/fixing-500-oops-vsftpd-refusing-to-run-with-writable-root-inside-chroot/
# and http://serverfault.com/questions/362619/why-is-the-chroot-local-user-of-vsftpd-insecure
allow_writeable_chroot=YES

## Hide ids from user
hide_ids=YES

## Set passive port address
pasv_addr_resolve=NO

## Enable logging
#xferlog_enable=YES
xferlog_file=/var/log/vsftpd/vsftpd.log
log_ftp_protocol=YES

## Enable active mode
port_enable=YES
connect_from_port_20=YES
ftp_data_port=20

## Disable seccomp filter sanboxing
seccomp_sandbox=NO

## Enable passive mode
pasv_enable=NO

## Make secure, per https://www.digitalocean.com/community/tutorials/how-to-configure-vsftpd-to-use-ssl-tls-on-an-ubuntu-vps
rsa_cert_file=/etc/ssl/private/vsftpd.pem
rsa_private_key_file=/etc/ssl/private/vsftpd.pem
ssl_enable=YES
allow_anon_ssl=NO
force_local_data_ssl=YES
force_local_logins_ssl=YES

#After this we configure the server to use TLS, which is actually a successor to SSL, and preferred:
ssl_tlsv1=YES
ssl_sslv2=NO
ssl_sslv3=NO

#Finally, we will require add some additional options to flesh out our configuration file:
require_ssl_reuse=NO
ssl_ciphers=HIGH

pasv_address=127.0.0.1
pasv_max_port=21110
pasv_min_port=21100

...하지만 분명히 뭔가 문제가 있는데 무엇을 조정해야 할지 잘 모르겠습니다.

답변1

서버가 수동 모드를 완전히 거부하는 것 같습니다. 이 줄은 수동 모드와 관련하여 vsftpd.conf에 제공하는 유일한 구성 지시문입니까? 이 경우 pasv_enable=yes를 추가해야 합니다.

네트워크 토폴로지에 대한 힌트와 서버의 로그 및 작업 연결 시도(LAN 내부에서)가 매우 도움이 될 것입니다.

편집: conf 파일은 pasv_enable이 NO로 설정되어 있음을 명확하게 보여줍니다. 위에서 이미 말했듯이 이를 YES로 설정해야 합니다.

관련 정보