4WebHelp
 FAQ  •  Search  •  User Groups  •  Forum Admins  •  Smilies List  •  Statistics  •  Rules   •  Login   •  Register
Toggle Navigation Menu

 Banning IPs and/or Browsers using Apache
Post New TopicReply to Topic
View Previous Topic Print this topic View Next Topic
Author Message
jayant
Team Member



Joined: 07 Jan 2002
Posts: 262
Location: New Delhi, India

PostPosted: Thu May 15, 2003 2:04 pm (21 years, 7 months ago) Reply with QuoteBack to Top

I wish to ban certain IPs and Browsers from going to any part on the website. These browsers are basically some robots which keep on trying to access some URLs like /cgi-bin/formmail.pl etc and lot of 404 errors get generated in return. How can I redirect those to some website like yahoo.com or simple serve them /disabled.html always irrespective of what they asked for.

________________________________
Jayant Kumar
Member of the 4WebHelp Team
Nibble Guru - Computing Queries Demystified
GZip/ Page Compression Test
OfflineView User's ProfileFind all posts by jayantSend Personal MessageVisit Poster's WebsiteYahoo MessengerMSN Messenger
Darren
Team Member



Joined: 05 Feb 2002
Posts: 549
Location: London

PostPosted: Thu May 15, 2003 2:24 pm (21 years, 7 months ago) Reply with QuoteBack to Top

Can't you have a robots.txt file at your site root with something like:

Code:
User-agent: *
Disallow: /cgi-bin


I'm not sure if thats correct as it ages ago I looked in to this.
OfflineView User's ProfileFind all posts by DarrenSend Personal MessageVisit Poster's Website
Ben
Senior WebHelper
Senior WebHelper


Joined: 08 Jan 2002
Posts: 431
Location: Liverpool - UK

PostPosted: Thu May 15, 2003 2:31 pm (21 years, 7 months ago) Reply with QuoteBack to Top

robots.txt won't do it, that only works if a robot reads it and obeys it, it doesn't stop access.

________________________________
Ben Scott

Red and White Kop
OfflineView User's ProfileFind all posts by BenSend Personal MessageSend emailVisit Poster's Website
jayant
Team Member



Joined: 07 Jan 2002
Posts: 262
Location: New Delhi, India

PostPosted: Thu May 15, 2003 3:34 pm (21 years, 7 months ago) Reply with QuoteBack to Top

I was sure Mod_Rewrite module will do this
We use a ruleset which forbids the URLs of the webarea /specialarea/

Code:
RewriteCond %{HTTP_USER_AGENT}   ^NameOfBadRobot.*
RewriteRule ^/specialarea/.+   -   [F]

________________________________
Jayant Kumar
Member of the 4WebHelp Team
Nibble Guru - Computing Queries Demystified
GZip/ Page Compression Test
OfflineView User's ProfileFind all posts by jayantSend Personal MessageVisit Poster's WebsiteYahoo MessengerMSN Messenger
Daniel
Team Member



Joined: 06 Jan 2002
Posts: 2564

PostPosted: Thu May 15, 2003 4:03 pm (21 years, 7 months ago) Reply with QuoteBack to Top

Is this what you're looking for?

http://www.engelschall.com/pw/apache/rewriteguide/#ToC37

________________________________
Image
OfflineView User's ProfileFind all posts by DanielSend Personal Message
eBizAlive
Junior WebHelper
Junior WebHelper


Joined: 03 Jul 2003
Posts: 4

PostPosted: Thu Jul 03, 2003 9:58 pm (21 years, 5 months ago) Reply with QuoteBack to Top

As for nulrouting IPs you can SSH in and

Code:
/sbin/route add -host <IP-number here> reject


This will kill all incoming and outgoing connections from that IP until you reboot the server. However, if you reboot the server, the null route is gone. If you would like to save the null route after rebooting to protect you in the future, just add the command to

Code:
pico /etc/rc.d/rc.local


and it will re-execute them when the server comes back online.

John

________________________________
http://www.ebizalive.net
Multiple Domain and Reseller Hosting
OfflineView User's ProfileFind all posts by eBizAliveSend Personal MessageVisit Poster's Website
Daniel
Team Member



Joined: 06 Jan 2002
Posts: 2564

PostPosted: Fri Jul 04, 2003 7:57 am (21 years, 5 months ago) Reply with QuoteBack to Top

Unfortunately these days it is getting harder and harder to get shell access with hosting due to abuse Crying or Very sad, but thanks for the tip! Smile

________________________________
Image
OfflineView User's ProfileFind all posts by DanielSend Personal Message
adam
Forum Moderator & Developer



Joined: 26 Jul 2002
Posts: 704
Location: UK

PostPosted: Fri Jul 04, 2003 9:33 am (21 years, 5 months ago) Reply with QuoteBack to Top

also, I believe you'd probably need root access to do that...

________________________________
It's turtles all the way down...
OfflineView User's ProfileFind all posts by adamSend Personal MessageVisit Poster's Website
Mart
Junior WebHelper
Junior WebHelper


Joined: 26 Jan 2002
Posts: 9
Location: Northant's U.K

PostPosted: Fri Jul 04, 2003 7:29 pm (21 years, 5 months ago) Reply with QuoteBack to Top

jayant,

Could you use .htaccess

With something along the lines of

Code:
IndexIgnore *


in the folder you wish to preventing directory listing.

Mart.
OfflineView User's ProfileFind all posts by MartSend Personal MessageVisit Poster's Website
jayant
Team Member



Joined: 07 Jan 2002
Posts: 262
Location: New Delhi, India

PostPosted: Wed Jul 09, 2003 5:07 pm (21 years, 5 months ago) Reply with QuoteBack to Top

to prevent a directory listings one has to use:
Code:
Options -Indexes

in .htaccess

edit:-
sorry for late reply. noticed this just today

________________________________
Jayant Kumar
Member of the 4WebHelp Team
Nibble Guru - Computing Queries Demystified
GZip/ Page Compression Test
OfflineView User's ProfileFind all posts by jayantSend Personal MessageVisit Poster's WebsiteYahoo MessengerMSN Messenger
Display posts from previous:      
Post New TopicReply to Topic
View Previous Topic Print this topic View Next Topic


 Jump to:   




You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot edit your posts in this forum.
You cannot delete your posts in this forum.
You cannot vote in polls in this forum.


Page generation time: 0.12972 seconds :: 18 queries executed :: All Times are GMT
Powered by phpBB 2.0 © 2001, 2002 phpBB Group :: Based on an FI Theme