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 --- smeserver-geoip-1.1.2/root/usr/share/qpsmtpd/plugins/check_badcountries 2012-09-03 13:22:12.000000000 +0200 +++ smeserver-geoip-1.1.2-new/root/usr/share/qpsmtpd/plugins/check_badcountries 2015-09-11 18:02:04.634000704 +0200 @@ -44,8 +44,9 @@ sub hook_connect { my ($self) = @_; - my $country = - $geoip->country_code_by_addr( $self->qp->connection->remote_ip ); + my $country = $geoip->country_code_by_addr( $self->qp->connection->remote_ip ); + my $connection = $self->qp->connection; + my $remoteIP = $self->qp->connection->remote_ip; return DECLINED unless $country; $self->qp->connection->notes('geoip_country', $country); @@ -55,9 +56,19 @@ my @badcountries = $self->qp->config("badcountries"); return DECLINED unless $country; + $self->log(LOGINFO, "Country $country RemoteIP $remoteIP"); + for (@badcountries) { my ($pattern, $response) = split /\s+/, $_, 2; + my $whitelisthost = $connection->notes('whitelisthost'); + if ($whitelisthost) { + $self->log(LOGINFO, "Country $country Pattern $pattern Whitehost $whitelisthost RemoteIP $remoteIP"); + $self->log(LOGINFO, "Geoip whitelisthost found $whitelisthost"); + return OK; + } + else { return (DENY, "Country is on Blocked List") if ($country eq $pattern); + } } }