<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Computer Solutions Blog &#187; unix</title>
	<atom:link href="http://www.computersolutions.cn/blog/tag/unix/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.computersolutions.cn/blog</link>
	<description>Whats happening at Computer Solutions</description>
	<lastBuildDate>Thu, 02 Sep 2010 08:07:13 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>How to setup fail2ban to block vpopmail attacks</title>
		<link>http://www.computersolutions.cn/blog/2009/10/how-to-setup-fail2ban-to-block-vpopmail-attacks/?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=how-to-setup-fail2ban-to-block-vpopmail-attacks</link>
		<comments>http://www.computersolutions.cn/blog/2009/10/how-to-setup-fail2ban-to-block-vpopmail-attacks/#comments</comments>
		<pubDate>Thu, 01 Oct 2009 13:04:25 +0000</pubDate>
		<dc:creator>Lawrence Sheed</dc:creator>
				<category><![CDATA[Email]]></category>
		<category><![CDATA[Technical Mumbo Jumbo]]></category>
		<category><![CDATA[fail2ban]]></category>
		<category><![CDATA[how to]]></category>
		<category><![CDATA[security]]></category>
		<category><![CDATA[unix]]></category>
		<category><![CDATA[vpopmail]]></category>

		<guid isPermaLink="false">http://www.computersolutions.cn/blog/?p=269</guid>
		<description><![CDATA[As the Wiki for fail2ban is a little less than explanatory than it could be, here are my own notes on setting up fail2ban to block pop3 attacks. Have been seeing sample dictionary attacks on some servers for a while now from random ip addresses &#8211; eg Sep 28 13:01:03 www vpopmail&#91;20410&#93;: vchkpw-pop3: vpopmail user [...]]]></description>
			<content:encoded><![CDATA[<p>As the Wiki for fail2ban is a little less than explanatory than it could be, here are my own notes on setting up fail2ban to block pop3 attacks.</p>
<p>Have been seeing sample dictionary attacks on some servers for a while now from random ip addresses &#8211; eg</p>
<div class="dean_ch" style="white-space: wrap;">
Sep <span class="nu0">28</span> <span class="nu0">13</span>:<span class="nu0">01</span>:<span class="nu0">03</span> www vpopmail<span class="br0">&#91;</span><span class="nu0">20410</span><span class="br0">&#93;</span>: vchkpw-pop3: vpopmail <span class="kw1">user</span> not found www@:<span class="nu0">24.153</span><span class="nu0">.205</span><span class="nu0">.71</span><br />
Sep <span class="nu0">28</span> <span class="nu0">13</span>:<span class="nu0">01</span>:<span class="nu0">03</span> www vpopmail<span class="br0">&#91;</span><span class="nu0">20411</span><span class="br0">&#93;</span>: vchkpw-pop3: vpopmail <span class="kw1">user</span> not found web@:<span class="nu0">24.153</span><span class="nu0">.205</span><span class="nu0">.71</span><br />
Sep <span class="nu0">28</span> <span class="nu0">13</span>:<span class="nu0">01</span>:<span class="nu0">09</span> www vpopmail<span class="br0">&#91;</span><span class="nu0">20417</span><span class="br0">&#93;</span>: vchkpw-pop3: vpopmail <span class="kw1">user</span> not found web@:<span class="nu0">24.153</span><span class="nu0">.205</span><span class="nu0">.71</span><br />
Sep <span class="nu0">28</span> <span class="nu0">13</span>:<span class="nu0">01</span>:<span class="nu0">11</span> www vpopmail<span class="br0">&#91;</span><span class="nu0">20420</span><span class="br0">&#93;</span>: vchkpw-pop3: vpopmail <span class="kw1">user</span> not found web@:<span class="nu0">24.153</span><span class="nu0">.205</span><span class="nu0">.71</span><br />
&nbsp;</div>
<p>Annoying, but not realistically going to provide much of a security issue &#8211; most of the user names are the generic ones which aren&#8217;t actually in use on the servers.</p>
<p>As we already use <a href="http://www.fail2ban.org">fail2ban</a> to perform basic service blocks against naughty script kiddie wannabee&#8217;s, why not have it block vpopmail attacks also.</p>
<p>Our mail error logs are located in /var/log/mail.log</p>
<p>As you saw above, the logs show the same common text for each failed login &#8211; </p>
<div class="dean_ch" style="white-space: wrap;">
vchkpw-pop3: vpopmail <span class="kw1">user</span> not found web@:<span class="nu0">24.153</span><span class="nu0">.205</span><span class="nu0">.71</span><br />
&nbsp;</div>
<p>A simple regex to identify that in the logs would look like this (as per the fail2ban wiki)</p>
<div class="dean_ch" style="white-space: wrap;">
failregex = vchkpw-pop3: vpopmail <span class="kw1">user</span> not found .*@:&lt;HOST&gt;$<br />
&nbsp;</div>
<p>First step is to create a filter for fail2ban.</p>
<p>Create /etc/fail2ban/filter.d/vpopmail.conf as below:</p>
<div class="dean_ch" style="white-space: wrap;">
<span class="co1"># Fail2Ban configuration file for vpopmail</span><br />
<span class="co1">#</span><br />
<span class="co1"># Author: Lawrence Sheed</span><br />
<span class="co1">#</span><br />
<span class="co1"># $Revision: 1.0 $</span><br />
<span class="co1">#</span></p>
<p><span class="br0">&#91;</span>Definition<span class="br0">&#93;</span></p>
<p><span class="co1"># Option: failregex</span><br />
<span class="co1"># Notes.: regex to match the password failures messages in the logfile.</span><br />
<span class="co1"># Values: TEXT</span><br />
<span class="co1">#</span><br />
failregex = vchkpw-pop3: vpopmail <span class="kw1">user</span> not found .*@:&lt;HOST&gt;$</p>
<p><span class="co1"># Option: &nbsp;ignoreregex</span><br />
<span class="co1"># Notes.: &nbsp;regex to ignore. If this regex matches, the line is ignored.</span><br />
<span class="co1"># Values: &nbsp;TEXT</span><br />
<span class="co1">#</span><br />
ignoreregex = <br />
&nbsp;</div>
<p>Second step is to add our filter to the fail2ban setup</p>
<p>Add this to the bottom of /etc/fail2ban/jail.conf</p>
<div class="dean_ch" style="white-space: wrap;">
<span class="br0">&#91;</span>vpopmail<span class="br0">&#93;</span><br />
enabled = true<br />
<span class="kw1">port</span> &nbsp; &nbsp;= pop3<br />
filter &nbsp;= vpopmail &nbsp;<br />
logpath = /var/log/mail.log<br />
maxretry = <span class="nu0">3</span><br />
&nbsp;</div>
<p>logpath should be amended to whatever your mail logs for vpopmail appear.<br />
maxretry should be set to a value that you agree with.</p>
<p>Restart fail2ban  with a: /etc/init.d/fail2ban restart<br />
and check that it has added the filter.</p>
<p>tail /var/log/fail2ban.log</p>
<p>You should see a line like this:</p>
<div class="dean_ch" style="white-space: wrap;">
<span class="nu0">2009</span><span class="nu0">-10</span><span class="nu0">-01</span> <span class="nu0">12</span>:<span class="nu0">36</span>:<span class="nu0">09</span>,<span class="nu0">590</span> fail2ban.jail &nbsp; : INFO &nbsp; Jail <span class="st0">&#8216;vpopmail&#8217;</span> started<br />
&nbsp;</div>
<p>If so, you&#8217;re all set!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.computersolutions.cn/blog/2009/10/how-to-setup-fail2ban-to-block-vpopmail-attacks/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
