<?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>PhishThis! &#187; IIS7</title>
	<atom:link href="http://www.phishthis.com/category/microsoft/iis7/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.phishthis.com</link>
	<description></description>
	<lastBuildDate>Mon, 21 Jun 2010 17:34:33 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>How to configure AD, SQL, and IIS for two-hop Kerberos authentication</title>
		<link>http://www.phishthis.com/2009/10/24/how-to-configure-ad-sql-and-iis-for-two-hop-kerberos-authentication-2/</link>
		<comments>http://www.phishthis.com/2009/10/24/how-to-configure-ad-sql-and-iis-for-two-hop-kerberos-authentication-2/#comments</comments>
		<pubDate>Sun, 25 Oct 2009 00:01:48 +0000</pubDate>
		<dc:creator>Tom</dc:creator>
				<category><![CDATA[Active Directory]]></category>
		<category><![CDATA[IIS7]]></category>
		<category><![CDATA[Microsoft]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[Server Management]]></category>
		<category><![CDATA[Windows Server 2008]]></category>
		<category><![CDATA[Internet Information Services]]></category>
		<category><![CDATA[Kerberos]]></category>
		<category><![CDATA[Microsoft SQL Server]]></category>
		<category><![CDATA[SQL]]></category>
		<category><![CDATA[Web service]]></category>

		<guid isPermaLink="false">http://www.phishthis.com/?p=138</guid>
		<description><![CDATA[<p>Recently, some of our developers were writing an app that required impersonation from the web service, as the user, to the database. Admittedly, Kerberos isn&#8217;t one of my strong points.</p>
<p>There were two hops here. From the user -&#62; IIS server and from IIS Server -&#62; SQL Server, but the application in IIS would impersonate the user [...]]]></description>
			<content:encoded><![CDATA[<p>Recently, some of our developers were writing an app that required impersonation from the web service, as the user, to the database. Admittedly, <A class=zem_slink title="Kerberos (protocol)" href="http://en.wikipedia.org/wiki/Kerberos_%28protocol%29" rel=wikipedia>Kerberos</A> isn&#8217;t one of my strong points.</p>
<p>There were two hops here. From the user -&gt; IIS server and from IIS Server -&gt; SQL Server, but the application in IIS would impersonate the user when authenticating with the SQL server.</p>
<p>So, the idea here is that from the user to the IIS server, we know Kerberos will work. The user passes its ticket to the web service. Nothing unusual. From there, the web app, running as a custom app pool ID, needs to pretend (delegate) to be the user when it authenticates to the SQL server. </p>
<p>There are a few requirements.<br />
<strong>1) </strong>Your application in IIS should be running under a custom identity &#8211; domain\MyAppService<br />
<strong>2) </strong>SQL Server needs to be running under a domain service account &#8211; domain\MySQLService<br />
<strong>3)</strong> IIS needs to use Negotiate instead of NTLM for that application. It should do this by default, then fall back to NTLM. For whatever reason, my app was using NTLM. IIS should also have Windows Authentication enabled.<br />
<strong>4) </strong>Change your connection string to impersonate the site user</p>
<p><STRONG>Step 1</STRONG> &#8211; Set the SPN on your app pool ID for the site, for the hostname and FQDN.<br />
<CODE>setspn -a http/mysite domain\MyAppService<br />
setspn -a http/mysite.domain.com domain\MyAppService</CODE></p>
<p><STRONG>Step 2</STRONG> &#8211; Set the SPN for the SQL service on your SQL service account &#8211; assuming you use the default SQL port<br />
<CODE>setspn -a MSSQLSvc/hostname domain\MySQLService<br />
setspn -a MSSQLSvc/hostname.domain.com domain/MySQLService<br />
setspn -a MSSQLSvc/hostname:1433 domain\MySQLService<br />
setspn -a MSSQLSvc/hostname.domain.com:1433 domain/MySQLService</CODE><br />
Restart SQL</p>
<p><STRONG>Step 3</STRONG> &#8211; In Active Directory Users and Computers, find the service account, click the delegation tab, and trust it for delegation. You can set it for delegation to anywhere, or constrained delegation to the SPNs you&#8217;ll set for the SQL service account. </p>
<p><STRONG>Step 4</STRONG> &#8211; Force your site or application to use Negotiate. This won&#8217;t work with NTLM, so we&#8217;ll remove it. (Note: This is for IIS7/7.5)<br />
- Find and open your applicationHost.config. It&#8217;s probably under c:\windows\system32\inetsrv\config. You can also set this in the system.webServer section of the web.config for the application. </p>
<p>- Scroll to the bottom and above /configuration copy this in:<br />
[xml]<br />
   <location path="SitePath"><br />
        <system.webServer><br />
            <security><br />
                <authentication><br />
                    <windowsAuthentication></p>
