Paul Hirschorn wrote:
I have been working on a variety of scenarios of how to handle per user spam
prefs on a mail gateway machine.  Through trial and error found a couple of
interesting things.  In order to user prefs to be read from SQL I need to
invoke the -u "username" flag in spamc.  I have my SQL tables setup and they
are working properly.  I do not have local users.  Here is the situation, I
did realize I can invoke spamc -u [EMAIL PROTECTED], this does work if I have
a user specified in my sql table as [EMAIL PROTECTED]  If I specify just
spamc -u "user" then all emails prefixed as "user"@domain1.com
"user"@domain2.com are both treated the same.  With the same prefs.
Regardless of what the user is setup as locally (I only setup a local user
for further testing this theory)   Is this the expected result of
spamassassin, in other words was it designed to work as such?  Is there such
a way I can create a user in the sql table and define that the user has the
following email addresses, [EMAIL PROTECTED], [EMAIL PROTECTED] and [EMAIL PROTECTED]

Unless you use a different database there is no field that assigns a username to an email account like you ask:


fields
------
username
preference
value
prefid

Whatever you use to call spamc to filter the email is what assigns a mysql "username" to an email address. The mysql usernames do NOT have to match the email account in any way, however if they don't it could get confusing.

In other words we could have the mysql username "150" used for the preferences for [EMAIL PROTECTED], the mysql username "[EMAIL PROTECTED]" could be used for [EMAIL PROTECTED] and [EMAIL PROTECTED] if you wanted.

I know that you don't use procmail so I am not the best person to explain how postfix handles spamc when mail comes into your server.
However I can say there is no way that spamc knows who this incoming email is for unless it is told (-u username).


One method is the use of procmailrc, basically when mail arrives it is sent to a mailbox, in qmail we use .qmail-user files and tell the mailer that it should do something before actually putting the mail into the final destination mailbox. Send mail works similarily, if it see's a .forward file in the users home directory it follows those instructions before placing the email into the final destination mailbox.

So for now lets forget you are forwarding to an Exchange server in order to simplify how this works. Lets say we have three local users one domain.

[EMAIL PROTECTED]
[EMAIL PROTECTED]
[EMAIL PROTECTED]

Sendmail.
Mail sent to [EMAIL PROTECTED], comes into the server, there is no .forward file so it is appended to /var/spool/mail/user1.


Same goes for mail sent to user2 except it is appended to /var/spool/mail/user2

Ditto for user3

Now we want to filter email for user1 so we tell the .forward file to follow instructions in a .procmailrc file, the procmailrc file contains the command call for spamc with the options to use the mysql user preferences based on a username that has been inputed into the mysql database

eg. /usr/bin/spamc -u user1 -f

When spamc has finished filtering it is told to deliver the mail to the usual place, (/var/spool/mail/user1).

So if we set up user2 we would now have a .forward file containing instructions to look at another .procmailrc which contains:

/usr/bin/spamc -u user2 -f

.... and deliver to /var/spool/mail/user2 etc.....

And finally to user3, we create the .forward file which points to user3's .procmailrc. However this time we want to use the same user preferences that user1 has therefore user3's spamc line is the same as user1's

eg. /usr/bin/spamc -u user1 -f

The filtering performed by spamc is based on user1's settings however mail is still deliverd to user3's mailbox, unless we have told it otherwise.

Something is wrong with your call to spamc if the same settings are used for multiple email accounts and it isn't what you intended.

Spamassassin/spamc and mysql do not differentiate the email accounts.

?  And then do the user based pref checking based on that username?  I did
notice the mysql support was beta, if this has not been addressed yet would
anyone know where I can drop off the suggestion?  Thank you for your help
with this. I also did notice in the man page for spamc the -u flag is
semi-obsoleted.  Is this going to be followed through with?  I think there
can still be a lot of power added to spam assassin with that option
especially with mysql user prefs and the way they work currently.  Just my
personal opinion.

I saw this too, and assumed it was an error, I can't imagine that an alternate method to use individual userprefs would be removed, If this is the case, and support for an option to use a username is to be dropped, I guess I would have to look elsewhere for an anti spam solution because it just isn't going to work in my environment where there are no "real" users.


Terry....




------------------------------------------------------- This SF. Net email is sponsored by: GoToMyPC GoToMyPC is the fast, easy and secure way to access your computer from any Web browser or wireless device. Click here to Try it Free! https://www.gotomypc.com/tr/OSDN/AW/Q4_2003/t/g22lp?Target=mm/g22lp.tmpl _______________________________________________ Spamassassin-talk mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/spamassassin-talk

Reply via email to