qpsmtpd Wiki

[[plugins:spam:berkeley_ipblacklist_ignore]]

You are here: start » plugins » spam » berkeley_ipblacklist_ignore

Login

You are currently not logged in! Enter your authentication credentials below to log in. You need to have cookies enabled to log in.

Login

You don't have an account yet? Just get one: Register

Forgotten your password? Get a new one: Set new password

=head1 NAME
 
berkeley_ipblacklist_ignore
 
=head1 DESCRIPTION
 
This plugin fills the "note" berkeley_ipblacklist_ignore for the berkeley_ipblacklist plugin. It should be called before berkeley_ipblacklist.
The whitelist is readed from berkeley_ipblacklist_ignore file.
 
=head1 CONFIG
 
It uses one file with a list of IP, where the berkeley_ipblacklist_ignore must be bypassed
 
The file is 'berkeley_ipblacklist_ignore'
 
=head1 NOTES
 
Remember to C<db_recover -h dbname> when the system is restarted
 
 
=head1 AUTHOR
 
Written by Leonardo Helman <lhelman@pert(punto)com(punto)ar>.
Pert Consultores SRL
Argentina
 
=head1 COPYRIGHT AND LICENSE
 
Copyright (c) 2005 Leonardo Helman. Pert Consultores SRL Argentina
 
This plugin is licensed under the same terms as the qpsmtpd package itself.
Please see the LICENSE file included with qpsmtpd for details.
 
=head1 VERSION
 
$Id: berkeley_ipblacklist_ignore,v 1.5 2006/05/16 14:12:33 leoh Exp $
 
=cut
 
 
use strict;
use warnings;
 
sub hook_connect {
  my ($self, $transaction) = @_;
 
  my $client_ip = $self->qp->connection->remote_ip;
  my @berkeley_ipblacklist_ignore = $self->qp->config("berkeley_ipblacklist_ignore");
  my %berkeley_ipblacklist_ignore = map { $_ => 1 } @berkeley_ipblacklist_ignore;
 
 
  # TODO: Cambiar esto (en TODOS lados) por un chequeo por modulo de perl con formato cidr
  while ($client_ip) {
    if (exists($berkeley_ipblacklist_ignore{$client_ip}) ) {
      $self->log( LOGINFO, "Using berkeley_ipblacklist_ignore on " . $self->qp->connection->remote_ip );
      $self->qp->connection->notes('berkeley_ipblacklist_ignore', 1);
      last;
    }
    $client_ip =~ s/\d+\.?$//; # strip off another 8 bits
  }
 
 
  return DECLINED;
}
 
 
 
1;
# vim:ft=perl: