Advertisement:

Author Topic: [TIP/TRICK] Having Problems With Banned Members?  (Read 32062 times)

Offline JBlaze

  • SMF Friend
  • SMF Super Hero
  • *
  • Posts: 12,152
    • @fragicide on Twitter
[TIP/TRICK] Having Problems With Banned Members?
« on: March 27, 2009, 07:51:10 PM »
I know that there are alot of you out there who are having trouble with banned members/spambots that still try to visit your site and create LOTS of error logs. It gets annoying, I know.

This simple Tip will help get rid of that... :P

What this will do is modify your .htaccess file, adding a banned IP address to that. This way, when a banned member/spambot tries to reach your site, instead of getting the login screen, they will get a "403 - Forbidden" Error. (What Is A "403 - Forbidden" Error?)

Well, here it is :P

.htaccess
Code: (ban single IP) [Select]
order deny,allow
deny from xx.xx.xx.xxx
allow from all

Code: (ban multiple IPs) [Select]
order deny,allow
deny from xx.xx.xx.xxx
deny from xx.xx.xx.xxx
deny from xx.xx.xx.xxx
deny from xx.xx.xx.xxx
allow from all
Change "xx.xx.xx.xxx" to the IP address you want to ban

Any questions, feel free to ask! :P

EDIT: I will try to make a script/MOD that can modify the .htaccess from the Admin panel. If anyone out there would like to help me, I would be grateful :P
« Last Edit: March 30, 2009, 04:55:08 AM by JBlaze™ »

Offline JBlaze

  • SMF Friend
  • SMF Super Hero
  • *
  • Posts: 12,152
    • @fragicide on Twitter
Re: [TIP/TRICK] Having Problems With Banned Members?
« Reply #1 on: March 28, 2009, 12:19:56 PM »
Bump?

Offline Marcus Forsberg

  • SMF Friend
  • SMF Hero
  • *
  • Posts: 8,608
  • Gender: Male
    • marcus.t.forsberg on Facebook
    • marcusforsberg on LinkedIn
    • @marcusforsberg on Twitter
    • marcusforsberg.net
Re: [TIP/TRICK] Having Problems With Banned Members?
« Reply #2 on: March 28, 2009, 12:20:57 PM »
Wanting this moved to Tips and Tricks, are we? :P

Offline JBlaze

  • SMF Friend
  • SMF Super Hero
  • *
  • Posts: 12,152
    • @fragicide on Twitter
Re: [TIP/TRICK] Having Problems With Banned Members?
« Reply #3 on: March 28, 2009, 12:40:21 PM »
Yessir :P :P :P

Offline Marcus Forsberg

  • SMF Friend
  • SMF Hero
  • *
  • Posts: 8,608
  • Gender: Male
    • marcus.t.forsberg on Facebook
    • marcusforsberg on LinkedIn
    • @marcusforsberg on Twitter
    • marcusforsberg.net
Re: [TIP/TRICK] Having Problems With Banned Members?
« Reply #4 on: March 28, 2009, 12:42:46 PM »
Though you didn't say please...
Moved

:P

Offline JBlaze

  • SMF Friend
  • SMF Super Hero
  • *
  • Posts: 12,152
    • @fragicide on Twitter
Re: [TIP/TRICK] Having Problems With Banned Members?
« Reply #5 on: March 28, 2009, 12:44:24 PM »
Pretty please with sugar on top, may you move this to Tip and Tricks? ;D

Offline JBlaze

  • SMF Friend
  • SMF Super Hero
  • *
  • Posts: 12,152
    • @fragicide on Twitter
Re: [TIP/TRICK] Having Problems With Banned Members?
« Reply #6 on: March 28, 2009, 12:46:10 PM »
By the way Nas, is there any way I can use php to modify the htaccess file?

I want to turn this into a MOD with admin panel options. I just need to know how to modify htaccess. I can do the rest :P :P

Offline Marcus Forsberg

  • SMF Friend
  • SMF Hero
  • *
  • Posts: 8,608
  • Gender: Male
    • marcus.t.forsberg on Facebook
    • marcusforsberg on LinkedIn
    • @marcusforsberg on Twitter
    • marcusforsberg.net
Re: [TIP/TRICK] Having Problems With Banned Members?
« Reply #7 on: March 28, 2009, 12:49:32 PM »
Not sure if it works on htaccess, but have a look at this:
http://www.php.net/manual/en/ref.filesystem.php

Open the file, write to it, close.

Offline JBlaze

  • SMF Friend
  • SMF Super Hero
  • *
  • Posts: 12,152
    • @fragicide on Twitter
Re: [TIP/TRICK] Having Problems With Banned Members?
« Reply #8 on: March 28, 2009, 12:55:07 PM »
Thanks bro. I'll get to work right now. Hopefully have it submitted by tomorrow :P :P

Offline C4G-TK

  • Sr. Member
  • ****
  • Posts: 961
  • SHOW others respect & you GET respect in return.
Re: [TIP/TRICK] Having Problems With Banned Members?
« Reply #9 on: March 30, 2009, 11:54:59 AM »
Great info here. 

It makes me wonder if it is possible to make your own "403 - Forbidden Error" page that people will see as well or is it strictly server side? 

I'm figuring that since it denies passageway to your own site, you wouldn't be able to make one yourself though since the person's IP is banned from browsing.  Maybe I just answered my own question there.  LOL  But, thought I'd ask!
-img removed-

