<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[iRedMail — Block IP class if too many auth failures?]]></title>
	<link rel="self" href="http://www.iredmail.org/forum/feed-atom-topic344.xml" />
	<updated>2009-10-19T14:00:15Z</updated>
	<generator>PunBB</generator>
	<id>http://www.iredmail.org/forum/topic344-block-ip-class-if-too-many-auth-failures.html</id>
		<entry>
			<title type="html"><![CDATA[Re: Block IP class if too many auth failures?]]></title>
			<link rel="alternate" href="http://www.iredmail.org/forum/post1560.html#p1560" />
			<content type="html"><![CDATA[<div class="quotebox"><cite>maxie_ro wrote:</cite><blockquote><p>But out of curiosity, what do you need a script for? To automate the process for the script which is run after the main CentOS installation?</p></blockquote></div><p>iRedMail is a set of shell scripts, each script is used to install and configure component automaticly. <img src="http://www.iredmail.org/forum/img/smilies/smile.png" width="15" height="15" alt="smile" /></p>]]></content>
			<author>
				<name><![CDATA[ZhangHuangbin]]></name>
				<uri>http://www.iredmail.org/forum/user2.html</uri>
			</author>
			<updated>2009-10-19T14:00:15Z</updated>
			<id>http://www.iredmail.org/forum/post1560.html#p1560</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Block IP class if too many auth failures?]]></title>
			<link rel="alternate" href="http://www.iredmail.org/forum/post1559.html#p1559" />
			<content type="html"><![CDATA[<p>Let&#039;s just say I don&#039;t consider bash/sh scripting to be one of my strongest points...</p><p>But out of curiosity, what do you need a script for? To automate the process for the script which is run after the main CentOS installation?</p><p>P.S.</p><p>Forgot to say, but to check that shorewall is really working you should delete everything from /etc/sysconfig/iptales. Shorewall will send it&#039;s own rules, so I put the ones to allow SSH/POP/IMAP/SMTP/HTTP in it&#039;s own config file and cleared the iptables. Take care not to lock yourself out of your own server, this can happen very fast with shorewall.</p><p>Oh, and I setup my SSHD to listen on another port than 22, you will see than in the configs (13xx).</p>]]></content>
			<author>
				<name><![CDATA[maxie_ro]]></name>
				<uri>http://www.iredmail.org/forum/user381.html</uri>
			</author>
			<updated>2009-10-19T13:55:36Z</updated>
			<id>http://www.iredmail.org/forum/post1559.html#p1559</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Block IP class if too many auth failures?]]></title>
			<link rel="alternate" href="http://www.iredmail.org/forum/post1558.html#p1558" />
			<content type="html"><![CDATA[<p>Got it. I will try to make it work for me first, and then try to integrate it as an optional components in iRedMail and iRedOS. Just be patient.</p><p>And if you are familar with Bash shell script, you can write script directly, so that we can have it in iRedMail/iRedOS quickly. <img src="http://www.iredmail.org/forum/img/smilies/tongue.png" width="15" height="15" alt="tongue" /></p>]]></content>
			<author>
				<name><![CDATA[ZhangHuangbin]]></name>
				<uri>http://www.iredmail.org/forum/user2.html</uri>
			</author>
			<updated>2009-10-19T13:47:38Z</updated>
			<id>http://www.iredmail.org/forum/post1558.html#p1558</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Block IP class if too many auth failures?]]></title>
			<link rel="alternate" href="http://www.iredmail.org/forum/post1557.html#p1557" />
			<content type="html"><![CDATA[<p>Oh, and something else:</p><p>I put the config for fail2ban to ban the IP after only 5 authentication failures, for 12 hours, no matter which is the source (ssh, sasl, postfix or roundcube). Some will find this too paranoid...</p>]]></content>
			<author>
				<name><![CDATA[maxie_ro]]></name>
				<uri>http://www.iredmail.org/forum/user381.html</uri>
			</author>
			<updated>2009-10-19T13:47:11Z</updated>
			<id>http://www.iredmail.org/forum/post1557.html#p1557</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Block IP class if too many auth failures?]]></title>
			<link rel="alternate" href="http://www.iredmail.org/forum/post1556.html#p1556" />
			<content type="html"><![CDATA[<p>Of course. This is how I did it:</p><p>1. Get the EPEL package (epel-release-5-3.noarch.rpm) and install it for quick access to EPEL repo.</p><p>2. Install gamin-python, with dependencies (gamin itself, etc.).</p><p>3. Install shorewall from EPEL (better support for iptables then iptables command line itself).</p><p>4. Configure shorewall (enabled: yes, accept from outside only ssh/pop/smtp/imap, check the files).</p><p>5. Install fail2ban from EPEL.</p><p>6. Configure fail2ban to listen to 4 sources in 3 log files (one of which is Roundcube, but you need to patch it to work).</p><p>I will attach the config files in the zip.</p><p>What&#039;s in the zip:</p><p>/shorewall - should go in /etc/shorewall; mostly as in docs, but I added zone &quot;loop&quot; for loopback, ACCEPT ALL;<br />Allow only what&#039;s needed for incoming (LDAP is commented out cause I don&#039;t use it), everything else DROP<br />For outgoing, accept all.</p><p>/fail2ban - should go in /etc/fail2ban, in corresponding dirs<br />For the filter for postfix (from /var/log/maillog), I modifies the syntax to only ban in case of 5xx codes, *NOT* 4xx, otherwise I will accidentally ban everyone because of greylisting and other temporary errors <img src="http://www.iredmail.org/forum/img/smilies/wink.png" width="15" height="15" alt="wink" /><br />For SASL I modified the syntax, the original one didn&#039;t work with iRedOS.<br />The syntax for SSHD is the same, but I include it because I modified the Jail.<br />The syntax for Roundcube is made by me, but caution: it won&#039;t work without <a href="http://www.roundcubeforum.net/requests/5639-imap-inc-patch.html">this patch</a> to roundcube 0.3-stable.</p><p>Have fun.</p>]]></content>
			<author>
				<name><![CDATA[maxie_ro]]></name>
				<uri>http://www.iredmail.org/forum/user381.html</uri>
			</author>
			<updated>2009-10-19T13:38:27Z</updated>
			<id>http://www.iredmail.org/forum/post1556.html#p1556</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Block IP class if too many auth failures?]]></title>
			<link rel="alternate" href="http://www.iredmail.org/forum/post1555.html#p1555" />
			<content type="html"><![CDATA[<p>It&#039;s on my TODO list, but i don&#039;t have time to integrate it now.</p><p>Will you share you doc? so that i can easily integrate it into iRedMail/iRedOS <img src="http://www.iredmail.org/forum/img/smilies/tongue.png" width="15" height="15" alt="tongue" /></p>]]></content>
			<author>
				<name><![CDATA[ZhangHuangbin]]></name>
				<uri>http://www.iredmail.org/forum/user2.html</uri>
			</author>
			<updated>2009-10-19T12:35:03Z</updated>
			<id>http://www.iredmail.org/forum/post1555.html#p1555</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Block IP class if too many auth failures?]]></title>
			<link rel="alternate" href="http://www.iredmail.org/forum/post1554.html#p1554" />
			<content type="html"><![CDATA[<p>Thank you, this fail2ban is exactly what I needed. It works flawlessly. I also put a rule for roundcube log, and created a patch for roundcube to show IP for authentication failures, so I can get that too.</p><p>ZhangHuangbin, you should consider adding this to iRedOS. <img src="http://www.iredmail.org/forum/img/smilies/tongue.png" width="15" height="15" alt="tongue" /></p>]]></content>
			<author>
				<name><![CDATA[maxie_ro]]></name>
				<uri>http://www.iredmail.org/forum/user381.html</uri>
			</author>
			<updated>2009-10-19T12:23:40Z</updated>
			<id>http://www.iredmail.org/forum/post1554.html#p1554</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Block IP class if too many auth failures?]]></title>
			<link rel="alternate" href="http://www.iredmail.org/forum/post1540.html#p1540" />
			<content type="html"><![CDATA[<p>fail2ban can do that (and more: ssh ...)<br />For integration see <a href="http://www.fail2ban.org/wiki/index.php/Main_Page">http://www.fail2ban.org/wiki/index.php/Main_Page</a></p>]]></content>
			<author>
				<name><![CDATA[peterpp]]></name>
				<uri>http://www.iredmail.org/forum/user323.html</uri>
			</author>
			<updated>2009-10-16T22:15:12Z</updated>
			<id>http://www.iredmail.org/forum/post1540.html#p1540</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Block IP class if too many auth failures?]]></title>
			<link rel="alternate" href="http://www.iredmail.org/forum/post1539.html#p1539" />
			<content type="html"><![CDATA[<p>Hi.</p><p>Is there any way in iRedOS to block a class of IPs if too many SMTP/POP3/IMAP authentication failures from that class? I had today a lot of tries from one IP, probably to hyjack mail accounts... I saw the attacker trying all possible combinations of username, probably with a dictionary attack...</p><p>Thanks.</p>]]></content>
			<author>
				<name><![CDATA[maxie_ro]]></name>
				<uri>http://www.iredmail.org/forum/user381.html</uri>
			</author>
			<updated>2009-10-16T19:08:01Z</updated>
			<id>http://www.iredmail.org/forum/post1539.html#p1539</id>
		</entry>
</feed>
