<?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>Evan Hoffman&#039;s silly writings. &#187; DSID-03190F00</title>
	<atom:link href="http://www.evanhoffman.com/evan/tag/dsid-03190f00/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.evanhoffman.com/evan</link>
	<description>When 3-nines uptime is just way too much.</description>
	<lastBuildDate>Mon, 06 Sep 2010 00:36:39 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>LDAP-Active Directory authentication, Part 3</title>
		<link>http://www.evanhoffman.com/evan/2010/01/08/ldap-active-directory-authentication-part-3/</link>
		<comments>http://www.evanhoffman.com/evan/2010/01/08/ldap-active-directory-authentication-part-3/#comments</comments>
		<pubDate>Fri, 08 Jan 2010 23:12:34 +0000</pubDate>
		<dc:creator>evan</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[active directory]]></category>
		<category><![CDATA[apache]]></category>
		<category><![CDATA[DSID-03190F00]]></category>
		<category><![CDATA[DSID-031A0F44]]></category>
		<category><![CDATA[ldap]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[unicodePwd]]></category>
		<category><![CDATA[work]]></category>

		<guid isPermaLink="false">http://www.evanhoffman.com/evan/?p=309</guid>
		<description><![CDATA[So I got everything working with .htaccess and AD/LDAP authentication. Just add LDAPVerifyServerCert Off to the httpd config to let Apache authenticate against an AD server with a self-signed certificate (without dealing with the annoyance of putting the cert on each Apache server). With that piece of the puzzle largely solved, I moved on to [...]]]></description>
			<content:encoded><![CDATA[<p>So I got everything working with .htaccess and AD/LDAP authentication.  Just add <tt>LDAPVerifyServerCert Off</tt> to the httpd config to let Apache authenticate against an AD server with a self-signed certificate (without dealing with the annoyance of putting the cert on each Apache server).  </p>
<p>With that piece of the puzzle largely solved, I moved on to another: how will users change their passwords (which are all stored in Active Directory)?  For users running Windows this is pretty trivial &#8212; they can do it right in Windows when they&#8217;re logged into the domain.  But what about Linux users?  I figured the easiest thing to do would be to make a web form to do this.  The user would login (with the http/LDAP auth I previously setup) and the form would ask for their password (twice) and update it in Active Directory.  Sounds pretty simple to me.  I think if this were OpenLDAP it probably would be, but being AD, it&#8217;s not.</p>
<p><span id="more-309"></span></p>
<p>I&#8217;d already spent an hour or two writing the script (in PHP) when I was able to test its basic functionality.  What I got was this:</p>
<p><code>Warning: ldap_mod_replace() [function.ldap-mod-replace]: Modify: Insufficient access in /home/evan/public_html/authtest/index.php</code></p>
<p>After some hair pulling I realized that I was binding with my &#8220;dummy&#8221; user when attempting to change the password.  I figured the solution would be to re-bind as the user whose password I was attempting to change, which is what I did.  I verified that the new bind worked, but I still couldn&#8217;t change the password.  I decided to fall back to command line and started issuing some ldapmodify commands to see what I could and couldn&#8217;t do as the user.  For whatever reason, it appears that even though the user CAN change his password in AD (the &#8220;user cannot change password&#8221; setting is NOT selected &#8212; I checked), the user cannot change his password through LDAP.</p>
<p><code><br />
$ ldapmodify -vv -x -d8 -D "CN=Boba Fett,OU=Utility,OU=Users,DC=example,DC=com" -w secret -H ldaps://activedirectory.example.com -f bfett.ldif<br />
ldap_initialize( ldaps://activedirectory.example.com )<br />
TLS certificate verification: Error, unable to get local issuer certificate<br />
request done: ld 0x9dd86e8 msgid 1<br />
replace unicodePwd:<br />
        "<br />
modifying entry "CN=Boba Fett,OU=Utility,OU=Users,DC=example,DC=com"<br />
modify complete<br />
request done: ld 0x9dd86e8 msgid 2<br />
ldapmodify: Insufficient access (50)<br />
        additional info: 00000005: SecErr: DSID-031A0F44, problem 4003 (INSUFF_ACCESS_RIGHTS), data 0<br />
</code></p>
<p>I Googled for the error code &#8211; <a href="http://www.google.com/search?q=DSID-031A0F44">DSID-031A0F44</a> &#8211; and found a couple of threads about people with the same problem, but no solutions.</p>
<p>The LDIF file I fed in looks like this:</p>
<p><code><br />
dn: CN=Boba Fett,OU=Utility,OU=Users,DC=example,DC=com<br />
changetype: modify<br />
replace: unicodePwd<br />
unicodePwd::IgBhAGIAYwBkAGUAZgBnAGgAIgA=<br />
-<br />
</code></p>
<p>When I run the same command with my own DN/password for binding it works fine (though I did discover that you can assign multiple values to unicodePwd, meaning that, until I fixed it, the test user had <b>two valid passwords</b>, which seems like a bug on Microsoft&#8217;s part), I assume because I&#8217;m a domain admin.  An &#8220;easy&#8221; out would be simply to have the script bind as a domain admin, but that means I&#8217;d be hardcoding a Domain Admin password in the script, which I&#8217;m against.  I&#8217;ll have to put some more thought into this.  Maybe Linux users will just have to log in to a Windows workstation to change their passwords.  That&#8217;s not ideal, but it does already work.</p>
<p>Grr&#8230;</p>
<p><b>Update</b> &#8211; Click the &#8220;ldap&#8221; tag below to see all the LDAP-related posts, including the solution to changing AD passwords via a browser.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.evanhoffman.com/evan/2010/01/08/ldap-active-directory-authentication-part-3/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
