You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@spamassassin.apache.org by Mike French <mi...@misonlineservices.com> on 2004/07/13 06:09:33 UTC

Spamassassin gateway to exchange

Anyone see a practical "How To" with this type of config?

At the Gateway:
Postfix + Amavis-new + Spamassassin + Razor

No local Mailboxes on the gateway.

Exchange 2000:
Local Mail boxes

The gateway and forwarding to exchange are easy, however getting spammy
messages that pass the filter back to the gateway for sa-learning has got me
stuck. I have seen some of the suggestions in the archives but, none really
address "How" it was successfully done. I have read about using a public
folder on the exchange server and using an IMAP connector from the gateway
to pull them across, however my *nix skills are still pretty weak. I get the
concepts pretty well, but I need more to go on. 

Any pointers, links etc.. would be great, maybe it will help getting through
my thick scull.

Mike French
MIS OnlineServices
754 Port America Place
Suite 150
Grapevine, TX 76051
(888) 327-5647
(817) 488-1600
FAX (817) 488-1103
MikeF@misonlineservices.com
www.misonlineservices.com 




Re: Spamassassin gateway to exchange

Posted by Loren Wilton <lw...@earthlink.net>.
> But the client is using POP3 to get the messages.  There is no way to get
> the messages out from the client once they have downloaded them.  If the
> client supported IMAP they could possible drag-and-drop them into the
public
> folder, but unfortunately the version of Goldmine doesn't support IMAP.
>
> I was just wondering what people were doing in this scenario.  It looks
like

With some work on the server end, you could set up spam and ham receive mail
accounts, and have the user create an empty mail, include the spam/ham AS AN
ATTACHMENT, and then send that to the relevent drop box.  The server would
then have to unwrap the attachments out of the received mails (rejecting any
witout an attachment) and process the attachments as the original spam/ham.

The whole trick here is sending the original mail as an attachment rather
than forwarding it.  At least in OE and Outlook, this will preserve the
original headers.  I've never heard of Goldmine, so it may or may not be as
well-behaved.


Note that Outlook also has 'shared folders'.  I don't know if these are IMAP
or something else, but they could probably also be used as drop boxes.
Maybe Goldmine can also access this sort of thing.


A third possibility might be to modify the client configuration to leave the
mail on the server for a day or so rather than deleting it on download.
Then if the user had a way of indicating the mails he thought were spam/ham,
an automated process could hunt up the actual messages in the server mailbox
and process them from there.  One way to do this would be to write a trivial
pop3 client that just listed the mails by subject line and let the user
click checkboxes for spam/ham on each item that he wanted someone to know
about.

        Loren


RE: Spamassassin gateway to exchange

Posted by Geoff Nordli <ge...@gnaa.net>.
Right, we can use the script to pull the messages from the public folder.

But the client is using POP3 to get the messages.  There is no way to get
the messages out from the client once they have downloaded them.  If the
client supported IMAP they could possible drag-and-drop them into the public
folder, but unfortunately the version of Goldmine doesn't support IMAP.  

I was just wondering what people were doing in this scenario.  It looks like
the only option would be for user's to keep the mail on the server, and then
once in a while go in an move the e-mail to the spam and ham public folders.

I guess one could also use the DSPAM plug-in, because it seems that you can
just forward your e-mail to DSPAM for it to learn.  Any one have any
comments on this?

Geoff

> -----Original Message-----
> From: Richard Ozer [mailto:rozer@ois-online.com] 
> Sent: Tuesday, July 13, 2004 11:16 AM
> To: Geoff Nordli
> Cc: spamassassin-users@incubator.apache.org
> Subject: Re: Spamassassin gateway to exchange
> 
> The client doesn't have to support imap.  What you do is put 
> imap support on
> your spamassassin server, read the stuff in exchange's SPAM 
> folder using
> imap, and push it to sa-learn.
> 
> Here's something I wrote up a while ago.
> 
> ***************************************
> How to support ad-hoc Bayesian learning with Microsoft 
> Exchange Server and
> Outlook
> 
> Problem:
> 
> Many organizations use Microsoft Exchange, MS Outlook, and 
> Outlook Express
> with IMAP for their corporate e-mail. Typically, SpamAssassin 
> is running on
> a Linux box that tags the mail and forwards it to the 
> Exchange server for
> delivery. One of the challenges in implementing SpamAssassin in this
> environment has been to provide a seamless mechanism for end 
> users to train
> the bayesian filter. The reason this is difficult is that 
> neither Outlook
> nor Outlook Express preserve the original message headers when mail is
> forwarded from one mailbox to another. This makes it tedious 
> to send the
> necessary information to a spam or ham mailbox. Although 
> mainly a training
> problem, most users are unwilling to take the additional time 
> to manually
> copy the original headers into a new message, along with the original
> message body. It's simply too unwieldy to do so. This often 
> leaves the task
> of Bayesian training to the mail admin, who receives 
> forwarded spam message
> from the end users (usually without the pre-requisite headers) and is
> expected to add the offending email to a blacklist, or to 
> create a new rule.
> 
> Solution:
> The only time headers are properly preserved in Microsoft 
> Outlook or Outlook
> Express, is during a drag and drop operation. This suggests a 
> solution that
> takes advantage of Microsoft Exchange's public folder 
> capabilities. A "Spam"
> public folder and "Ham" public folder can be created on the 
> exchange server,
> allowing users to drag spam or ham into these folders where 
> they will await
> retrieval by the SpamAssassin host.
> 
> A key piece of this puzzle can be found on Nick Burch's web site at:
> 
> http://tirian.magd.ox.ac.uk/~nick/code/
> 
> There you will find a perl script called imap-sa-learn.pl. 
> This script will
> logon to any server supporting IMAP, retrieve any messages 
> located in any
> arbitrarily named folder, process the contents of that folder 
> as either ham
> or spam, delete the processed messages, and then run an 
> sa-learn --rebuild.
> The script is simple to understand, and you need only 
> predicate your public
> folder name with the "Public Folders" directive. For 
> instance, if you create
> a public folder called "Spam", you would set the script 
> variable containing
> the Spam folder's path to:
> 
> my $defspamfolder = 'Public Folders/Spam';
> 
> Likewise, you would do something similar for the Ham folder.
> 
> On the exchange side, create a domain user called 
> spamassassin with minimal
> rights and create an exchange mailbox for it... it should 
> never receive any
> mail. The account is there simply to give the account access 
> to the public
> folders.
> 
> Using Outlook, and while logged in as an administrator, 
> create the Spam and
> Ham public folders. Right click on each folder, go to the folder
> properties/permissions tab and make the spamassassin user a 
> folder "Owner".
> This will give the spamassassin account the necessary 
> privleges to delete
> processed messages. The default permissions should allow 
> anyone to post to
> the folder, and delete only their items.
> In Nick's script, set the login and password to the spamassain user's
> account ID and password, and test. By using a non-admin 
> account for the
> spamassassin, you avoid the risk of having a plain-text 
> administrator name
> and password sitting inside a perl script.
> 
> This mechanism works for both Exchange 5.5 SP4, or Exchange 2000+.
> 
> Richard Ozer
> rozer@ois-online.com
> 
> 
> ----- Original Message ----- 
> From: "Geoff Nordli" <ge...@gnaa.net>
> To: "'Richard Ozer'" <ro...@ois-online.com>; "'SpamAssassin 
> Users List'"
> <sp...@incubator.apache.org>
> Sent: Tuesday, July 13, 2004 11:09 AM
> Subject: RE: Spamassassin gateway to exchange
> 
> 
> > That is what I thought.
> >
> > What happens if they use a client that doesn't support 
> IMAP?   They are
> > currently using Goldmine (CRM package).
> >
> > One could configure the client to not delete the e-mail on 
> the server when
> > downloading messages.
> >
> > Are there any other ideas?
> >
> > Thanks,
> >
> > Geoff
> >
> >
> > > -----Original Message-----
> > > From: Richard Ozer [mailto:rozer@ois-online.com]
> > > Sent: Tuesday, July 13, 2004 11:06 AM
> > > To: Geoff Nordli; 'SpamAssassin Users List'
> > > Subject: Re: Spamassassin gateway to exchange
> > >
> > > If you use outlook or outlook express, you must drag/drop 
> the e-mail.
> > > Forwarding will re-write the headers.
> > >
> > > RO
> > >
> > > ----- Original Message ----- 
> > > From: "Geoff Nordli" <ge...@gnaa.net>
> > > To: "'SpamAssassin Users List'"
> > > <sp...@incubator.apache.org>
> > > Sent: Tuesday, July 13, 2004 11:03 AM
> > > Subject: RE: Spamassassin gateway to exchange
> > >
> > >
> > > >
> > > > > >The gateway and forwarding to exchange are easy, however
> > > > > getting spammy
> > > > > >messages that pass the filter back to the gateway for
> > > > > sa-learning has got me
> > > > > >stuck. I have seen some of the suggestions in the 
> archives but,
> > > > > >
> > > > > Do a google on imap sa-learn. It is a version of sa-learn
> > > > > that can use
> > > > > an imap mailbox.
> > > > >
> > > > > Create an IMAP folder for your account called CRAP and put
> > > > > all the bad
> > > > > email in there. Create one called HAM as well for good email.
> > > > > Then use
> > > > > the imap-sa-learn to learn from your SA machine to your
> > > > > exchange mailbox.
> > > > >
> > > > > Martin
> > > > >
> > > >
> > > > Is it OK if the users forward the e-mail to the account (say
> > > ham@domain.com
> > > > and spam@domain.com), or do they have to drag-and-drop it
> > > to the folder?
> > > >
> > > > Thanks,
> > > >
> > > > Geoff
> > > >
> > > >
> > >
> > >
> >
> >
> 
> 


