Koozali.org: home of the SME Server

whitelisting on sending e-mail

Offline magwm

  • *
  • 159
  • +0/-0
  • SmeLover
    • Gadis Tourist Service Italia SRL
whitelisting on sending e-mail
« on: August 18, 2008, 10:26:35 AM »
Hello,

I would like to know if there is a way to automatically add recipients of outgoing mails to the spamassassin whitelist on SME 7.3.

I am using one of the contribs at the moment (E-mail WBL) which does basic black/whitelist, but it would be much better if users could simply reply to a mail to put it on whitelist.

in the mean time, thanks to you all for the fantastic distro&forum,

Michel
MagWm

Offline gzartman

  • *
  • 306
  • +0/-0
    • LEI Engineering & Surveying
Re: whitelisting on sending e-mail
« Reply #1 on: August 18, 2008, 07:02:14 PM »
I would like to know if there is a way to automatically add recipients of outgoing mails to the spamassassin whitelist on SME 7.3.

I don't believe there is, although this would be a nice feature.

Enabling Bayes in the server-manager will help, as in time Bayes will teach Spamassassin not to adversely score those you send email to as spam.

Greg
----
Greg J. Zartman
LEI Engineering & Surveying

SME user and community member since 2000.

Offline magwm

  • *
  • 159
  • +0/-0
  • SmeLover
    • Gadis Tourist Service Italia SRL
Re: whitelisting on sending e-mail
« Reply #2 on: August 19, 2008, 04:42:41 PM »
so no one thinks this is possible? how could I rais a feature request? does that go through the bugzilla as well?

greetings, M
MagWm

Offline elmarconi

  • ****
  • 139
  • +0/-0
Re: whitelisting on sending e-mail
« Reply #3 on: August 20, 2008, 11:08:52 AM »
tai64nlocal < /var/log/qmail/current | grep -i "to remote" | awk '{ print $10 }' | sort | uniq

gives you a nice list to start with...

edit: quote fix...
« Last Edit: August 21, 2008, 10:10:17 AM by elmarconi »
...

Offline magwm

  • *
  • 159
  • +0/-0
  • SmeLover
    • Gadis Tourist Service Italia SRL
Re: whitelisting on sending e-mail
« Reply #4 on: September 15, 2008, 03:13:34 PM »
Thanksalot, Elmarconi!

but what can I do with this list? pasting it into the WBL contrib f*w$%&$cks up the db, so I have to clean it. Would someone know where to hire someone to create a system like this?

Specifically, I would like to
- put onto the whitelist all addresses we send mail to
or, even better,
- when spamassassin reports that a mail is ***SPAM***, be able to send return the mail to a specific address, which results in whitelisting the address or make spambayes learn it it not spam..

any thoughts, anyone?
MagWm

Offline mercyh

  • *
  • 824
  • +0/-0
    • http://mercyh.org
Re: whitelisting on sending e-mail
« Reply #5 on: September 15, 2008, 03:29:22 PM »
Here is not exactly what you are asking for but it may be worth your time to look at:

http://wiki.contribs.org/Sme-unjunkmgr

Offline magwm

  • *
  • 159
  • +0/-0
  • SmeLover
    • Gadis Tourist Service Italia SRL
Re: whitelisting on sending e-mail
« Reply #6 on: September 15, 2008, 07:39:11 PM »
now that is a VERY good tip!

Thanks a lot! Michel :-D
MagWm

Offline Paul Howard

  • *
  • 17
  • +0/-0
    • The Devil Wears A Mechanical Heart
Re: whitelisting on sending e-mail
« Reply #7 on: September 16, 2008, 11:56:27 AM »
Rather than relying on the default spamassasisin settings and entering email addresses manually onto the whitelist, I also implemented the AWL (autoWhiteList). So far it has worked well. 

Not quite a whitelist but more an aid to scoring as you will read here > http://wiki.apache.org/spamassassin/AutoWhitelist


Offline Knuddi

  • *
  • 540
  • +0/-0
    • http://www.scanmailx.com
Re: whitelisting on sending e-mail
« Reply #8 on: September 16, 2008, 08:38:52 PM »
I have been thinking about creating exactly what you request - I have been concerned about how SpamAssassin would react to a very large WhiteList if it was individual addresses and not domains. For my network we send to properly thousands of users and the list would grow quickly - would that maybe slow down SA significantly?, what is the limits of SA?, etc.

I think that a small script could be created that graps the "To:" in all outgoing emails and convert these into a SA WhiteList - maybe on a daily basis....

