Hi comrades, and all those who fight against the evils that plague our 
internet playground,

I've recently started playing with SpamAssassin and stumbled across 
some limitations in the way vpopmail support is implemented. Vpopmail 
(by default) creates domains within a system user account named 
"vpopmail".  So, if you just create a domain with 
"~vpopmail/bin/vadddomain [EMAIL PROTECTED]" you'll end up with a mail 
domain directory at ~vpopmail/domains/example.com.  However, you can 
create domains under any system account, and that's where trouble 
creeps in.

The first problem I've found with SpamAssassin's vpopmail support is 
that the only way it works at all is if you use it with the "-v -u 
vpopmail" flags to spamd. That's of very limited usefulness as you end 
up with one user account (vpopmail) with one mail settings file for 
every mail user and domain on your system. That's no better than simply 
using the system wide config file.

The second limitation was that in order to utilize any vpopmail 
support,  you had to run  your spamd daemon as the vpopmail user. The 
reason that's limiting is that vpopmail (and qmail) allow you to have 
mail domains and users set up under various user accounts. For example, 
I have a mail server set up with about 10,000 domains hosted on it and 
each domain is set up under it's own system user (mostly for file 
system quota purposes). So, in order for vpopmail support to be useful, 
spamd must be running as root so that it's got permission to play in 
every users home directories.

So, I made a few small changes to spamd so that spamd can do something 
useful with the -v flag and not crap out.

Attachment: spamd.diff
Description: Binary data



The changes in the attached spamd.diff file get basic functionality of 
spamassassin working in a vpopmail environment. However, there still 
wasn't quite enough pieces of the puzzle assembled to help spamassassin 
be able to access individual configuration files for each and every 
mail user on a vpopmail toaster. Since email accounts have no direct 
correlation to system users, the problem was getting the email address 
fed into spamd so that it could determine the appropriate home 
directory for each mail account.

The fix was to make a few changes to qmail-scanner-queue.pl and have it 
dynamically call spamc based on the email's envelope recipient (ex: 
spamc -f -u [EMAIL PROTECTED]). With that part in place, I had the 
$username variable in spamd populated with the destination email 
address and could find that users mail directory (via the vuserinfo -d 
system call).

That worked like a charm but I had to go back and make a few more 
tweaks to pass along the right system username to the 
create_dotsa_if_necessary and create_default_if_necessary subroutines.  
The last change I had to make was to SpamAssassin.pm.  It created the 
.spamassassin directory and the config file correctly but it only 
changed the ownership of the config file. I altered it to also change 
the ownership of the .spamassasin directory as well.

Attachment: SpamAssassin.pm.diff
Description: Binary data



Now all is well and spamassassin is working like a charm for me. These 
changes are against 2.41 distribution, it would be great if you'd merge 
them into the sources.

About me: I'm fairly active in the vpopmail community and I publish a 
series of How-To's, the most popular being my Mail Toaster Recipe 
(http://matt.simerson.net/computing/mail/toaster). I've got a small 
(somewhere in the hundreds) following of mail toaster owners that are 
waiting for me to finally publish a comprehensive "this is how you make 
anti-virus and anti-spam work on your toaster" recipe.

Thanks for your time and consideration.
Matt

Reply via email to