Mike Leone on 8 Sep 2004 15:59:02 -0000

[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

[PLUG] Using fetchmail to read from an Exchange public folder for learning spam

I've got a question that deals with fetchmail, spamassassin and Exchange. I
know about the Spamassassin mail inglist, but I figured I'd ask here first,
before I re-subbed onto that very high volume list.

I use postfix as a mail server, and forward everything inbound to an
Exchange server. The postfix server uses amavisd-new to virus and spam-scan,
before handing off to the Exchange server. if the spam-score is above a
certain number, it redirects the spam to a special Exchange email address,
for quarantining.

Problem is, some spam is still slipping thru. So I made an Exchange public
folder, and will be teaching the users how to drag the uncaught spam to it.
I'm told this is the only way to preserve the headers of the email, which SA
needs to learn it as spam.

So what I need to do is to use fetchmail from the postfix server, and have
it read (via IMAP) the contents of that Public Folder. And then I can run
sa-learn --spam, on it.

I've found this:

/usr/bin/fetchmail -a -s -n -p IMAP --folder 'INBOX.Learn Spam' -m 'bash -c
"/usr/bin/tee >(/usr/bin/sa-learn --spam --single \ 
                 > /dev/null)|/usr/bin/spamc|/usr/lib/cyrus-imapd/deliver
$LOGNAME"' mail.hughes-family.org

from http://wiki.apache.org/spamassassin/RemoteImapFolder

but am unclear how to adapt this to my purposes. For instance, where is this
"INBOX.Learn spam" folder in this command - in an IMAP server? So in my
case, it would be my "Uncaught Spam" folder? It appears as if he is
re-delivering the mail he just got, back to himself, AFTER marking it up
(again) with spamc. I don't need (or want) to do that re-delievery step; I
know it's spam. :-)

So, before I start screwing around with a production system (and no, I don't
have a test system(s) I can try this on), I wonder:

- fetchmail isn't actuallY fetching the mail, so it's just reading the
contents of a folder, and then running a command on what it finds there?
- And it does that for every new piece of mail in that folder?

And I would want:

/usr/bin/fetchmail -a -s -n -p IMAP --folder '???????' -m 'bash -c
"/usr/bin/tee >(/usr/bin/sa-learn --spam --single > /dev/null)"'

(the '?????' are because I'm not sure how to specify the folder name)

I'm not sure how the "tee" comes into play. I've read the man page, but it's
still not clicking.

And what of a username and password, to access the Exchnage server? I have
one, obviously, for this spam account, but where and how do I use it, with
fetchmail like this?

Anybody wanna try talking me (slowly :-) through this first?

Philadelphia Linux Users Group         --        http://www.phillylinux.org
Announcements - http://lists.phillylinux.org/mailman/listinfo/plug-announce
General Discussion  --   http://lists.phillylinux.org/mailman/listinfo/plug