Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Set an Apache IP Whitelist

I'm currently creating some web-app for our department. The department is part of a greater intranet who serve many more department of course.

I've setup a WAMP enviroment on a PC that's never used and developed some simple application to be used inside this department.

For every app i've created an alias, and a sort of "home page" where you can see an "index" of the web apps.

Now i've to setup apache to deny the access to the various web app except a list of IP.

I've tried using the authz_host to accomplish this but it doesn't work.

Following the copypaste from the Alias of a web app.

Alias /national-alerts/ "c:/wamp/www/national-alerts/" 

<Directory "c:/wamp/www/national-alerts/">
    Options Indexes FollowSymLinks MultiViews
    AllowOverride all
       Order deny,allow
    Deny from all
    Allow from 10.176.164.53
    Allow from 10.176.162.144
    Allow from 10.176.162.219
    Allow from 10.176.160.202
    Allow from 10.176.165.143
    Allow from 10.176.162.209
    Allow from 10.176.166.46
    Allow from 10.176.162.119
    Allow from 10.176.160.232
    Allow from 10.176.162.53
    Allow from 10.176.164.33
    Allow from 10.176.161.185
    Allow from 10.176.162.111
</Directory>

All of these IPs are from the internal IP of the intranet. As result any access get an 'Access Denied' like the Allow has been ignored totally.

Can someone help me pointing to the right example/documentation?

like image 221
Claudio Avatar asked Jan 07 '13 12:01

Claudio


1 Answers

Your conf with changed IPs works for me.

What is the subnet mask of your intranet if it's not 255.255.0.0 or wider there is a chance that requests are made not directly by 10.176.164.53 for example but from his gateway.

And what is the IP address of the web server?

When you try to access the page (for example from 10.176.164.53) take a look to apache's access logs and check if request was made from same ip.

like image 186
Vladimir Dimitrov Avatar answered Nov 18 '22 13:11

Vladimir Dimitrov