VSFTP的PASSIVE模式的防火墙设置

本文涉及的产品
云防火墙,500元 1000GB
简介:

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:
目录
相关文章
|
1月前
|
网络协议 网络安全
华为openEuler欧拉系统的防火墙常用设置方法
在有防火墙的系统中,比如我们部署了一个WEB项目,我们需要给该WEB项目所需的端口放行。本文介绍了防火墙常用设置方法。
208 81
|
网络协议 Linux 网络安全
Centos7 防火墙配置+端口设置
Centos7 防火墙配置+端口设置
324 0
Centos7 防火墙配置+端口设置
|
5月前
|
网络协议 Ubuntu 网络安全
|
5月前
|
开发框架 缓存 Ubuntu
dotnet开发框架+ubuntu防火墙命令+win11设置自动登录+阿里云短信发送限制
dotnet开发框架+ubuntu防火墙命令+win11设置自动登录+阿里云短信发送限制
71 3
|
8月前
|
监控 安全 网络安全
|
7月前
|
Linux 网络安全
在Linux中,如何设置防火墙规则?
在Linux中,如何设置防火墙规则?
|
7月前
|
网络协议 Ubuntu 前端开发
如何在操作使用ufw设置防火墙
如何在操作使用ufw设置防火墙
|
7月前
|
安全 网络安全 数据处理
防火墙设置难倒你?这两种组网模式轻松解决网络安全难题!
【8月更文挑战第23天】在网络安全日益重要的今天,防火墙作为关键防护设备扮演着重要角色。本文重点分析两种核心组网模式:三层路由网关模式与二层透明网桥模式。前者通过IP层处理实现内外网隔离及丰富的策略配置,增强安全性;后者以MAC地址转发,部署简便,不影响现有网络结构,适合服务不可中断的情况。通过企业升级安全防护的实际案例,展示了不同模式的应用场景及优势,并提供了三层路由网关模式的配置示例。正确选择和配置防火墙组网模式对于提高网络安全性和保证业务连续性至关重要。
225 0
|
7月前
|
监控 安全 Serverless
SAE 防火墙的震撼之举:默认拦截公网一切流量,开启网络安全的无敌模式!
【8月更文挑战第7天】在数字化时代,网络安全至关重要。SAE(Serverless Application Engine,无服务器应用引擎)的防火墙功能默认阻止所有公网流量,为应用与数据提供坚实保护。这像坚固城门,将潜在威胁拒之门外,减少恶意攻击风险。如同在混沌中建立秩序,划定网络安全边界。但依赖默认设置不足,需根据业务需求配置规则,如开放特定端口或IP范围。还需持续监控防火墙效果,通过分析访问日志等手段及时调整优化,确保最佳防护效果。
105 0
|
10月前
|
监控 网络协议 安全
【亮剑】当设备IP能ping通但无法上网时,可能是DNS解析、网关/路由设置、防火墙限制、网络配置错误或ISP问题
【4月更文挑战第30天】当设备IP能ping通但无法上网时,可能是DNS解析、网关/路由设置、防火墙限制、网络配置错误或ISP问题。解决步骤包括检查网络配置、DNS设置、网关路由、防火墙规则,以及联系ISP。预防措施包括定期备份配置、更新固件、监控网络性能和实施网络安全策略。通过排查和维护,可确保网络稳定和安全。
1801 1