Koozali.org: home of the SME Server
Legacy Forums => Experienced User Forum => Topic started by: si_blakely on May 13, 2004, 08:00:00 AM
-
I use abook to maintain an LDAP address book. I was suddenly inspired to write this script, which adds all the e-mail addresses in my LDAP directory into the SpamAssassin config as a whitelist. It does not affect the server-manager panel whitelist in any way.
This script should be added to /etc/cron.daily.
Update the baseDN for your system to make sure it works. YMMV
Si
#!/bin/sh
#
# Update the spamassassin whitelist with the contents of our ldap addessbook
#
cd /etc/e-smith/templates-custom/etc/mail/spamassassin/local.cf
if [ -e 60ldap_whitelist ]; then
rm -f 60ldap_whitelist
fi
touch 60ldap_whitelist
echo "#" >> 60ldap_whitelist
echo "# whitelist derives from the LDAP directory" >> 60ldap_whitelist
echo "#" >> 60ldap_whitelist
ldapsearch -x -h localhost -b "dc=<UPDATE_THIS>,dc=<UPDATE_THIS>,dc=<UPDATE_THIS>" -S "mail" \
'mail=*' | grep mail: | sed 's/mail: /whitelist_from /' >> 60ldap_whitelist
echo "#" >> 60ldap_whitelist
echo "# ldap whitelist finished" >> 60ldap_whitelist
echo "#" >> 60ldap_whitelist
echo "" >> 60ldap_whitelist
# expand the spamassassin local.cf
/sbin/e-smith/expand-template /etc/mail/spamassassin/local.cf
# restart spamassassin
service spamassassin restart
-
I recently discovered some local user messages being tagged as spam when they're not really... SA is set to a sensitivity of two because of the amount of junk we receive...
This will be very useful!
-
Has anyone done something similar to this in order to whitelist pseudonym's on the SME?
Some of my users prefer to use a pseudonym for their email rather than their account name, and I'd like to whitelist the pseudonym's as well...
Thanks.