SYNOPSIS

    use Net::RBLClient;
    my $rbl = Net::RBLClient->new;
    $rbl->lookup('211.101.236.160');
    my @listed_by = $rbl->listed_by;

DESCRIPTION

This module is used to discover what \s-1RBL\s0's are listing a particular \s-1IP\s0 address. It parallelizes requests for fast response.

An \s-1RBL\s0, or Realtime Blackhole List, is a list of \s-1IP\s0 addresses meeting some criteria such as involvement in Unsolicited Bulk Email. Each \s-1RBL\s0 has its own criteria for addition and removal of addresses. If you want to block email or other traffic to/from your network based on one or more \s-1RBL\s0's, you should carefully study the behavior of those \s-1RBL\s0's before and during such blocking.

CONSTRUCTOR

new( [\s-1ARGS\s0] )

Takes an optional hash of arguments:

lists

An arraref of (sub)domains representing RBLs. In other words, each element in the array is a string similar to 'relays.somerbl.org'. Use this if you want to query a specific list of \s-1RBL\s0's - if this argument is omitted, a large list of \s-1RBL\s0's is queried.

query_txt

Set this to true if you want Net::RBLClient to also query for \s-1TXT\s0 records, in which many \s-1RBL\s0's store additional information about the reason for including an \s-1IP\s0 address or links to pages that contain such information. You can then retrieve these information using the \*(L"txt_hash()\*(R" method.

max_time

The maximum time in seconds that the lookup function should take. In fact, the function can take up to \*(C`max_time + timeout\*(C' seconds. Max_time need not be integer. Of course, if the lookup returns due to max_time, some \s-1DNS\s0 replies will be missed. Default: 8 seconds.

timeout

The maximum time in seconds spent awaiting each \s-1DNS\s0 reply packet. The only reason to change this is if \*(C`max_time\*(C' is decreased to a small value. Default: 1 second.

max_hits

A hit is an affirmative response, stating that the \s-1IP\s0 address is on a certain list. If \*(C`max_hits\*(C' hits are received, \*(C`lookup()\*(C' returns immediately. This lets the calling program save time. Default: 1000 (effectively out of the picture).

max_replies

A reply from an \s-1RBL\s0 could be affirmative or negative. Either way, it counts towards \*(C`max_replies\*(C'. \*(C`Lookup()\*(C' returns when \*(C`max_replies\*(C' replies have been received.

udp_maxlen

The maximum number of bytes read from a \s-1DNS\s0 reply packet. There's probably no reason to change this. Default: 4000

server

The local nameserver to use for all queries. Should be either a resolvable hostname or a dotted quad \s-1IP\s0 address. By default, the first nameserver in /etc/resolv.conf will be used.

METHODS

lookup( \s-1IPADDR\s0 )

Lookup one \s-1IP\s0 address on all \s-1RBL\s0's previously defined. The \s-1IP\s0 address must be expressed in dotted quad notation, like '1.2.3.4'. \*(C`Lookup()\*(C' returns 1.

listed_by()

Return an array of \s-1RBL\s0's which block the specified \s-1IP\s0. The \s-1RBL\s0's are indicated via the (sub)domain used for \s-1DNS\s0 query. The calling program must first call \*(C`lookup()\*(C'.

listed_hash()

Return a hash whose keys are the \s-1RBL\s0's which block the specified \s-1IP\s0, represented as in \*(C`listed_by()\*(C'. If the \s-1RBL\s0 returned an A record, the value for that key will be the \s-1IP\s0 address in the A record - typically 127.0.0.1 - 127.0.0.4. If the \s-1RBL\s0 returned a \s-1CNAME\s0, the value will be the hostname, typically used for a comment on why the \s-1IP\s0 address is listed.

txt_hash()

Return a hash (or a reference to that hash if called in a scalar context) whose keys are the \s-1RBL\s0's which block the specified \s-1IP\s0, represented as in \*(C`listed_by()\*(C'. If the \s-1RBL\s0 returned \s-1TXT\s0 records containing additional information, the value will contain this information (several \s-1TXT\s0 records from one \s-1RBL\s0 will be joined by semicolons, but this should not happen), if not, it will be undef.

AUTHOR

Asher Blum <[email protected]>

CREDITS

Martin H. Sluka <[email protected]>

COPYRIGHT

Copyright (C) 2002 Asher Blum. All rights reserved. This code is free software; you can redistribute it and/or modify it under the same terms as Perl itself.