amavisd plugin for the geolocation addresses and headers X-Anti-Abuse
fakessh
fakessh at fakessh.eu
Mon May 2 18:09:29 CEST 2011
Le lundi 2 mai 2011 15:17, fakessh a écrit :
> Le lundi 2 mai 2011 13:49, fakessh a écrit :
> > hello list
> > hello gurus
> >
> >
> > I would like to write a milter to postfix to achieve a geolocation
> > addresses and headers X-Anti-Abuse
> >
> > you tell me with mimedefang is very simple
> > I have tried with success
> >
> > but when I've put my achievements in production
> > the headers X-SenderID disappears
> >
> > so I wonder why after having added mimedefang header and X-SenderID
> > disappears
> >
> > Do you know a milter to the geolocation and X-Header-AntiAbuse
> >
> > this may be easily realized with a plugin with amavisd
> >
> >
> >
> > thanks .... s ///
>
> I just wrote a small plugin for anti abuse that here but I do not know
> where to start for geolocation with Geo:: IP:: PurePerl
>
> package Amavis::Custom;
> use strict;
>
> # invoked at child process creation time;
> # return an object, or just undef when custom checks are not needed
> sub new {
> my($class,$conn,$msginfo) = @_;
> my($self) = bless {}, $class;
> my($hdr_edits) = $msginfo->header_edits;
> my($cl_ip) = $msginfo->client_addr;
> $hdr_edits->add_header('X-Header-AntiAbuse', "report abuse to
> postmaster\@fakessh.eu");
> $hdr_edits->add_header('X-Header-AntiAbuse', "client addr $cl_ip");
> $hdr_edits->add_header('X-Header-AntiAbuse', "primary hostname
> r13151.ovh.net");
>
> $self; # returning an object activates further callbacks,
> # returning undef disables them
> }
> 1; # insure a defined return
>
>
> can you help me for the geolocalisation plugin
I wrote a plugin that minimum here but I get no result
package Amavis::Custom;
use Geo::IP::PurePerl;
# invoked at child process creation time;
# return an object, or just undef when custom checks are not needed
sub new {
my($class,$conn,$msginfo) = @_;
my($self) = bless {}, $class;
my($cl_ip) = $msginfo->client_addr;
if (!exists $self->{geoip}) {
my $geo_file = "/usr/share/GeoIP/GeoLiteCity.dat";
$self->{geoip} = undef;
if (!-e $geo_file) {
do_log(0, "geoip-plugin: GeoIP, unable to stat %s", $geo_file);
} else {
$self->{geoip} = Geo::IP::PurePerl->new($geo_file, GEOIP_STANDARD);
do_log(0, "geoip-plugin: GeoIP, failed to open %s",
$geo_file) if !$self->{geoip};
}
}
my($country_code, $country_code3, $country_name, $region,
$city, $postal_code, $latitude, $longitude,
$metro_code, $area_code) =
$self->{geoip}->get_city_record($cl_ip);
my($hdr_edits) = $msginfo->header_edits;
$hdr_edits->add_header('X-Header-GeoIP-Client', " geo ip client
$country_code $country_code3 $country_name $region $city
$postal_code $latitude $longitude $metro_code $area_code ");
$self; # returning an object activates further callbacks,
# returning undef disables them
}
1; # insure a defined return
--
http://pgp.mit.edu:11371/pks/lookup?op=get&search=0x092164A7
gpg --keyserver pgp.mit.edu --recv-key 092164A7
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <http://lists.amavis.org/pipermail/amavis-users/attachments/20110502/0d7dc1f9/attachment.pgp>
More information about the amavis-users
mailing list