< Day Day Up > |
Recipe 21.10. Setting Up SpamAssassin Without Amavisd-new21.10.1 ProblemYou're not using Amavisd-new, so how can you use SpamAssassin with Postfix? 21.10.2 SolutionUse Courier-Maildrop to pass traffic between Postfix and SpamAssassin. After installing Courier-Maildrop, edit or create /etc/maildroprc, adding these lines: if ( $SIZE < 26144 ) { exception { xfilter "/usr/bin/SpamAssassin" } } if (/^X-Spam-Flag: *YES/) { exception { to "$HOME/Maildir/.junkmail/" } } else { exception { to "$HOME/Maildir/" } } The .junkmail folder, or whatever you want to call it, must already exist. $SIZE < 26144 specifies a minimum message size to send to SpamAssassin; you can tweak this to suit your needs. Then add this line to /etc/postfix/main.cf, to tell Postfix to use Maildrop for delivery to Linux system accounts: mailbox_command = /usr/bin/maildrop -d ${USER} Run postfix reload, and you're finished. The default SpamAssassin configuration is a good starting point; run it for a while without changing anything. See the "Discussion" section of this recipe for a sample configuration and explanations of the options. 21.10.3 DiscussionIf you're hosting virtual domains on your Postfix server, don't use the mailbox_command directive. Instead, add these lines to main.cf: maildrop_destination_recipient_limit = 1 virtual_transport = maildrop Then add the following lines to /etc/master.cf: maildrop unix - n n - - pipe flags=DRhu user=vhosts argv=/usr/bin/maildrop -d ${recipient} There's a tricky bit here, in user=vhosts. Maildrop must run as the same user that owns the virtual mailboxes, which should be a unique user created just for the job. It must not be the "nobody," "postfix," or root user. (See Recipe Recipe 20.15.) Restart Postfix, and you're done. Configuring SpamAssassin is pretty simple. The global configuration file is /etc/spamassassin/local.cf. Here is a sample configuration: required_hits 8.0 rewrite_subject 1 use_terse_report 1 report_safe 0 skip_rbl_checks 0 use_bayes 1 auto_learn 1 Here's a rundown of what the above options mean:
Complete options are spelled out in perldoc Mail::SpamAssassin::Conf. That's a command, if you're not familiar with Perldocs: $ perldoc Mail::SpamAssassin::Conf Perldocs are also available online and in man page format. 21.10.4 See Also |
< Day Day Up > |