LinuxQuestions.org
Help answer threads with 0 replies.
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, 07: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, 08: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, 08:20 AM   #3
Hangdog42
LQ Veteran
 
Registered: Feb 2003
Location: Maryland
Distribution: Slackware
Posts: 7,791
Blog Entries: 1

Rep: Reputation: 414Reputation: 414Reputation: 414Reputation: 414Reputation: 414
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, 08: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, 08: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, 08: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, 04: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


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


All times are GMT -5. The time now is 03:18 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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration