Skip to content

Commit 3e28318

Browse files
committed
*) Add the ldap-search option to mod_authnz_ldap, allowing authorization
to be based on arbitrary expressions that do not include the username. Make sure that when ldap searches are too long, we explicitly log the error. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/2.4.x@1922957 13f79535-47bb-0310-9956-ffa450edef68
1 parent 83ab7e7 commit 3e28318

File tree

4 files changed

+230
-98
lines changed

4 files changed

+230
-98
lines changed

STATUS

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -157,25 +157,6 @@ RELEASE SHOWSTOPPERS:
157157
PATCHES ACCEPTED TO BACKPORT FROM TRUNK:
158158
[ start all new proposals below, under PATCHES PROPOSED. ]
159159

160-
*) Add the ldap-search option to mod_authnz_ldap, allowing authorization
161-
to be based on arbitrary expressions that do not include the username.
162-
Make sure that when ldap searches are too long, we explicitly log the
163-
error.
164-
Trunk version of patch:
165-
https://svn.apache.org/r1589993
166-
https://svn.apache.org/r1591012
167-
https://svn.apache.org/r1596108
168-
https://svn.apache.org/r1745033
169-
https://svn.apache.org/r1913958
170-
https://svn.apache.org/r1913959
171-
https://svn.apache.org/r1914091
172-
https://svn.apache.org/r1914281
173-
Backport version for 2.4.x of patch:
174-
https://svn.apache.org/repos/asf/httpd/httpd/patches/2.4.x/httpd-2.4-httpd-2.4-ldap-search5.patch
175-
+1: minfrin, covener, jim
176-
rpluem says: https://svn.apache.org/repos/asf/httpd/httpd/patches/2.4.x/httpd-2.4-ldap-search5.patch returns 404
177-
covener: fixed slightly diff URL above
178-
179160
*) mod_proxy: Honor parameters of ProxyPassMatch workers with substitution
180161
in the host name or port. PR 69233.
181162
trunk patch: https://svn.apache.org/r1912462

docs/manual/expr.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@
6161
<seealso><a href="mod/mod_authnz_ldap.html#reqdn">Require ldap-dn</a></seealso>
6262
<seealso><a href="mod/mod_authnz_ldap.html#reqattribute">Require ldap-attribute</a></seealso>
6363
<seealso><a href="mod/mod_authnz_ldap.html#reqfilter">Require ldap-filter</a></seealso>
64+
<seealso><a href="mod/mod_authnz_ldap.html#reqsearch">Require ldap-search</a></seealso>
6465
<seealso><a href="mod/mod_authz_dbd.html#reqgroup">Require dbd-group</a></seealso>
6566
<seealso><a href="mod/mod_authz_dbm.html#reqgroup">Require dbm-group</a></seealso>
6667
<seealso><a href="mod/mod_authz_groupfile.html#reqgroup">Require group</a></seealso>

docs/manual/mod/mod_authnz_ldap.xml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@ for HTTP Basic authentication.</description>
8989
<li><a href="#reqdn">Require ldap-dn</a></li>
9090
<li><a href="#reqattribute">Require ldap-attribute</a></li>
9191
<li><a href="#reqfilter">Require ldap-filter</a></li>
92+
<li><a href="#reqsearch">Require ldap-search</a></li>
9293
</ul>
9394
</li>
9495

@@ -234,6 +235,11 @@ in <module>mod_ldap</module> for details of the cache tunables.
234235
directive, and the search filter successfully finds a single user
235236
object that matches the dn of the authenticated user.</li>
236237

238+
<li>Grant access if there is a <a href="#reqsearch">
239+
<code>Require ldap-search</code></a>
240+
directive, and the search filter successfully returns a single
241+
matching object with any distinguished name.</li>
242+
237243
<li>otherwise, deny or decline access</li>
238244
</ul>
239245

@@ -531,6 +537,28 @@ Require ldap-filter "&amp;(cell=*)(department=marketing)"
531537

532538
</section>
533539

540+
<section id="reqsearch"><title>Require ldap-search</title>
541+
542+
<p>The <code>Require ldap-search</code> directive allows the
543+
administrator to grant access based on a generic LDAP search filter using an
544+
<a href="../expr.html">expression</a>. If there is exactly one match to the search filter,
545+
regardless of the distinguished name, access is granted.</p>
546+
547+
<p>The following directive would grant access to URLs that match the given objects in the
548+
LDAP server:</p>
549+
550+
<highlight language="config">
551+
&lt;LocationMatch ^/dav/(?<SITENAME>[^/]+)/&gt;
552+
Require ldap-search (cn=%{ldap:%{unescape:%{env:MATCH_SITENAME}} Website)
553+
&lt;/LocationMatch&gt;
554+
</highlight>
555+
556+
<p>Note: care must be taken to ensure that any expressions are properly escaped to guard
557+
against LDAP injection. The <strong>ldap</strong> function can be used as per the example
558+
above.</p>
559+
560+
</section>
561+
534562
</section>
535563

536564
<section id="examples"><title>Examples</title>

0 commit comments

Comments
 (0)