LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 02-24-2004, 06:56 AM   #1
AZIMBD03
Member
 
Registered: Oct 2003
Location: Dhaka,Bangladeh
Distribution: Red Hat
Posts: 80

Rep: Reputation: 15
Angry How I can block a IP to view my web site??


Hi everybody?

I am using apache 1.3.20-16 on my RH PC, now I would like to deny to access the page virtual host http://me.com from from any viewers of IP address 202.141.191.x PLease anybody help me how i can do this job???




Blues
:
 
Old 02-24-2004, 07:19 AM   #2
Satriani
Member
 
Registered: Mar 2003
Location: The Netherlands
Distribution: Red Hat 7.3, Red Hat 9, Solaris8, Slackware 10, Slax on USB, AIX, FreeBSD, WinXP, AIX, Ubuntu
Posts: 418

Rep: Reputation: 30
I think you will need to setup some firewall rules... I don't think you can do that with apache itself.. Or you could write a cgi / php script to check the IP address and take proper action....
 
Old 02-24-2004, 07:20 AM   #3
Hangdog42
LQ Veteran
 
Registered: Feb 2003
Location: Maryland
Distribution: Slackware
Posts: 7,803
Blog Entries: 1

Rep: Reputation: 422Reputation: 422Reputation: 422Reputation: 422Reputation: 422
You can do it with an iptables rule in your firewall:

iptables -A INPUT -p tcp -s 202.141.191.0/24 --dport 80 -j DROP

This should prevent them from accessing your web server (assuming its running on port 80. If its not, change the rule to match your httpd port). Just make sure this rule is ahead of any other rule that might accept the packets.
 
Old 02-24-2004, 07:25 AM   #4
Satriani
Member
 
Registered: Mar 2003
Location: The Netherlands
Distribution: Red Hat 7.3, Red Hat 9, Solaris8, Slackware 10, Slax on USB, AIX, FreeBSD, WinXP, AIX, Ubuntu
Posts: 418

Rep: Reputation: 30
This will prevent any access on port 80 from that IP range...
But i believe you want certain virtual hosts not to be available, but others should be? Then... Wow... That's hard I think...
I should go for some CGI-script / php page when entering your site...
 
Old 02-24-2004, 07:26 AM   #5
dimitri358
LQ Newbie
 
Registered: Jan 2004
Location: Greece
Posts: 11

Rep: Reputation: 0
I'm not sure i haven't tested it, just read it in theory but if you go to the Apache web page, in the how-to's section

http://httpd.apache.org/docs/howto/auth.html<--here you will find what you want.Read what is says. I believe what you are looking for is there.
 
Old 02-24-2004, 07:36 AM   #6
Satriani
Member
 
Registered: Mar 2003
Location: The Netherlands
Distribution: Red Hat 7.3, Red Hat 9, Solaris8, Slackware 10, Slax on USB, AIX, FreeBSD, WinXP, AIX, Ubuntu
Posts: 418

Rep: Reputation: 30
Ahhhhh Dimitri is right on the money!!!
When i read it, i remembered it!
You should indeed read that, and then add something to your httpd.conf's virtualhost section like:
Code:
deny from 202.141.191
 
Old 02-26-2004, 03:19 PM   #7
AZIMBD03
Member
 
Registered: Oct 2003
Location: Dhaka,Bangladeh
Distribution: Red Hat
Posts: 80

Original Poster
Rep: Reputation: 15
Thumbs up

Oh ! I have blocked the IP 202.141.191.x just using following script on access.conf file

<Directory /var/www/html/xyz>
<Limit GET POST>
Oreder mutual-failure
deny from 202.141.191.x
allow from all
</Limit>
</Directory>



Enjoy

Blues
 
  


Reply



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
allow specific ip to browse the block site space_beyond Linux - Newbie 1 06-03-2005 09:15 AM
how can i donload and view entire web site offline !! hitesh_linux Linux - Software 8 03-08-2004 10:32 AM
squid acl how to block all site except some mikmok Linux - Networking 1 12-22-2003 08:20 AM
block local user to access a site xen_chris Linux - Newbie 3 04-15-2003 09:55 AM
How to view the web site hosted on win2k server which is a client machine? gogo Linux - Networking 10 10-19-2002 10:48 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 06:32 AM.

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
Open Source Consulting | Domain Registration