Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Spam Fighting moved from MUA to MTA - success!

by merlyn (Sage)
on Nov 04, 2003 at 15:36 UTC ( #304451=CUFP: print w/ replies, xml ) Need Help??

I had been handling $random@stonehenge.com by letting postfix deliver to my procmailrc, which fired up a separate Perl invocation to sort and deliver the mail for each incoming email. And test for spam.

The problem is the MIRVs. A lot of mail gets addressed to thereto@stonehenge, barney@stonehenge, merlyn@stonehenge, for about 10 addresses in one payload. And this type of spam seems to have greatly increased in the past few months. A burst would come in, and for the next two minutes, I was splitting and forking and Mail::SpamAssassin-ing, and loadav would hit 3 or so, and my sublease customers were complaining.

So yesterday, I bit the bullet, and learned about Amavisd, a preforking Perl daemon built around Net::Server, that could pull in SpamAssassin and some virus checkers. I carefully read the "README.postfix" file included in the distro, and set up everything.

Wow, what a difference. Now my postfix/amavisd MTA checks for spam once for the MIRVs, without forking, instead of 10 times with a lot of forking going on. My loadav has never exceeded 0.9! Hooray. Success.

I'm getting about 1 MIRV a minute. Ouch.

My only concern is that the amavisd is started and stopped outside the normal postfix engine, so I'm concerned about what happens when it goes down. (Postfix will just stop, but I won't be around to notice.) I'm thinking of a cronjob entry to just keep restarting it every half hour or so, just in case it fries.

-- Randal L. Schwartz, Perl hacker
Be sure to read my standard disclaimer if this is a reply.

Comment on Spam Fighting moved from MUA to MTA - success!
Re: Spam Fighting moved from MUA to MTA - success!
by Aristotle (Chancellor) on Nov 09, 2003 at 13:43 UTC
    Uhm, am I missing something, or couldn't you simply use spamd/spamc?

    Makeshifts last the longest.

      From what I understand, spamc/spamd are command-line tools meant to work on one item at a time. There's no real place to plug those in at an MTA level. They work fine from an MUA level, but at that point, I'd still be calling it 10 times instead of once for each MIRV.

      With amavis, I get to make one call to SpamAssassin per incoming MIRV, and that's the big win.

      -- Randal L. Schwartz, Perl hacker
      Be sure to read my standard disclaimer if this is a reply.

        You certainly can plug them in at MTA level. I've not much idea about postfix; but I've had it working in exim. You basically set it up as another transport, round-trip everything through that transport and set a flag so that you're not going round in circles.

        spamc/spamd certainly are command line tools, but isn't everything?

Re: Spam Fighting moved from MUA to MTA - success!
by Anonymous Monk on Dec 10, 2003 at 02:25 UTC
    One thing I've noticed about most CUFP, is that typically there's some CODE in them somewhere. Or at least a link to code. This is some code I'd like to see. Where can I find it?

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: CUFP [id://304451]
Approved by Corion
Front-paged by broquaint
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others exploiting the Monastery: (4)
As of 2014-09-02 02:40 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite cookbook is:










    Results (18 votes), past polls