Re: Spamassassin gateway to exchange

Posted by Richard Ozer <ro...@ois-online.com>.
The client doesn't have to support imap.  What you do is put imap support on
your spamassassin server, read the stuff in exchange's SPAM folder using
imap, and push it to sa-learn.

Here's something I wrote up a while ago.

***************************************
How to support ad-hoc Bayesian learning with Microsoft Exchange Server and
Outlook

Problem:

Many organizations use Microsoft Exchange, MS Outlook, and Outlook Express
with IMAP for their corporate e-mail. Typically, SpamAssassin is running on
a Linux box that tags the mail and forwards it to the Exchange server for
delivery. One of the challenges in implementing SpamAssassin in this
environment has been to provide a seamless mechanism for end users to train
the bayesian filter. The reason this is difficult is that neither Outlook
nor Outlook Express preserve the original message headers when mail is
forwarded from one mailbox to another. This makes it tedious to send the
necessary information to a spam or ham mailbox. Although mainly a training
problem, most users are unwilling to take the additional time to manually
copy the original headers into a new message, along with the original
message body. It's simply too unwieldy to do so. This often leaves the task
of Bayesian training to the mail admin, who receives forwarded spam message
from the end users (usually without the pre-requisite headers) and is
expected to add the offending email to a blacklist, or to create a new rule.

Solution:
The only time headers are properly preserved in Microsoft Outlook or Outlook
Express, is during a drag and drop operation. This suggests a solution that
takes advantage of Microsoft Exchange's public folder capabilities. A "Spam"
public folder and "Ham" public folder can be created on the exchange server,
allowing users to drag spam or ham into these folders where they will await
retrieval by the SpamAssassin host.

A key piece of this puzzle can be found on Nick Burch's web site at:

http://tirian.magd.ox.ac.uk/~nick/code/

There you will find a perl script called imap-sa-learn.pl. This script will
logon to any server supporting IMAP, retrieve any messages located in any
arbitrarily named folder, process the contents of that folder as either ham
or spam, delete the processed messages, and then run an sa-learn --rebuild.
The script is simple to understand, and you need only predicate your public
folder name with the "Public Folders" directive. For instance, if you create
a public folder called "Spam", you would set the script variable containing
the Spam folder's path to:

my $defspamfolder = 'Public Folders/Spam';

Likewise, you would do something similar for the Ham folder.

On the exchange side, create a domain user called spamassassin with minimal
rights and create an exchange mailbox for it... it should never receive any
mail. The account is there simply to give the account access to the public
folders.

Using Outlook, and while logged in as an administrator, create the Spam and
Ham public folders. Right click on each folder, go to the folder
properties/permissions tab and make the spamassassin user a folder "Owner".
This will give the spamassassin account the necessary privleges to delete
processed messages. The default permissions should allow anyone to post to
the folder, and delete only their items.
In Nick's script, set the login and password to the spamassain user's
account ID and password, and test. By using a non-admin account for the
spamassassin, you avoid the risk of having a plain-text administrator name
and password sitting inside a perl script.

This mechanism works for both Exchange 5.5 SP4, or Exchange 2000+.

Richard Ozer
rozer@ois-online.com


----- Original Message ----- 
From: "Geoff Nordli" <ge...@gnaa.net>
To: "'Richard Ozer'" <ro...@ois-online.com>; "'SpamAssassin Users List'"
<sp...@incubator.apache.org>
Sent: Tuesday, July 13, 2004 11:09 AM
Subject: RE: Spamassassin gateway to exchange


> That is what I thought.
>
> What happens if they use a client that doesn't support IMAP?   They are
> currently using Goldmine (CRM package).
>
> One could configure the client to not delete the e-mail on the server when
> downloading messages.
>
> Are there any other ideas?
>
> Thanks,
>
> Geoff
>
>
> > -----Original Message-----
> > From: Richard Ozer [mailto:rozer@ois-online.com]
> > Sent: Tuesday, July 13, 2004 11:06 AM
> > To: Geoff Nordli; 'SpamAssassin Users List'
> > Subject: Re: Spamassassin gateway to exchange
> >
> > If you use outlook or outlook express, you must drag/drop the e-mail.
> > Forwarding will re-write the headers.
> >
> > RO
> >
> > ----- Original Message ----- 
> > From: "Geoff Nordli" <ge...@gnaa.net>
> > To: "'SpamAssassin Users List'"
> > <sp...@incubator.apache.org>
> > Sent: Tuesday, July 13, 2004 11:03 AM
> > Subject: RE: Spamassassin gateway to exchange
> >
> >
> > >
> > > > >The gateway and forwarding to exchange are easy, however
> > > > getting spammy
> > > > >messages that pass the filter back to the gateway for
> > > > sa-learning has got me
> > > > >stuck. I have seen some of the suggestions in the archives but,
> > > > >
> > > > Do a google on imap sa-learn. It is a version of sa-learn
> > > > that can use
> > > > an imap mailbox.
> > > >
> > > > Create an IMAP folder for your account called CRAP and put
> > > > all the bad
> > > > email in there. Create one called HAM as well for good email.
> > > > Then use
> > > > the imap-sa-learn to learn from your SA machine to your
> > > > exchange mailbox.
> > > >
> > > > Martin
> > > >
> > >
> > > Is it OK if the users forward the e-mail to the account (say
> > ham@domain.com
> > > and spam@domain.com), or do they have to drag-and-drop it
> > to the folder?
> > >
> > > Thanks,
> > >
> > > Geoff
> > >
> > >
> >
> >
>
>


RE: Spamassassin gateway to exchange

Posted by Geoff Nordli <ge...@gnaa.net>.
That is what I thought.

What happens if they use a client that doesn't support IMAP?   They are
currently using Goldmine (CRM package).

One could configure the client to not delete the e-mail on the server when
downloading messages.

Are there any other ideas?

Thanks,

Geoff


