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

x
?
Solved

Apache folder restrictions only for a subnet?

Posted on 2012-08-24
5
Medium Priority
?
1,000 Views
Last Modified: 2012-08-26
Hi,

I've got a Linux server that has the IP 192.168.0.2

My virtualhost has the following configuration:


<VirtualHost *:80>
    ServerAdmin webm@server.example.com
    DocumentRoot /var/www/virtual
    ServerName server.example.com
    ErrorLog logs/server.example.com
    CustomLog logs/server.example.com-access_log common
</VirtualHost>

Under /var/www/virtual I have a directory: /var/www/virtual/billing

 that has a index.html file that I'd like to be available when clients access:

server.example.com/billing

However, this link must be accessible only to clients from network: 192.168.0.3/24

When clients from other networks are trying to access /var/www/virtual/billing they shouldn't be able to do so.

Is this achievable?

Thanks!
0
Comment
Question by:g0all
5 Comments
 
LVL 29

Accepted Solution

by:
Jan Springer earned 1600 total points
ID: 38330651
Within the virtual host <Directory> section:

Order deny,allow
Deny from all
Allow from 192.16.0.3
0
 
LVL 2

Assisted Solution

by:zunder1990
zunder1990 earned 400 total points
ID: 38330696
If you look at Section 2 "main" server config of httpd.conf for the line<Directory "/var/www/html"> that will tell you how to use the Directory option. I have added my allow access after the </directory>. This is what mine looks like


<Directory /var/www/html/administrator/>
Order allow,deny
Allow from 192.168.0.0/24
Allow from 127
Allow from 10.0.21.0/24
Allow from 10.0.21.45
</Directory>

Open in new window

0
 
LVL 1

Author Closing Comment

by:g0all
ID: 38331233
Thank you!
0
 
LVL 13

Expert Comment

by:Sandy
ID: 38334303
.htaccess is also a good solution
0

Featured Post

Evaluating UTMs? Here's what you need to know!

Evaluating a UTM appliance and vendor can prove to be an overwhelming exercise.  How can you make sure that you're getting the security that your organization needs without breaking the bank? Check out our UTM Buyer's Guide for more information on what you should be looking for!

Question has a verified solution.

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

​Being a Managed Services Provider (MSP) has presented you  with challenges in the past— and by meeting those challenges you’ve reaped the rewards of success.  In 2014, challenges and rewards remain; but as the Internet and business environment evol…
It’s 2016. Password authentication should be dead — or at least close to dying. But, unfortunately, it has not traversed Quagga stage yet. Using password authentication is like laundering hotel guest linens with a washboard — it’s Passé.
Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
Suggested Courses
Course of the Month12 days, 9 hours left to enroll

579 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