]> andersk Git - mod-vhost-ldap.git/blame - examples/README.apacheExtConfigRequireValidUser-details
git-svn-id: svn://svn.debian.org/svn/modvhostldap/branches/ext-config/mod-vhost-ldap...
[mod-vhost-ldap.git] / examples / README.apacheExtConfigRequireValidUser-details
CommitLineData
d684c835
PW
1#####################################################################
2#####################################################################
3#####################################################################
4######## mod_vhost_ldap version 2.0.3 or later ######################
5#####################################################################
6
7 This file contains further considerations and usage examples
8of single-value access control entry attribute named
9"apacheExtConfigRequireValidUser". Handling of user "validity" is
10quite complicated and a little bit different than you could expect,
11so even I make sometimes misunderstanding if its current implemen-
12tation if this feature.
13
14I'm going to explain here, how user validity is related to
15TWO types of resources, to which access control may be defined:
16
17I. Location access control (sometimes referred as uri access control,
18or virtual host access control)
19II. Directory access control (sometimes referred as physical location
20access control, or virtualhost-independent access control).
21
22Resource, depending on case, may mean "location" or "directory",
23or "both/no matter which kind of goods" :-).
24
25"Access control" usually means authentication + authorization (for
26polish readers - "uwierzytelnianie" and "autoryzacja").
27
28Authentication concerns about various ways of checking validity
29of username/password pair. It includes checking whether user
30exists in user-information source, and whether supplied password
31is valid for supplied user. There are hundreds of methods to
32perform such tasks and apache supports many of them. However,
33mod_vhost_ldap currently support ONLY "basic" authentication,
34which conforms to checking whether user exists and whether applied
35password is correct for applied username. Some authentication
36methods may be used for authentication and authorization, some
37of them cannot (in some situation some information e.g. "realm"
38provided by clients with authentication are used to authorize
39them, sometimes not), however with modvhostldap authentication
40and authorization are two different things.
41
42Authorization concerns about checking whether particular user is
43authorized to connect/use particular resource or particular
44kind of resource.Depending on authorization configuration,
45a resource may be available only to authenticated users, or
46for authenticated and not-authenticated users. Here we
47take care only about resources which are available only for
48authenticated users, so every not-authenticated user is not
49authorized to access particular resources. We don't discuss
50resources that don't need users to be authenticated to determine
51whether they're authorized or not, and vice versa - we assume,
52that every resource which has authentication defined, has
53user authorization status determined in some way, which will
54be explained below.
55
56Authentication is most simple of all of this - authenticated
57user is a user which provided username and password, and
58the pair was verified in some way. Http authentication status
59information is then kept in http headers (usually until
60browser or browser-window is not reopened, depending on browser.
61
62First we define what's actually defined by access control entry,
63and what is NOT defined by access control entry.
64
65In both cases, (location and directory) access control entry
66defines whether particular resource is protected, however
67with directory, existing access entry means that directory
68has access control, and for location, existing access entry
69means,that location is protected if and only if virtual host
70has access control enabled. you can enable/disable location access
71control for virtualhost, no matter whether access control
72entry for this location exists - on virtual host configuration
73level, by setting apacheExtConfigHasRequireLine attribute to
74TRUE or FALSE. if this attribute for vhost is FALSE, location
75access control won't be checked at all.
76Directory access control is always checked, no matter, whether
77virtualhost has access control enabled, or not. LAC is configured
78against particular address on (with) particular virtual server, DAC
79is configured against physical location of the resource, no matter
80whether it is accessed by some alias address, or some uri
81directly available under virtual server directory tree. (www.internal.com/ and below).
82Sometimes you may want particular file or directory
83on the disk to be protected, no matter which way user tries
84to access it, and sometimes you may want that some particular
85URL to be protected, if its accessed via www.domain.com, but
86opened e.g. from internal network (when it's accessed via www.inernal.com
87virtualhost, which is available for internally-conected clients.
88
89Directory access control has higher level of importance than
90location access control. Secured directory is secured no matter
91under which location it's accessed. If you secure directory
92as directory, and you secure location, location authentication
93and authorization will be checked first, and if allowed, directory
94authentication and authorization will be checked, and if
95denied - user will be denied access. Authentication information
96are stored somewhere in http headers, so once authenticated
97user data will be passed to directory authentication.
98if the same user is authorized to access directory, access
99will be granted, if perlocation-authenticated user is not
100authorized to access directory, a prompt for another
101authentication data will be displayed. This may cause
102to annoying results, as authentication information in http
103headers would be probably replaced (?), and new values won't
104match location requirements. However i'm not sure how this
105works, I didn't tested it, it's possible that headers may contain
106information for location and directory, anyway it's recommended to
107avoiding such situation, to always have clearance which set of access
108control settings are applied to the resource client wants access.
109In doubt I suggest you to configure per-directory access control,
110in almost all cases this is what you want.
111
112
113
114Now, for apache there are three ways in which user can be
115authorized for resource: user may be valid-user, user may
116be one of exactly defined authorized users, or user may
117be member of authorized group. for details refer to apache documentation
118of "Require" directives, anyway, modvhostldap currently
119supports valid-user and userlist, and this is difference,
120which is determined by apacheExtConfigRequireValidUser attribute.
121
122Location "Require" directive is created for
123each request for each vhost which have has LAC enabled
124(hasRequireLines = TRUE), and for which there's found
125access control object, which has the same or higher
126uri as its apacheExtConfigUri value.
127
128Directory Require directive is created
129if there's found access control object, which has
130the same or higher directory as its apacheExtConfigPath value.
131
132Let's assume that if we're processing per-location config
133then servername of the http request is "internal", and uri of the
134request is "/abcd/xyz/protected/" (so we have
135http://internal/abcd/protected/xyz/"
136First is checked whether "internal" HasRequireLines is TRUE.
137If yes, then there's made a lookup for access control
138entry, which has apacheExtConfigServerName value = internal
139and apacheExtConfigUri value set to a value,
140which is contained in '/abcd/protected/xyz' starting
141from left. so access control objects which have
142apacheExtConfigUri like: "/", "/abc",
143"/abcd/xyz/protected" and "/abcd/xyz/protected/"
144will match. Finally, if the full string is reached,
145and access control object is not found, error is
146reported - (access control configured but no
147access control objects found), and access control
148is not applied.
149
150And - other case - if we're processing per-directory config,
151then match is made exactly the same way, except that
152servername is not checked. If higher (shorter) or equal
153directory value has acl object with this value - object
154is matched. If full string is reached and object is not found,
155access control is not applied, and no error is reported.
156
157Now ACL object, if found, is examined.
158If apacheExtConfigRequireValidUser attribute for it
159has value set to "TRUE", then
160configuration is processed as "Require valid-user"
161(access shoud be granted to any valid user).
162analog directive,
163If it's "FALSE", then configuration
164is processed as "Require user ..." directive, userlist
165is created, and access is granted to any valid user,
166which username is on the list.
167List, if needed, is created depending on values
168of attribute apacheExtConfigUserDn which must in this
169case contain full distinguished names of the users,
170which should have access granted. Username "nobody"
171is always appended first, before appending attribute
172values (loginnames), to avoid situation, when
173apacheExtConfigRequireValidUser = FALSE, and no apacheExtConfigUserDn
174values exist in entry ("Require user" if defined, must contain at least one username).
175
176So access gets configured, and then it comes to authentication.
177Further processing depends whether it's case I or II.
178In case I - valid user, is user which matches the following filter:
179(&
180 (_D_)
181 (objectClass=apacheExtendedConfigUserObject)
182 (apacheExtConfigUserServerName=_A_)
183 (apacheExtConfigUserLocationUri=_G_)
184)
185
186and in case II
187(&
188 (_D_)
189 (objectClass=apacheExtendedConfigUserObject)
190 (apacheExtConfigUserDirectoryName=_E_)
191)
192
193where _D_ is global user-defined filter, and other attributes
194have values the same as access control object.
5f4649c4
PW
195More details about used filters and global
196user-defined filter you'll find in vhost_ldap.conf
d684c835
PW
197
198Finally, in both cases, if access control object
199has apacheExtConfigRequireValidUser = FALSE, user is authenticated,
200loginname is found on the list, access is granted, or
201of the apacheExtConfigRequireValidUser = TRUE,and user is authenticated,
202access is granted, otherwise access is denied.
203This final stage, in comparison to analog configuration files,
204is the same as checking context in which particular user has been
205defined - <Directory /some/dir> or <Location /abcd/xyz/protected>.
206Simply - with .htaccess context is determined based on
207the location of the .htaccess file, in common configuration
208context is determined by the context :-), and with ldap
209context is determined by attributes of the particular webuser.
210
211For each user object, supplied password is checked against
212as clear text, htpasswd format, or unix crypt format, and with
213debug all of them are logged, and additionaly. information
214which one matched (or none) is logged too.
215
216So, to be short at last - access control has particular precendence,
217there are some differences between location and directory access
218processing. You always need to specify inside userobject
219for which resource it is valid, and, additionaly, if you set
220apacheExtConfigRequireValidUser=FALSE, then you need to
221put webuser object DN into apacheExtConfigUserDn attribute
222of the access entry related to this resource. Applied
223password is checked against mostly used formats.
224And, you can have multiple locations, directories and servernames
225for access config entries, and user entries, and (ugh),
226you can have multiple access control entries for virtualhost(s).
227
228If you get into mess, and things doesn't work, you can disable
229some part(s) of authentication process. any trouble with
230authentication won't impact rest of virtualhost filesystem.
231Aliased directiories are substituted first, so directory
232access control entries will apply only to final real-directory
233or file name.
234
235Aliasing match works similar way as Directory and Location
236match - there's a try to find object which define targed physical
237location for current URI, and this target (existing or not),
238has precedence over (existing or not) URL part(s).
239And you can have multiple aliases for virtualhost, and
240multiple virtual URI's for one target.
241
242If you create entries, which coincidents, like two
5f4649c4
PW
243alias object which specify the same url and vhost, but
244different targets, or two uses with the same
d684c835
PW
245logins and the same permissions but e.g. different passwords,
246only first found will be used (each matching is done only once),
247and it's hard to predict which one this would actually be.
09500a0b
PW
248Creating users without passwords at all, is avoided by
249schema.
d684c835
PW
250
251Note, that all this stuff is of course checked before actual
252resource is returned to browser, so any of alias targets, or
253users defined as valid, doesn't need to be existing - if
254they don't exist, finally some HTTP error will be returned, but
255existence of objects doesn't affect processing itself.
256
257Have fun, feedback welcomed :)
258PW.
This page took 0.074869 seconds and 5 git commands to generate.