<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Fellinghaug Blog &#187; ldap</title>
	<atom:link href="http://asbjorn.fellinghaug.com/blog/tag/ldap/feed/" rel="self" type="application/rss+xml" />
	<link>http://asbjorn.fellinghaug.com/blog</link>
	<description>&#62;&#62;&#62; from fellinghaug import asbjorn; asbjorn.play()</description>
	<lastBuildDate>Thu, 19 Nov 2009 21:22:01 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Apache, subversion and LDAP group authentication</title>
		<link>http://asbjorn.fellinghaug.com/blog/2009/06/apache-subversion-and-ldap-group-authentication/</link>
		<comments>http://asbjorn.fellinghaug.com/blog/2009/06/apache-subversion-and-ldap-group-authentication/#comments</comments>
		<pubDate>Thu, 04 Jun 2009 07:30:00 +0000</pubDate>
		<dc:creator>Asbjørn Alexander Fellinghaug</dc:creator>
				<category><![CDATA[general IT]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[tips]]></category>
		<category><![CDATA[work]]></category>
		<category><![CDATA[apache]]></category>
		<category><![CDATA[authenticate]]></category>
		<category><![CDATA[ldap]]></category>
		<category><![CDATA[ldap-filter]]></category>
		<category><![CDATA[ldap-group]]></category>
		<category><![CDATA[subversion]]></category>
		<category><![CDATA[svn]]></category>

		<guid isPermaLink="false">http://asbjorn.fellinghaug.com/blog/?p=222</guid>
		<description><![CDATA[Hellu!
Lately I&#8217;ve been working on securing some web accessible resource, especially Subversion access to repositories through the Apache webserver. One aspect we found very difficult was to secure subversion access through our apache server, when we had a Active Directory server to authenticate against (I know..).
Apache have some directives such as &#8220;Require valid-user&#8221; which signals [...]]]></description>
			<content:encoded><![CDATA[<p>Hellu!</p>
<p>Lately I&#8217;ve been working on securing some web accessible resource, especially Subversion access to repositories through the Apache webserver. One aspect we found very difficult was to secure subversion access through our apache server, when we had a Active Directory server to authenticate against (I know..).</p>
<p>Apache have some directives such as &#8220;Require valid-user&#8221; which signals that a user has to be authenticated against some authentication provider. This is in most cases a standard &#8220;.htaccess&#8221; and &#8220;.htpasswd&#8221; combination which provides this. For small projects, this may be a working approach. However, in a large-scale organization where you want a dynamic handling of users and their access, then using groups to reflect the users access to resources may be a better working solution.</p>
<p>For one of our projects, we wanted all LDAP (AD) users to have read access, while members of certain groups have read and write access. We solved this with the following Apache config:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
</pre></td><td class="code"><pre class="apache apache" style="font-family:monospace;">&lt;<span style="color: #000000; font-weight:bold;">Location</span> /wicked_project&gt;
   DAV svn
   SVNParentPath /var/svn/wicked_project
   AuthzLDAPAuthoritative <span style="color: #0000ff;">off</span>
   <span style="color: #00007f;">AuthType</span> basic
   AuthBasicProvider ldap
   <span style="color: #00007f;">AuthName</span> <span style="color: #7f007f;">&quot;Need to authenticate here&quot;</span>
   AuthLDAPBindDN <span style="color: #7f007f;">&quot;ldap_user@domain.net&quot;</span>
   AuthLDAPBindPassword secretPassword
   AuthLDAPURL <span style="color: #7f007f;">&quot;ldap://ad.domain.net/dc=domain,dc=net?sAMAccountName?sub?(objectClass=*)&quot;</span>
&nbsp;
   &lt;Limit GET PROPFIND <span style="color: #00007f;">OPTIONS</span> CHECKOUT&gt;
      <span style="color: #00007f;">Require</span> valid-<span style="color: #00007f;">user</span>
   &lt;/Limit&gt;
   &lt;Limit REPORT MKACTIVITY PROPPATCH PUT MKCOL MOVE COPY DELETE LOCK UNLOCK MERGE&gt;
   <span style="color: #00007f;">Require</span> ldap-filter |(memberOf=CN=Staff,OU=GROUPS,DC=DOMAIN,DC=NET) \
                (memberOf=CN=Wicked_project_rw,OU=GROUPS,DC=DOMAIN,DC=NET)
   &lt;/Limit&gt;
&lt;/<span style="color: #000000; font-weight:bold;">Location</span>&gt;</pre></td></tr></table></div>

<p>Another LDAP directive which can work if you only need one group to have read and write access is the &#8220;ldap-group&#8221; directive. However, in our case we needed multiple groups, which is not supported by the &#8220;ldap-group&#8221; directive.</p>
<p>To solve this problem we used &#8220;ldap-filter&#8221; with multiple group filters inside the same filter, and divide them with the boolean OR. I don&#8217;t know if there are any more elegant ways of achieving the same result, but this solved our problems.</p>
<p>Having a second look at this &#8220;ldap-fiter&#8221; directive, I see that it have a significant strength in terms of flexibility. However, one aspect I have not considered is the performance of this approach. Without looking in-depth into the mod_ldap apache module, I can guess that for each filter inside the ldap-filter directive, it have to make a query to the LDAP (AD) server to retrieve the wanted resource. So, for each group filter inside the ldap-filter, you need a call. In our approach, we need two LDAP queries. As you now may see, the more groups to filter, the more LDAP queries, hence the performance will degrade the more complex the ldap-filter is.</p>
]]></content:encoded>
			<wfw:commentRss>http://asbjorn.fellinghaug.com/blog/2009/06/apache-subversion-and-ldap-group-authentication/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
