Blacklist script

Users tips and ideas

Moderators: FlorianB, Pascal, bourgeois, mentor

msweany
Posts: 52
Joined: Thu Nov 30, 2006 3:21 pm

Blacklist script

Postby msweany » Tue Mar 20, 2007 3:37 pm

I had a couple of emails that were making it through the spam filter that always had the same send from address, so I wrote this script to easily add entries to the blacklist.

Use it if you would like. * If you currently use local.cf for whitelist or other entries, you need to modify this script to save to another file*

Create a file called blacklist and make it executable

Code: Select all

touch /usr/bin/blacklist
chmod +x /usr/bin/blacklist


Next open blacklist with your favorite editor (we'll use pico here)

Code: Select all

pico /usr/bin/blacklist


Copy this code

Code: Select all

echo If at any time you would like to stop this script, press Ctrl + C
echo =============================================
echo Enter Blacklist Address use "*" for wildcard
echo =============================================
read white
echo
# Add name to the global blacklist
echo "blacklist_from" $white >> /usr/mailcleaner/share/spamassassin/local.cf
/usr/mailcleaner/bin/dump_mailscanner_config.pl
/usr/mailcleaner/etc/init.d/mailscanner restart
echo =========================================
echo ===== Current Blacklisted Addresses =====
echo =========================================
cat /usr/mailcleaner/share/spamassassin/local.cf


and right click to paste it into file.

now press Ctrl O to save and Ctrl X to exit.

If you type blacklist at the prompt now, you will be prompted to enter an email address you would like to blacklist, it will add this address to the file (or create it if you have not already) and restart mailcleaner. It will also display your current blacklist entries.
fredmdl
Posts: 2
Joined: Tue Oct 29, 2013 3:32 pm
How did you hear about Mailcleaner: Zimbra Forum

Re: Blacklist script

Postby fredmdl » Mon Nov 18, 2013 5:27 pm

Hi.
I create the blacklist file:
/usr/mailcleaner/share/spamassassin/black.cf
And script in /usr/bin/blacklist

This work only if I put a complete address like jonh@gmail.com, if try to Enter Blacklist Address use "*" for wildcard it faill to block. Like *@gmail.com or *gmail.com.

Someone have a tip or another way to configure backlist on mailcleaner?

tks

Return to “Tips”

Who is online

Users browsing this forum: No registered users and 1 guest