First of all I am new to Ubuntu server. I am still trying to understand and learning about how does firewall. I want my firewall like if you fail 3 times it will time out. Is there any body could be explain more to me about this. I have read web about firewall but i quilt dont get it
-
Hello Jack, Welcome to Askubuntu. While asking a question please provide as much details as you can get like here we need to know your query to be explained a bit broadly and also provide which version of Ubuntu you are using and other relevant info.– heemaylJan 19, 2015 at 22:17
Add a comment
|
1 Answer
If I understand, you will block more then 3 fail connection on some service on server? You can do that with iptables - firewall
sudo iptables -I INPUT -p tcp --dport 22 -i eth0 -m state --state NEW -m recent --set
sudo iptables -I INPUT -p tcp --dport 22 -i eth0 -m state --state NEW -m recent --update --seconds 60 --hitcount 4 -j DROP
This rule will block an IP if it attempts more than 3 connections per minute to SSH. You can change destination port from 22 for ssh to 80 for http or 110 for pop3 ...