The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

How to MailScanner SpamAssassin Spambox

Discussion in 'E-mail Discussions' started by bmcgrail, Jan 29, 2004.

  1. bmcgrail

    bmcgrail Well-Known Member

    Joined:
    Dec 8, 2003
    Messages:
    83
    Likes Received:
    0
    Trophy Points:
    6
    I wanted to run spamassassin on my system from MailScanner. When I tured this on both MailScanner was running spamassassin and so was exim.

    Here is what I changed on my system to allow spamassasin to be run from MailScanner while still keeping the use of the spambox for domains that want it.

    For the scope of this I am not going to go into how to configure MailScanner or the Exim in/out queues.

    First I setup MailScanner and told it to check for spam and use spamassassin.

    Then I shut off spamd in my startup scripts. (touch /etc/spamdisable)

    Next I edited /etc/exim.pl so it would find the correct headers and route the spam. I am sure that cpanel will over write this next time exim updates so beware.

    In exim.pl find the subroutines checkuserspambox & check_deliver_spam
    and change
    if ($headers =~ /^X-Spam-Status: Yes/m) {
    to
    if ($headers =~ /^X-MailScanner-SpamCheck: spam/m) {

    After doing this everything was working great. However I noticed MailScanner was running twice against locally delivered messages. Not only does this put extra load on the server, it also puts the spam score headers in twice. Very annoying.

    To defeat this I edited /etc/exim_outgoing.conf
    Commenting out or removing the directors
    virtual_sa_user:
    sa_localuser:
    keeps exim from trying to reinject the message and stops the MailScanner from running a second time.

    You can also remove the transports
    virtual_sa_userdelivery:
    local_sa_delivery:
    as they will not be called anymore.

    Remember always make copies of your working config files before you edit them :)
     
  2. goodmove

    goodmove Well-Known Member

    Joined:
    May 12, 2003
    Messages:
    624
    Likes Received:
    0
    Trophy Points:
    16
    bmcgrail, what are the benefits (or advantages) of using spamassassin from mailscanner instead of exim?
     
  3. bmcgrail

    bmcgrail Well-Known Member

    Joined:
    Dec 8, 2003
    Messages:
    83
    Likes Received:
    0
    Trophy Points:
    6
    SpamAssassin Run from MailScanner

    By default cpanel/exim only runs SpamAssassin against each locally delivered message. By running it through MailScanner, SpamAssassin is run against all incoming messages. And MailScanner runs against a batch which should be faster and less of a load on high traffic email servers.

    By running SpamAssassin from MailScanner you can do spam filtering for domains that are not locally delivered. Either as a gateway service or for forwarded messages.

    You can also setup rules for MailScanner to treat different email aliases differently.

    Lets say you have yourname@1stdomain.com, your2ndname@1stdomain.com and your3rdname@2nddomain.com for email addresses and they all forward to realname@domain.com. You can setup rules in MailScanner to change the subject line for spam messages sent to the 1st alias, delete spam sent to the 2nd alias, strip html sent to the 3rd alias and not even scan for messages sent to the realname or any combination.

    Note that you do loose the virtual domain user preferences as found in ~./spamassassin/user_prefs (the file that is configured via cpanel > spam assassin > configure spam assassin) However though manual configuration you gain much more control.

    --Ben
     
  4. goodmove

    goodmove Well-Known Member

    Joined:
    May 12, 2003
    Messages:
    624
    Likes Received:
    0
    Trophy Points:
    16
    Which virus definition file do you advise to use? Is Clam appropriate for this setup (I believe that's the one that comes with the layer1/mailscanner package)?
     
    #4 goodmove, Jan 31, 2004
    Last edited: Feb 17, 2004
Loading...

Share This Page