Skip to content

Commit

Permalink
Banned text into a template instead of hardcoded. Remove reference
Browse files Browse the repository at this point in the history
to Slashdot-specific FAQ.
  • Loading branch information
jamiemccarthy committed Jan 27, 2003
1 parent 7be4b64 commit 3b104e6
Show file tree
Hide file tree
Showing 5 changed files with 81 additions and 89 deletions.
69 changes: 5 additions & 64 deletions Slash/Apache/Banlist/Banlist.pm
Expand Up @@ -7,6 +7,7 @@ package Slash::Apache::Banlist;

use strict;
use Slash::Utility;
use Slash::Display;
use Digest::MD5 'md5_hex';
use Apache::Constants qw(:common);
use vars qw($VERSION);
Expand Down Expand Up @@ -34,76 +35,16 @@ sub handler {
my $banlist = $slashdb->getBanList();

if ($banlist->{$cur_ipid} || $banlist->{$cur_subnet}) {
# This is hardcoded text instead of a template because
# the idea is that the banned script is costing us
# resources, and we want to get rid of them as cheaply
# as possible.
my $constants = getCurrentStatic();
my $bug_off =<<EOT;
<HTML>
<HEAD><TITLE>BANNED!</TITLE></HEAD>
<BODY BGCOLOR="pink">
<H1>Either your network or ip address has been banned
from this site</H1><BR>
due to script flooding that originated
from your network or ip address
-- or this IP might have been used to post comments designed to break
web browser rendering.
If you feel that this is unwarranted, feel free to include your IP address
(<b>$cur_ip</b>) in the subject of an email, and we will examine why
there is a ban. If you fail to include the IP address (again,
<em>in the Subject!</em>), then
your message will be deleted and ignored. I mean come on,
we're good, we're not psychic.
EOT
if ($constants->{basedomain} eq 'slashdot.org') {
$bug_off .= <<EOT;
<p>Since you can't read the FAQ because you're banned, here's the
<a href="/faq/accounts.shtml#ac900">relevant portion</a>:
<h2>Why is my IP banned?</h2>
<p>&middot; Perhaps you are running some sort of program that loaded thousands of
Slashdot Pages. We have limited resources here and are fairly protective of
them. We need to make sure that everyone shares. If your IP loads thousands
of pages in a day, you will likely be banned. Please note that many proxy
servers load large quantities of pages, but we can usually distinguish
between proxy servers being used by humans, and IPs running software that is
hammering our servers.<p>
&middot; Your IP might have been used to perform some sort of denial of service
attack against Slashdot. These range from simple programs that just load a
lot of pages, to programs that attempt to coordinate an avalanche of posts
in the forums (often through misconfigured "Open Relay" proxy servers).<p>
&middot; You might be using a proxy server that is also being used by another person
who did something from the above list. You should have your <b>proxy server
administrator</b> <a href="mailto:banned\@$constants->{basedomain}">contact us</a>.<p>
&middot; Your IP might have been used to post comments designed to break
web browser rendering. <br>
<br>
<i><small> Answered by: <a href="mailto:malda\@slashdot.org">CmdrTaco</a> <br>
Last Modified: 7/02/02<br>
</small></i> <a name="ac1000"></a>
<h2>How do I get an IP Unbanned?</h2>
<p>Email <a href="mailto:banned\@$constants->{basedomain}">banned\@$constants->{basedomain}</a>. Make
sure to include the IP in question, and any other pertinent information. If
you are connecting through a proxy server, you might need to have your proxy
server's admin contact us instead of you. <br>
<br>
<i><small> Answered by: <a href="mailto:malda\@slashdot.org">CmdrTaco</a> <br>
Last Modified: 3/26/02</small></i><i><small><br></small></i>
EOT
}
$bug_off .= <<EOT;
</BODY>
</HTML>
EOT
$r->custom_response(FORBIDDEN, $bug_off);
$r->custom_response(FORBIDDEN,
slashDisplay('bannedtext_ipid', { ip => $cur_ip },
{ Return => 1} )
);
return FORBIDDEN;
}

return OK;
}


sub DESTROY { }

