]> andersk Git - mod-vhost-ldap.git/blame - debian/README.apacheExtConfigRequireValidUser-details
git-svn-id: svn://svn.debian.org/svn/modvhostldap/branches/ext-config/mod-vhost-ldap...
[mod-vhost-ldap.git] / debian / README.apacheExtConfigRequireValidUser-details
CommitLineData
f0f02f06
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
112Now, for apache there are three ways in which user can be
113authorized for resource: user may be valid-user, user may
114be one of exactly defined authorized users, or user may
115be member of authorized group. for details refer to apache documentation
116of "Require" directives, anyway, modvhostldap currently
117supports valid-user and userlist, and this is difference,
118which is determined by apacheExtConfigRequireValidUser attribute.
119
120Location "Require" directive is created for
121each request for each vhost which have has LAC enabled
122(hasRequireLines = TRUE), and for which there's found
123access control object, which has the same or higher
124uri as its apacheExtConfigUri value.
125
126Directory Require directive is created
127if there's found access control object, which has
128the same or higher directory as its apacheExtConfigPath value.
129
130Let's assume that if we're processing per-location config
131then servername of the http request is "internal", and uri of the
132request is "/abcd/xyz/protected/" (so we have
133http://internal/abcd/protected/xyz/"
134First is checked whether "internal" HasRequireLines is TRUE.
135If yes, then there's made a lookup for access control
136entry, which has apacheExtConfigServerName value = internal
137and apacheExtConfigUri value set to a value,
138which is contained in '/abcd/protected/xyz' starting
139from left. so access control objects which have
140apacheExtConfigUri like: "/", "/abc",
141"/abcd/xyz/protected" and "/abcd/xyz/protected/"
142will match. Finally, if the full string is reached,
143and access control object is not found, error is
144reported - (access control configured but no
145access control objects found), and access control
146is not applied.
147
148And - other case - if we're processing per-directory config,
149then match is made exactly the same way, except that
150servername is not checked. If higher (shorter) or equal
151directory value has acl object with this value - object
152is matched. If full string is reached and object is not found,
153access control is not applied, and no error is reported.
154
155Now ACL object, if found, is examined.
156If apacheExtConfigRequireValidUser attribute for it
157has value set to "TRUE", then
158configuration is processed as "Require valid-user"
159(access shoud be granted to any valid user).
160analog directive,
161If it's "FALSE", then configuration
162is processed as "Require user ..." directive, userlist
163is created, and access is granted to any valid user,
164which username is on the list.
165List, if needed, is created depending on values
166of attribute apacheExtConfigUserDn which must in this
167case contain full distinguished names of the users,
168which should have access granted. Username "nobody"
169is always appended first, before appending attribute
170values (loginnames), to avoid situation, when
171apacheExtConfigRequireValidUser = FALSE, and no apacheExtConfigUserDn
172values exist in entry ("Require user" if defined, must contain at least one username).
173
174So access gets configured, and then it comes to authentication.
175Further processing depends whether it's case I or II.
176In case I - valid user, is user which matches the following filter:
177(&
178 (_D_)
179 (objectClass=apacheExtendedConfigUserObject)
180 (apacheExtConfigUserServerName=_A_)
181 (apacheExtConfigUserLocationUri=_G_)
182)
183
184and in case II
185(&
186 (_D_)
187 (objectClass=apacheExtendedConfigUserObject)
188 (apacheExtConfigUserDirectoryName=_E_)
189)
190
191where _D_ is global user-defined filter, and other attributes
192have values the same as access control object.
193More details about used filters and global
194user-defined filter you'll find in vhost_ldap.conf
195
196Finally, in both cases, if access control object
197has apacheExtConfigRequireValidUser = FALSE, user is authenticated,
198loginname is found on the list, access is granted, or
199of the apacheExtConfigRequireValidUser = TRUE,and user is authenticated,
200access is granted, otherwise access is denied.
201This final stage, in comparison to analog configuration files,
202is the same as checking context in which particular user has been
203defined - <Directory /some/dir> or <Location /abcd/xyz/protected>.
204Simply - with .htaccess context is determined based on
205the location of the .htaccess file, in common configuration
206context is determined by the context :-), and with ldap
207context is determined by attributes of the particular webuser.
208In general- it means, that valid-user is not only a user which
209has authenticated successfully, but also is valid for
210specified resource. Directive "Require user nobody [...]"
211allows you to limit all users valid for a resource to exactly
212defined list.
213
214For each user object, supplied password is checked against
215as clear text, htpasswd format, or unix crypt format, and with
216debug all of them are logged, and additionaly. information
217which one matched (or none) is logged too.
218
219So, to be short at last - access control has particular precendence,
220there are some differences between location and directory access
221processing. You always need to specify inside userobject
222for which resource it is valid, and, additionaly, if you set
223apacheExtConfigRequireValidUser=FALSE, then you need to
224put webuser object DN into apacheExtConfigUserDn attribute
225of the access entry related to this resource. Applied
226password is checked against mostly used formats.
227And, you can have multiple locations, directories and servernames
228for access config entries, and user entries, and (ugh),
229you can have multiple access control entries for virtualhost(s).
230
231If you get into mess, and things doesn't work, you can disable
232some part(s) of authentication process. any trouble with
233authentication won't impact rest of virtualhost filesystem.
234Aliased directiories are substituted first, so directory
235access control entries will apply only to final real-directory
236or file name.
237
238Aliasing match works similar way as Directory and Location
239match - there's a try to find object which define targed physical
240location for current URI, and this target (existing or not),
241has precedence over (existing or not) URL part(s).
242And you can have multiple aliases for virtualhost, and
243multiple virtual URI's for one target.
244
245If you create entries, which coincidents, like two
246alias object which specify the same url and vhost, but
247different targets, or two uses with the same
248logins and the same permissions but e.g. different passwords,
249only first found will be used (each matching is done only once),
250and it's hard to predict which one this would actually be.
251Creating users without passwords at all, is avoided by
252schema.
253
254Note, that all this stuff is of course checked before actual
255resource is returned to browser, so any of alias targets, or
256users defined as valid, doesn't need to be existing - if
257they don't exist, finally some HTTP error will be returned, but
258existence of objects doesn't affect processing itself.
259
260And one note about user-defined filter - it's appended
261checked as normal standalone ldap filter, and
262appended to all searches, so it may be considered "global".
263There's plan to implement directives to support user-defined
264filters to be applied to specified elements of configuration,
265however I'm not sure whether this makes sense. Usage
266of such filter is usually related to enabling/disabling
267objects. E.g. if you have some coustome attribute of the objects
268like "isActive" or "toRemove" or something, and you set it
269to TRUE or FALSE, you may then apply it to user-defined
270filter, to include only objects, which have this attribute
271set to "FALSE" or doesn't have it set at all, e.g.
272
273 ( | (isActive=TRUE)(!(isActive=*)) )
274
275(isActive equal TRUE, or isActive not equal to anything).
276
277Have fun, feedback welcomed :)
278Piotr Wadas <pwadas@jewish.org.pl>
This page took 0.168782 seconds and 5 git commands to generate.