Spamassassin conf with fetchmail, postfix, procmail, kmail
Hi guys,
Update: I don't seem to have sa-learn and also mail for the inbox is still going to /home/user1/Mail rather than /home/user1/Maildir
I am trying to configure spamassassin to filter the 100's of crap email I get everyday andI am having a few problems. I have it filtering some spam sucessfully so I think I am nearly there. However, some still gets through and also I cannot access the folders I am filtering mail into via procmail. Any help would be greatly appreciated.
I am running Mandrake 9.1 with fetchmail release 6.2.1, procmail 3.22, postfix and kmail
My setup has 2 local users receiving mail from an external smtp server. I have fetchmail set up to run as a daemon from startup and root has a .fetchmailrc as follows
set syslog
set postmaster "user1"
set bouncemail
set spambounce
set properties ""
set daemon 180
poll mail.btinternet.com with proto POP3
user 'removed1' there with password 'removed1' is 'user1 here options fetchall antispam 501
user 'removed2' there with password 'removed2' is 'user2' here options fetchall antispam 501
This has been sucessfully pulling down mail and dropping it into /var/spool/mail from which we have add access from kmail set up to access the mail file. Kmail was then set with folders confirgured to filer mail into using rules.
Postfix is up and running and has been sucessful for ages under this system. main.cf is as follows:
#soft_bounce = no
command_directory = /usr/sbin
daemon_directory = /usr/lib/postfix
myhostname = machine.mydomain.com
mydomain = mydomain.com
inet_interfaces = localhost
unknown_local_recipient_reject_code = 450
alias_maps = hash:/etc/postfix/aliases
home_mailbox = Mailbox
#home_mailbox = Maildir/
mail_spool_directory = /var/spool/mail
mailbox_command = /usr/bin/procmail -Y -a $DOMAIN
smtpd_banner = $myhostname ESMTP $mail_name ($mail_version) (Mandrake Linux)
debug_peer_level = 2
delay_warning_time = 4
sendmail_path = /usr/sbin/sendmail.postfix
newaliases_path = /usr/bin/newaliases.postfix
mailq_path = /usr/bin/mailq.postfix
setgid_group = postdrop
readme_directory = /usr/share/doc/postfix-2.0.6/README_FILES
alias_database = hash:/etc/postfix/aliases
myorigin = btinternet.com
notify_classes = resource, software, delay
This has been chopped to what I think is needed to show here, One of the lines I am uncertain about if homemailbox. Should this be set to maildir?
This all worked a treat until I tried to spamassassin on. I installed sa and set up a .procmailrc in /home/user1 as follows:
home/user1/.procmailrc
SHELL=/bin/sh
PATH="$HOME/bin:/usr/bin:/usr/local/bin:/usr/include:/usr/local/sbin:/bin:/sbin:/usr/sbin"
MAILDIR=
PMDIR=$HOME/.procmail
LOCKFILE=/home/user1/.procmail/lockfile.lock
DEFAULT=/home/user1/Maildir/
JUNKMAIL=/home/user1/Maildir/.junkmail/
LFS=/home/user1/Maildir/LFS/
IPCOP=/home/user1/Maildir/IPCOP
LOCKTIMEOUT=10
LOGFILE=$PMDIR/log
LOGABSTRACT=all
VERBOSE=no
#Filter out Mails from Newgroups
:0 : $LOCKFILE
* ^To:.ipcop-user@*
$IPCOP
#Filter out Mail from lfs
:0 : $LOCKFILE
* ^To:.*@linuxfromscratch.org
$LFS
#Run SpamAssasin
:0fw
| spamassassin -a -P
:0e
{
EXITCODE=$?
}
:0: $LOCKFILE
* ^Subject:.*\*\*\*\*SPAM\*\*\*\*
$JUNKMAIL
# Everything else goes in default mailbox.
:0 : $LOCKFILE
I then set up kmail to receive mail from maildir at /home/user1/maildir. I also ran maildirmake++ and created maildir with a .junkmail .lfs and .ipcop folder underneath. This receives email and also appears to filter some span leaving it in .junkmail with spam addedd as a prefix to the message subject. Also stuff like the following appears in teh message headers so that must be working:
-Spam-Status: No, hits=-0.8 required=6.0
tests=AWL,FROM_AND_TO_SAME_5,NOSPAM_INC,SPAM_PHRASE_00_01,
USER_AGENT
version=2.44
X-Spam-Level:
Status: R
X-Status: N
This is fine although I need to adjust the scoring as some gets through. However I still have the folders I set up in kmail when using a flat Mail directory. I cannot see the procmail .lfs and .ipcop folders even when I remove the . I really want to use procmail to filter these and others but also access them from kmail.
Can anyone point me in the correct direction. I would also appreciate assistance with score tweaking. A lot of stuff on the web about this is fairly confusing. I think I have posted all the config which will help here but if not please ask for more. Once I have set this up I am going to do the same for user2.
Cheers
Iain
Last edited by iihay; 05-26-2003 at 08:06 AM.
|