Skip to content

Commits on Source 7

(c) Matteo Corti, ETH Zurich, 2007-2012
(c) Matteo Corti, 2007-2018
see AUTHORS for the complete list of contributors
# check_rbl
A Nagios plugin to check if an SMTP server is blacklisted
## Note
Some blacklister as Spamhaus ban DNS queries from public DNS
resolvers as Google resulting in no host being listed. If you are
experiencing problems with the plugin just try the DNS query with a
tool as nslookup to check your DNS configuration.
## Known bugs and problems
Needs ```Data::Validate::Domain``` 0.12 to handle fully qualified host names with an ending dot (e.g., "example.org.")
## Example
```
check_rbl -H example.org -t 60 -c 1 -w 1 -s cbl.anti-spam.org.cn -s cblplus.anti-spam.org.cn -s cblless.anti-spam.org.cn -s cdl.anti-spam.org.cn -s cbl.abuseat.org -s bl.deadbeef.com -s t1.dnsbl.net.au -s spamtrap.drbl.drand.net -s spamsources.fabel.dk -s 0spam.fusionzero.com -s mail-abuse.blacklist.jippg.org -s korea.services.net -s spamguard.leadmon.net -s ix.dnsbl.manitu.net -s relays.nether.net -s no-more-funn.moensted.dk -s psbl.surriel.com -s dyna.spamrats.com -s noptr.spamrats.com -s spam.spamrats.com -s dnsbl.sorbs.net -s dul.dnsbl.sorbs.net -s old.spam.dnsbl.sorbs.net -s problems.dnsbl.sorbs.net -s safe.dnsbl.sorbs.net -s spam.dnsbl.sorbs.net -s bl.spamcop.net -s pbl.spamhaus.org -s sbl.spamhaus.org -s xbl.spamhaus.org -s ubl.unsubscore.com -s dnsbl-1.uceprotect.net -s dnsbl-2.uceprotect.net -s dnsbl-3.uceprotect.net -s db.wpbl.info
```
## Bugs
Please report any bugs or feature requests through the
web interface at https://github.com/matteocorti/check_rbl/issues
#!/bin/sh
# Our one non-success exit code.
EXIT_BAD_ARGS=1
if [ $# -lt 1 ]; then
echo "Usage: $0 <ip address>"
echo ''
echo ' <ip address> the IP to check against a bunch of blacklists.'
echo ''
exit $EXIT_BAD_ARGS
else
IP_ADDR="${1}"
fi
perl ./check_rbl -H $IP_ADDR \
-t 60 \
-c 1 \
-w 1 \
-v \
-s cbl.anti-spam.org.cn -s cblplus.anti-spam.org.cn -s cblless.anti-spam.org.cn -s cdl.anti-spam.org.cn -s cbl.abuseat.org -s bl.deadbeef.com -s t1.dnsbl.net.au -s spamtrap.drbl.drand.net -s spamsources.fabel.dk -s 0spam.fusionzero.com -s mail-abuse.blacklist.jippg.org -s korea.services.net -s spamguard.leadmon.net -s ix.dnsbl.manitu.net -s relays.nether.net -s no-more-funn.moensted.dk -s psbl.surriel.com -s dyna.spamrats.com -s noptr.spamrats.com -s spam.spamrats.com -s dnsbl.sorbs.net -s dul.dnsbl.sorbs.net -s old.spam.dnsbl.sorbs.net -s problems.dnsbl.sorbs.net -s safe.dnsbl.sorbs.net -s spam.dnsbl.sorbs.net -s bl.spamcop.net -s pbl.spamhaus.org -s sbl.spamhaus.org -s xbl.spamhaus.org -s ubl.unsubscore.com -s dnsbl-1.uceprotect.net -s dnsbl-2.uceprotect.net -s dnsbl-3.uceprotect.net -s db.wpbl.info
......@@ -5,6 +5,7 @@ Jan Kantert <jan.kantert@researchgate.net> for the whitelisting support
Nick Nicholas <opoudjis@gmail.com> for IPv6 support
Michael Orlitzky <michael@orlitzky.com> for the test.sh usage patch
Celevra https://github.com/celevra for the Debian/Ubuntu documentation update
Claudio Kuenzler https://github.com/Napsty for the append patch
Please report any bugs or feature requests through the
web interface at https://github.com/matteocorti/check_rbl/issues
......
Copyright (c) 2009-2016 Matteo Corti
Copyright (c) 2009-2019 Matteo Corti
Copyright (c) 2010 Elan Ruusamae
Copyright (c) 2009 ETH Zurich
......
2019-02-28 Matteo Corti <matteo@corti.li>
* Version 1.4.4
* check_rbl: applied --append patch
2018-05-30 Matteo Corti <matteo@corti.li>
* Version 1.4.3
......
---
abstract: ~
author:
- 'Matteo Corti <matteo@corti.li>'
build_requires:
ExtUtils::MakeMaker: 6.59
ExtUtils::MakeMaker: 6.36
configure_requires:
ExtUtils::MakeMaker: 6.59
ExtUtils::MakeMaker: 6.36
distribution_type: module
dynamic_config: 1
generated_by: 'Module::Install version 1.18'
license: gpl
generated_by: 'Module::Install version 1.19'
license: unknown
meta-spec:
url: http://module-build.sourceforge.net/META-spec-v1.4.html
version: 1.4
......@@ -29,7 +26,4 @@ requires:
Net::DNS: 0
Net::IP: 0
Readonly: 0
perl: 5.8.0
resources:
license: http://opensource.org/licenses/gpl-license.php
version: 1.4.0
version: 1.4.3
{
"abstract" : "unknown",
"author" : [
"Matteo Corti <matteo@corti.li>"
"unknown"
],
"dynamic_config" : 0,
"generated_by" : "Module::Install version 1.18, CPAN::Meta::Converter version 2.150010",
"generated_by" : "Module::Install version 1.19, CPAN::Meta::Converter version 2.150010",
"license" : [
"open_source"
"unknown"
],
"meta-spec" : {
"url" : "http://search.cpan.org/perldoc?CPAN::Meta::Spec",
......@@ -46,11 +46,6 @@
}
},
"release_status" : "stable",
"resources" : {
"license" : [
"http://opensource.org/licenses/gpl-license.php"
]
},
"version" : "1.4.0",
"version" : "1.4.3",
"x_serialization_backend" : "JSON::PP version 2.27400_02"
}
---
abstract: unknown
author:
- 'Matteo Corti <matteo@corti.li>'
- unknown
build_requires:
ExtUtils::MakeMaker: '6.36'
configure_requires:
ExtUtils::MakeMaker: '0'
dynamic_config: 0
generated_by: 'Module::Install version 1.18, CPAN::Meta::Converter version 2.150010'
license: open_source
generated_by: 'Module::Install version 1.19, CPAN::Meta::Converter version 2.150010'
license: unknown
meta-spec:
url: http://module-build.sourceforge.net/META-spec-v1.4.html
version: '1.4'
......@@ -28,7 +28,5 @@ requires:
Net::DNS: '0'
Net::IP: '0'
Readonly: '0'
resources:
license: http://opensource.org/licenses/gpl-license.php
version: 1.4.0
version: 1.4.3
x_serialization_backend: 'CPAN::Meta::YAML version 0.018'
......@@ -46,7 +46,7 @@ else {
my $ver = eval { require Net::DNS; $Net::DNS::VERSION };
if (!$ver || $ver eq '1.03') {
warn 'Net::DNS is broken please downgrade until fixed. See https://rt.cpan.org/Ticket/Display.html?id=108745';
$prereqs{'Nagios::Plugin::Getopt'} = '1.04';
$prereqs{'Net::DNS'} = '1.04';
}
install_script 'check_rbl';
......
2019-02-28: 1.4.4 - added the --append option
2018-05-30: 1.4.3 - removing spamcannibal.org from the documentation and default configuration
2018-05-25: 1.4.2 - removing dnsbl.cyberlogic.net from the documentation and default configuration
2017-07-17: 1.4.1 - Perl 5.26 support
......
(c) Matteo Corti, ETH Zurich, 2007-2012
(c) Matteo Corti, 2007-2019
see AUTHORS for the complete list of contributors
# check_rbl
A Nagios plugin to check if an SMTP server is blacklisted
## Note
Some blacklister as Spamhaus ban DNS queries from public DNS
resolvers as Google resulting in no host being listed. If you are
experiencing problems with the plugin just try the DNS query with a
tool as nslookup to check your DNS configuration.
## Known bugs and problems
Needs ```Data::Validate::Domain``` 0.12 to handle fully qualified host names with an ending dot (e.g., "example.org.")
## Example
```
check_rbl -H example.org -t 60 -c 1 -w 1 -s cbl.abuseat.org -s bl.deadbeef.com -s spamtrap.drbl.drand.net -s spamsources.fabel.dk -s 0spam.fusionzero.com -s mail-abuse.blacklist.jippg.org -s korea.services.net -s spamguard.leadmon.net -s ix.dnsbl.manitu.net -s relays.nether.net -s psbl.surriel.com -s dyna.spamrats.com -s noptr.spamrats.com -s spam.spamrats.com -s dnsbl.sorbs.net -s spam.dnsbl.sorbs.net -s bl.spamcop.net -s pbl.spamhaus.org -s sbl.spamhaus.org -s xbl.spamhaus.org -s ubl.unsubscore.com -s dnsbl-1.uceprotect.net -s dnsbl-2.uceprotect.net -s dnsbl-3.uceprotect.net -s db.wpbl.info -s access.redhawk.org -s blacklist.sci.kun.nl -s dnsbl.kempt.net -s forbidden.icm.edu.pl -s hil.habeas.com -s rbl.schulte.org -s sbl-xbl.spamhaus.org -s bl.technovision.dk -s b.barracudacentral.org -s dnsbl.antispam.or.id -s dnsbl.inps.de -s drone.abuse.ch -s dsn.rfc-ignorant.org -s dul.dnsbl.sorbs.net -s http.dnsbl.sorbs.net -s l1.spews.dnsbl.sorbs.net -s l2.spews.dnsbl.sorbs.net -s misc.dnsbl.sorbs.net -s postmaster.rfc-ignorant.org -s rbl.spamlab.com -s rbl.suresupport.com -s relays.bl.kunden.de -s smtp.dnsbl.sorbs.net -s socks.dnsbl.sorbs.net -s spam.abuse.ch -s spamrbl.imp.ch -s tr.countries.nerd.dk -s unsure.nether.net -s virbl.bit.nl -s web.dnsbl.sorbs.net -s whois.rfc-ignorant.org -s wormrbl.imp.ch -s zen.spamhaus.org -s zombie.dnsbl.sorbs.net -s blackholes.five-ten-sg.com -s blacklist.woody.ch -s bl.emailbasura.org -s bogons.cymru.com -s combined.abuse.ch -s duinv.aupads.org -s dynip.rothen.com -s ohps.dnsbl.net.au -s omrs.dnsbl.net.au -s orvedb.aupads.org -s osps.dnsbl.net.au -s osrs.dnsbl.net.au -s owfs.dnsbl.net.au -s owps.dnsbl.net.au -s probes.dnsbl.net.au -s proxy.bl.gweep.ca -s proxy.block.transip.nl -s rbl.inter.net -s rbl.megarbl.net -s rdts.dnsbl.net.au -s relays.bl.gweep.ca -s residential.block.transip.nl -s ricn.dnsbl.net.au -s rmst.dnsbl.net.au -s spamlist.or.kr -s t3direct.dnsbl.net.au -s ubl.lashback.com -s all.s5h.net -s bl.spamcannibal.org -s dnsbl.anticaptcha.net -s dnsbl.dronebl.org -s dnsbl.spfbl.net -s ips.backscatterer.org -s singular.ttk.pte.hu -s spam.dnsbl.anonmails.de -s spambot.bls.digibase.ca -s z.mailspike.net
```
## Bugs
Please report any bugs or feature requests through the
web interface at https://github.com/matteocorti/check_rbl/issues
......@@ -20,7 +20,7 @@ package main;
use strict;
use warnings;
our $VERSION = '1.4.3';
our $VERSION = '1.4.4';
use Data::Validate::Domain qw(is_hostname);
use Data::Validate::IP qw(is_ipv4 is_ipv6);
......@@ -77,6 +77,7 @@ Readonly our $DEFAULT_TIMEOUT => 15;
Readonly our $DEFAULT_RETRIES => 4;
Readonly our $DEFAULT_WORKERS => 20;
Readonly our $DEFAULT_QUERY_TIMEOUT => 15;
Readonly our $DEFAULT_APPEND_STRING => q{};
# IMPORTANT: Nagios plugins could be executed using embedded perl in this case
# the main routine would be executed as a subroutine and all the
......@@ -383,7 +384,7 @@ sub validate {
if ( !$ip ) {
$plugin->nagios_exit( $plugin_module->UNKNOWN,
'Cannot resolve ' . $options->host );
'Cannot resolve ' . $hostname );
}
}
......@@ -484,6 +485,13 @@ sub run {
default => $DEFAULT_QUERY_TIMEOUT,
);
$options->arg(
spec => 'append|a=s',
help => 'Append string at the end of the plugin output',
required => 0,
default => $DEFAULT_APPEND_STRING,
);
$options->getopts();
###############
......@@ -575,6 +583,7 @@ s/(\d{1,3}) [.] (\d{1,3}) [.] (\d{1,3}) [.] (\d{1,3})/$4.$3.$2.$1.$server/mxs;
my $total = scalar @listed;
my $status;
my $appendstring = $options->append;
if ( $options->get('whitelistings') ) {
$status =
......@@ -619,6 +628,11 @@ s/(\d{1,3}) [.] (\d{1,3}) [.] (\d{1,3}) [.] (\d{1,3})/$4.$3.$2.$1.$server/mxs;
uom => q{s},
);
# append string defined in append argument to status output
if ( $appendstring ne q{} ) {
$status .= " $appendstring";
}
$plugin->nagios_exit( $threshold->get_status($total), $status );
return;
......