
我有一個在 Centos 6.6 上運行的網路伺服器。最近,Config Server Security Firewall 向我發送了超過 150 封電子郵件,內容涉及一些惡意機器人試圖猜測我的客戶 ftp 用戶和密碼。我討厭暴力攻擊,我嘗試將我的 ftp 端口從 21 更改為 ****。我配置了 purefptd.conf
# IP address/port to listen to (default=all IP and port 21).
Bind *** # My New Port Here Without 127.0.0.1
然後我在我的 csf 設定檔中允許 IPv4 和 IPv6 的所有 TCP_IN、TCP_OUT、UDP_IN、UDP_OUT 新端口,並在資源後面添加 iptables 規則
iptables -A INPUT -p tcp --dport newport -j ACCEPT
iptables -A OUTPUT -p tcp --dport newport -j ACCEPT
iptables -A INPUT -p udp --dport newport -j ACCEPT
iptables -A OUTPUT -p udp --dport newport -j ACCEPT
service iptables save
service iptables restart
更改後,我重新啟動 pureftpd 和 csf。現在,當我嘗試透過 Filezilla 3.9.0.6 連接到我的 ftp 伺服器時,它給了我這個答案。
Response: 227 Entering Passive Mode (*,*,*,*)
Command: MLSD
Error: Connection timed out
Error: Failed to retrieve directory listing
答案1
我自己找到了答案。我將 pureftp conf 檔案的被動連接行更改為:
# Port range for passive connections replies. - for firewalling.
PassivePortRange 50000 51000
並允許它在 csf 設定檔上,50000:51000
如
TCP_IN IPv4 和 IPv6。
現在效果很好。