1;
Expand Down
28 changes: 3 additions & 25 deletions Slash/Apache/User/User.pm
Expand Up @@ -198,31 +198,9 @@ sub handler {
# If this uid is marked as banned, deny them access.
my $banlist = $slashdb->getBanList();
if ($banlist->{$uid}) {
# This is hardcoded text instead of a template because
# the uid may be still using a script, and we want to
# get rid of them as cheaply as possible. Still...
# we probably should pull this into a template...
my $bug_off =<<EOT;
<HTML>
<HEAD><TITLE>BANNED!</TITLE></HEAD>
<BODY BGCOLOR="pink">
<H1>Your user account has been banned from $constants->{sitename}</H1><BR>
Due to questionable activity from this user account, it has been
temporarily disabled. Actions that would cause this ban are posting
comments designed to intentionally break comment rendering for other
users, or running some sort of script or program that loaded an
unacceptable number of pages in a short time frame.
<p>If you feel that this is unwarranted, feel free to include your UID
(<b>$uid</b>) in the subject of an email, and we will examine why
there is a ban. If you fail to include the UID (again,
<em>in the Subject!</em>), then
your message will be deleted and ignored. I mean come
on, we're good, we're not psychic. Send your email to
<a href="mailto:banned\@$constants->{basedomain}">banned\@$constants->{basedomain}</a>.
</BODY>
</HTML>
EOT
$r->custom_response(FORBIDDEN, $bug_off);
$r->custom_response(FORBIDDEN,
slashDisplay('bannedtext_uid', { }, { Return => 1} )
);
return FORBIDDEN;
}

Expand Down
2 changes: 2 additions & 0 deletions themes/slashcode/THEME
Expand Up @@ -91,6 +91,8 @@ task=tasks/run_portald.pl
task=tasks/set_recent_topics.pl
task=tasks/spamarmor.pl
template=templates/admin;menu;default
template=templates/bannedtext_ipid;misc;default
template=templates/bannedtext_uid;misc;default
template=templates/changePasswd;users;default
template=templates/comment_submit;comments;default
template=templates/config;menu;default
Expand Down
36 changes: 36 additions & 0 deletions themes/slashcode/templates/bannedtext_ipid;misc;default
@@ -0,0 +1,36 @@
__section__
default
__description__
Text to display to users banned by IPID/SubnetID.

* ip = their (un-encoded) IP number

__title__

__page__
misc
__lang__
en_US
__name__
bannedtext_ipid
__template__
<HTML>
<HEAD><TITLE>BANNED!</TITLE></HEAD>
<BODY BGCOLOR="pink">
<H1>Either your network or ip address has been banned
from this site</H1><BR>
due to script flooding that originated
from your network or ip address
-- or this IP might have been used to post comments designed to break
web browser rendering.
If you feel that this is unwarranted, feel free to include your IP address
(<b>[% ip %]</b>) in the subject of an email, and we will examine why
there is a ban. If you fail to include the IP address (again,
<em>in the subject!</em>), then
your message will be deleted and ignored. I mean come on,
we're good, we're not psychic.
</BODY>
</HTML>

__seclev__
500
35 changes: 35 additions & 0 deletions themes/slashcode/templates/bannedtext_uid;misc;default
@@ -0,0 +1,35 @@
__section__
default
__description__
Text to display to users banned by UID.

__title__

__page__
misc
__lang__
en_US
__name__
bannedtext_uid
__template__
<HTML>
<HEAD><TITLE>BANNED!</TITLE></HEAD>
<BODY BGCOLOR="pink">
<H1>Your user account has been banned from [% constants.sitename %]</H1><BR>
Due to questionable activity from this user account, it has been
temporarily disabled. Actions that would cause this ban are posting
comments designed to intentionally break comment rendering for other
users, or running some sort of script or program that loaded an
unacceptable number of pages in a short time frame.
<p>If you feel that this is unwarranted, feel free to include your UID
(<b>[% user.uid %]</b>) in the subject of an email, and we will examine why
there is a ban. If you fail to include the UID (again,
<em>in the subject!</em>), then
your message will be deleted and ignored. I mean come
on, we're good, we're not psychic. Send your email to
<a href="mailto:[% constants.adminmail | strip_attribute %]">[% constants.adminmail %]</a>.
</BODY>
</HTML>

__seclev__
500

0 comments on commit 3b104e6

Please sign in to comment.