Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

blocking access

Posted on 2003-03-15
5
Medium Priority
?
184 Views
Last Modified: 2010-03-04
I want to block access from all IP's in the 68.52.0.0 subnetwork.  A bunch of people on that part of the network keep trying the Nimda virus on my server, and its just filling up my logs.  But when I put:

    Order deny,allow
    deny from 68.52
    Allow from all

under the Directory directive for the server directory, its not working because they aren't trying to access that directory.  How can I keep the server from doing anything regarding the 68.52.0.0 subnetwork?  I do not know what the subnet mask is.

Thanks

Jason D
0
Comment
Question by:yodaj007
  • 3
  • 2
5 Comments
 
LVL 15

Expert Comment

by:samri
ID: 8146758
Hi Jason,

How about using Location or LocationMatch directive.

http://httpd.apache.org//docs/mod/core.html#location
http://httpd.apache.org//docs/mod/core.html#locationmatch
--
<Location /*>  
   Order deny,allow
   deny from 68.52
   Allow from all
</Location>
--

However, you might have other directives - Directory, or Files that might allow connection from those IP address.

Check out how sections are merged - http://httpd.apache.org//docs/sections.html

The order of merging is:

   1.<Directory> (except regular expressions) and .htaccess done simultaneously (with .htaccess, if allowed, overriding <Directory>)
   2.<DirectoryMatch>, and <Directory> with regular expressions
   3.<Files> and <FilesMatch> done simultaneously
   4.<Location> and <LocationMatch> done simultaneously

So by using Location/LocationMatch, you would be safe.
0
 

Author Comment

by:yodaj007
ID: 8152890
Thanks.  I've implemented that.  When I see that it solves my problem, I'll set your comment to an answer.  Thanks again.

Jason D.
0
 
LVL 15

Accepted Solution

by:
samri earned 240 total points
ID: 8153079
Sure Jason.

Btw, you could test by adding, a 2nd Deny line.

Deny your-ip

Btw, I just noticed that the "deny" directive.  Try to use "Deny" -- notice the Uppercase "D". Some typo.

and try to do something like http://yourserver/anything, and see if you get a 403 error (Forbidden).

cheers.
0
 

Author Comment

by:yodaj007
ID: 8154788
Here are the directives from my config file.  You've helped me successfully deny everything from the 68.52 domain *that isn't referencing my homepage*.  Thats exactly what I wanted.  But for some reason I can't block myself from my own homepage as you suggested.  I've increased the points to 60 and I'm accepting your answer.  If you can tell me how to block access to my homepage, I can't thank you enough.  But its not necessary.

Jason D.



<Directory "C:/Program Files/Apache Group/Apache2/htdocs">
    Options Indexes FollowSymLinks
    AllowOverride None
    Order deny,allow
    Deny from localhost
    Deny from 192.168.1.102
    Allow from all
</Directory>

<Location /*>  
  Order deny,allow
  Deny from 68.52
  Allow from all
</Location>
0
 
LVL 15

Expert Comment

by:samri
ID: 8157392
Sure.  Thanks a lot.
0

Featured Post

[Webinar] Database Backup and Recovery

Does your company store data on premises, off site, in the cloud, or a combination of these? If you answered “yes”, you need a data backup recovery plan that fits each and every platform. Watch now as as Percona teaches us how to build agile data backup recovery plan.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

As Wikipedia explains 'robots.txt' as -- the robot exclusion standard, also known as the Robots Exclusion Protocol or robots.txt protocol, is a convention to prevent cooperating web spiders and other web robots from accessing all or part of a websit…
If you've heard about htaccess and it sounds like it does what you want, but you're not sure how it works... well, you're in the right place. Read on. Some Basics #1. It's a file and its filename is .htaccess (yes, with a dot in the front). #…
When cloud platforms entered the scene, users and companies jumped on board to take advantage of the many benefits, like the ability to work and connect with company information from various locations. What many didn't foresee was the increased risk…
Kernel Data Recovery is a renowned Data Recovery solution provider which offers wide range of softwares for both enterprise and home users with its cost-effective solutions. Let's have a quick overview of the journey and data recovery tools range he…
Suggested Courses
Course of the Month10 days, 10 hours left to enroll

571 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question