vsftpd - GnuTLS 错误 -15:收到了意外的 TLS 数据包

vsftpd - GnuTLS 错误 -15:收到了意外的 TLS 数据包

当我尝试连接到 filezila 上的 ftp 服务器时,如何修复此错误:

GnuTLS error -15: An unexpected TLS packet was received.

sublime ftpsync 插件出现以下错误:

ssl.SSLError: [SSL: WRONG_VERSION_NUMBER] wrong version number (_ssl.c:1515)

这是我的 vsftpd 设置:

listen=YES
anonymous_enable=NO
local_enable=YES
write_enable=YES
local_umask=022
nopriv_user=vsftpd
virtual_use_local_privs=YES
guest_enable=YES
user_sub_token=$USER
local_root=/var/www/$USER
chroot_local_user=YES
hide_ids=YES
guest_username=vsftpd

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

ssl_tlsv1=YES
ssl_sslv2=NO
ssl_sslv3=NO

require_ssl_reuse=NO
ssl_ciphers=HIGH

答案1

我尝试在配置文件中添加一行。在此处打开配置:

sudo nano /etc/vsftpd.conf

并将此行放在底部:

allow_writeable_chroot=YES

然后重启服务:

sudo service vsftpd restart

这帮我修复了这个问题。

答案2

您可能遇到了与 SSL 无关的错误。

  1. 尝试停用 SSL ( ssl_enable=NO)
  2. 连接您最喜欢的 FTP 客户端。

那么您可能会看到真正的错误。

这就是为什么 Francisc IB 答案与 SSL 无关的原因。

答案3

我遇到了同样的问题。另一个帖子建议不要设置允许写入_chroot=是出于安全原因,即减轻“咆哮的野兽袭击”。

环境允许写入_chroot=是意味着 vsftpd 应该允许用户的主目录可由该用户写入的情况。出于安全原因,我将用户根文件夹的权限从 777 更改为 555。

原始:drwxrwxrwx /home/ftpuser/

更改为:dr-xr-xr-x /home/ftpuser/

这使得用户的主目录不可由用户写入,因此我不必使用允许写入_chroot=是参数。这对于我的情况来说很好(并且更安全),因为我有一个预设的目录结构,并且无论如何都不希望用户在其根文件夹中创建新文件或目录。

当我将主目录切换到时,我发现了这一点/var/ftp通过local_root=[路径]参数 vsftpd 并且它无需设置就可以工作允许写入_chroot=是。此文件夹 /var/ftp 为 (755) 但归 root 所有,因此 ftpuser 不可写入。

答案4

我发现了很多令人困惑的答案。我将发布一个

/etc/vsftpd.conf

2019-09-04,我在 Ubuntu 18.04 上使用 fileZilla 作为客户端,运行完美。FTPS 部署在 EC2 实例中,该实例受非常严格的安全组监管,仅允许特定的公共 IPS 访问。

# FTPS Shim TLS configuration /etc/vsftpd.conf
# Run standalone?  vsftpd can run either from an inetd or as a standalone
# daemon started from an initscript.
# This directive enables listening on IPv6 sockets. By default, listening
# on the IPv6 "any" address (::) will accept connections from both IPv6
# and IPv4 clients. It is not necessary to listen on *both* IPv4 and IPv6
# sockets. If you want that (perhaps because you want to listen on specific
# addresses) then you must run two copies of vsftpd with two configuration
# files.
listen=YES
# Make sure PORT transfer connections originate from port 20 (ftp-data).
connect_from_port_20=NO
listen_port=38250
ftp_data_port=38255
# Allow anonymous FTP? (Disabled by default).
anonymous_enable=NO
# Uncomment this to allow local users to log in.
local_enable=YES
# Default umask for local users is 077. You may wish to change this to 022,
# if your users expect that (022 is used by most other ftpd's)
local_umask=022
# Activate directory messages - messages given to remote users when they
# go into a certain directory.
dirmessage_enable=YES
# If enabled, vsftpd will display directory listings with the time
# in  your  local  time  zone.  The default is to display GMT. The
# times returned by the MDTM FTP command are also affected by this
# option.
use_localtime=YES
# 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
# You may override where the log file goes if you like. The default is shown below.
xferlog_file=/var/log/vsftpd.log
log_ftp_protocol=YES
debug_ssl=YES
# You may change the default value for timing out an idle session.
idle_session_timeout=600
# You may change the default value for timing out a data connection.
data_connection_timeout=120
# You may fully customise the login banner string:
ftpd_banner=Welcome to Read-Only FTPS Shim service.
# You may restrict local users to their home directories.  See the FAQ for
# the possible risks in this before using chroot_local_user or
# chroot_list_enable below.
chroot_local_user=YES
allow_writeable_chroot=YES
# This option should be the name of a directory which is empty.  Also, the
# directory should not be writable by the ftp user. This directory is used
# as a secure chroot() jail at times vsftpd does not require filesystem
# access.
secure_chroot_dir=/var/run/vsftpd/empty
# This string is the name of the PAM service vsftpd will use.
pam_service_name=ftp
# FTPS Passive Mode. -Define port range for passive mode connections
pasv_enable=Yes
pasv_min_port=10100
pasv_max_port=10110
ssl_enable=YES
# force client to use TLS when logging in
allow_anon_ssl=NO
force_local_data_ssl=YES
force_local_logins_ssl=YES
ssl_tlsv1=YES
ssl_sslv2=NO
ssl_sslv3=NO
require_ssl_reuse=NO
ssl_ciphers=HIGH
# specify TSL certificate/private key
rsa_cert_file=/etc/ssl/certs/fullchain.pem
rsa_private_key_file=/etc/ssl/private/privkey.pem
force_local_logins_ssl=YES
force_anon_logins_ssl=YES
# Uncomment this to indicate that vsftpd use a utf8 filesystem.
utf8_filesystem=YES
# Users
userlist_enable=YES
userlist_file=/etc/vsftpd.user_list
userlist_deny=NO

相关内容