<?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>typeof(Blog); &#187; hardware pain</title>
	<atom:link href="http://blog.reveille.org.uk/category/hardware-pain/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.reveille.org.uk</link>
	<description>.net development thoughts and others</description>
	<lastBuildDate>Sat, 11 Sep 2010 15:48:08 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.5</generator>
		<item>
		<title>Using Impersonation and Delegation in ASP.Net &#8211; part 2</title>
		<link>http://blog.reveille.org.uk/2010/01/asp-net-impersonation-delegation-2/</link>
		<comments>http://blog.reveille.org.uk/2010/01/asp-net-impersonation-delegation-2/#comments</comments>
		<pubDate>Thu, 28 Jan 2010 09:31:12 +0000</pubDate>
		<dc:creator>Graham Clark</dc:creator>
				<category><![CDATA[coding problems]]></category>
		<category><![CDATA[hardware pain]]></category>
		<category><![CDATA[asp.net]]></category>
		<category><![CDATA[delegation]]></category>
		<category><![CDATA[iis]]></category>
		<category><![CDATA[impersonation]]></category>

		<guid isPermaLink="false">http://blog.reveille.org.uk/?p=68</guid>
		<description><![CDATA[In a previous post I explained how to configure Impersonation and Delegation in ASP.Net (for the Windows Server 2008 and IIS7 case at least). Turns out there&#8217;s one extra little step required. After all that setup, I could use Internet Explorer to browse to the site fine &#8211; integrated Windows Authentication would let me in. [...]]]></description>
			<content:encoded><![CDATA[<p>In a <a title="part 1" href="http://blog.reveille.org.uk/2010/01/asp-net-impersonation-delegation/">previous post</a> I explained how to configure Impersonation and Delegation in ASP.Net (for the Windows Server 2008 and IIS7 case at least). Turns out there&#8217;s one extra little step required.</p>
<p>After all that setup, I could use Internet Explorer to browse to the site fine &#8211; integrated Windows Authentication would let me in. However, as the DNS had yet to be set up, and the web server and the website had the same IP address, I was browsing using the <em>machine name</em>, e.g. <code>http://machine.domain/website</code> instead of <code>http://dnsname.co.uk/website</code>.</p>
<p>When the DNS was set up and I tried to browse to the website, I got a Windows user name &amp; password box popping up. After 3 tries I was denied access (a 401 error). Just changing the DNS name to the machine name in the location bar let me in, even though they were both the same IP address!</p>
<p>Using <a title="Fiddler" href="http://www.fiddler2.com/fiddler2/">Fiddler</a>, I could see the initial client GET request, and the server&#8217;s 401 challenge response, including a WWW-Authenticate header set to “Negotiate”. This occurred in both cases (browsing to the DNS name and to the machine name). However, the client response to this challenge was different in each case. The Negotiate token the client sent to the DNS name was much shorter than the one sent to the machine name. Clearly something was telling the client not to send the proper Kerberos authentication token to the DNS name.</p>
<p>Just looking at the HTTP traffic was not enough here &#8211; for cases like these a lower-level tool like Microsoft&#8217;s <a title="NetMon" href="http://www.microsoft.com/downloads/details.aspx?FamilyID=983b941d-06cb-4658-b7f6-3088333d062f&amp;displaylang=en">Network Monitor</a> is required, or <a title="Wireshark" href="http://www.wireshark.org/">Wireshark</a> if you&#8217;re feeling hardcore. This showed that the client was encountering a Kerberos error. A bit of searching around this and&#8230;</p>
<p>A magic SPN setting will solve this, all explained in a handy <a title="Kerberos &quot;technical supplement&quot;" href="http://msdn.microsoft.com/en-us/library/aa480609.aspx">MSDN article</a>. You will need to run this command (I ran it on the web server itself, however this may not be necessary):</p>
<p><code>setspn -A HTTP/[dns name of the site] [machine name]</code></p>
<p>Then a reboot of the web server, and a few hours&#8217; wait for the settings to propagate around the domain. This will allow clients to send complete Kerberos authentication tokens to the website. Problem solved!</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.reveille.org.uk/2010/01/asp-net-impersonation-delegation-2/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Using Impersonation and Delegation in ASP.Net</title>
		<link>http://blog.reveille.org.uk/2010/01/asp-net-impersonation-delegation/</link>
		<comments>http://blog.reveille.org.uk/2010/01/asp-net-impersonation-delegation/#comments</comments>
		<pubDate>Thu, 21 Jan 2010 14:04:04 +0000</pubDate>
		<dc:creator>Graham Clark</dc:creator>
				<category><![CDATA[coding problems]]></category>
		<category><![CDATA[hardware pain]]></category>
		<category><![CDATA[active directory]]></category>
		<category><![CDATA[asp.net]]></category>
		<category><![CDATA[delegation]]></category>
		<category><![CDATA[iis]]></category>
		<category><![CDATA[impersonation]]></category>

		<guid isPermaLink="false">http://blog.reveille.org.uk/?p=53</guid>
		<description><![CDATA[ASP.Net exposes a handy Windows feature called Impersonation. This lets an application access local resources using the credentials of the current user. Local resources is important &#8211; if you want to access some files, then that&#8217;s fine, but if you want to access a remote database, you&#8217;re going to need Delegation as well. It&#8217;s fairly [...]]]></description>
			<content:encoded><![CDATA[<p>ASP.Net exposes a handy Windows feature called <a title="Microsoft" href="http://msdn.microsoft.com/en-us/library/aa376391(VS.85).aspx">Impersonation</a>. This lets an application access local resources using the credentials of the current user. <strong>Local</strong> resources is important &#8211; if you want to access some files, then that&#8217;s fine, but if you want to access a remote database, you&#8217;re going to need Delegation as well.</p>
<p>It&#8217;s fairly simple to set this up once you know what needs doing. Getting to that stage wasn&#8217;t the most fun I&#8217;ve ever had &#8211; the MSDN articles on the subject are useful, but they seem to want to cover at least 3 topics at a time, which can be a little confusing.</p>
<p>The scenario was this: an intranet web application would authenticate users using Windows Authentication, granting access based on their Active Directory roles. The application would access the back-end SQL Server database using Integrated Security, with the credentials of the current user.  This gives two main advantages &#8211; you don&#8217;t have to setup or administer a separate account or accounts for the database, and auditing via SQL triggers is easy. However, this approach is only really suited to an intranet scenario, as database connection pools are used on a per-user basis. Too many users and the database will not be happy.</p>
<p>The setup is in four parts.</p>
<h2>ASP.Net</h2>
<p>Under the <code>&lt;system.web&gt;</code> section of your <code>web.config</code>, add the following:</p>
<pre class="brush: xml; light: true; title: ;">
&lt;authentication mode=&quot;Windows&quot;/&gt;
&lt;identity impersonate=&quot;true&quot;/&gt;
</pre>
<p>Also, make sure you&#8217;re using a connection string that uses Integrated Security.</p>
<h2>IIS</h2>
<p>I&#8217;m using IIS7, which has some more detailed settings than IIS6. In the website or virtual directory, ensure that Anonymous Authentication and Forms Authentication are disabled, and ASP.Net Impersonation and Windows Authentication are enabled. IIS should pick this up from <code>web.config</code>.</p>
<p><img class="alignnone size-full wp-image-56" title="IISAuthentication" src="http://blog.reveille.org.uk/wp-content/uploads/2010/01/IISAuthentication.jpg" alt="IIS Authentication section" width="464" height="182" /></p>
<p>IIS7 lets you specify &#8220;providers&#8221; for Windows Authentication. You must use the <em>Negotiate:Kerberos</em> provider. Choosing this provider will mean that &#8220;Kernel-mode authentication&#8221; cannot be used. This is disabled under the Advanced Settings within the Authentication section.</p>
<h2>Active Directory</h2>
<p>The <em>web</em> server&#8217;s Active Directory properties must be edited to enable Delegation of credentials onto the SQL server. There&#8217;s a great explanation with a screen grab of the Active Directory property page in a <a title="Ken Schaefer's blog" href="http://www.adopenstatic.com/cs/blogs/ken/archive/2007/01/28/1282.aspx">post from Ken Schaefer</a>.</p>
<p>Windows Server 2003 domains and later support <em>Constrained Delegation</em>, which can constrain the delegation to a specific service on the target machine. This is obviously more secure. To delegate to SQL Server, <em>MSSQLSvc</em> is the service you need.</p>
<h2>SQL Server</h2>
<p>All you need to do at the database level is grant the relevant permissions for the users or roles you want accessing the database.</p>
<p>Now it should all magically work!</p>
<p>UPDATE: That might not be all! See <a title="Part 2" href="http://blog.reveille.org.uk/2010/01/asp-net-impersonation-delegation-2/">Part 2</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.reveille.org.uk/2010/01/asp-net-impersonation-delegation/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>iTunes takes its revenge on your CD drive if you uninstall</title>
		<link>http://blog.reveille.org.uk/2009/11/itunes-takes-its-revenge-on-your-cd-drive-if-you-uninstall/</link>
		<comments>http://blog.reveille.org.uk/2009/11/itunes-takes-its-revenge-on-your-cd-drive-if-you-uninstall/#comments</comments>
		<pubDate>Mon, 16 Nov 2009 13:22:27 +0000</pubDate>
		<dc:creator>Graham Clark</dc:creator>
				<category><![CDATA[hardware pain]]></category>
		<category><![CDATA[drivers]]></category>
		<category><![CDATA[itunes]]></category>

		<guid isPermaLink="false">http://blog.reveille.org.uk/?p=41</guid>
		<description><![CDATA[A while ago, I realised I had iTunes installed on my work computer. I didn&#8217;t want any extraneous services running, so off it went. A few days later I realised I no longer had a DVD drive in My Computer. Device Manager said there was a problem with the drivers, but no new ones could [...]]]></description>
			<content:encoded><![CDATA[<p>A while ago, I realised I had <a href="http://www.apple.com/itunes/">iTunes</a> installed on my work computer. I didn&#8217;t want any extraneous services running, so off it went. A few days later I realised I no longer had a DVD drive in My Computer.</p>
<p>Device Manager said there was a problem with the drivers, but no new ones could be found automatically, and rolling back didn&#8217;t work as they hadn&#8217;t actually changed. An interweb search for drivers turned up nothing. There were no physical connection issues, all looked fine.</p>
<p>After a while I investigated the Event Log and saw the following error occurred in the System log every boot-up:</p>
<blockquote><p>The following boot-start or system-start driver(s) failed to load:<br />
Imapi<br />
redbook</p></blockquote>
<p>I searched again with this info, and stumbled across a handy Microsoft article, <a href="http://support.microsoft.com/kb/314060">&#8220;Your CD drive or DVD drive is missing or is not recognized by Windows or other programs&#8221;</a>. This pointed me to some obscure registry key to do with CD burning, and a value called &#8220;UpperFilters&#8221;. This contained two values, &#8220;Sidney&#8221; and &#8220;GEARAspiWDM&#8221;. I deleted the value then restarted, and the DVD drive was back!</p>
<p>I checked the registry again, and the &#8220;UpperFilters&#8221; value was back, but &#8220;GEARAspiWDM&#8221; was not. It turns out that this is some kind of burning driver that was probably installed by iTunes, but not removed from the registry during the uninstall. Thanks Apple! iTunes can still be a pain after death.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.reveille.org.uk/2009/11/itunes-takes-its-revenge-on-your-cd-drive-if-you-uninstall/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

