VSFTP的PASSIVE模式的防火墙设置

简介:

XXX昨天,将DENY放在ACCEPT之前了。

然后,DROP的条目都生效了。

但同时,VSFTP服务的ACTIVE模式连上正常,但PASSIVE不能使用了。

只好再找方案来解决。

就是在/etc/sysconfig/iptables-config文件里加截模块IPTABLES_MODULES="ip_conntrack_ftp"

搞定。

http://balajitheone.blogspot.com/2011/09/opening-iptables-for-vsftpd.html

Opening IPtables for VSFTPD

 
While working with vsftpd configuring iptables is essential. It can be done as follows:


Here's the document I refer people to so that they can following the FTP protocol: http://slacksite.com/other/ftp.html
  • To do active-mode FTP, you need to allow incoming connections to TCP port 21 and outgoing connections from port 20.
  • To do passive-mode FTP, you need to allow incoming connections to TCP port 21 and incoming connections to a randomly-generated port on the server computer (necessitating using a conntrack module in netfilter)
You don't have anything re: your OUTPUT chain in your post, so I'll include that here, too. If your OUTPUT chain is default-drop then this matters.
Add these rules to your iptables configuration:
iptables -A INPUT -p tcp --dport 21 -j ACCEPT
iptables -A OUTPUT -p tcp --sport 20 -j ACCEPT
To support passive mode FTP, then, you need to load the ip_conntrack_ftp module on boot. Uncomment and modify the IPTABLES_MODULES line in the /etc/sysconfig/iptables-config file to read:
IPTABLES_MODULES="ip_conntrack_ftp"
Save the iptables config and restart iptables.
service iptables save
service iptables restart
To completely rule out VSFTPD as being a problem, stop VSFTPD, verify that it's not listening on port 21 with a "netstat -a" and then run a :
nc -l 21
This will start netcat listening on port 21 and will echo input to your shell. From another host, TELNET to port 21 of your server and verify that you get a TCP connection and that you see output in the shell when you type in the TELNET connection.
Finally, bring VSFTPD back up, verify that it is listening on port 21, and try to connect again. If the connection to netcat worked then your iptables rules are fine. If the connection to VSFTPD doesn't work after netcat does then something is wrong w/ your VSFTPD configuration
 
References:
目录
相关文章
|
10月前
|
网络协议 Linux 网络安全
Centos7 防火墙配置+端口设置
Centos7 防火墙配置+端口设置
216 0
Centos7 防火墙配置+端口设置
|
13天前
|
监控 网络协议 安全
【亮剑】当设备IP能ping通但无法上网时,可能是DNS解析、网关/路由设置、防火墙限制、网络配置错误或ISP问题
【4月更文挑战第30天】当设备IP能ping通但无法上网时,可能是DNS解析、网关/路由设置、防火墙限制、网络配置错误或ISP问题。解决步骤包括检查网络配置、DNS设置、网关路由、防火墙规则,以及联系ISP。预防措施包括定期备份配置、更新固件、监控网络性能和实施网络安全策略。通过排查和维护,可确保网络稳定和安全。
|
8月前
|
安全 Linux 网络安全
百度搜索:蓝易云【服务器安全设置Centos7 防火墙firewall与iptables】
CentOS 7使用的默认防火墙是firewall,它是一种基于Netfilter的用户空间工具,用于管理Linux内核中的iptables规则。为了加强服务器的安全性,可以通过配置CentOS 7防火墙和iptables规则来保护服务器。
109 0
|
4月前
|
网络协议 Shell Linux
系统初始化shell,包括:挂载镜像、搭建yum、设置主机名及IP地址和主机名映射、配置动态IP、关闭防火墙和selinux
系统初始化shell,包括:挂载镜像、搭建yum、设置主机名及IP地址和主机名映射、配置动态IP、关闭防火墙和selinux
42 2
|
6月前
|
Linux 网络安全
防火墙iptable的设置总结
防火墙iptable的设置总结
37 0
|
8月前
|
监控 安全 网络安全
防火墙的设置主要是为了防范什么
防火墙的设置主要是为了防范什么
|
11月前
|
Linux 网络安全
centos下防火墙设置
centos下防火墙设置
222 0
|
11月前
|
Linux 网络安全
Linux | 防火墙设置
Linux | 防火墙设置
105 0
|
12月前
|
Linux 网络安全
centos防火墙规则设置
centos防火墙规则设置
240 0
|
12月前
|
网络协议 Linux 网络安全
CentOS 8防火墙常规设置命令记录
CentOS 8防火墙常规设置命令记录
138 0