<?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>ashleyknowles &#187; iis</title>
	<atom:link href="http://www.ashleyknowles.net/tag/iis/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.ashleyknowles.net</link>
	<description>IT professional, Formula 1 addict, security/hacking enthusiast, I love LAMP</description>
	<lastBuildDate>Tue, 07 Feb 2012 01:17:09 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>IIS, PHP, and LDAPS with Active Directory.</title>
		<link>http://www.ashleyknowles.net/2011/07/iis-php-and-ldaps-with-active-directory/</link>
		<comments>http://www.ashleyknowles.net/2011/07/iis-php-and-ldaps-with-active-directory/#comments</comments>
		<pubDate>Sat, 16 Jul 2011 13:08:09 +0000</pubDate>
		<dc:creator>Ashley Knowles</dc:creator>
				<category><![CDATA[Active Directory]]></category>
		<category><![CDATA[Microsoft]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[Web]]></category>
		<category><![CDATA[active directory]]></category>
		<category><![CDATA[authentication]]></category>
		<category><![CDATA[iis]]></category>
		<category><![CDATA[ldaps]]></category>
		<category><![CDATA[ldap_bind]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://www.ashleyknowles.net/?p=786</guid>
		<description><![CDATA[Why you&#8217;d ever want to do this is probably a discussion best left to the political arena. But for the purpose of that thing I call my &#8220;day job&#8221;, I was required to do just this. External website, authenticates against &#8230; Continue reading &#8594;]]></description>
			<content:encoded><![CDATA[<p>Why you&#8217;d ever want to do this is probably a discussion best left to the political arena. But for the purpose of that thing I call my &#8220;day job&#8221;, I was required to do just this.</p>
<p>External website, authenticates against Active Directory using LDAPS. Website is coded in PHP, and runs on IIS on Windows Server 2008 R2 x64.</p>
<p>In the rest of the world, this is an Apache deal, but limited by internal support, it has to be IIS and Windows.<span id="more-786"></span></p>
<p><strong>Requirements to make this work:</strong></p>
<ul>
<li>Active Directory domain controller (DC), configured as an Enterprise Certification Authority</li>
<li>Firewall opened from web server to DC on either TCP port 636 or 3269 (3269 is the LDAPS port for a Global Catalog)</li>
<li>Windows Server (I&#8217;d say any of the 2003/2008 versions will work)</li>
<li>IIS (6 or 7)</li>
<li>PHP (I&#8217;m using version 5.3.6) with the php_ldap extension</li>
</ul>
<p><strong>Getting there:</strong></p>
<ol>
<li>Configure AD OU&#8217;s / security groups to suit your application</li>
<li>Generate a Root CA certificate for your domain/domain controllers</li>
<li><strong>Export the Root CA in Base64 X.509 format</strong></li>
<li>Copy Root CA certificate to the webserver (C:\OpenLDAP\sysconf\webcert.crt)</li>
<li>Create C:\OpenLDAP\sysconf\ldap.conf with the following lines:<br />
TLS_REQCERT never<br />
TLS_CACERT c:\openldap\sysconf\webcert.crt</li>
<li>Install PHP on the webserver, using the IIS FastCGI installer option, and enabling the LDAP extension (if you use the installer, that is. If you do a manual install, you have to install/configure these manually.)</li>
<li>Use ldap_connect(&#8220;ldaps://servername//&#8221;) to connect &#8211; if using the global catalog, specify the port in the URL, i.e. <a href="ldaps://servername:3269"  class="autohyperlink" title="ldaps://servername:3269" target="_blank">servername:3269</a></li>
</ol>
<p><strong>Code:</strong></p>
<p><code>&amp;lt;?php<br />
$ds=ldap_connect("ldaps://servername/");<br />
ldap_set_option($ds, LDAP_OPT_PROTOCOL_VERSION, 3);<br />
ldap_set_option($ds, LDAP_OPT_REFERRALS, 0);<br />
$ldapbind = @ldap_bind($ds, "<a class="autohyperlink" href="mailto:username@contoso.msft" title="mailto:username@contoso.msft">username@contoso.msft</a>", "password");<br />
if($ldapbind) {<br />
// do some stuff<br />
} else {<br />
echo ldap_error();<br />
}<br />
ldap_close($ds);<br />
?&amp;gt; </code></p>
<p><strong>Final Notes:</strong></p>
<p>Provided all is done as above, should be able to connect to LDAPS perfectly. Use &#8220;ldp.exe&#8221; to check LDAP connectivity using SSL (use port 636 or 3269 &#8211; not 389 as is the default), or any other LDAP tool that supports LDAP with SSL.</p>
<p>I got caught out exporting the Root CA certificate from the certificate store as a DER Encoded X.509 certificate, instead of Base64. Yes, it matters.</p>
<p>There is very little documentation for this solution &#8211; specifically the certificate requirements. LDAPS in generally is supported quite well, as is configuring Active Directory to serve up LDAPS. Even the PHP coding is well supported. The Windows/IIS/PHP/LDAPS combination as a whole, however, is best documented&#8230;right here, of course <img src='http://www.ashleyknowles.net/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>Lastly &#8211; there&#8217;s a bug in some versions of the PHP LDAP module (5.3.3 I believe fixed it), which required you to place the ldap.conf file at the root of every drive that hosts an IIS website &#8211; or, just the one that utilises the LDAP file. I haven&#8217;t tested this, but it is discussed very briefly on some of the PHP threads I found.</p>
<p><strong><br />
</strong></p>
<p><strong>Important links:</strong></p>
<ul>
<li><a href="http://adldap.sourceforge.net/"  class="autohyperlink aga aga_2" title="http://adldap.sourceforge.net/" target="_blank">adldap.sourceforge.net/</a></li>
<li><a href="http://php.net/manual/en/function.ldap-start-tls.php"  class="autohyperlink aga aga_3" title="http://php.net/manual/en/function.ldap-start-tls.php" target="_blank">php.net/manual/en/function.ldap-start-tls.php</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.ashleyknowles.net/2011/07/iis-php-and-ldaps-with-active-directory/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>TeamViewer for Remote Support</title>
		<link>http://www.ashleyknowles.net/2009/10/teamviewer-for-remote-support/</link>
		<comments>http://www.ashleyknowles.net/2009/10/teamviewer-for-remote-support/#comments</comments>
		<pubDate>Mon, 12 Oct 2009 06:13:23 +0000</pubDate>
		<dc:creator>Ashley Knowles</dc:creator>
				<category><![CDATA[Administration]]></category>
		<category><![CDATA[Computers and IT]]></category>
		<category><![CDATA[Mac OS X]]></category>
		<category><![CDATA[Windows]]></category>
		<category><![CDATA[exchange]]></category>
		<category><![CDATA[http]]></category>
		<category><![CDATA[iis]]></category>
		<category><![CDATA[linkedin]]></category>
		<category><![CDATA[remote desktop]]></category>
		<category><![CDATA[remote support]]></category>
		<category><![CDATA[TeamViewer]]></category>

		<guid isPermaLink="false">http://www.ashleyknowles.net/?p=71</guid>
		<description><![CDATA[We&#8217;ve been using TeamViewer here to remotely connect to clients for about 2 months now. To say we have been impressed is an understatement. The ease that we we can connect to a client&#8217;s machine and take over their session &#8230; Continue reading &#8594;]]></description>
			<content:encoded><![CDATA[<p>We&#8217;ve been using TeamViewer here to remotely connect to clients for about 2 months now. To say we have been impressed is an understatement. The ease that we we can connect to a client&#8217;s machine and take over their session has enabled us to provide support services to clients we would otherwise had to have gone on site to help out.</p>
<p>As part of the TeamViewer package, we have a logon account which lists our &#8220;partner connections&#8221;, i.e. a list of our clients computers, aliasing their respective &#8220;partner ID&#8217;s&#8221;. The partner ID is a &#8220;permanent&#8221; ID number which is assigned to your computer by TeamViewer&#8217;s servers, (which I believe it is only permanent in the sense it creates a registry entry to remember your ID number). This allows us to connect to the same machine over and over again without messing about trying to find out the client&#8217;s IP address and getting their username and password to otherwise connect via Remote Desktop or something similar.</p>
<p>In addition to being able to service individual clients, we have been able to roll out the TeamViewer app via group policy to entire workgroups. It also enables us to have &#8220;one click&#8221; access to our client&#8217;s servers via the TeamViewer host application.</p>
<p>This is where the fun starts. We had an interesting call this morning from a client who had advised that their iPhone was no longer syncing with their Exchange server. I connected up to their server, and low and behold, the Default Website had been stopped. I thought this was a bit odd, but have seen similar cases recently as a result of Windows Updates.</p>
<p>Upon closer inspection, this was a little more sinister. Trying to start the service resulted in IIS telling me to find something better to do. I ran a &#8220;quick&#8221; `netstat -a -b`, which overwhelmed the command line buffer&#8230; Changing this to something more suitable, I noticed something, peculiar&#8230;</p>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 57px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">TCP    asu01:5938             asu01.ASU.local:0      LISTENING       12464</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 57px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">[TeamViewer.exe]</div>
<p>TCP    server:http             server.domain.local:0      LISTENING       12464</p>
<p>[TeamViewer.exe]</p>
<p>Why was TeamViewer listening for HTTP requests??? How could we stop it, without stopping TeamViewer?</p>
<p>It turns out this was a problem for more then just a few people, but I gave up searching Google and looked instead in the Windows Registry.</p>
<p>I ended up making the following change, killing the TeamViewer host, and starting it again:</p>
<p>HKEY_LOCAL_MACHINE\Software\TeamViewer\Version4\ListenHTTP = 0</p>
<div>This seemed to fix everything, and I was able to start up IIS again. Hooray. Crisis averted <img src='http://www.ashleyknowles.net/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </div>
]]></content:encoded>
			<wfw:commentRss>http://www.ashleyknowles.net/2009/10/teamviewer-for-remote-support/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

