surblhost(1)

NAME
surblhost - check if hostnames are blacklisted by surbl.org

SYNOPSIS
surblhost [ options ] [ host(s) ]

DESCRIPTION
surblhost will check if the given hostnames are blacklisted by surbl.org. Blacklisting means that global spam mail contains links to the given hostnames, and should therefore be avoided. Although surbl.org is usually used in mail transfer agents for identifying spam, you can use it for a lot of other purposes.

OPTIONS

-   Read hostnames from standard input, separated by newlines.

--check-whitelist
    Explicitly checks each and every entry in the pre-compiled and user-submitted whitelist against the SURBL lists. This is good to check if the whitelist is indeed OK, especially when you compile your own. When you set up a system to use your own whitelist, it is sufficient to run this command every once in a while -- you should *not* run it every time you check a host.

-h --help
    Print help text.

--no-surbl
    Do not use the default multi.surbl.org as hostname suffix when doing DNS A record lookups. That means you have to specify your hostnames in the form somewhere.com.multi.surbl.org, or similarly if you want to use other lookup providers than surbl.org. This is the same as using --surbl=''.

--print-tlds
    Print the two-level TLDs that are used for recognizing domains such as co.uk.

--print-whitelist
    Prints the predefined whitelist that is hardcoded into surblhost. This list is derived from the SpamAssassin whitelist at http://spamassassin.apache.org/full/3.1.x/dist/rules/25_uribl.cf and is pretty safe to hard-code. The point of the whitelist is to reduce the number of DNS lookups needed for common hostnames.

-q --quiet
    Quiet output; useful when you just want to check the exit code of the program to determine if the given host(s) are blacklisted.

-r --recursive
    Recursively checks all subdomains for a given host. Example: If you submit sub2.sub1.somewhere.com to surblhost with this option, the following domains will be checked for blacklisting: sub2.sub1.somewhere.com, sub1.somewhere.com, somewhere.com. Note that the SURBL.org guidelines says they will only list somewhere.com, but this option has been implemented because some TLD countrycodes are a bit tricky. This is the situation with e.g. co.uk domains. If you want to check somewhere.co.uk, then using the -s option will not work very well, as it will check "co.uk" instead of "somewhere.co.uk". Using the recursive options works around this.

-f --skip-whitelist
    Skip checking hostnames against the whitelists. You should almost never use this option, as the whitelist is designed to reduce the number of DNS lookups for most common hostnames. See --print-whitelist.

-s --strip-sub
    Strips subdomains from the hostnames given on the commandline, i.e. `surblhost -s foo.bar.com' will only check if bar.com is blacklisted. Two-level TLDs are recognized, so if you check www.somewhere.co.uk and use this option, then only somewhere.co.uk will be looked up.

--surbl=...
    Set the surbl suffix yourself. The default value is multi.surbl.org, but you can use other provides to check against blacklists at your will. You just have to be sure that the returned IP-addresses are in the same format as given by the surbl guidelines at http://www.surbl.org

--test
    Tests against a permanent testpoint, which should always be blacklisted.

--tlds=file
    Read two-level TLDs from given file. You should put one entry per line. An example of a two-level TLD is "co.uk".

--tlds-add=file
    Same as --tlds=file, but adds the contents of file to the list.

-v --verbose
    Give verbose output. This is recommended to give a feel of what is actually being done.

-V --version
    Show program version and exit.

--whitelist=file
    Reads whitelist from given file. You should put one entry per line.

--whitelist-add=file
    Same as --whitelist=file, but adds the contents to the whitelist.

RETURN VALUES
Surblhost returns 0 when no of the hostnames are blacklisted. It returns 1 for errors, and 2 when one or more sites are blacklisted.

EXAMPLE: USING WITH SCRIPTS
Here is a complete BASH script that uses the exit code from surblhost to check the status of given hostnames: #!/bin/bash
# Copyright (C) 2006, 2007 Christian Stigen Larsen
# This script is placed in the public domain.
if test "$#" == "0" ; then
        echo "usage: lookup [ hostname(s) ]"
        echo "looks up if hosts are blocked by surbl.org"
        exit 1
fi
while test ! -z "${1}" ; do
        echo -n "checking ${1} ... "
        surblhost -q -r 2>/dev/null ${1}

        if test "$?" == "2"; then
                echo "blocked"
        else
                echo "not blocked"
        fi
        shift
done
echo ""
echo "for more information, see http://www.surbl.org/lists.html"
exit 0

BUGS
This is still an early release, so there should be some code bugs. Be sure to report anything to the author below. If you have suggestions or patches, the author will be very happy to hear from you.

AUTHOR
Christian Stigen Larsen <csl@sublevel3.org> -- http://csl.sublevel3.org

LICENSE
surblhost is distributed under the GNU General Public License v2.