/[smecontribs]/rpms/smeserver-geoip/contribs8/smeserver-geoip-whitelist_by_IP.patch
ViewVC logotype

Contents of /rpms/smeserver-geoip/contribs8/smeserver-geoip-whitelist_by_IP.patch

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.1 - (show annotations) (download)
Wed Sep 23 20:14:10 2015 UTC (8 years, 7 months ago) by reetspetit
Branch: MAIN
CVS Tags: smeserver-geoip-1_1_2-5_el5_sme, HEAD
* Wed Sep 23 2015 John Crisp <jcrisp@safeandsoundit.co.uk> 1.1.2-5 - Add ability to whitelist an IP

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

admin@koozali.org
ViewVC Help
Powered by ViewVC 1.2.1 RSS 2.0 feed