LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 06-06-2008, 03:51 PM   #1
Usalabs
Member
 
Registered: Jan 2004
Distribution: OpenSUSE 42.1 Server
Posts: 156

Rep: Reputation: 15
How do use htaccess to trigger an error 403 when a url contaiins a direction code?


ok, here's my dilemma, I have users that are trying to flood the registration system of my home based server powered website, even though I have the site security to use captcha and email validation, my admin section shows at least 100 users that have tried to signup using fake email addresses, all ending in .cn, the ip addresses slightly differ but all begin with 74.55 or 74.52, an ip check showed they all originated from an ISP in Dallas Texas, I contacted them and got exactly the same reply, as wth other people that I know, who have also contacted them, "We are aware of the problem and are looking into it.", which indicates the reply is an auto responder,,,,,anyway, getting back to the question.

My registration link uses:
Code:
index.php?act=REG&CODE=00
I use htaccess on another site to block the IP address block of the ISP from accessessing signup.php, thus triggering a 403 error, and apache then directs to a custom error page, this works perfectly, but how to I use htaccess to do the same, but trigger an error 403 on the above code?
 
Old 06-06-2008, 03:57 PM   #2
trickykid
LQ Guru
 
Registered: Jan 2001
Posts: 24,149

Rep: Reputation: 256Reputation: 256Reputation: 256
Just drop them with an iptables rule, that's what I do. If they're spam bots and if they're smart spam bots, when they can't connect for a few hours or days/weeks, they'll stop trying to flood your site. Instead of them still flooding your webserver, using resources, a simple -DROP from iptables saves you some resources instead of relying on apache to do it for you, still taking away such resources from apache.

Last edited by trickykid; 06-06-2008 at 03:58 PM.
 
Old 06-06-2008, 04:07 PM   #3
Usalabs
Member
 
Registered: Jan 2004
Distribution: OpenSUSE 42.1 Server
Posts: 156

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by trickykid View Post
Just drop them with an iptables rule, that's what I do. If they're spam bots and if they're smart spam bots, when they can't connect for a few hours or days/weeks, they'll stop trying to flood your site. Instead of them still flooding your webserver, using resources, a simple -DROP from iptables saves you some resources instead of relying on apache to do it for you, still taking away such resources from apache.
mmmmmmm, I do have the ability to install shorewall, but currently it's not installed, but I do use a hardware firewall, but adding the line:-

Code:
iptables -A INPUT -s xx.xx.0.0/14 -j DROP
adds it after last rule of a list:-

rule 1
rule 2
etc etc
DROP all -- anywhere anywhere
DROP all -- xx.xx.0.0/14 anywhere

but if I remove the drop all anywhere rule then add the IP block range rule, then add the drop anywhere rule as the last rule, all access to the server, including my access via ssh, is blocked.

Is there a way to 'insert' the rule before the last rule in the list without removing it?

I know I can use the -I option but I have to use an integer value, but when I try to use -I4 or -I 4, I get an error, plus, I can't find anywhere, to find examples of how each option is used.

Last edited by Usalabs; 06-06-2008 at 04:23 PM.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
.htaccess domain / url forwarding max_tcs Linux - Software 1 12-17-2007 10:40 AM
mambo problem with .htaccess & // in url paul_mat Linux - Software 1 01-10-2007 02:03 PM
PostgreSQL trigger dropping error nazdrowie Programming 3 08-03-2005 12:03 AM
ERROR The requested URL could not be retrieved While trying to retrieve the URL: /re Niceman2005 Linux - General 1 06-29-2005 09:51 AM
.htaccess code for blocking CVS directories mrtwice Linux - Software 1 10-12-2004 01:38 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 07:33 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration