The Spamhaus Project is one of the largest anti-spam DNS blacklist services known. Founded in 1998, Spamhaus has operations in Geneva, Switzerland, and London in addition to the 28 investigators and forensic specialists located in 8 countries. Spamhaus is a true 24 hour a day anti-spam operation. With over 60 public DNS Servers distributed across 18 countries, Spamhaus is able to serve billion of DNS requests to the world over, all free of charge. It has been estimated that 1.4 billion users mailboxes are in some way protected by The Spamhaus Project every day.

Here, I will show you a script that automatically blocks IPs blocked by Spamhaus:

#!/bin/bash

IPT=”/sbin/iptables”
FILE=”/tmp/drop.lasso”
URL=”http://www.spamhaus.org/drop/drop.lasso”

echo “”
echo -n “Deleting DROP list from existing firewall…”

Continue Reading…

In Bash Shell Scripting the variables do not need to  be declared.

However, if the variable is not declared it will only produce an empty string.  When you declare variables you are telling the shell what value the variable contains.  In this example, the variable $var, note that it can be lower case, has a value of “time”.

Each time the variable is called it will have this value.  You can also declare variables with the declare command.

var=time

or

declare var=time

If you had a variable constructed without declaring the value it would look like this:

var=

Or you may call a variable that has no value attached with something like this:

echo $VAR

If the VAR variable has not been declared you just get an empty string.

I’ll show you a simple script for easily monitor server



#!/bin/bash
# Monitoring Server with ping

########################################################

# host/ip
HOST="debian-tutorials.com"

# NO ping request
COUNT=3

# Report
SUBJECT="Server Down!"
EMAIL="[email protected]"
for host in $HOST

do
count=$(ping -c $COUNT $HOST | grep 'received' | awk -F',' '{ print $2 }' | awk '{ print $1 }')

  if [ $COUNT -eq 0 ]; then
# Server is DOWN!

    echo "Host : $HOST is down (ping failed) at $(date)" | mail -s "$SUBJECT" $EMAILID
  fi
done
Page 1 of 11