As a System Administrators “The Key to a good performing Server is Good IP Reputation”
Maintaining a MAIL Servers or Web Servers is big time for System Admins,there is always a big fear for your IP getting Blacklisted on different SPAM sources due to which mails originated from your server either are not accepted or deffered by the Recipient Server.It would of great help if we get timely EMAIL as well as SMS alerts of IP getting blacklisted. This would make servers perform well as BOUNCES do use system resources which impact on system overall performance (Explaining Which in this article is OUT OF SCOPE.)
You can get this by Paying a Handsome amount of money to a Service Provider or DO MY way. I have written a Shell script using which you can get timely alerts as your IP gets blacklisted. You can put the script in crontab to run every Hour or so.
To START with Copy the script onto you system
# mkdir dnsbl && cd dnsbl
# vim dnsbl_check.sh
Copy the Below Script
#!/bin/bash
# Date: Mar 20,2010
# Author: Ashwin Muni
# Purpose: Check the IP Against Major SPAM Sources.
## Uncomment to Debug
# set -x
# Variables
tmp_file='/tmp/dnsbl'
#IN_DNSBL=127.0.0.[2-6]
#IN_DNSBL=127.0.0.
IN_DNSBL='127.0.0.2|127.0.0.3|127.0.0.4|127.0.0.5|127.0.0.6|127.0.0.7|127.0.0.8|127.0.0.9|127.0.0.10|127.0.0.'
DIG=`which dig`
MAIL_ADMIN="test@example.com ashwin@linuxmaza.com"
###################################################
# SCRIPT START
> $tmp_file
echo "Below IPs are Listed" >> $tmp_file
if [ "$#" == 1 ]; then
for i in `cat rbllist.txt`; do
IP_REV=`echo $1 | awk -F\. '{ print $4"."$3"."$2"."$1 }'`
$DIG $IP_REV.$i | grep $IN_DNSBL
if [ $? == '0' ]; then
#echo "$1 Listed on $i"
echo -e "\033[31m \033[1m PROBLEM : Listed on $i \033[0m \033[22m"
echo "################################ Attention : $1 Listed on $i" >> $tmp_file
else
echo -e "Not Listed on $i : \033[32m \033[1m OK \033[22m \033[0m "
echo "$1 Not Listed on $i" >> $tmp_file
fi
done
echo -e "\033[31m \033[1m ===================$1 is LISTED ON BELOW SPAM SOURCES====================== \033[0m \033[22m"
cat $tmp_file | mail -s "DNSBL REPORT FOR $1" $MAIL_ADMIN
else
echo -e "\t\t\t\t\033[31m \033[1m Enter Proper Arguments:\n Script Usage :\n /bin/sh $0 IP.ADD.RE.SS \033[0m \033[22m"
# EOF
################################################
Save the file Using “:wq”
Make necessary changes in the Script like the System Admin email address to sent Emails.
You will need the SPAM sources to check which you can find Here MAJOR SPAM SOURCES
Copy all the SPAM Sources and paste it in a txt file named “rbllist.txt”
# vi rbllist.txt
Should show you all the Major SPAM Sources for Checking your IPs.
Note: The script and the rbllist.txt should exist in the Same directory.
Once done we will give executable permission to the script which allows us to run it.
# chmod 755 dnsbl_check.sh
OR
# chmod +x dnsbl_check.sh
Now Run the Script
#./dnsbl_check.sh 100.200.100.200
You can put the script in crontab to run it regularly.
Related posts:
- MAJOR SPAM Sources where your IPs can get blacklisted which could affect your service. MAJOR SPAM Sources where your IPs can get blacklisted which...
- Email Marketing In India – How Do I Choose One from Many Email Marketing In India As the name say Email used...
- Init Script to Start, Stop, Restart RED5 Media Server Click Here Howto Install RED5 Flash Media Server in Fedora...



