问题原文
原帖链接 · palehorse · CC BY-SA 3.0
On our CentOS 6 servers, I've used information from this article to reduce the brute force ssh attempts on our servers, specifically the rate limiting / logging section. Is there a way to do the same thing using firewalld in CentOS 7? I'd prefer to avoid switching back to iptables since it seems firewalld is the direction that the OS is going.
For reference, here's the basic configuration in iptables that we're using (some values are different)
/sbin/iptables -N LOGDROP
/sbin/iptables -A LOGDROP -j LOG
/sbin/iptables -A LOGDROP -j DROP
iptables -I INPUT -p tcp --dport 22 -i eth0 -m state --state NEW -m recent --set
iptables -I INPUT -p tcp --dport 22 -i eth0 -m state --state NEW -m recent --update --seconds 60 --hitcount 4 -j LOGDROP
社区高分解答
原帖链接 · Federico Sierra · CC BY-SA 3.0
Try with:
firewall-cmd --permanent --direct --add-rule ipv4 filter INPUT_direct 0 -p tcp --dport 22 -m state --state NEW -m recent --set
firewall-cmd --permanent --direct --add-rule ipv4 filter INPUT_direct 1 -p tcp --dport 22 -m state --state NEW -m recent --update --seconds 30 --hitcount 4 -j REJECT --reject-with tcp-reset
firewall-cmd --reload
A full example: RHEL7: How to mitigate HTTP attacks.
About logging rejecting package FirewallD simply does not support the same level of logging that the old iptables-service did. See https://lists.fedorahosted.org/pipermail/firewalld-users/2014-February/000155.html
But there may be a posible work-around: https://bluehatrecord.wordpress.com/2014/04/17/logging-packet-drops-in-firewalld/
摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。