> -----Original Message-----
> From: Richard Ozer [mailto:rozer@ois-online.com] 
> Sent: Tuesday, July 13, 2004 11:06 AM
> To: Geoff Nordli; 'SpamAssassin Users List'
> Subject: Re: Spamassassin gateway to exchange
> 
> If you use outlook or outlook express, you must drag/drop the e-mail.
> Forwarding will re-write the headers.
> 
> RO
> 
> ----- Original Message ----- 
> From: "Geoff Nordli" <ge...@gnaa.net>
> To: "'SpamAssassin Users List'" 
> <sp...@incubator.apache.org>
> Sent: Tuesday, July 13, 2004 11:03 AM
> Subject: RE: Spamassassin gateway to exchange
> 
> 
> >
> > > >The gateway and forwarding to exchange are easy, however
> > > getting spammy
> > > >messages that pass the filter back to the gateway for
> > > sa-learning has got me
> > > >stuck. I have seen some of the suggestions in the archives but,
> > > >
> > > Do a google on imap sa-learn. It is a version of sa-learn
> > > that can use
> > > an imap mailbox.
> > >
> > > Create an IMAP folder for your account called CRAP and put
> > > all the bad
> > > email in there. Create one called HAM as well for good email.
> > > Then use
> > > the imap-sa-learn to learn from your SA machine to your
> > > exchange mailbox.
> > >
> > > Martin
> > >
> >
> > Is it OK if the users forward the e-mail to the account (say
> ham@domain.com
> > and spam@domain.com), or do they have to drag-and-drop it 
> to the folder?
> >
> > Thanks,
> >
> > Geoff
> >
> >
> 
> 


Re: Spamassassin gateway to exchange

Posted by Richard Ozer <ro...@ois-online.com>.
If you use outlook or outlook express, you must drag/drop the e-mail.
Forwarding will re-write the headers.

RO

----- Original Message ----- 
From: "Geoff Nordli" <ge...@gnaa.net>
To: "'SpamAssassin Users List'" <sp...@incubator.apache.org>
Sent: Tuesday, July 13, 2004 11:03 AM
Subject: RE: Spamassassin gateway to exchange


>
> > >The gateway and forwarding to exchange are easy, however
> > getting spammy
> > >messages that pass the filter back to the gateway for
> > sa-learning has got me
> > >stuck. I have seen some of the suggestions in the archives but,
> > >
> > Do a google on imap sa-learn. It is a version of sa-learn
> > that can use
> > an imap mailbox.
> >
> > Create an IMAP folder for your account called CRAP and put
> > all the bad
> > email in there. Create one called HAM as well for good email.
> > Then use
> > the imap-sa-learn to learn from your SA machine to your
> > exchange mailbox.
> >
> > Martin
> >
>
> Is it OK if the users forward the e-mail to the account (say
ham@domain.com
> and spam@domain.com), or do they have to drag-and-drop it to the folder?
>
> Thanks,
>
> Geoff
>
>


RE: Spamassassin gateway to exchange

Posted by Geoff Nordli <ge...@gnaa.net>.
 
> >The gateway and forwarding to exchange are easy, however 
> getting spammy
> >messages that pass the filter back to the gateway for 
> sa-learning has got me
> >stuck. I have seen some of the suggestions in the archives but, 
> >
> Do a google on imap sa-learn. It is a version of sa-learn 
> that can use 
> an imap mailbox.
> 
> Create an IMAP folder for your account called CRAP and put 
> all the bad 
> email in there. Create one called HAM as well for good email. 
> Then use 
> the imap-sa-learn to learn from your SA machine to your 
> exchange mailbox.
> 
> Martin
> 

Is it OK if the users forward the e-mail to the account (say ham@domain.com
and spam@domain.com), or do they have to drag-and-drop it to the folder?

Thanks,

Geoff


Re: Spamassassin gateway to exchange

Posted by Martin McWhorter <m_...@prairiegroup.com>.
>The gateway and forwarding to exchange are easy, however getting spammy
>messages that pass the filter back to the gateway for sa-learning has got me
>stuck. I have seen some of the suggestions in the archives but, 
>
Do a google on imap sa-learn. It is a version of sa-learn that can use 
an imap mailbox.

Create an IMAP folder for your account called CRAP and put all the bad 
email in there. Create one called HAM as well for good email. Then use 
the imap-sa-learn to learn from your SA machine to your exchange mailbox.

Martin