<?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>Katastrophos.net Blog &#187; Mail</title>
	<atom:link href="http://katastrophos.net/andre/blog/tag/mail/feed/" rel="self" type="application/rss+xml" />
	<link>http://katastrophos.net/andre/blog</link>
	<description>Chaotic solutions and random thoughts from the restless mind of a notorious problem solver (TM), by Andre Beckedorf</description>
	<lastBuildDate>Fri, 30 Dec 2011 19:32:57 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>qmail greylisting patch</title>
		<link>http://katastrophos.net/andre/blog/2006/10/23/qmail-greylisting-patch/</link>
		<comments>http://katastrophos.net/andre/blog/2006/10/23/qmail-greylisting-patch/#comments</comments>
		<pubDate>Mon, 23 Oct 2006 02:00:13 +0000</pubDate>
		<dc:creator>Andre Beckedorf</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Mail]]></category>
		<category><![CDATA[Server]]></category>

		<guid isPermaLink="false">http://katastrophos.net/andre/blog/2006/10/23/qmail-greylisting-patch/</guid>
		<description><![CDATA[As a follow-up to my previous entry about greylisting, here is what I used for the setup: the greylisting patch at Bill Shupp&#8217;s wonderful qmail related site. I&#8217;ve made some modifications to his patch to allow for sender address and sender domain based whitelisting. You can get my patch here: large-qmail-patch_greylisting-katastrophos.net-20061023.patch The dbdef.sql file includes [...]]]></description>
			<content:encoded><![CDATA[<p>As a follow-up to <a href="http://katastrophos.net/andre/blog/2006/10/23/qmail-greylisting/">my previous entry about greylisting</a>, here is what I used for the setup: <a href="http://shupp.org/patches/greylisting-20060105.patch">the greylisting patch</a> at <a href="http://www.shupp.org" target="_blank">Bill Shupp&#8217;s wonderful qmail related site</a>.</p>
<p>I&#8217;ve made some modifications to his patch to allow for sender address and sender domain based whitelisting.<br />
You can get my patch here:</p>
<p><a class="downloadlink" href="http://www.katastrophos.net/downloads/qmailtoaster/large-qmail-patch_greylisting-katastrophos.net-20061023.patch">large-qmail-patch_greylisting-katastrophos.net-20061023.patch</a></p>
<p>The dbdef.sql file includes an example of how to set up a whitelist filter for a specific sender domain or sender address.</p>
<p>The patch is against Bill&#8217;s <a href="http://www.shupp.org/patches/qmail-toaster-0.8.3.patch.bz2">Large Qmail Patch 0.8.3</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://katastrophos.net/andre/blog/2006/10/23/qmail-greylisting-patch/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>qmail greylisting</title>
		<link>http://katastrophos.net/andre/blog/2006/10/23/qmail-greylisting/</link>
		<comments>http://katastrophos.net/andre/blog/2006/10/23/qmail-greylisting/#comments</comments>
		<pubDate>Mon, 23 Oct 2006 01:23:45 +0000</pubDate>
		<dc:creator>Andre Beckedorf</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Mail]]></category>
		<category><![CDATA[Server]]></category>

		<guid isPermaLink="false">http://katastrophos.net/andre/blog/2006/10/23/qmail-greylisting/</guid>
		<description><![CDATA[Three weeks ago I&#8217;ve set up greylisting on our little qmail toaster. The technique works amazingly well on our setup: The server used to get hit by round about 1600 mails each day. Roughly 70% of those were spam mails. Now, with greylisting activated, this amount has been reduced to just a dozen spam mails [...]]]></description>
			<content:encoded><![CDATA[<p>Three weeks ago I&#8217;ve set up <a href="http://projects.puremagic.com/greylisting/" target="_blank">greylisting</a> on our little <a href="http://en.wikipedia.org/wiki/Qmail" target="_blank">qmail</a> toaster. The technique works amazingly well on our setup:<br />
The server used to get hit by round about 1600 mails each day. Roughly 70% of those were spam mails. Now, with greylisting activated, this amount has been reduced to just a dozen spam mails and around 350 &#8211; 400 legit emails:</p>
<p><a href="http://katastrophos.net/andre/blog/wp-content/photos/qmail-greylisting/Bild%201.png" target="_blank" title="{greylisting} qmail AWstats - snapshot taken on October 23rd, 2006." rel="lightbox[45]"><img src="http://katastrophos.net/andre/blog/wp-content/photos/qmail-greylisting/thumb_Bild%201.png" alt="qmail AWstats - snapshot taken on October 23rd, 2006." width="70" height="68" /></a></p>
<p>The server load is also reduced because SpamAssassin and ClamAV are less busy filtering mails:</p>
<p><a href="http://katastrophos.net/andre/blog/wp-content/photos/qmail-greylisting/graph_image.png" target="_blank" title="{greylisting} Average server load - snapshot taken October, 3rd 2006 - four days after setting up greylisting. Peaks are running backups." rel="lightbox[45]"><img src="http://katastrophos.net/andre/blog/wp-content/photos/qmail-greylisting/thumb_graph_image.png" alt="Average server load - snapshot taken October, 3rd 2006 - four days after setting up greylisting. Peaks are running backups." width="130" height="52" /></a><a href="http://katastrophos.net/andre/blog/wp-content/photos/qmail-greylisting/graph_image-3.png" target="_blank" title="{greylisting} Average server load for the year. One can pretty clearly see the difference the qmail greylisting makes on the server load." rel="lightbox[45]"><img src="http://katastrophos.net/andre/blog/wp-content/photos/qmail-greylisting/thumb_graph_image-3.png" alt="Average server load for the year. One can pretty clearly see the difference the qmail greylisting makes on the server load." width="130" height="52" /></a><a href="http://katastrophos.net/andre/blog/wp-content/photos/qmail-greylisting/graph_image-2.png" target="_blank" title="{greylisting} Average server load for the month - snapshot taken October, 23rd 2006. Again, peaks are running backups. The big peak in week 39 was the time of compilation and deployment. Thereafter you can clearly see the drop of server load compared to beginning of week 39." rel="lightbox[45]"><img src="http://katastrophos.net/andre/blog/wp-content/photos/qmail-greylisting/thumb_graph_image-2.png" alt="Average server load for the month - snapshot taken October, 23rd 2006. Again, peaks are running backups. The big peak in week 39 was the time of compilation and deployment. Thereafter you can clearly see the drop of server load compared to beginning of week 39." width="130" height="52" /></a></p>
<p>So, speaking for us, this experiment has been very successful. Exactly no real mails got lost, tons of spam was blocked at the SMTP level. Excellent. Now, let&#8217;s see how long the effects of this technique will last&#8230;</p>
<p>See <a href="http://projects.puremagic.com/greylisting/" target="_blank">http://projects.puremagic.com/greylisting/</a> to learn more about greylisting.</p>
]]></content:encoded>
			<wfw:commentRss>http://katastrophos.net/andre/blog/2006/10/23/qmail-greylisting/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>vpopmail &#8211; maildrop &#8211; SqWebMail mailfilter patch</title>
		<link>http://katastrophos.net/andre/blog/2006/10/03/vpopmail-maildrop-sqwebmail-mailfilter-patch/</link>
		<comments>http://katastrophos.net/andre/blog/2006/10/03/vpopmail-maildrop-sqwebmail-mailfilter-patch/#comments</comments>
		<pubDate>Tue, 03 Oct 2006 21:27:27 +0000</pubDate>
		<dc:creator>Andre Beckedorf</dc:creator>
				<category><![CDATA[Debian]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Mail]]></category>
		<category><![CDATA[Server]]></category>

		<guid isPermaLink="false">http://katastrophos.net/andre/blog/2006/10/03/vpopmail-maildrop-sqwebmail-mailfilter-patch/</guid>
		<description><![CDATA[On our production mail server we&#8217;re using a so called qmail toaster setup. It&#8217;s essentially the same setup as described by shupp.org. However, instead of using SquirrelMail for webmail, we opted for SqWebMail and maildrop. The nice thing about SqWebMail is that it offers a web interface for configuring the maildrop mailfilters. That way, every [...]]]></description>
			<content:encoded><![CDATA[<p>On our production mail server we&#8217;re using a so called <span>qmail</span> toaster setup. It&#8217;s essentially the same setup as described by shupp.org. However, instead of using <a target="_blank" href="http://www.squirrelmail.org/">SquirrelMail</a> for webmail, we opted for <a target="_blank" href="http://www.courier-mta.org/sqwebmail/">SqWebMail</a> and <a target="_blank" href="http://www.courier-mta.org/maildrop/">maildrop</a>. The nice thing about SqWebMail is that it offers a web interface for configuring the maildrop mailfilters. That way, every user can configure their filtering rules individually.
</p>
<p>The problem here is that vdelivermail (of <a target="_blank" href="http://www.inter7.com/index.php?page=vpopmail">vpopmail</a>) doesn&#8217;t support those mailfilter files. For that to work we need vdelivermail to call maildrop to process those files on an individual basis. However, this requires to setup the processing instructions for every mail account manually. Of course, this is unbearable on a large setup.
</p>
<p>We came up with a patch for vdelivermail that automatically chain-calls maildrop if it finds a mailfilter file in the domain&#8217;s account directory. Some parts are based on another patch which source I forgot. I mainly extended it to be less strict and to publish certain internal vpopmail/vdelivermail variables as environment variables that could be used inside the mailfilter &#8211; namely username, userdir, domainname, domaindir.
</p>
<p>If it finds the file in the domain&#8217;s directory, it will delegate the mail to the domain-wide mailfilter.<br />
The domain-wide mailfilter will delegate the mail to the users mailfilter if it exists. If not, it will simply do a standard mail delivery to the account&#8217;s INBOX.
</p>
<p>If vdelivermail can&#8217;t find any domain-wide mailfilter it will simply default to standard mail delivery to the account&#8217;s INBOX.
<p>Here is the patch against vpopmail 5.4.17:</p>
<p><a class="downloadlink" target="_blank" href="http://www.katastrophos.net/downloads/qmailtoaster/vpopmail-5.4.17-vdelivermail.c-maildrop.patch">vpopmail-5.4.17-vdelivermail.c-maildrop.patch</a>
<p>If you&#8217;re too lazy to patch the vpopmail sourcecode yourself, here is the already patched vdelivermail.c:</p>
<p><a class="downloadlink" href="http://www.katastrophos.net/downloads/qmailtoaster/vdelivermail-5.4.17-maildrop.c">vdelivermail-5.4.17-maildrop.c</a></p>
<p>(Rename it to vdelivermail.c and place it in the vpopmail source directory and compile.)
</p>
<p><span id="more-39"></span></p>
<p><strong>Our current mail server setup goes something like this:<br />
</strong></p>
<p><strong>qmail (with SMTP-AUTH + TLS) + vpopmail + </strong><strong>SpamAssassin / ClamAV</strong><strong> + maildrop + custom scripts + SqWebMail (for webmail) + Dovecot (for SSL IMAP)</strong>
</p>
<p>In our setup by default every account has the following hierarchy:</p>
<pre>
INBOX
  Spam
    learn no-spam
    learn spam
</pre>
<p>The Spam subfolder is automatically created by the domain-wide mailfilter once the first email hits the account.
</p>
<p>We&#8217;re using the following domain-wide filter (/home/vpopmail/domains/yourdomainname/mailfilter):</p>
<p><a class="downloadlink" target="_blank" href="http://www.katastrophos.net/downloads/qmailtoaster/mailfilter">mailfilter</a></p>
<p>Again, our modified vdelivermail takes care of checking the domain for that mailfilter as described above.</p>
<p>Here is our script used to create the Spam subfolders in the domain-wide mailfilter above:</p>
<p><a class="downloadlink" href="http://www.katastrophos.net/downloads/qmailtoaster/check-create-spamfolders.sh">check-create-spamfolders.sh</a></p>
<p>If you want to use it, make sure to adjust the paths in the file to your setup.</p>
<p>So, now consider that the Spam subfolders have been created. People can use these folders to instruct what mails are spam and what mails are ham (non-spam). They can use this mechanism to report missed spam mails or to correct mistakenly classified non-spam mails.</p>
<p>Now, we wanted to get information out of those folders and try to educate our SpamAssassin&#8217;s bayes filter. Here is what we start in our crontab every hour:</p>
<p><a class="downloadlink" href="http://www.katastrophos.net/downloads/qmailtoaster/sa-learn.sh">sa-learn.sh</a></p>
<p>This script will make a list of all account&#8217;s spam and ham folders in every domain under /home/vpopmail/domains and feed the mails therein into <a href="http://spamassassin.apache.org/full/3.0.x/dist/doc/sa-learn.html" target="_blank">sa-learn</a>. Again, if you want to use the script, make sure to adjust the paths to your setup.
</p>
<p>Since our server runs Debian installing SpamAssassin is pretty easy. We just had to make sure to start SpamAssassin&#8217;s <a href="http://spamassassin.apache.org/full/3.0.x/dist/doc/spamd.html" target="_blank">spamd</a> with the following adjusted settings in /etc/default/spamd.conf:</p>
<pre>
# Change to one to enable spamd
ENABLED=1

# Options
# See man spamd for possible options. The -d option is automatically added.
OPTIONS="-m 2 -H -u vpopmail --vpopmail --nouser-config"

# Set nice level of spamd
NICE="--nicelevel 10"
</pre>
<p>This will launch spamd globally for all vpopmail accounts. The bayes database is shared among all accounts and is stored in /home/vpopmail/.spamassassin/ with the following local.cf in /etc/spamassassin/local.cf:</p>
<p><a class="downloadlink" href="http://www.katastrophos.net/downloads/qmailtoaster/local.cf">local.cf</a>
<p>Having a global shared bayes database for your SpamAssassin is controversial. I won&#8217;t go into detail on why it&#8217;s good or bad to do so. All I can say is it&#8217;s working pretty well for us.</p>
<p>Currently, in our setup the SpamAssassin and ClamAV scanning is integrated into qmail via <a target="_blank" href="http://qmail-scanner.sourceforge.net/">Qmail-Scanner</a>. This has the disadvantage that antivirus filtering is done pretty deep down the processing chain. I plan to migrate this to <a target="_blank" href="http://inter7.com/?page=simscan">simscan</a>, which stops and rejects any virus mail at SMTP level and thus prevents them from entering the queue, i.e. nothing will get onto your box. Qmail-Scanner on the other hand puts virus mails into a global quarantine directory.
</p>
<p>As for IMAP access to mail accounts, we&#8217;ve previously used <a target="_blank" href="http://www.inter7.com/courierimap/">Courier IMAP</a> and just recently migrated all accounts to <a target="_blank" href="http://www.dovecot.org/">Dovecot</a>. Both servers are proven and very reliable. However, we found Dovecot to be more secure and way faster. This is especially noticeable when doing searches and threading on mailboxes. Also, Dovecot is easier to set up as there are fewer external dependencies than with Courier IMAP.<br />
Dovecot offers support for vpopmail. If you want to give it a try in your setup, make sure to enable this support via the &#8220;&#8211;with-vpopmail&#8221; switch when running configure.</p>
<p>As already stated above, we chose to use SqWebMail for webmail and mail filter configuration. By default the latter is disabled. You&#8217;ll have to explicitly enable the mail filter interface. Check the documentation on how to do that.</p>
<p></p>
]]></content:encoded>
			<wfw:commentRss>http://katastrophos.net/andre/blog/2006/10/03/vpopmail-maildrop-sqwebmail-mailfilter-patch/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
	</channel>
</rss>

