Loading ...
Sorry, an error occurred while loading the content.
 

milter postfix for the geolocation addresses and headers X-Anti-Abuse

Expand Messages
  • fakessh
    hello list hello gurus hello   Wietse Venema I would like to write a milter to postfix to achieve a geolocation addresses and headers X-Anti-Abuse you tell me
    Message 1 of 3 , May 2, 2011
      hello list
      hello gurus
      hello   Wietse Venema


      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

      this may be easy to realize native with postfix

      thanks .... s /// ;)
      --
      http://pgp.mit.edu:11371/pks/lookup?op=get&search=0x092164A7
      gpg --keyserver pgp.mit.edu --recv-key 092164A7
    • Wietse Venema
      ... Please provide one or more of the following. a) Free crystal balls. b) Free telepathic services. c) Concrete information about this problem. Wietse
      Message 2 of 3 , May 2, 2011
        fakessh:
        > hello list
        > hello gurus
        > hello ? Wietse Venema
        >
        >
        > 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
        >
        > this may be easy to realize native with postfix
        >
        > thanks .... s /// ;)

        Please provide one or more of the following.

        a) Free crystal balls.

        b) Free telepathic services.

        c) Concrete information about this problem.

        Wietse
      • fakessh
        ... yes I possess crystal balls some nice numbers thank you ... yes I possess powers parapsychic I discuss with a large Indian matemathiciens I show you his
        Message 3 of 3 , May 3, 2011
          Le lundi 2 mai 2011 17:22, Wietse Venema a écrit :
          > fakessh:
          > > hello list
          > > hello gurus
          > > hello ? Wietse Venema

          > a) Free crystal balls.

          yes I possess crystal balls some nice numbers thank you

          >
          > b) Free telepathic services.


          yes I possess powers parapsychic I discuss with a large Indian matemathiciens
          I show you his page and I think we have succeeded in inventing a prototype
          language based on orthogonal curvilinear representations of image that allows
          us to accurately answer questions
          >
          > c) Concrete information about this problem.

          no problem
          the problem is solved by a plugin amavis
          i cote
          package Amavis::Custom;
          use strict;
          use re 'taint';
          use warnings;
          use warnings FATAL => qw(utf8 void);
          no warnings qw(uninitialized redefine);

          BEGIN {
            import Amavis::Conf qw(:platform :confvars c cr ca);
            import Amavis::Util qw(do_log untaint min max);
          }

          sub new {
            my($class,$conn,$msginfo) = @_;
            my($self) = bless {}, $class;
            checks_geo($self,$conn,$msginfo);
            $self;
          }

          use Geo::IP;
          sub checks_geo {
            my($self,$conn,$msginfo) = @_;
            if (!exists $self->{geoip}) {  # first time only in a child process
              my $geo_file = "/usr/local/share/GeoIP/GeoLiteCity.dat";
              $self->{geoip} = Geo::IP->open($geo_file, GEOIP_STANDARD);
              if (!$self->{geoip}) {
                do_log(0, "GeoIP: failed to open %s", $geo_file);
              } else {
                $self->{geoip}->set_charset(GEOIP_CHARSET_UTF8);
              }
            }
            if ($self->{geoip}) {
              my $last_received_ip =
                Amavis::UnmangleSender::parse_ip_address_from_received($msginfo);
              if (defined $last_received_ip && $last_received_ip ne '') {
                my($country_name,$region_name,$city);
                my $record = $self->{geoip}->record_by_addr($last_received_ip);
                if (!$record) {
                  do_log(2, "GeoIP: no record for %s", $last_received_ip);
                } else {
                  $country_name = $record->country_name;
                  $region_name = $record->region_name;
                  $city = $record->city;
                }
                do_log(2, "GeoIP: %-15s %s %s, %s, %s", $last_received_ip,
                          $msginfo->is_in_contents_category(CC_SPAM) ? 'SPAM' : '    ',
                          map(defined $_ && $_ ne '' ? $_ : "-",
                              $country_name, $region_name, $city));
                my $hdr_edits = $msginfo->header_edits;
                $hdr_edits->add_header('X-Amavis-GeoIP', "$country_name $city");
              }
            }
          }

          1;


          thanks


          >
          > Wietse

          --
          http://pgp.mit.edu:11371/pks/lookup?op=get&search=0x092164A7
          gpg --keyserver pgp.mit.edu --recv-key 092164A7
        Your message has been successfully submitted and would be delivered to recipients shortly.