The command:
tai64nlocal < /var/log/qmail/current | grep -i "to remote" | awk '{ print $10 }' | sort | uniq

Will be a good start, next is to exclude local emails which could be done someting like this:
tai64nlocal < /var/log/qmail/current | grep -i "to remote" | awk '{ print $10 }' | sort | uniq | grep -v `domainname`

Then this has to be augmented to /etc/mail/spamassassin/local.cf as "whitelist_from <email address> properly done via a template. But all this has to be kept in a DB so it is maintained over log rotates.







Offline Knuddi

  • *
  • 540
  • +0/-0
    • http://www.scanmailx.com
Re: whitelisting on sending e-mail
« Reply #9 on: September 17, 2008, 02:30:18 PM »
Couldn't help making a little script that should make this possible. If you place this script in /etc/cron.daily then you will get an increasingly growing whitelist created on a daily basis for all people you send email to. Notice that if you have multiple domains on your server you send from these are not filtered out and hence make the DB a little larger than needed. Make sure to make the script executable (chmod +x <script>)

Code: [Select]
#!/bin/bash
                                                                                                                                                                                         
# The Database is stored in
DB='/usr/local'
                                                                                                                                                                                         
if [ ! -e $DB/userwhitelist ]; then
echo "User Whitelist database doesn't exist - creating intial version"
touch  $DB/userwhitelist
fi
                                                                                                                                                                                         
cat $DB/userwhitelist > userwhitelist.tmp
tai64nlocal < /var/log/qmail/current | grep -i "to remote" | awk '{ print $10 }' | sort -u | grep -v `domainname` >> userwhitelist.tmp
cat userwhitelist.tmp | sort -u > $DB/userwhitelist
# A little clean-up
rm -rf userwhitelist.tmp
                                                                                                                                                                                         
# Now make the SpamAssassin local.cf template
USERS=`cat $DB/userwhitelist`
                                                                                                                                                                                         
# Clear User List
rm -rf /etc/e-smith/templates/etc/mail/spamassassin/local.cf/90SentUserWhiteList
                                                                                                                                                                                         
for USER in $USERS; do
echo "whitelist_from $USER" >> /etc/e-smith/templates/etc/mail/spamassassin/local.cf/90SentUserWhiteList
done
                                                                                                                                                                                         
# Expand Templates for SpamAssassin
/sbin/e-smith/expand-template /etc/mail/spamassassin/local.cf
                                                                                                                                                                                         
# Lastly we need SpamAssassin to start using these new settings
/sbin/e-smith/signal-event email-update

Let me know how this works.

Enjoy,
Jesper
« Last Edit: September 17, 2008, 02:49:02 PM by Knuddi »

Offline elmarconi

  • ****
  • 139
  • +0/-0
Re: whitelisting on sending e-mail
« Reply #10 on: September 17, 2008, 02:40:08 PM »
Code: [Select]
cat userwhitelist.tmp | sort -u > $DB/userwhitelist
Would add another uniq to prevent double entries in the $DB/userwhitelist...
...

Offline Knuddi

  • *
  • 540
  • +0/-0
    • http://www.scanmailx.com
Re: whitelisting on sending e-mail
« Reply #11 on: September 17, 2008, 02:45:36 PM »
Where would you add this? This script does already have this after userwhitelist.tmp has been appended and before the clean-up (sort -u does the same a uniq)
« Last Edit: September 17, 2008, 02:48:38 PM by Knuddi »

Offline elmarconi

  • ****
  • 139
  • +0/-0
Re: whitelisting on sending e-mail
« Reply #12 on: September 17, 2008, 03:45:22 PM »
(sort -u does the same a uniq)

<blush> Oops, you're right....
...

Offline magwm

  • *
  • 159
  • +0/-0
  • SmeLover
    • Gadis Tourist Service Italia SRL
Re: whitelisting on sending e-mail
« Reply #13 on: July 16, 2009, 11:08:57 AM »
Hello, I am trying this script now.. as an addittion to WBL. - I hope it is possible..

the only error I found is the part after "grep -v 'domainname'" which should be "grep -v domainname" (without the single quotes)

as for the rest, I don't understand how spamassassin would use the database, but that may be my misunderstanding.

I'll post the results -

ciao, Michel

MagWm

Offline kevinb

  • *
  • 237
  • +0/-0
Re: whitelisting on sending e-mail
« Reply #14 on: September 10, 2009, 05:19:37 PM »
Michel,

How did this work out? I am writing a script for spam learning and would lke to incorporate this too.

Thanks,

Kevin