From a533ec8bb5f8ea9c285950bc747e05169ca12833 Mon Sep 17 00:00:00 2001
From: Chris Darroch
mod_authn_anon
mod_authn_dbd
mod_authn_dbm
mod_authn_default
mod_authn_file
mod_authnz_ldap
mod_authnz_ldap
mod_authz_dbd
mod_authz_dbm
mod_authz_default
mod_authz_groupfile
mod_authz_host
mod_authz_owner
To take authorization a little further, the directives
- <SatisfyAll>
and
- <SatisfyOne>
allow
- AND/OR logic to be applied so that the order in which authorization
- is handled can be completely controled through the configuration. See
- these directives for a complete example on they can be applied.
To take authorization a little further, authorization container
+ directives such as
+ <MatchAll>
and
+ <MatchAny>
+ allow logic to be applied so that the order in which authorization
+ is handled can be completely controled through the configuration.
+ See Authorization
+ Containers for an example of they may be applied.
Controling how and in what order authorization will be applied
- has been a bit of a mystery in the past. In Apache 2.2 a provider based
+ has been a bit of a mystery in the past. In Apache 2.2 a provider-based
authentication mechanism was introduced to decouple the actual
authentication process from authorization and supporting functionality.
One of the side benefits was that authentication providers could be
configured and called in a specific order which didn't depend on the
load order of the auth module itself. This same provider based mechanism
has been brought forward into authorization as well. What this means is
- that the Require
directive
- not only specifies which authorization methods should be used, it also
+ that the Require
and
+ Match
directives
+ not only specify which authorization methods should be used, they also
specifies the order in which they are called. Multiple authorization
methods are called in the same order in which the
- Require
directives appear
- in the configuration.
With the introduction of the directives
- <SatisfyAll>
and
- <SatisfyOne>
, the
- configuration also has control over when the
+ Require
+ or Match
directives
+ appear in the configuration.
With the introduction of authorization container directives
+ such as
+ <MatchAll>
+ and
+ <MatchAny>
,
+ the configuration also has control over when the
authorization methods are called and what criteria determines when
- access is granted. For example the following authorization block would
- apply the logic:
- # if ((user == "John") ||
- # ((Group == "admins")
- # && (ldap-group <ldap-object> contains auth'ed_user)
- # && ((ldap-attribute dept == "sales")
- # || (file-group contains auth'ed_user))))
- # then
- # auth_granted
- # else
- # auth_denied
- #
- <Directory /www/mydocs>
-
- Authname ...
- AuthBasicProvider ...
- ...
- Require user John
- <SatisfyAll>
-
- Require Group admins
- Require ldap-group cn=mygroup,o=foo
- <SatisfyOne>
-
- Require ldap-attribute dept="sales"
- Require file-group
-
- </SatisfyOne>
-
- </SatisfyAll>
-
- </Directory>
-
By default all Require
- directives are handled through an OR operation. In other words, if
+ access is granted. See
+ Authorization Containers
+ for an example of how they may be used to express complex
+ authorization logic.
By default all
+ Require
+ directives are handled as though contained within a
+ <MatchAny>
+ container directive. In other words, if
any of the specified authorization methods succeed, then authorization
- is granted. By enclosing a set of
- Require
directives within
- a <SatisfyAll>
block,
- the processing switches to an AND operation which requires all authorization
- methods to succeed before authorization is granted.
In contrast, by default all
+ Match
directives
+ are handled as though contained within a
+ <MatchAll>
+ container directive (unless they are explicitly contained within
+ a different authorization container directive).
+ This permits
+ Match
directives
+ to be usefully mixed with negated
+ Match not
directives. To authorize the request,
+ none of the negated directives can match their parameters,
+ while all of the positive directives must match their
+ parameters (or else return a neutral result).
Authentication by username and password is only part of the story. Frequently you want to let people in based on something other than who they are. Something such as where they are @@ -527,10 +513,10 @@ person in ip let you allow or deny access based other host based criteria such as host name or ip address of the machine requesting a document.
- +The usage of these providers is specified through the
Require
and
- Reject
directives.
+ Match
directives.
These directives register the authorization providers
that will be called during the authorization stage of the request
processing. For example:
- Reject ip 10.252.46.165
+ Match not ip 10.252.46.165
Visitors coming from that address will not be able to see @@ -563,30 +549,30 @@ person in machine name, rather than an IP address, you can use that.
- Reject host host.example.com
+ Match not host host.example.com
And, if you'd like to block access from an entire domain, you can specify just part of an address or domain name:
- <SatisfyAll>
+ Match all granted
+ <MatchNotAny>
- Reject ip 192.168.205
- Reject host phishers.example.com moreidiots.example
Reject host ke
+ Match ip 192.168.205
+ Match host phishers.example.com moreidiots.example
+ Match host ke
- </SatisfyAll>
+ </MatchNotAny>
Using the Reject
directive
- inside of a <SatisfyAll>
- block, will let you be sure that you are actually restricting things to
- only the group that you want to let in.
The above example uses the
- <SatisfyAll>
block to make sure that all of the
- Reject
directives are
- satisfied before granting access.
The above example uses the <MatchNotAny>
container directive
+ to make sure that none of the
+ Match
directives
+ match their parameters before granting access. Note that
+ the Match all granted
directive and the
+ <MatchNotAny>
are implicitly contained
+ within a <MatchAll>
directive.
Satisfy
are no longer needed.
However to provide backwards compatibility for older configurations, these
directives have been moved to the mod_access_compat
module.
-
- One of the problems with these directives was that the line between
- authorization and access control was very fuzzy. The
- Satisfy
directive
- tried to tie these two stages together by hooking itself into the
- request processing itself. Now that these directive have been moved to the
- mod_access_compat
, mixing the new authorization directives
- with the older access control directives becomes difficult. To address this
- issue, the mod_authz_default
module becomes very important and must
- be loaded. The main purpose of the mod_authz_default
module is
- to handle any authorization requests that could not be handled by the
- authorization providers. But when the older access control directives are used,
- it also links access control with authorization and determines if access
- should be granted based on the outcome of each stage. Therefore if the
- older directives do not seem to be working properly, it might be because the
- mod_authz_default
module has not been loaded.
Apache HTTP Server Version 2.3
-Description: | Authentication fallback module |
---|---|
Status: | Base |
Module Identifier: | authn_default_module |
Source File: | mod_authn_default.c |
Compatibility: | Available in Apache 2.1 and later |
This module is designed to be the fallback module, if you don't
- have configured an authentication module like
- mod_auth_basic
. It simply rejects any
- credentials supplied by the user.
Description: | Sets whether authentication is passed to lower level -modules |
---|---|
Syntax: | AuthDefaultAuthoritative On|Off |
Default: | AuthDefaultAuthoritative On |
Context: | directory, .htaccess |
Override: | AuthConfig |
Status: | Base |
Module: | mod_authn_default |
Setting the AuthDefaultAuthoritative
directive
- explicitly to Off
allows for authentication to be passed on
- to lower level modules (as defined in the modules.c
- files).
Normally there are no lower level modules, since
- mod_authn_default
is defined to be already on
- a very low level. Therefore you should leave the value of
- AuthDefaultAuthoritative
as default
- (On
).