开发者

How to dynamically set group access in apache2 configuration

I have an apache configuration containing the following directives. It is for a trac environment with multiple projects, each containing a different set of users that are allowed access.

I want to use a wildcard to allow only a defined group access to this environment, how can this be done? Currently my config allowes all users:

<LocationMatch "/private/[^/]+/login">
        AuthType Basic
        AuthName "Trac"
        AuthUserFile /home/auth/private.access.user
        Require valid-user
</LocationMatch>

But I would like it to read something like:

<LocationMatch "/private/[^/]+/login">
        AuthType Basic
        AuthName "Trac"
        AuthUserFile /home/auth/pr开发者_如何转开发ivate.access.user
        Require Group [^/]
</LocationMatch>

Is this possible?


With Trac, I find it much easier to allow access to everybody in the Apache config and then use Trac's account manager plugin (http://trac-hacks.org/wiki/AccountManagerPlugin) to control access to each project's Trac instance. Revoke all permissions from the 'anonymous' user, and users from group2 won't be able to do anything with group1's Trac instance except see an error page and be prompted to login.


What I would do is the following...

<LocationMatch "/private/[^/]+/login">
        AuthType Basic
        AuthName "Trac"
        AuthUserFile /home/auth/private.access.user
        AuthGroupFile /home/auth/private.access.groups
        Require Group group1 group2
</LocationMatch>

Where the group file /home/auth/private.access.groups is just a simple text (ascii) file, for example it could look like this:

group1: john barry
group2: frank jeremy

I'm not sure it Regular Expressions are possible in Require Group directive (I doubt they are), I always name particular names of groups listed in the group authentication file.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