qmail-rblchk - filter all incoming mail and check if it comes from
RBL listed IPs.
| qmail-rblchk [ options ] [ /SpamDir/ ]
qmail-rblchk is used in .qmail files to check the IP
address from the Received: from lines. It has the same function as
rblsmtpd(1) , but the messages are checked at local delivery time.
With this you can check the content of the message by simply redirecting it
to another mailbox or address.
If a directory is given with /SpamDir/ parameter, all spam message are
delivered to that directory if it exist and is in Maildir format. The
directory name must start with a / or . (dot) and end with a /.
General options:
- -h
- show help screen
- -s
- add X-Spam header to the incoming mail (work only with delivery to
``/SpamDir/'')
- -c
- turn on condredirect(1) compatibility mode
- -i NUM
- ignore first NUM IP addresses found in the header
- -x IP
- do not check IP , try to find other address in header
- -v
- verbose (debug) mode
- -V
- show program version
- -p
- don't check private IP class:
127.0.0.0 - 127.255.255.255
10.0.0.0 - 10.255.255.255
172.16.0.0 - 172.31.255.255
192.168.0.0 - 192.168.255.255
- -q
- quiet mode (suppress any output)
- -m
- check all IP in the email (default: check only first IP address)
- -l log
- write program action to log file
- -L data
- write blocked IP to data file
Control options:
- -r addr
- use addr for RBL checking (block mail if TXT record
exists)
- -R addr
- use addr for RBL reverted checking (block mail if TXT record
does NOT exist)
- -a addr
- use addr for anti-RBL checking (block mail if A record does
NOT exist)
- -A addr
- use addr for anti-RBL reverted checking (block mail if A
record exist)
- -C addr
- use addr for one time RBL checking (don't block mail if A or
TXT record exist)
- -X cdb
- check if IP is listed in cdb file, see tcprules(1) or
EXAMPLES section for the format
You must specify one or more (max 32) RBL address or a CDB
file, example:
-r dnsbl.sorbs.net -r sbl-xbl.spamhaus.org -r relays.ordb.org
-X rule.cdb -r relays.ordb.org
- You can ignore (-x option) no
more than 16 IP address.
The program exit status in normal mode:
0 when the message is not blocked
100 when the message is blocked
111 when the program fails or no options were given
In delivery mode:
0 the message is not blocked (continue .qmail checking)
99 the blocked message has been written to ``SpamDir'' Maildir
111 when the program fails or no options were given
In condredirect compatibility mode:
0 when the message is blocked
1 when the message is not blocked
111 when the program fails or no options were given
There are some examples of qmail-rblchk use, please use
them carefully to prevent loss of mail.
We check bl.spamcop.net and dialups.mail-abuse.org
RBL list. If the mail is spam, the delivery will fail, and the sender will
receive a bounce message:
# we discard all suspected mail
| qmail-rblchk -r dnsbl.sorbs.net -r sbl-xbl.spamhaus.org
We delivery all mail that comes from RBL listed IP addresses to
our ../spam/ Maildir:
# save spam-suspected mail in another Maildir
| qmail-rblchk -r dnsbl.sorbs.net -r sbl-xbl.spamhaus.org ../spam/
Same as above, but all spam messages are delivered to
me-spam address with condredirect :
# save spam-suspected mail in another box
| condredirect me-spam qmail-rblchk -c -r dnsbl.sorbs.net \
-r sbl-xbl.spamhaus.org
If you prefere to use a CDB file, crete a rule file
like that:
# allow mails from local network
192.168.0.:allow
# some spammer IPs
10.0.0.1:deny
1.2.3.4:deny
create the CDB file with:
tcprules rule.cdb rule.tmp < rule
The .qmail file is:
# save spam-suspected mail in another Maildir
| qmail-rblchk -X ./rule.cdb -r sbl-xbl.spamhaus.org ../spam/
if the IP is found in rule.cdb qmail-rblchk follow the rule
in the file:
allow the message is good
deny the message is spam
if the IP is not listed qmail-rblchk continue with normal
RBL checking. You can insert into the CDB file a default rule (:allow
or :deny), to block or accept all other IPs.
Luca Morettoni <luca@morettoni.net> -
http://morettoni.net
Joerg Backschues <jbks@tca-os.de> for the English page check
and testing on 300.000 users and 500.000 mails system;
Brian T Glenn <glenn@delink.net> for some option suggestions
and for the disk space at USA mirror;
Emanuel Haupt <haupt@critical.ch> for the FreeBSD port and
manpage hints;
Emanuel's wife for the manpage correction.
dot-qmail(5), qmail-command(8), condredirect(1), tcprules(1)
http://morettoni.net/qmail-rblchk.en.html
Report me any bug, problem or other hints!