зеркало из https://github.com/mozilla/pjs.git
Bug 360427: Add RBL support for blocking open proxies
r=gerv
This commit is contained in:
Родитель
77f8dbdad0
Коммит
af33e81636
|
@ -33,6 +33,7 @@ use strict;
|
|||
use Template;
|
||||
use CGI;
|
||||
use Email::Send qw(NNTP);
|
||||
use Net::RBLClient;
|
||||
|
||||
# use CGI::Carp qw(fatalsToBrowser);
|
||||
|
||||
|
@ -41,6 +42,16 @@ my $newsgroup = $::ENV{'HENDRIX_NEWSGROUP'} || "mozilla.feedback";
|
|||
my $server = $::ENV{'HENDRIX_NNTP_SERVER'} || "news.mozilla.org";
|
||||
my $skin = $::ENV{'HENDRIX_SKIN'} || "skin/planet.css";
|
||||
|
||||
my $rbl = Net::RBLClient->new(
|
||||
lists => [
|
||||
'opm.blitzed.org',
|
||||
'http.dnsbl.sorbs.net',
|
||||
'socks.dnsbl.sorbs.net',
|
||||
'misc.dnsbl.sorbs.net',
|
||||
],
|
||||
query_txt => 1
|
||||
);
|
||||
|
||||
my $cgi = new CGI;
|
||||
my $form = $cgi->Vars;
|
||||
my $vars;
|
||||
|
@ -72,6 +83,14 @@ elsif ($action eq "submit") {
|
|||
throwError("like_spam");
|
||||
}
|
||||
|
||||
# Check the poster's IP against some blacklists
|
||||
$rbl->lookup($::ENV{REMOTE_ADDR});
|
||||
my %rbl_results = $rbl->txt_hash();
|
||||
if (scalar(keys %rbl_results) > 0) {
|
||||
$vars->{'rbl_results'} = \%rbl_results;
|
||||
throwError("rbl_hit");
|
||||
}
|
||||
|
||||
# Format the parameters and send to the newsgroup.
|
||||
|
||||
# Check for compulsory parameters
|
||||
|
|
|
@ -56,6 +56,17 @@
|
|||
press Back, change the Summary to something else and try again.
|
||||
</p>
|
||||
|
||||
[% CASE "rbl_hit" %]
|
||||
<p class="error">
|
||||
Your internet address is in a list of known open proxies. We consult this
|
||||
list in an effort to stop spammers from using this form. If you are not a
|
||||
spammer, please send this information to your Internet Service Provider
|
||||
(ISP).<br>
|
||||
[% FOREACH hit IN rbl_results.keys %]
|
||||
<b>[% hit %]</b> - [% rbl_results.$hit %]<br>
|
||||
[% END %]
|
||||
</p>
|
||||
|
||||
[% CASE DEFAULT %]
|
||||
The error is unknown. Please try again later.
|
||||
[% END %]
|
||||
|
|
Загрузка…
Ссылка в новой задаче