Chapter 10. Access control
<Directory /var/www/CHEESE/games>
AuthType Basic
AuthName "Cheese lovers only"
AuthUserFile /etc/httpd/access/passwd
AuthGroupFile /etc/httpd/access/group
Require group stilton cheddar
</Directory>
Figure 10-12. httpd.conf: Restricting access to /var/www/CHEESE/games to groups
cheddar and stilton
Syntax summary: Require
Require
The Require command specifies the policy of who is allowed access once identi-
fication is complete.
Require valid-user
Any authenticated user may have access to the pages.
Require user user
1
user
2
user
3
...
Only one of the listed users may have access to the pages.
Require group group
1
group
2
group
3
...
Any user in one or more of the listed groups may have access to the pages.
If we wanted to delegate policy regarding access control by this mechanism we must
allow the override with AllowOverride AuthConfig.
Variations on a theme of user identification
What we described in the previous section is a way to provide user authenticated
access control. We used the Basic protocol and simple text files to store the userids,
passwords and groups.
The Basic protocol can be replaced with the Digest protocol. This comes from module
auth_digest_module from mod_auth_digest.so.
LoadModule auth_digest_module modules/mod_auth_digest.so
<Directory /var/www/CHEESE/games>
AuthType Digest
AuthName "Cheese lovers only"
AuthDigestDomain /games/
AuthDigestFile /etc/httpd/access/digest_pw
AuthDigestGroupFile /etc/httpd/access/group
Require group cheddar stilton
</Directory>
Figure 10-13. httpd.conf: The equivalent commands for the Digest protocol
The password file is replaced with one with a different structure, but the group file is
the same as it was before.
77
Komentáře k této Příručce