blob: 93cea3750384c9e42b587369c5a69cca183265a1 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
|
#!/bin/sh
#
# dnsbl-check-nagios.sh
#
# (c) 2009 Damon Tajeddini & heise Netze
#
STATE_OK=0
STATE_WARNING=1
STATE_CRITICAL=2
STATE_UNKNOWN=3
STATE_DEPENDENT=4
FOUND_ADRESS=0
DNSBLlist=`grep -v ^# <<!
cbl.abuseat.org
dnsbl.ahbl.org
ircbl.ahbl.org
virbl.dnsbl.bit.nl
blackholes.five-ten-sg.com
dnsbl.inps.de
ix.dnsbl.manitu.net
no-more-funn.moensted.dk
combined.njabl.org
dnsbl.njabl.org
dnsbl.sorbs.net
bl.spamcannibal.org
bl.spamcop.net
sbl.spamhaus.org
xbl.spamhaus.org
pbl.spamhaus.org
dnsbl-1.uceprotect.net
# dnsbl-2.uceprotect.net
# dnsbl-3.uceprotect.net
psbl.surriel.com
l2.apews.org
dnsrbl.swinog.ch
db.wpbl.info
!`
# reverse IP address
convertIP()
{
set `IFS=".";echo $1`
echo $4.$3.$2.$1
}
usage()
{
echo "Usage: $0 [-H] <host>] [-p]"
echo " -H check Host "
echo " -p print list of DNSBLs"
exit 3
}
# Checks the IP with list of DNSBL servers
check()
{
count=0;
for i in $DNSBLlist
do
count=$(($count + 1))
if nslookup $ip_arpa.$i | grep -q "127.0.0." ;
then
FOUND_ADRESS=$(($FOUND_ADRESS + 1))
echo "DNSBL-Alarm: $ip is listed on $i"
fi
done
if [ $FOUND_ADRESS -ge 1 ]
then
exit 1
fi
echo "OK - $ip not on $count DNSBLs"
exit 0
}
case $1 in
-H)
if [ -z "$2" ]
then
echo "ip address missing"
exit
fi
ip=$2
ip_arpa=`convertIP $ip`
check;;
-p)
for i in $DNSBLlist
do
echo $i
done
exit $STATE_WARNING
exit;;
--help)
usage
exit;;
*)
if [ -z "$1" ]
then
usage
fi
echo "unknown command: $1"
exit;;
esac
|