IP based authorization group in Apache
I do have a directory in Apache. It is protected with basic-authentication. Authorization is made like:
require valid-user
Now I'd like to change the group depending on the IP e.g.:
<if ip from s开发者_运维百科ubnet a>
require user1
<else>
require user2
<end if>
Is this possible in Apache?
This may be a bit late but for reference the solution that worked for me was:
Deny from all
Order deny,allow
AuthName "blah blah blah"
AuthUserFile path/to/.htpasswd
AuthType Basic
Require valid-user
Allow from 192.168.
Satisfy Any
This will allow you to force the htpass except from a specified domain, otherwise this link has a lot of good info regrading groups http://petergasser.com/codebase/comments.php?DiscussionID=38 but taking from that page, does this accomplish what you need it to do?
"managers can view this page from anywhere, everyone else must be from a golden.net IP address:"
htaccess:
AuthUserFile /usr/home/lee/htpasswd
AuthGroupFile /usr/home/lee/htgroup
AuthName "Lee's Secret Area"
AuthType Basic
Satisfy Any Default is Satisfy ALL
<Limit GET POST>
order deny,allow
deny from all
allow from .golden.net
require group managers
</Limit>
AuthGroupFile:
managers: cisco bob tim jeff kari
systems: lee joe cisco
sales: kari tonja
精彩评论