1 |
diff -ruN smeserver-geoip-1.1.2/root/usr/share/qpsmtpd/plugins/check_badcountries smeserver-geoip-1.1.2-new/root/usr/share/qpsmtpd/plugins/check_badcountries |
2 |
--- smeserver-geoip-1.1.2/root/usr/share/qpsmtpd/plugins/check_badcountries 2012-09-03 13:22:12.000000000 +0200 |
3 |
+++ smeserver-geoip-1.1.2-new/root/usr/share/qpsmtpd/plugins/check_badcountries 2015-09-11 18:02:04.634000704 +0200 |
4 |
@@ -44,8 +44,9 @@ |
5 |
sub hook_connect { |
6 |
my ($self) = @_; |
7 |
|
8 |
- my $country = |
9 |
- $geoip->country_code_by_addr( $self->qp->connection->remote_ip ); |
10 |
+ my $country = $geoip->country_code_by_addr( $self->qp->connection->remote_ip ); |
11 |
+ my $connection = $self->qp->connection; |
12 |
+ my $remoteIP = $self->qp->connection->remote_ip; |
13 |
return DECLINED unless $country; |
14 |
|
15 |
$self->qp->connection->notes('geoip_country', $country); |
16 |
@@ -55,9 +56,19 @@ |
17 |
my @badcountries = $self->qp->config("badcountries"); |
18 |
return DECLINED unless $country; |
19 |
|
20 |
+ $self->log(LOGINFO, "Country $country RemoteIP $remoteIP"); |
21 |
+ |
22 |
for (@badcountries) { |
23 |
my ($pattern, $response) = split /\s+/, $_, 2; |
24 |
+ my $whitelisthost = $connection->notes('whitelisthost'); |
25 |
+ if ($whitelisthost) { |
26 |
+ $self->log(LOGINFO, "Country $country Pattern $pattern Whitehost $whitelisthost RemoteIP $remoteIP"); |
27 |
+ $self->log(LOGINFO, "Geoip whitelisthost found $whitelisthost"); |
28 |
+ return OK; |
29 |
+ } |
30 |
+ else { |
31 |
return (DENY, "Country is on Blocked List") if ($country eq $pattern); |
32 |
+ } |
33 |
} |
34 |
} |
35 |
|