Re: [Exim] does rbl_domains work with lookups ?

Top Pagina
Delete this message
Reply to this message
Auteur: Gary Palmer
Datum:  
Aan: Peter Galbavy
CC: exim-users
Onderwerp: Re: [Exim] does rbl_domains work with lookups ?
"Peter Galbavy" wrote in message ID
<011f01c09fd3$1fb44e80$77cb87d4@???>:
> > The way I was thinking of doing it would be to export the results of
> > exims rbl lookups into variables (each rbl domain in a seperate
> > variable) and then use a perl-enhanced smartuser director to make the
> > rejection decision. That way, it can be as fine as a per-user basis.
> > The problem with doing it in rbl_domains itself is that the lookup is
> > done before you know what user and/or domain the mail is coming for.
> > Its done during the initial TCP connection setup. So unless you have
> > one exim instance (or one IP address) for each customer, and you can
> > check what customer the mail is destined for on that basis, I don't
> > think your plan will work.
>
> Now I had not realised that. Oops. Yes, your suggestion will probably be
> much more realistic.
>
> So, got any code ? :-)


Peter,

Unfortunately not. I was going to do something similar, and the first
cut was actually going to do the RBL checks in the perl code itself.
e.g. (and I'm sorry if the code offends anyones perl style :) )

#
# If the hostname passed in in the first argument resolves, then return
# 1, else return 0.
#

sub
rbl_lookup {
my ($hname) = @_;

($name,$aliases,$addrtype,$length,@addrs) = gethostbyname($hname);

return(1) if ($name);
return(0);
}

#
# Check the IP passed in the first argument to see if its on the RBL or
# the RSS. The values are cached, but are refreshed if the force flag
# is set to 1.
#

sub
rbl_check {
my ($ip, $force) = @_;

  if (($checked != 1) || ($force == 1)) {
    $checked = 1;


    my ($reverse_ip) = $ip;
    $reverse_ip =~ s/([0-9]+)\.([0-9]+)\.([0-9]+)\.([0-9]+)/$4.$3.$2.$1/;


    if (rbl_lookup($reverse_ip.".rbl.maps.vix.com") == 1) {
      $rbl = 1;
    }


    if (rbl_lookup($reverse_ip.".relays.mail-abuse.org") == 1) {
      $rss = 1;
    }
  }


return ($rbl * 2) + $rss;
}

I have a force parameter so I can rescan for changes to the listings
periodically.

This code is already in line for some stuff, but I don't do it per
user so I don't know what it'd do to the load. I bet it'd probably
kill my boxes :-/

Unfortunately I got distracted by management stuff when I sat down to
look at what it'd take to hack the rbl variable stuff in.