在 Debian 7.6 上配置并运行 vsftpd 2.3.5,使用 IPtables 和 fail2ban,并启用 ssl_enabled
我无法正确上传文件,因为上传几个文件后我收到以下错误:
Timeout
or
OOPS: priv_sock_get_cmd
这是我的 vsftpd.conf 的一部分
#passive mode
pasv_enable=YES
pasv_min_port=49192
pasv_max_port=50000
# Virtual Users Config
guest_enable=YES
guest_username=vsusers
user_config_dir=/etc/vsftpd/vusers
strict_ssl_read_eof=YES
download_enable=NO
force_dot_files=YES#
遵循我的 iptable 规则(在谷歌搜索后玩了一下,不知道它们是否正确)
# Allow FTP connections
-A INPUT -p tcp --dport 21 -m state --state NEW,ESTABLISHED -j ACCEPT
-A OUTPUT -p tcp --sport 21 -m state --state ESTABLISHED -j ACCEPT
-A INPUT -p tcp --dport 20 -m state --state NEW,ESTABLISHED,RELATED -j ACCEPT
-A OUTPUT -p tcp --sport 20 -m state --state ESTABLISHED -j ACCEPT
-A INPUT -p tcp -m tcp --dport 49192:50000 -j ACCEPT
我发现一些帖子谈论 IPTABLES_MODULES="ip_conntrack_ftp",但我的系统上没有 /etc/sysconfig!此外,以下命令将出错
sudo modprobe ip_conntrack_ftp
libkmod: ERROR ../libkmod/libkmod.c:554 kmod_search_moddep: could not open moddep file '/lib/modules/3.2.41-042stab092.2/modules.dep.bin'
modprobe nf_conntrack_ftp
libkmod: ERROR ../libkmod/libkmod.c:554 kmod_search_moddep: could not open moddep file '/lib/modules/3.2.41-042stab092.2/modules.dep.bin'
有什么提示该怎么做吗?
编辑:如果我更改 ssl_enable=NO,传输就可以正常工作...那么 SSL 有问题吗?无法使用 FileZilla 或 Cyberduck 上传
EDIT2:debug_ssl 引发以下错误
DEBUG: Client "79.221.104.18", "SSL version: TLSv1/SSLv3, SSL cipher: AES256-SHA, reused, no cert"
DEBUG: Client "79.221.104.18", "SSL shutdown state is: SSL_RECEIVED_SHUTDOWN"
DEBUG: Client "79.221.104.18", "SSL shutdown state is: 3"
EDIT3: vsftpd ssl 配置
#SSL
ssl_enable=YES
allow_anon_ssl=YES
force_local_data_ssl=YES
force_local_logins_ssl=YES
force_anon_logins_ssl=YES
ssl_tlsv1=YES
ssl_sslv2=NO
ssl_sslv3=YES
ssl_ciphers=HIGH
require_ssl_reuse=NO
EDIT4:端口处理似乎出了点问题?/proc/net/nf_conntrack 报告了以下 dport,我指定了 49192 到 50000
ipv4 2 tcp 6 111 TIME_WAIT src=**** dst=**** sport=50648 dport=49738 src=**** dst=**** sport=49738 dport=50648 [ASSURED] mark=0 secmark=0 use=2
ipv4 2 tcp 6 409189 ESTABLISHED src=**** dst=**** sport=49918 dport=21 [UNREPLIED] src=**** dst=**** sport=21 dport=49918 mark=0 secmark=0 use=2
ipv4 2 tcp 6 299 ESTABLISHED src=**** dst=**** sport=50756 dport=22 src=**** dst=**** sport=22 dport=50756 [ASSURED] mark=0 secmark=0 use=2
ipv4 2 tcp 6 409189 ESTABLISHED src=**** dst=**** sport=49899 dport=21 [UNREPLIED] src=**** dst=**** sport=21 dport=49899 mark=0 secmark=0 use=2
ipv4 2 tcp 6 409189 ESTABLISHED src=**** dst=**** sport=49916 dport=21 [UNREPLIED] src=**** dst=**** sport=21 dport=49916 mark=0 secmark=0 use=2
ipv4 2 tcp 6 118 TIME_WAIT src=**** dst=**** sport=50660 dport=49681 src=**** dst=**** sport=49681 dport=50660 [ASSURED] mark=0 secmark=0 use=2
答案1
您的内核模块有问题。您必须先解决 modprobe,然后才能解决 FTP 问题。您编译过内核吗?
答案2
如果仅在激活 SSL 时问题仍然存在,请尝试以下操作
#SSL
ssl_enable=YES
allow_anon_ssl=NO
force_local_data_ssl=YES
force_local_logins_ssl=YES
force_anon_logins_ssl=YES
ssl_tlsv1=YES
ssl_sslv2=NO
ssl_sslv3=NO
ssl_ciphers=HIGH
require_ssl_reuse=NO
否则设置
ssl_sslv2=YES
ssl_sslv3=YES