
這種情況很典型。我在網站的負載平衡器後面使用 CentOS + Apache。
此時,我們假設我沒有任何存取負載平衡器的權限(或)讓我們忘記這一點。
目前我正在用來.htaccess
封鎖 IP,因為本機iptables
無法封鎖這種X-Forwarded-For
IP 位址(據我所知)。
無論如何,我目前的方法有效。但這至少仍然會讓我的阿帕契受到攻擊。
有沒有firewall
(喜歡:iptables
)X-Forwarded-For
哪個也可以阻止IP/連線?
先感謝大家:)
答案1
您可以在 iptables 規則中使用字串匹配,例如
iptables -I name 1 -p tcp --dport 80 -m string --algo bm --string 'X-Forwarded-For: 10.1.1.1' -j DROP