Lirt
1/6/2015 - 3:09 AM

GeoIP postfwd2 plugin

GeoIP postfwd2 plugin

#!/usr/bin/perl
use Geo::IP;
my $gi = Geo::IP->new(GEOIP_MEMORY_CACHE);


%postfwd_items_plugin = (
    "client_country_code" => sub {
        my(%request) = @_;
        my(%result) = ();
 	$result{client_country_code} = $gi->country_code_by_addr($request{client_address});
        return %result;
    },
);

1;

## EOF postfwd.plugins
#Example usage
id=SASL_003
	HIT_dnsbls >= 2
	sasl_username =~ /^(.+)$/
        client_country_code !~ /^(FR|IL|US|UK|CA|BE|CH|IT)$/
        action = rcpt(sasl_username/3/86400/REJECT your is ip listed as trojaned, only 3 recipient per DAY for $$sasl_username)