Aqui está minha configuração atual para o IPTables. Mas o IP que eu bani ainda pode pingar, ssh, web e assim por diante ..
O IP im que testa estas regras é: 195.154.220.14
# Generated by iptables-save v1.4.7 on Thu Feb 16 22:06:28 2017
*nat
:PREROUTING ACCEPT [1452:83067]
:POSTROUTING ACCEPT [95:6213]
:OUTPUT ACCEPT [95:6213]
COMMIT
# Completed on Thu Feb 16 22:06:28 2017
# Generated by iptables-save v1.4.7 on Thu Feb 16 22:06:28 2017
*filter
:INPUT ACCEPT [0:0]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [591:260189]
:ICMPFLOOD - [0:0]
:SSHBRUTE - [0:0]
:f2b-BadBots - [0:0]
:f2b-SSH - [0:0]
:f2b-SSHDDOS - [0:0]
:f2b-apache-modsecurity - [0:0]
:f2b-apache-overflows - [0:0]
:f2b-dovecot - [0:0]
:f2b-dovecot-auth - [0:0]
:f2b-dovecot-pop3imap - [0:0]
:f2b-pam - [0:0]
:f2b-php-url-open - [0:0]
:f2b-sendmail-auth - [0:0]
:f2b-ssh - [0:0]
:monitorix_IN_0 - [0:0]
:monitorix_IN_1 - [0:0]
:monitorix_IN_10 - [0:0]
:monitorix_IN_11 - [0:0]
:monitorix_IN_2 - [0:0]
:monitorix_IN_3 - [0:0]
:monitorix_IN_4 - [0:0]
:monitorix_IN_5 - [0:0]
:monitorix_IN_6 - [0:0]
:monitorix_IN_7 - [0:0]
:monitorix_IN_8 - [0:0]
:monitorix_IN_9 - [0:0]
-A INPUT -p tcp -m tcp --sport 1024:65535 --dport 6667 -m conntrack --ctstate NEW,RELATED,ESTABLISHED -j monitorix_IN_11
-A INPUT -p tcp -m tcp --sport 1024:65535 --dport 587 -m conntrack --ctstate NEW,RELATED,ESTABLISHED -j monitorix_IN_10
-A INPUT -p tcp -m tcp --sport 1024:65535 --dport 993 -m conntrack --ctstate NEW,RELATED,ESTABLISHED -j monitorix_IN_9
-A INPUT -p tcp -m tcp --sport 1024:65535 --dport 465 -m conntrack --ctstate NEW,RELATED,ESTABLISHED -j monitorix_IN_8
-A INPUT -p tcp -m tcp --sport 1024:65535 --dport 143 -m conntrack --ctstate NEW,RELATED,ESTABLISHED -j monitorix_IN_7
-A INPUT -p udp -m udp --sport 1024:65535 --dport 53 -m conntrack --ctstate NEW,RELATED,ESTABLISHED -j monitorix_IN_6
-A INPUT -p tcp -m tcp --sport 1024:65535 --dport 3306 -m conntrack --ctstate NEW,RELATED,ESTABLISHED -j monitorix_IN_5
-A INPUT -p tcp -m tcp --sport 1024:65535 --dport 443 -m conntrack --ctstate NEW,RELATED,ESTABLISHED -j monitorix_IN_4
-A INPUT -p tcp -m tcp --sport 1024:65535 --dport 22 -m conntrack --ctstate NEW,RELATED,ESTABLISHED -j monitorix_IN_3
-A INPUT -p tcp -m tcp --sport 1024:65535 --dport 80 -m conntrack --ctstate NEW,RELATED,ESTABLISHED -j monitorix_IN_2
-A INPUT -p tcp -m tcp --sport 1024:65535 --dport 21 -m conntrack --ctstate NEW,RELATED,ESTABLISHED -j monitorix_IN_1
-A INPUT -p tcp -m tcp --sport 1024:65535 --dport 25 -m conntrack --ctstate NEW,RELATED,ESTABLISHED -j monitorix_IN_0
-A INPUT -p tcp -m tcp --dport 22 -j f2b-ssh
-A INPUT -p tcp -m tcp --dport 22 -j f2b-SSHDDOS
-A INPUT -p tcp -m tcp --dport 22 -j f2b-SSH
-A INPUT -j f2b-pam
-A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT
-A INPUT -p icmp -j ACCEPT
-A INPUT -i lo -j ACCEPT
-A INPUT -i eth1 -j ACCEPT
-A INPUT -s 195.154.220.14/32 -j DROP
-A INPUT -p tcp -m tcp --dport 80 -m string --string "GET /scrape.php" --algo kmp --to 65535 -j DROP
-A INPUT -p tcp -m tcp --dport 80 -m string --string "GET /rss.php?cats=" --algo kmp --to 65535 -j DROP
-A INPUT -p tcp -m tcp --dport 80 -m string --string "GET /announce.php" --algo kmp --to 65535 -j DROP
-A INPUT -p tcp -m tcp --dport 80 -m string --string "GET /wp-login.php" --algo kmp --to 65535 -j DROP
-A INPUT -p tcp -m tcp --dport 80 -m string --string "GET /w00tw00t" --algo kmp --to 65535 -j DROP
-A INPUT -p tcp -m tcp --dport 80 -m string --string "GET /?p=rss&categories" --algo kmp --to 65535 -j DROP
-A INPUT -p tcp -m tcp --dport 80 -m string --string "GET /?p=online" --algo kmp --to 65535 -j DROP
-A INPUT -p tcp -m tcp --dport 80 -m string --string "GET /download.php?torrent" --algo kmp --to 65535 -j DROP
-A INPUT -p tcp -m tcp --dport 80 -m string --string "torrent_pass" --algo kmp --to 65535 -j DROP
-A INPUT -p tcp -m tcp --dport 443 -m string --string "GET /rss.php" --algo kmp --to 65535 -j DROP
-A INPUT -p tcp -m tcp --dport 443 -m string --string "GET /announce.php" --algo kmp --to 65535 -j DROP
-A INPUT -p tcp -m tcp --dport 443 -m string --string "GET /wp-login.php" --algo kmp --to 65535 -j DROP
-A INPUT -p tcp -m tcp --dport 443 -m string --string "GET /w00tw00t" --algo kmp --to 65535 -j DROP
-A INPUT -p tcp -m tcp --dport 443 -m string --string "GET /?p=rss&categories" --algo kmp --to 65535 -j DROP
-A INPUT -p tcp -m tcp --dport 443 -m string --string "GET /?p=online" --algo kmp --to 65535 -j DROP
-A INPUT -p tcp -m tcp --dport 443 -m string --string "GET /download.php?torrent" --algo kmp --to 65535 -j DROP
-A INPUT -p tcp -m tcp --dport 443 -m string --string "torrent_pass" --algo kmp --to 65535 -j DROP
-A INPUT -p tcp -m state --state NEW -m tcp --dport 21 -j ACCEPT
-A INPUT -p tcp -m state --state NEW -m tcp --dport 22 -j ACCEPT
-A INPUT -p tcp -m state --state NEW -m tcp --dport 53 -j ACCEPT
-A INPUT -p udp -m state --state NEW -m udp --dport 53 -j ACCEPT
-A INPUT -p tcp -m state --state NEW -m tcp --dport 80 -j ACCEPT
-A INPUT -p tcp -m state --state NEW -m tcp --dport 110 -j ACCEPT
-A INPUT -p tcp -m state --state NEW -m tcp --dport 143 -j ACCEPT
-A INPUT -p tcp -m state --state NEW -m tcp --dport 443 -j ACCEPT
-A INPUT -p tcp -m state --state NEW -m tcp --dport 465 -j ACCEPT
-A INPUT -p tcp -m state --state NEW -m tcp --dport 587 -j ACCEPT
-A INPUT -p tcp -m state --state NEW -m tcp --dport 993 -j ACCEPT
-A INPUT -p tcp -m state --state NEW -m tcp --dport 995 -j ACCEPT
-A INPUT -p tcp -m state --state NEW -m tcp --dport 3306 -j ACCEPT
-A INPUT -p tcp -m state --state NEW -m tcp --dport 6660 -j ACCEPT
-A INPUT -p tcp -m state --state NEW -m tcp --dport 6661 -j ACCEPT
-A INPUT -p tcp -m state --state NEW -m tcp --dport 6663 -j ACCEPT
-A INPUT -p tcp -m state --state NEW -m tcp --dport 6664 -j ACCEPT
-A INPUT -p tcp -m state --state NEW -m tcp --dport 6665 -j ACCEPT
-A INPUT -p tcp -m state --state NEW -m tcp --dport 6666 -j ACCEPT
-A INPUT -p tcp -m state --state NEW -m tcp --dport 6667 -j ACCEPT
-A INPUT -p tcp -m state --state NEW -m tcp --dport 6668 -j ACCEPT
-A INPUT -p tcp -m state --state NEW -m tcp --dport 6669 -j ACCEPT
-A INPUT -p tcp -m state --state NEW -m tcp --dport 6697 -j ACCEPT
-A INPUT -j REJECT --reject-with icmp-host-prohibited
-A FORWARD -m state --state RELATED,ESTABLISHED -j ACCEPT
-A FORWARD -p icmp -j ACCEPT
-A FORWARD -i lo -j ACCEPT
-A FORWARD -i eth1 -j ACCEPT
-A FORWARD -j REJECT --reject-with icmp-host-prohibited
-A OUTPUT -p tcp -m tcp --sport 6667 --dport 1024:65535 -m conntrack --ctstate RELATED,ESTABLISHED -j monitorix_IN_11
-A OUTPUT -p tcp -m tcp --sport 587 --dport 1024:65535 -m conntrack --ctstate RELATED,ESTABLISHED -j monitorix_IN_10
-A OUTPUT -p tcp -m tcp --sport 993 --dport 1024:65535 -m conntrack --ctstate RELATED,ESTABLISHED -j monitorix_IN_9
-A OUTPUT -p tcp -m tcp --sport 465 --dport 1024:65535 -m conntrack --ctstate RELATED,ESTABLISHED -j monitorix_IN_8
-A OUTPUT -p tcp -m tcp --sport 143 --dport 1024:65535 -m conntrack --ctstate RELATED,ESTABLISHED -j monitorix_IN_7
-A OUTPUT -p udp -m udp --sport 53 --dport 1024:65535 -m conntrack --ctstate RELATED,ESTABLISHED -j monitorix_IN_6
-A OUTPUT -p tcp -m tcp --sport 3306 --dport 1024:65535 -m conntrack --ctstate RELATED,ESTABLISHED -j monitorix_IN_5
-A OUTPUT -p tcp -m tcp --sport 443 --dport 1024:65535 -m conntrack --ctstate RELATED,ESTABLISHED -j monitorix_IN_4
-A OUTPUT -p tcp -m tcp --sport 22 --dport 1024:65535 -m conntrack --ctstate RELATED,ESTABLISHED -j monitorix_IN_3
-A OUTPUT -p tcp -m tcp --sport 80 --dport 1024:65535 -m conntrack --ctstate RELATED,ESTABLISHED -j monitorix_IN_2
-A OUTPUT -p tcp -m tcp --sport 21 --dport 1024:65535 -m conntrack --ctstate RELATED,ESTABLISHED -j monitorix_IN_1
-A OUTPUT -p tcp -m tcp --sport 25 --dport 1024:65535 -m conntrack --ctstate RELATED,ESTABLISHED -j monitorix_IN_0
-A ICMPFLOOD -m recent --set --name ICMP --rsource
-A ICMPFLOOD -m recent --update --seconds 1 --hitcount 6 --rttl --name ICMP --rsource -m limit --limit 1/sec --limit-burst 1 -j LOG --log-prefix "iptables[ICMP-flood]: "
-A ICMPFLOOD -m recent --update --seconds 1 --hitcount 6 --rttl --name ICMP --rsource -j DROP
-A ICMPFLOOD -j ACCEPT
-A SSHBRUTE -m recent --set --name SSH --rsource
-A SSHBRUTE -m recent --update --seconds 300 --hitcount 10 --name SSH --rsource -m limit --limit 1/sec --limit-burst 100 -j LOG --log-prefix "iptables[SSH-brute]: "
-A SSHBRUTE -m recent --update --seconds 300 --hitcount 10 --name SSH --rsource -j DROP
-A SSHBRUTE -j ACCEPT
-A f2b-BadBots -j RETURN
-A f2b-SSH -j RETURN
-A f2b-SSHDDOS -j RETURN
-A f2b-apache-modsecurity -j RETURN
-A f2b-apache-overflows -j RETURN
-A f2b-dovecot -j RETURN
-A f2b-dovecot-auth -j RETURN
-A f2b-dovecot-pop3imap -j RETURN
-A f2b-pam -j RETURN
-A f2b-php-url-open -j RETURN
-A f2b-sendmail-auth -j RETURN
-A f2b-sendmail-auth -j RETURN
-A f2b-ssh -s 116.31.116.23/32 -j REJECT --reject-with icmp-port-unreachable
-A f2b-ssh -s 116.228.236.206/32 -j REJECT --reject-with icmp-port-unreachable
-A f2b-ssh -s 115.76.238.24/32 -j REJECT --reject-with icmp-port-unreachable
-A f2b-ssh -s 111.74.239.197/32 -j REJECT --reject-with icmp-port-unreachable
-A f2b-ssh -s 111.69.98.237/32 -j REJECT --reject-with icmp-port-unreachable
-A f2b-ssh -s 111.69.98.204/32 -j REJECT --reject-with icmp-port-unreachable
-A f2b-ssh -s 111.69.96.50/32 -j REJECT --reject-with icmp-port-unreachable
-A f2b-ssh -s 111.69.96.38/32 -j REJECT --reject-with icmp-port-unreachable
-A f2b-ssh -s 111.69.103.109/32 -j REJECT --reject-with icmp-port-unreachable
-A f2b-ssh -s 111.69.102.173/32 -j REJECT --reject-with icmp-port-unreachable
-A f2b-ssh -j RETURN
COMMIT
# Completed on Thu Feb 16 22:06:28 2017
Eu não tenho certeza do que está errado aqui. Eu usei o comando
iptables -A INPUT -s 195.154.220.14 -j DROP