Last active
August 19, 2016 13:34
-
-
Save stefb69/64a52a4bcde96abb1459 to your computer and use it in GitHub Desktop.
GeoIP postfwd2 plugin
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment