VSFTPD FileZilla GnuTLS 错误 -15(收到了意外的 TLS 数据包)

Sar*_*ger 7 ftp centos vsftpd filezilla gnutls

我同时设置了两个新的 CentOS 7 机器,所以配置应该是相同的,只是 IP 地址和主机名不同。

我安装了 VSFTPD 并配置了被动端口。一个盒子连接正常,没有问题,但是第二个盒子不断向我抛出这个错误:

GnuTLS error -15: An unexpected TLS packet was received.
Run Code Online (Sandbox Code Playgroud)

这是调试 FileZilla 跟踪:

Status: Connecting to 192.168.20.68:21...
Status: Connection established, waiting for welcome message...
Trace:  CFtpControlSocket::OnReceive()
Response:   220 (vsFTPd 3.0.2)
Trace:  CFtpControlSocket::SendNextCommand()
Command:    AUTH TLS
Trace:  CFtpControlSocket::OnReceive()
Response:   234 Proceed with negotiation.
Status: Initializing TLS...
Trace:  CTlsSocket::Handshake()
Trace:  CTlsSocket::ContinueHandshake()
Trace:  CTlsSocket::OnSend()
Trace:  CTlsSocket::OnRead()
Trace:  CTlsSocket::ContinueHandshake()
Trace:  CTlsSocket::OnRead()
Trace:  CTlsSocket::ContinueHandshake()
Trace:  CTlsSocket::OnRead()
Trace:  CTlsSocket::ContinueHandshake()
Trace:  TLS Handshake successful
Trace:  Protocol: TLS1.2, Key exchange: ECDHE-RSA, Cipher: AES-256-GCM, MAC: AEAD
Status: Verifying certificate...
Status: TLS connection established.
Trace:  CFtpControlSocket::SendNextCommand()
Command:    USER datamover
Trace:  CTlsSocket::OnRead()
Trace:  CFtpControlSocket::OnReceive()
Response:   331 Please specify the password.
Trace:  CFtpControlSocket::SendNextCommand()
Command:    PASS *******
Trace:  CTlsSocket::OnRead()
Trace:  CTlsSocket::Failure(-15)
Error:  GnuTLS error -15: An unexpected TLS packet was received.
Trace:  CRealControlSocket::OnClose(106)
Trace:  CControlSocket::DoClose(64)
Trace:  CFtpControlSocket::ResetOperation(66)
Trace:  CControlSocket::ResetOperation(66)
Error:  Could not connect to server
Run Code Online (Sandbox Code Playgroud)

在密码检查之后错误总是正确的。

我知道问题不是 SELinux,因为我禁用了它。问题也不在于防火墙,因为我尝试禁用防火墙守护程序 (firewalld)。

这是 /etc/vsftpd/vsftpd.conf 文件的相关部分。

listen=YES
listen_ipv6=NO
pasv_enable=YES
pasv_max_port=10100
pasv_min_port=10090
pasv_address=192.168.20.88

ssl_enable=YES
allow_anon_ssl=NO
force_local_data_ssl=YES
force_local_logins_ssl=YES
ssl_tlsv1=YES
ssl_sslv2=NO
ssl_sslv3=NO
ssl_ciphers=HIGH
require_ssl_reuse=NO

rsa_cert_file=/etc/ssl/private/vsftpd.pem
rsa_private_key_file=/etc/ssl/private/vsftpd.pem
Run Code Online (Sandbox Code Playgroud)

我进行了 Google 搜索,但没有看到任何 15 个错误代码。

想法?

小智 10

我在 CENTOS 7 中的 PASS 命令后遇到了同样的错误。(GnuTLS 错误 -15:收到了意外的 TLS 数据包。)

我的解决方案如下:

我必须在 vsftpd.conf 中添加以下内容:

allow_writeable_chroot=YES

chroot_local_user=YES 
local_root=/ftphome/$USER 
user_sub_token=$USER
Run Code Online (Sandbox Code Playgroud)


Sar*_*ger 5

我发布这个答案是希望它可以帮助将来的某人,可能是我,因为我在解决这个问题时遇到了困难。

我没有local_root/etc/vsftpd/vsftpd.conf文件中正确设置。该设置指向一个不存在的文件夹。

通过我的观察,我看到 FileZilla 中的密码命令失败,所以我认为它不喜欢该密码。让我朝着正确方向思考的原因是我花时间研究为什么我没有收到详细的日志。我没有收到任何日志。当我开始接收调试日志时,我在其中看到了 FTP 协议,我看到 FTP 服务器对密码表示“OK”。遗憾的是,没有任何类型的日志记录,但我想到协商本地根将是验证密码后的下一步行动。我是对的,这导致了我的问题。

这是文件中的代码片段/etc/vsftpd/vsftpd.conf,包含本地根目录。

# 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().
# (Warning! chroot'ing can be very dangerous. If using chroot, make sure that
# the user does not have write access to the top level directory within the
# chroot)
chroot_local_user=YES
#local_root=/mnt/raid1
local_root=/ftproot
#chroot_list_enable=YES
# (default follows)
#chroot_list_file=/etc/vsftpd/chroot_list
Run Code Online (Sandbox Code Playgroud)

以下是我最终打开详细日志记录的方法,不过我现在将其关闭以节省磁盘空间并提高性能。

# Activate logging of uploads/downloads.
xferlog_enable=YES
#
# If you want, you can have your log file in standard ftpd xferlog format.
# Note that the default log file location is /var/log/xferlog in this case.
xferlog_std_format=NO
log_ftp_protocol=YES
#
# Activate logging of uploads/downloads.
xferlog_enable=YES
Run Code Online (Sandbox Code Playgroud)

恕我直言,我认为该评论是一个错误,因为 xferlog_enable 不仅仅是文件的实际上传和下载。此属性还打开日志记录。谷歌的一项研究证明,这log_ftp_protocol=YES需要xferlog_enable=YES.