################# # # # SpamAssassin # # # ################# :0fw # skip passing to spamc/spamd if user is on # exempt list, or if message is really big. # all_spam_to has problems, and why burden # the server w/large messages if we can # catch them here! * < 500000 * ! ? /usr/local/bin/nospam.pl $LOGNAME |/usr/bin/spamc -s 100000 -d <spamd_server> -p 783
Here's the nospam.pl script:
#!/usr/bin/perl # # nospam.pl -- accept username as option, # check a list of names, see if # user wants spam scanning or not # 0 = skip scanning # nonzero = scan (fail "safe" so that # majority of users are scanned)
$userfile="/etc/spamassassin/exempt"; $found="false";
$user=$ARGV[0];
print "$user\n";
open USERS,$userfile or die "unable to open $userfile $!\n"; while (<USERS>) { next if ( /^#/ ); if ( /^$user$/ ) { $found="true"; last; }; };
close USERS;
if ( $found eq "true" ){ exit 0; };
exit 1;
The logic of the tests seems backwards, but my thinking was, if anything along the line failed (permission problems, I messed up the script, etc.) I want the email to go to spamassassin. I figure it's better to accidentally markup a message for the < 3% of exempt users than it is to blow off marking for everyone else.
There's obviously a lot of overhead here, particularly with opening and closing the file multiple times. At 20K emails per day, that doesn't appear to have caused any problems so far. The linear search also hasn't been a problem so far, and I doubt it will become one until the list grows over 1000 users. If the file open/close overhead gets too large, I'll have to rethink my approach, and write a daemon, or something, but until then, this seems to work out alright.
Another advantage (or disadvantage, depending on your setup) of this approach is that the decision to run SA or not is based on the recipient, instead of the envelope. That way, if a spammer sends a message with a "spam-lover" and a "spam-hater" in the To field of the same email, both will still see the message processed as expected.
--Rich
Obantec Support wrote:
Hi All
RH8.0 with SA2.60 installed as sitewide.
Procmailrc is handling spam for all users and creates ~/.spamassassin/user_prefs ok.
Now 1 customer has decided he does not like spam filtered emails (cannot please all).
tried |/usr/bin/spamassasin -x in procmailrc since i read no user_prefs no spam handling. tried ~/.no-spamfilter
Done a google search but not found an answer to disable on a per user basis.
Mark
------------------------------------------------------- This SF.net email is sponsored by: SF.net Giveback Program. Does SourceForge.net help you be more productive? Does it help you create better code? SHARE THE LOVE, and help us help YOU! Click Here: http://sourceforge.net/donate/ _______________________________________________ Spamassassin-talk mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/spamassassin-talk
------------------------------------------------------- This SF.net email is sponsored by OSDN's Audience Survey. Help shape OSDN's sites and tell us what you think. Take this five minute survey and you could win a $250 Gift Certificate. http://www.wrgsurveys.com/2003/osdntech03.php?site=8 _______________________________________________ Spamassassin-talk mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/spamassassin-talk