<?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; Server</title>
	<atom:link href="http://katastrophos.net/andre/blog/tag/server/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>FHEM module for ELV ESA1000 (WZ/Z/GAS) series of devices</title>
		<link>http://katastrophos.net/andre/blog/2011/06/25/fhem-module-for-elv-esa1000-wzzgas-series-of-devices/</link>
		<comments>http://katastrophos.net/andre/blog/2011/06/25/fhem-module-for-elv-esa1000-wzzgas-series-of-devices/#comments</comments>
		<pubDate>Sat, 25 Jun 2011 13:27:24 +0000</pubDate>
		<dc:creator>Andre Beckedorf</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Development]]></category>
		<category><![CDATA[Hack]]></category>
		<category><![CDATA[Home automation]]></category>
		<category><![CDATA[Server]]></category>
		<category><![CDATA[Software]]></category>
		<category><![CDATA[Thoughts]]></category>

		<guid isPermaLink="false">http://katastrophos.net/andre/blog/?p=515</guid>
		<description><![CDATA[FHEM, the amazing home-automation server software, already has support for several sensors, meters and switches produced by ELV. In October 2010 I bought two meters, ESA1000WZ and ESA1000GAS for my house in the hope that FHEM would support them. Unfortunately it did not (at the time). I quickly found some hints that somebody, namely Gerd [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://fhem.de" target="_blank">FHEM</a>, the amazing home-automation server software, already has support for several sensors, meters and switches produced by <a href="http://www.elv.de" target="_blank">ELV</a>. In October 2010 I bought two meters, <a href="http://www.elv.de/output/controller.aspx?cid=74&#038;detail=10&#038;detail2=22049" target="_blank">ESA1000WZ</a> and <a href="http://www.elv.de/output/controller.aspx?cid=74&#038;detail=10&#038;detail2=25408" target="_blank">ESA1000GAS</a> for my house in the hope that FHEM would support them. Unfortunately it did not (at the time). I quickly found some hints that somebody, namely Gerd K., was working on adding support. So I contacted him and a day later received his module for testing. In the meantime eager in anticipation I was hacking away, duplicating the existing EM1000 extension and customizing it to read the raw strings coming from my <a href="http://busware.de" target="_blank">Busware.de</a> CUL 868 MHz USB adapter. While I got the power meter&#8217;s values (<a href="http://www.elv.de/output/controller.aspx?cid=74&#038;detail=10&#038;detail2=22049" target="_blank">ESA1000WZ</a>) figured out pretty quickly, it was a bit more involving to get correct readings from the gas meter (<a href="http://www.elv.de/output/controller.aspx?cid=74&#038;detail=10&#038;detail2=25408" target="_blank">ESA1000GAS</a>). Unfortunately Gerd&#8217;s code did not include support for the gas meter, so I emailed him my changes, but sadly never received feedback.<br />
So today I am releasing my code on a works-for-me basis:</p>
<p><strong>Download</strong></p>
<p><a class="downloadlink" href="http://katastrophos.net/downloads/FHEM/CUL_ESA.tar.gz"><strong>CUL_ESA.tar.gz</strong> Version: Oct 25th 2010</a></p>
<ul>
<li>Supports <a href="http://www.elv.de/output/controller.aspx?cid=74&#038;detail=10&#038;detail2=22049" target="_blank">ESA1000WZ</a> power meter (infrared version, possibly others as well)</li>
<li>Supports ESA1000Z and <a href="http://www.elv.de/output/controller.aspx?cid=74&#038;detail=10&#038;detail2=25408" target="_blank">ESA1000GAS</a> gas meters (infrared version and version using impulse transducer for the Elster-Kromschroeder BK-G4)</li>
<li>Features proper graph files to plot current and cumulated day/month consumption</li>
</ul>
<p><strong>Photos / Screenshots</strong><br />

<a href='http://katastrophos.net/andre/blog/2011/06/25/fhem-module-for-elv-esa1000-wzzgas-series-of-devices/20110625_002/' title='Elster-Kromschroeder BK-G4 and impulse transducer'><img width="113" height="150" src="http://katastrophos.net/andre/blog/wp-content/uploads/2011/06/20110625_002-113x150.jpg" class="attachment-thumbnail" alt="Elster-Kromschroeder BK-G4 and impulse transducer" title="Elster-Kromschroeder BK-G4 and impulse transducer" /></a>
<a href='http://katastrophos.net/andre/blog/2011/06/25/fhem-module-for-elv-esa1000-wzzgas-series-of-devices/20110625_003/' title='Elster-Kromschroeder BK-G4 and impulse transducer'><img width="150" height="112" src="http://katastrophos.net/andre/blog/wp-content/uploads/2011/06/20110625_003-150x112.jpg" class="attachment-thumbnail" alt="Elster-Kromschroeder BK-G4 and impulse transducer" title="Elster-Kromschroeder BK-G4 and impulse transducer" /></a>
<a href='http://katastrophos.net/andre/blog/2011/06/25/fhem-module-for-elv-esa1000-wzzgas-series-of-devices/20110625_004/' title='ESA1000Z gas meter 868 MHz transmitting unit'><img width="112" height="150" src="http://katastrophos.net/andre/blog/wp-content/uploads/2011/06/20110625_004-112x150.jpg" class="attachment-thumbnail" alt="ESA1000Z gas meter 868 MHz transmitting unit" title="ESA1000Z gas meter 868 MHz transmitting unit" /></a>
<a href='http://katastrophos.net/andre/blog/2011/06/25/fhem-module-for-elv-esa1000-wzzgas-series-of-devices/20110625_005/' title='Power meter with attached infrared sensor on the outside'><img width="150" height="113" src="http://katastrophos.net/andre/blog/wp-content/uploads/2011/06/20110625_005-150x113.jpg" class="attachment-thumbnail" alt="Power meter with attached infrared sensor on the outside" title="Power meter with attached infrared sensor on the outside" /></a>
<a href='http://katastrophos.net/andre/blog/2011/06/25/fhem-module-for-elv-esa1000-wzzgas-series-of-devices/20110625_006/' title='ESA1000WZ power meter 868 MHz transmitting unit'><img width="113" height="150" src="http://katastrophos.net/andre/blog/wp-content/uploads/2011/06/20110625_006-113x150.jpg" class="attachment-thumbnail" alt="ESA1000WZ power meter 868 MHz transmitting unit" title="ESA1000WZ power meter 868 MHz transmitting unit" /></a>
<a href='http://katastrophos.net/andre/blog/2011/06/25/fhem-module-for-elv-esa1000-wzzgas-series-of-devices/gasmeter/' title='FHEM: Day and cumulated day/month plots for the gas meter ESA1000GAS'><img width="150" height="76" src="http://katastrophos.net/andre/blog/wp-content/uploads/2011/06/gasmeter-150x76.png" class="attachment-thumbnail" alt="FHEM: Day and cumulated day/month plots for the gas meter ESA1000GAS" title="FHEM: Day and cumulated day/month plots for the gas meter ESA1000GAS" /></a>
<a href='http://katastrophos.net/andre/blog/2011/06/25/fhem-module-for-elv-esa1000-wzzgas-series-of-devices/gasmeterdetails/' title='FHEM: Detailed settings for the gas meter ESA1000GAS'><img width="129" height="150" src="http://katastrophos.net/andre/blog/wp-content/uploads/2011/06/gasmeterdetails-129x150.png" class="attachment-thumbnail" alt="FHEM: Detailed settings for the gas meter ESA1000GAS" title="FHEM: Detailed settings for the gas meter ESA1000GAS" /></a>
<a href='http://katastrophos.net/andre/blog/2011/06/25/fhem-module-for-elv-esa1000-wzzgas-series-of-devices/powermeter/' title='FHEM: Day and cumulated day/month plots for the power meter ESA1000WZ'><img width="150" height="78" src="http://katastrophos.net/andre/blog/wp-content/uploads/2011/06/powermeter-150x78.png" class="attachment-thumbnail" alt="FHEM: Day and cumulated day/month plots for the power meter ESA1000WZ" title="FHEM: Day and cumulated day/month plots for the power meter ESA1000WZ" /></a>
<a href='http://katastrophos.net/andre/blog/2011/06/25/fhem-module-for-elv-esa1000-wzzgas-series-of-devices/powermeterdetails/' title='FHEM: Detailed settings for the power meter ESA1000WZ'><img width="128" height="150" src="http://katastrophos.net/andre/blog/wp-content/uploads/2011/06/powermeterdetails-128x150.png" class="attachment-thumbnail" alt="FHEM: Detailed settings for the power meter ESA1000WZ" title="FHEM: Detailed settings for the power meter ESA1000WZ" /></a>
</p>
<p><strong>Installation</strong></p>
<p>Copy <strong>19_CUL_ESA.pm</strong> and all <strong>.gplot files</strong> to your FHEM directories.<br />
Sadly adding autocreate support and extending the CUL module to understand the raw message strings requires patching. Check <strong>cul_esa-for-fhem-5.0.patch</strong> to patch the files. This was diffed against the Debian package of FHEM 5.0. The very same version of FHEM as tar.gz has some differences in the sourcecode and some files missing. I contacted the author of FHEM about this issue but he has not updated the packages yet. So if you run into issues here it is probably due to these differences.</p>
<p><strong>UPDATE:</strong> Here is a completely patched version based on the Debian package of FHEM 5.0: <a class="downloadlink" href="http://katastrophos.net/downloads/FHEM/fhem-5.0-cul_esa.tar.gz"><strong>fhem-5.0-cul_esa.tar.gz</strong> Version: Oct 25th 2010</a></p>
<p><strong>Here are some notes in German I made while developing the module, mostly concerning the different behavior of the ESA1000GAS compared to the ESA1000WZ:</strong></p>
<p>Der ESA1000GAS mit dem ESA1000Z-Messgerät verhält sich leider anders als das ESA1000WZ, sodaß ich wieder die Korrektur-Faktoren einbinden mußte.<br />
Ich konnte nicht herausfinden, wozu der übermittelte Tick beim ESA1000Z dient. Zwar ändert sich dieser mit geänderter Zählerkonstante, allerdings ergibt der Wert im Zusammenhang mit den von der Einheit übermittelten Werten keinen Sinn, sodaß ich hier direkt mit der Zählerkonstante multipliziere, um die Kubikmeter zu erhalten, und dann zusätzlich noch mit dem Umrechnungsfaktor (bei der EWE ergibt sich dieser aus der Zustandszahl * Brennwert Hs) multipliziere, um die Kilowattstunden aus der Gasmenge zu erhalten.<br />
Leider ändern sich damit die Parameter bei der Definition:</p>
<p>Stromzähler:<br />
<strong>define CUL_ESA_286 CUL_ESA 1925 286 1 1 23.086</strong><br />
also:<br />
corr1 = corr2 = 1 (und damit wirkungslos)<br />
CostPerUnit = 23.086 Cent/kWh</p>
<p>Gaszähler:<br />
<strong>define CUL_ESA_798 CUL_ESA 1429 798 0.001 9.5154 4.5339</strong><br />
also:<br />
corr1 = 0.001<br />
corr2 = 9.5154 kWh/m3<br />
CostPerUnit = 4.5339 Cent/kWh</p>
<p>Ich habe ebenfalls noch einen Durchschnittswert in Kilowatt implementiert, sodaß man die Durchschnittleistung einigermaßen sinnvoll in einem Diagramm darstellen kann. Hier gab es allerdings bei meinem Drehstromzähler Probleme mit Unterabtastung, weil sich die Drehscheibe bei geringem Verbrauch zu langsam dreht, sodaß das Meßgerät zwischendurch schon Nullwerte zurückmeldet, weil kein Impuls eingegangen ist. Dafür habe ich einen entsprechenden Schwellenwert bei der Berechnung des Durchschnittswertes implementiert. Nicht schön, funktioniert aber für meine Zwecke.</p>
]]></content:encoded>
			<wfw:commentRss>http://katastrophos.net/andre/blog/2011/06/25/fhem-module-for-elv-esa1000-wzzgas-series-of-devices/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Setting up the Inno Setup compiler on Debian</title>
		<link>http://katastrophos.net/andre/blog/2009/03/16/setting-up-the-inno-setup-compiler-on-debian/</link>
		<comments>http://katastrophos.net/andre/blog/2009/03/16/setting-up-the-inno-setup-compiler-on-debian/#comments</comments>
		<pubDate>Sun, 15 Mar 2009 23:36:22 +0000</pubDate>
		<dc:creator>Andre Beckedorf</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Debian]]></category>
		<category><![CDATA[Development]]></category>
		<category><![CDATA[Findings]]></category>
		<category><![CDATA[Hack]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Quasar Media Player]]></category>
		<category><![CDATA[Server]]></category>
		<category><![CDATA[Windows]]></category>

		<guid isPermaLink="false">http://katastrophos.net/andre/blog/?p=180</guid>
		<description><![CDATA[I&#8217;m currently setting up a nightly build system for Quasar on my Linux box which is running Debian. This system also cross-compiles Quasar for Windows. The Windows version of Quasar is going to be available in two fashions: one self-contained, portable version and one version that can be installed. I&#8217;m not a huge fan of [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m currently setting up a nightly build system for Quasar on my Linux box which is running Debian. This system also cross-compiles Quasar for Windows.<br />
The Windows version of Quasar is going to be available in two fashions: one self-contained, portable version and one version that can be installed.<br />
I&#8217;m not a huge fan of installers. But when it comes to creating a setup program for a given Windows application I&#8217;m quite accustomed to <a href="http://www.innosetup.com" target="_blank">Inno Setup</a> having used it for years. Unfortunately there is no native Linux version of the Inno Setup compiler available for Linux. <a href="http://nsis.sourceforge.net" target="_blank">NSIS</a> exists as package for Debian but I am not fond of using it, largely because I am a Delphi guy. :)<br />
So, here is a small guide on how to get the Inno Setup compiler up and running on Debian:</p>
<p>First step is to install <a href="http://www.winehq.org" target="_blank">Wine</a> either as super user or by using <strong>sudo</strong>:</p>
<pre name="code" class="bash:nocontrols">
sudo apt-get install wine
</pre>
<p>As normal user fire up your X server and your favourite terminal application and get the latest <a href="http://www.innosetup.com/isdl.php#qsp" target="_blank">Inno Setup QuickStart pack</a>:</p>
<pre name="code" class="bash:nocontrols">
mkdir /tmp/innosetup
cd /tmp/innosetup
wget http://files.jrsoftware.org/ispack/ispack-5.2.3.exe
wine ./ispack-5.2.3.exe
</pre>
<p>This will start the installer in Wine. Note, for the installation you will need a running X11 server since the installer obviously is graphical. If you have not set up Wine before, the default location <strong>C:\Program Files\Inno Setup 5</strong> will install to <strong>~/.wine/drive_c/Programme/Inno Setup 5</strong>.</p>
<p>Luckily the Inno Setup compiler offers a command line interface, ISCC.exe, which will run in Wine without the necessity of having a X server running. So it is ideally suited for automated runs.</p>
<p>Here is a simple wrapper shell script called <strong>iscc</strong>:</p>
<pre name="code" class="bash:nocontrols">
#!/bin/sh
unset DISPLAY
scriptname=$1
[ -f "$scriptname" ] &#038;&#038; scriptname=$(winepath -w "$scriptname")
wine "C:\Program Files\Inno Setup 5\ISCC.exe" "$scriptname" "$2" "$3" "$4" "$5" "$6" "$7" "$8" "$9"
</pre>
<p>I installed this script in my local bin directory (~/bin) and added it to the PATH environment variable.<br />
This will allow running the Inno Setup compiler from anywhere and it also makes it very easy to integrate into a build script. You can even feed a script via stdin, e.g. something like:</p>
<pre name="code" class="bash:nocontrols">
iscc - < ./myscript.iss</pre>
</pre>
]]></content:encoded>
			<wfw:commentRss>http://katastrophos.net/andre/blog/2009/03/16/setting-up-the-inno-setup-compiler-on-debian/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<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>