<providers>
                            <add value="Negotiate" /><br />
                            <remove value="NTLM" />
                        </providers>
                    </windowsAuthentication><br />
                </authentication><br />
            </security><br />
        </system.webServer><br />
    </location><br />
[/xml]</p>
<p>If you get a 500 error after adding the above XML, it&#8217;s probably because Negotiate is already added elsewhere. Just remove the line that says add value=&#8221;Negotiate&#8221; and leave the remove NTLM line. </p>
<p>Reference: This post was extremely helpful in solving my problem &#8211; <A href="http://blogs.technet.com/askds/archive/2008/06/13/understanding-kerberos-double-hop.aspx">http://blogs.technet.com/askds/archive/2008/06/13/understanding-kerberos-double-hop.aspx</A> &#8211; in the end, I did pretty much everything in that post, and still had the IIS server passing anonymous to SQL, which is what tipped me off that it was using NTLM and not Negotiate.</p>
<p><DIV style="MARGIN-TOP: 10px; HEIGHT: 15px" class=zemanta-pixie><A class=zemanta-pixie-a title="Reblog this post [with Zemanta]" href="http://reblog.zemanta.com/zemified/fbffe8a7-8bb0-4ce5-9df2-afc98ab58ee0/"><IMG style="BORDER-BOTTOM: medium none; BORDER-LEFT: medium none; FLOAT: right; BORDER-TOP: medium none; BORDER-RIGHT: medium none" class=zemanta-pixie-img alt="Reblog this post [with Zemanta]" src="http://img.zemanta.com/reblog_e.png?x-id=fbffe8a7-8bb0-4ce5-9df2-afc98ab58ee0"></A><SPAN class="zem-script more-related pretty-attribution"><SCRIPT type="text/javascript" defer="defer" src="http://static.zemanta.com/readside/loader.js"></SCRIPT></SPAN></DIV></p>
]]></content:encoded>
			<wfw:commentRss>http://www.phishthis.com/2009/10/24/how-to-configure-ad-sql-and-iis-for-two-hop-kerberos-authentication-2/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>AjaxControlToolkit causes System.Security.SecurityException: Request for the permission of type &#8216;System.Web.AspNetHostingPermission &#8230; failed.</title>
		<link>http://www.phishthis.com/2009/03/11/ajaxcontroltoolkit-causes-systemsecuritysecurityexception-request-for-the-permission-of-type-systemwebaspnethostingpermission-failed/</link>
		<comments>http://www.phishthis.com/2009/03/11/ajaxcontroltoolkit-causes-systemsecuritysecurityexception-request-for-the-permission-of-type-systemwebaspnethostingpermission-failed/#comments</comments>
		<pubDate>Wed, 11 Mar 2009 21:02:51 +0000</pubDate>
		<dc:creator>Tom</dc:creator>
				<category><![CDATA[IIS7]]></category>
		<category><![CDATA[Microsoft]]></category>
		<category><![CDATA[Server Management]]></category>
		<category><![CDATA[Windows Server 2008]]></category>
		<category><![CDATA[Ajax]]></category>
		<category><![CDATA[System.Security.SecurityException]]></category>

		<guid isPermaLink="false">http://www.phishthis.com/?p=84</guid>
		<description><![CDATA[<p>Here&#8217;s a quick one&#8230;</p>
<p>A developer was using AJAXControlToolkit in an application. Not a big deal. Except that it kept throwing that damn exception. You know the one:</p>
<p>
Server Error in &#8221; Application.
Security Exception
Description: The application attempted to perform an operation not allowed by the security policy. To grant this application the required permission please contact your system [...]]]></description>
			<content:encoded><![CDATA[<p>Here&#8217;s a quick one&#8230;</p>
<p>A developer was using AJAXControlToolkit in an application. Not a big deal. Except that it kept throwing that damn exception. You know the one:</p>
<p><CODE><br />
Server Error in &#8221; Application.<br />
Security Exception<br />
Description: The application attempted to perform an operation not allowed by the security policy. To grant this application the required permission please contact your system administrator or change the application&#8217;s trust level in the configuration file.</p>
<p>Exception Details: System.Security.SecurityException: Request for the permission of type &#8216;System.Web.AspNetHostingPermission, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089&#8242; failed.<br />
</CODE></p>
<p>I know what you&#8217;re going to say, but I prefer to not use caspol.exe to set the trust. </p>
<p>There were several other sites on the server using the toolkit that worked fine, <B>without using caspol to set full trust</B>. </p>
<p>The difference? Those other applications were compiling the AJAX DLL when the apps themselves were compiled. The developer in this case had just copied the DLL from the toolkit download and added the reference to her code. </p>
<p>I copied the DLL from one of the sites that I knew worked, and it magically started working. Copy her version of the DLL back, and it failed again (after IISReset). </p>
<p>I don&#8217;t really know how this happened, but if the DLL was referenced in the VS project, it should have been built with the rest of the app and then deployed with full trust&#8230;</p>
<p>So, if you&#8217;re running into this and you&#8217;re building the code yourself, make sure that the AjaxControlToolkit.dll is building with the rest of your application (the timestamp should be the same) as the other DLLs that were modified. Don&#8217;t just drop it in afterwards&#8230;it won&#8217;t work&#8230;</p>
<p><DIV class=zemanta-pixie style="MARGIN-TOP: 10px; HEIGHT: 15px"><A class=zemanta-pixie-a title="Zemified by Zemanta" href="http://reblog.zemanta.com/zemified/fdd8051e-f9fd-4550-9c8d-cd308ab24e44/"><IMG class=zemanta-pixie-img style="BORDER-RIGHT: medium none; BORDER-TOP: medium none; FLOAT: right; BORDER-LEFT: medium none; BORDER-BOTTOM: medium none" alt="Reblog this post [with Zemanta]" src="http://img.zemanta.com/reblog_e.png?x-id=fdd8051e-f9fd-4550-9c8d-cd308ab24e44"></A><span class="zem-script more-related"><script type="text/javascript" src="http://static.zemanta.com/readside/loader.js" defer="defer"></script></span></DIV></p>
]]></content:encoded>
			<wfw:commentRss>http://www.phishthis.com/2009/03/11/ajaxcontroltoolkit-causes-systemsecuritysecurityexception-request-for-the-permission-of-type-systemwebaspnethostingpermission-failed/feed/</wfw:commentRss>
		<slash:comments>20</slash:comments>
		</item>
		<item>
		<title>How to export your IIS7 config from one server and import into another</title>
		<link>http://www.phishthis.com/2008/05/27/how-to-export-your-iis-config-from-one-box-and-import-on-another/</link>
		<comments>http://www.phishthis.com/2008/05/27/how-to-export-your-iis-config-from-one-box-and-import-on-another/#comments</comments>
		<pubDate>Tue, 27 May 2008 23:05:03 +0000</pubDate>
		<dc:creator>Tom</dc:creator>
				<category><![CDATA[IIS7]]></category>
		<category><![CDATA[Microsoft]]></category>
		<category><![CDATA[Windows Server 2008]]></category>

		<guid isPermaLink="false">http://www.phishthis.com/?p=26</guid>
		<description><![CDATA[I had copied the IIS7 config files from an already-configured server to a new server I was building. The two servers were going to be load balanced (non-NLB). After overwriting the config files on the new server with those that I had exported from the old server, I discovered that my app pools kept crashing. I attempted to reset the domain account credentials on the app pools, but found myself getting:  [...]]]></description>
			<content:encoded><![CDATA[<p>UPDATE: While the post below will still work, there is a better way to do this. Please check out the Microsoft Web Deployment Tool if you need to keep your servers in sync. </p>
<p><a href="http://www.iis.net/extensions/WebDeploymentTool">http://www.iis.net/extensions/WebDeploymentTool</a></p>
<p>This tool will package registry, COM, and GAC settings. It also says that it&#8217;ll integrate with VS2010, so that your developers can package the application for easy deployment on your IIS boxes. I don&#8217;t know whether to rejoice or be scared :) Back to the original article&#8230;</p>
<p>I had copied the IIS7 config files from an already-configured server to a new server I was building. The two servers were going to be load balanced (non-NLB). After overwriting the config files on the new server with those that I had exported from the old server, I discovered that my app pools kept crashing. I attempted to reset the domain account credentials on the app pools, but found myself getting: </p>
<p><strong>hresult:0&#215;80090005, Message: Failed to commit configuration. Bad Data.</strong></p>
<p>Built-in account works, domain accounts did not. Given that I&#8217;m much too lazy to re-configure all of the application pool IDs, I began looking for a way to gracefully import settings from the other server. Turns out, there isn&#8217;t an &#8220;import&#8221; button, so to speak. I did find that using &#8220;Shared configuration&#8221; I could essentially accomplish an import.</p>
<p>In IIS manager, you need to export the config from the already-configured server. In IIS manager, click the Server node, and go to <strong>Shared Configuration under Management.</strong></p>
<p><img src="http://www.phishthis.com/wp-content/uploads/2008/05/sharedconfig.jpg" alt="IIS Shared Configuration" /></p>
<p>Click &#8220;<strong>Export Configuration</strong>&#8221;</p>
<p><img src="http://www.phishthis.com/wp-content/uploads/2008/05/exportconfig.jpg" alt="Export Configuration" /></p>
<p>Enter the path you&#8217;d like to export the config to, and set an encryption key password:</p>
<p><img src="http://www.phishthis.com/wp-content/uploads/2008/05/exportconfiguration.jpg" alt="Export Configuration Settings" /></p>
<p>Copy <strong>administration.config, applicationHost.config, and configEncKey.key </strong>to your new server to a temp location.</p>
<p>On the new server, go back to the &#8220;<strong>Shared Configuration</strong>&#8221; section and check &#8220;<strong>Enable shared configuration</strong>.&#8221; Enter the location in physical path and click &#8220;Apply.&#8221; It should prompt for the encryption password that you had set. Enter it, and reset IIS. </p>
<p><img src="http://www.phishthis.com/wp-content/uploads/2008/05/importconfig.jpg" alt="Import IIS Config" /></p>
<p>After resetting IIS, go back to Shared Configuration and <strong>uncheck</strong> &#8220;Enable shared configuration.&#8221; Click apply. You should see this:</p>
<p><img src="http://www.phishthis.com/wp-content/uploads/2008/05/sharedconfigwarning.jpg" alt="Shared Configuration Warning" /></p>
<p>Click <strong>YES</strong> and it will import all of the settings from your Shared Config into the local config on your new IIS server. </p>
<p>At this point, all you should need to do is change your server-specific site bindings, and it should be good to go. </p>
]]></content:encoded>
			<wfw:commentRss>http://www.phishthis.com/2008/05/27/how-to-export-your-iis-config-from-one-box-and-import-on-another/feed/</wfw:commentRss>
		<slash:comments>13</slash:comments>
		</item>
	</channel>
</rss>
