<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://www.chepkov.com/w/index.php?action=history&amp;feed=atom&amp;title=IPTables</id>
	<title>IPTables - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://www.chepkov.com/w/index.php?action=history&amp;feed=atom&amp;title=IPTables"/>
	<link rel="alternate" type="text/html" href="https://www.chepkov.com/w/index.php?title=IPTables&amp;action=history"/>
	<updated>2026-04-28T17:14:55Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.43.6</generator>
	<entry>
		<id>https://www.chepkov.com/w/index.php?title=IPTables&amp;diff=457&amp;oldid=prev</id>
		<title>Vvc at 19:25, 16 July 2010</title>
		<link rel="alternate" type="text/html" href="https://www.chepkov.com/w/index.php?title=IPTables&amp;diff=457&amp;oldid=prev"/>
		<updated>2010-07-16T19:25:11Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;===Block ssh brutal force attack ===&lt;br /&gt;
* /etc/modprobe.conf&lt;br /&gt;
 options ipt_recent ip_list_tot=200 ip_pkt_list_tot=15 ip_list_hash_size=0&lt;br /&gt;
&lt;br /&gt;
* /etc/sysconfig/iptables&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
*filter&lt;br /&gt;
:INPUT ACCEPT [0:0]&lt;br /&gt;
:FORWARD ACCEPT [0:0]&lt;br /&gt;
:OUTPUT ACCEPT [0:0]&lt;br /&gt;
:IN - [0:0]&lt;br /&gt;
:blacklist - [0:0]&lt;br /&gt;
:ssh - [0:0]&lt;br /&gt;
-A INPUT -j IN&lt;br /&gt;
-A FORWARD -j IN&lt;br /&gt;
-A IN -i lo -j ACCEPT&lt;br /&gt;
-A IN -p icmp --icmp-type any -j ACCEPT&lt;br /&gt;
-A IN -m state --state INVALID -j DROP&lt;br /&gt;
-A IN -m state --state ESTABLISHED,RELATED -j ACCEPT&lt;br /&gt;
# SSH handler&lt;br /&gt;
-A IN -m state --state NEW -m tcp -p tcp --syn --dport ssh -j ssh&lt;br /&gt;
-A blacklist -m recent --name blacklist --set -j DROP&lt;br /&gt;
-A ssh -m recent --update --name blacklist --seconds 600 --hitcount 1 -j DROP&lt;br /&gt;
-A ssh -m recent --set --name sshcount &lt;br /&gt;
-A ssh -m recent --rcheck --name sshcount --seconds 60 --hitcount 10 -j blacklist&lt;br /&gt;
-A ssh -j ACCEPT&lt;br /&gt;
# Other services&lt;br /&gt;
-A IN -m state --state NEW -m tcp -p tcp --syn --dport http -j ACCEPT&lt;br /&gt;
-A IN -j REJECT --reject-with icmp-host-prohibited&lt;br /&gt;
COMMIT&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: Make sure &amp;#039;&amp;#039;ip_pkt_list_tot&amp;#039;&amp;#039; is big enough to fit &amp;#039;&amp;#039;hitcount&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
This firewall configuration &amp;quot;blacklist&amp;quot;s any IP, which tries to establish an ssh connection more then 10 times in any given 60 seconds interval.&amp;lt;br&amp;gt;&lt;br /&gt;
The IP will be blacklisted for 600 seconds, as long as no new packets arrived from this IP during this grace period, otherwise, the timer will be reset to 0 with each new packet.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Observe your good work:&lt;br /&gt;
 watch cat /proc/net/ipt_recent/blacklist&lt;/div&gt;</summary>
		<author><name>Vvc</name></author>
	</entry>
</feed>