Qmail + vpopmai l+ procmail + spamassassin

You might probably think that’s crazy…but yes it is possible. I have a qmail lazydog installation that has built in vpopmail. But no mailer is complete these days unless it features antispam and antivirus protection. So I though I should implement spamassassin + clamav. I won’t show how to setup spamd or clamd but how to process and deliver mails to users.
How it works:
inside each domain in vpopmail there’s a .qmail-default file that it has probably something like this,

| /home/vpopmail/bin/vdelivermail ” /home/vpopmail/domains/DOMAINNAME/postmaster

But we want to use procmail, so we make it like this:

| preline /usr/bin/procmail -p -m /home/vpopmail/etc/procmailrc

My procmailrc file:

# qmail Lazydog procmailrc file
VHOME=`/home/vpopmail/bin/vuserinfo -d $EXT@$HOST`

# Make sure that we have a .Spam and .Virus folder to sort spam and virus into.
# This will create directorys under the ~vpopmail/domains///Maildir
# direcory. This directory will be created as soon as the user
# recives any mail. It simply creates the .Spam and .Virus directories,
# as well as subscribes them to courier-imap
* ? test ! -d $VHOME/Maildir/.Spam
|( /var/qmail/bin/maildirmake $VHOME/Maildir/.Spam ; /bin/echo “INBOX/Spam” >> $VHOME/Maildir/.bincimap-subscribed )
* ? test ! -d $VHOME/Maildir/.Virus
|( /var/qmail/bin/maildirmake $VHOME/Maildir/.Virus ; /bin/echo “INBOX/Virus” >> $VHOME/Maildir/.bincimap-subscribed )

# Run Anti-Virus and Anit-spam tests.
| /var/qmail/bin/scanmail.sh

* ^X-Virus-Status: INFECTED

# Sort anything marked as SPAM into the users Maildir/.Spam/
* ^X-Spam-Status: YES

# Everything else goes to the users default Maildir/
| /home/vpopmail/bin/vdelivermail ” bounce-no-mailbox

notice the last 2 lines, they make procmail return the mail back to vpopmail so any quotas or other options are applied. Take a look at the Spam and Virus folders that are created inside each everyone’s account. scanmail.sh that is referred inside procmailrc is provided by the lazydog package. You can configure it as you want ..and it has a lot of options on how viruses and spam is treated.

Have fun with your secure and without spam mail….you do use smtp auth and ssl patches for your smtp+imap…don’t you ?

Something was wrong…

The blog had a prob and I couldn’t login. I really don’t know what ‘exactly’ was wrong…but I created a second database and started moving the data from the old db to the new bit by bit. Export – Import…Export – Import. Finally I got it working…
Then I exported both the working db and the non-working one, diff-ed them and saw that for a strange reason the last post I had made on the old db had gone between two others…like that:
(49, 1, ‘2004-08-28 17:10:26’, ‘2004-08-28 14:10:26’,
(57, 1, ‘2004-09-05 01:03:37’, ‘2004-09-04 22:03:37’,
(53, 1, ‘2004-08-31 03:46:59’, ‘2004-08-31 00:46:59’

Everything looks ok now…let’s hope it stays that way 🙂

Bad Routing HOW-TO

I recently bought a Linksys WRT54GS as an AP but until placing it on the roof I use it for testing. What I had done and was absolutely wrong was this:rnIn my configuration I had 2 pcs behind the switch ports (of Linksys) and the whole Linksys machine connected to another switch of mine. On that second switch my wireless client and another 2 pcs are connected (already confused ? 🙂 ). What I had been testing were the routing capabilities of the linksys. Due to my fault I had set up linksys to route all traffic (LAN & WAN instead of just WAN) through a gateway far away on the wireless network. With that setup I had perfect pings for machines behind the (linksys) switch ports (1ms) but lousy pings (10-20ms) for the linksys switch itself. I couldn’t figure out what was wrong until I pinged -r the switch IP…what I saw was that the packets were going from my pc to the switch…then to the gateway on the wireless network and back to my pc…
just try to imagine this:
PC1–switch(1)–WRT–switch(1)–my wrls client–AP(1)–remote wrls client–gateway router–remote wrls client–AP(1)–my wrls client–switch(1)–WRT–PC1

Nice heh ?