[Mimedefang] spamassassin

John Nemeth jnemeth at victoria.tc.ca
Tue Sep 13 02:34:30 EDT 2005


On Dec 29, 12:30pm, Steve Jordan wrote:
}
} I'm lost when it comes to spamassassin. First, do you need to call
} spam_assassin_init($config_file)->compile_now(1) once at the beginning of
} mimedefang-filter or once with each user? Second, can you tell

     Call it once at the beginning of mimedefang-filter.  This will
cause $SASpamTester to be set, which you will need.

} spamassassin that you are using mysql and the password, etc. or should I

     Just put this in your config_file, i.e.

--- sa-mimedefang.cf ---
user_scores_dsn                 DBI:mysql:spamassassin:localhost
user_scores_sql_username        spamuser
user_scores_sql_password        xxxxxxxx
user_scores_sql_table           userpref
---

Then right before spam_assassin_check(); do

$SASpamTester->load_scoreonly_sql($user);

where $user is the user who's mail is being checked.  $user can be just
the username or it can username at domain.  SpamAssassin basically takes
$user and does 'select * from userpref where username=$user' (with
proper quoting and using the table specified in the config_file,
etc.).

} get the user preferences myself and put it into the config file? We are
} busy enough that we plan on using at least 8 machines to handle the load.
} Right now I have it on a demo machine and I am using stream_by_recipient.
} For each email, I get the user preferences from mysql and append them to
} a copy of the sa-mimedefang.cf file. I then invoke
} spam_assassin_init($config_file)->compile_now(1). Then I call

     This is rather silly.

} spam_assassin_check() and add appropriate headers using
} action_change_header. I think I could speed it up by using periodic dumps

     You still need to do this.  MIMEDefang doesn't let SpamAssassin
change the message.

} of the mysql table if necessary (may have to do this to lighten the load
} on the mysql server). Right now we are using spamc on some of the email.

     Index on username and it shouldn't be too bad.  Certainly a lot
better then constantly calling spamassassin_init().

} We are hoping to break even or speed things up by using spamassassin from
} mimedefang as a sendmail milter. So, is using the milter worthwhile, or is
} spamc more efficient? Oh yeah, forgot to say we are using mimedefang 2.47

     MIMEDefang is much more efficient.  Also, if the message only had
one recipient (you can test this by checking $WasResent) then you can
reject the message letting the sender know that you didn't like it,
instead of having to discard the message.

} and clamd already as a sendmail milter. Adding spamassassin is not much
} more code in mimedefang-filter I am sure, but I am unsure of the best way

     This depends.  Are you using virtual domains?  If not, then all
you have to do is check to see if the recipient is in your domain,
extract the username and pass it to load_scoreonly_sql().  If you are
using virtual domains, then you have to pass the correct
username at domain.  My own filter also includes the ability for a
recipient to opt-out of spamassassin and the ability to have the
message tossed.  I do this by adding my own "preferences" to the
userpref table and checking them myself.

     Also, the ammount of work will be determined by what you want to
do in the case that it is spam.  But, there are many examples around in
the mimedefang-filter.example, the FAQ, and the kwiki.

} of coding it in general terms. I am willing to upgrade if needed.

     If you want to use the 2.x and later versions of SpamAssasin then
you need to upgrade.

} Efficiency is needed because of our volume of mail (peaks of over 1000
} email / minute without stream_by_recipient).

     Ouch!  Make sure /var/spool/MIMEDefang is a RAM disk.  Make sure
you have LOTS of memory.  I don't know what you're requirements are,
but you can improve things by dividing users into classes or even
making them all use the same rules.

}-- End of excerpt from Steve Jordan



More information about the MIMEDefang mailing list