aishaweb

  • Guest
Re: [TIP/TRICK] Having Problems With Banned Members?
« Reply #10 on: March 30, 2009, 12:07:22 PM »
Is this a mod yet?

Got a beta to test? Please attach it if so.

Offline JBlaze

  • SMF Friend
  • SMF Super Hero
  • *
  • Posts: 12,152
    • @fragicide on Twitter
Re: [TIP/TRICK] Having Problems With Banned Members?
« Reply #11 on: March 30, 2009, 04:24:36 PM »
Great info here. 

It makes me wonder if it is possible to make your own "403 - Forbidden Error" page that people will see as well or is it strictly server side? 

I'm figuring that since it denies passageway to your own site, you wouldn't be able to make one yourself though since the person's IP is banned from browsing.  Maybe I just answered my own question there.  LOL  But, thought I'd ask!

Create file 403.shtml (or ask your host if they provide error handling)
Add custom HTML



Still working on it as we speak. A beta will be release soon. :P
Is this a mod yet?

Got a beta to test? Please attach it if so.

Offline Dinolin

  • Newbie
  • *
  • Posts: 5
Re: [TIP/TRICK] Having Problems With Banned Members?
« Reply #12 on: April 07, 2009, 02:45:27 PM »
ermm..... this help me a lot :)
nice info and tips .... :)

Offline cflforum

  • Semi-Newbie
  • *
  • Posts: 76
Re: [TIP/TRICK] Having Problems With Banned Members?
« Reply #13 on: April 09, 2009, 08:37:46 AM »
Is this a mod yet?

Got a beta to test? Please attach it if so.

There is no reason why this wouldnt work on an internal system intranet, is there?

While the site is to be intranet based, I'm of no illusions that somebody wouldnt think it funny to have crowing rights over how "insecure" or "setup on the cheap" is!

If this iproject is successfull, we should be able to grab maybe 20k of their budget :D ( cackles with glee)

Offline JBlaze

  • SMF Friend
  • SMF Super Hero
  • *
  • Posts: 12,152
    • @fragicide on Twitter
Re: [TIP/TRICK] Having Problems With Banned Members?
« Reply #14 on: April 24, 2009, 11:29:58 PM »
I see no reason why it shouldn't work on an intranet system.

Offline Autumn13

  • Semi-Newbie
  • *
  • Posts: 98
Re: [TIP/TRICK] Having Problems With Banned Members?
« Reply #15 on: May 01, 2009, 12:38:35 AM »
Sorry to sound like such a noob here, but would someone be so kind enough as to tell the lady how to do this step by step? I'd really appreciate it!


ETA: nevermind, got it. Thanks again!!!!! It's a BIG help!
« Last Edit: May 01, 2009, 06:57:31 PM by Autumn13 »

Offline TLBSupport

  • Charter Member
  • Jr. Member
  • *
  • Posts: 118
Re: [TIP/TRICK] Having Problems With Banned Members?
« Reply #16 on: May 06, 2009, 03:46:34 AM »
Great tip, however just to add little bit of sugar :D
For those who's hosts give them CPanel access you can also access the.htaccess file by updating entries in the IP Ban control in the Security control panel area, if you have it.
Advantages for this is that, from my understanding it will alter all the .htaccess files on your site, or sites. Will shut up now in case im wrong :D im used to that
Respect to all

Offline JBlaze

  • SMF Friend
  • SMF Super Hero
  • *
  • Posts: 12,152
    • @fragicide on Twitter
Re: [TIP/TRICK] Having Problems With Banned Members?
« Reply #17 on: May 06, 2009, 03:39:44 PM »
Great tip, however just to add little bit of sugar :D
For those who's hosts give them CPanel access you can also access the.htaccess file by updating entries in the IP Ban control in the Security control panel area, if you have it.
Advantages for this is that, from my understanding it will alter all the .htaccess files on your site, or sites. Will shut up now in case im wrong :D im used to that
Respect to all

As long as you enter it in the root .htaccess, it applies for the whole forum as every action is executed through index.php.

Offline Mayhem30

  • Full Member
  • ***
  • Posts: 539
Re: [TIP/TRICK] Having Problems With Banned Members?
« Reply #18 on: May 16, 2009, 11:51:37 PM »
The problem with this is that it could put a lot of load on the apache server. If you have a busy forum, everyone who attempts to view your site will be checked against that list in the .htaccess file.

If you have access to ssh, you could do this instead :

Code: [Select]
iptables -A INPUT -s xxx.xxx.xxx.xxx -j DROP
Keep in mind that if your server is rebooted, the ban will no longer be in place. If you want the ban to stick even after a reboot, you must do this :

Code: [Select]
service iptables save
service iptables restart

Use at your own risk  :D

Offline H

  • SMF Friend
  • SMF Super Hero
  • *
  • Posts: 21,660
  • Gender: Male
Re: [TIP/TRICK] Having Problems With Banned Members?
« Reply #19 on: July 06, 2009, 07:18:00 PM »
It is important to note that Mayhem's suggestion requires not just SSH access but also root access :). The second code segment will also only work under Redhat and similar distros. Others (Debian, ubuntu etc) will require a different way of saving firewall rules
-H
Former Support Team Lead
                              I recommend:
Namecheap (domains)
Fastmail (e-mail)
Linode (VPS)