<?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>Net Data Design, LLC Blog &#187; AppPool Identity</title>
	<atom:link href="http://blog.nddllc.com/tag/apppool-identity/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.nddllc.com</link>
	<description>Software and Database Development Blog</description>
	<lastBuildDate>Fri, 20 Aug 2010 16:33:26 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1-alpha</generator>
		<item>
		<title>IIS 7.5 AppPool Identities</title>
		<link>http://blog.nddllc.com/2010/03/04/iis-7-5-apppool-identities/</link>
		<comments>http://blog.nddllc.com/2010/03/04/iis-7-5-apppool-identities/#comments</comments>
		<pubDate>Thu, 04 Mar 2010 12:03:27 +0000</pubDate>
		<dc:creator>Chris Smith</dc:creator>
				<category><![CDATA[Best Practices]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[AppPool Identity]]></category>
		<category><![CDATA[IIS 7.5]]></category>
		<category><![CDATA[Microsoft]]></category>

		<guid isPermaLink="false">http://blog.nddllc.com/?p=145</guid>
		<description><![CDATA[Windows 7 and Windows Server 2008 R2 ship with IIS 7.5. It&#8217;s called Application Pool Identities. Application Pool Identities allows you to run Application Pools under an unique account without having to create and manage domain or local accounts. The name of the Application Pool account corresponds to the name of the Application Pool. The [...]]]></description>
			<content:encoded><![CDATA[<p>Windows 7 and Windows Server 2008 R2 ship with IIS 7.5. It&#8217;s called Application Pool Identities. Application Pool Identities allows you to run Application Pools under an unique account without having to create and manage domain or local accounts. The name of the Application Pool account corresponds to the name of the Application Pool. The image below shows an IIS worker process (w3wp.exe) running as the DefaultAppPool identity.</p>
<div id="attachment_146" class="wp-caption aligncenter" style="width: 408px"><a href="http://blog.nddllc.com/wp-content/uploads/2010/03/AppPool01.png"><img class="size-full wp-image-146" title="AppPool01" src="http://blog.nddllc.com/wp-content/uploads/2010/03/AppPool01.png" alt="AppPool Identity Worker Process" width="398" height="185" /></a><p class="wp-caption-text">Task Manager - Worker Process</p></div>
<h3>Application Pool Identity Accounts</h3>
<p>Worker processes in IIS 6 and 7 run as NETWORKSERVICE by default. NETWORKSERVICE is a built-in Windows identity. It doesn&#8217;t require a password and it has only user privileges, i.e. it is relatively low-privileged. Running as a low-privileged account is a good security practice because then a software bug can&#8217;t be used by a malicious user to take over the whole system.</p>
<p>The problem is however that over time more and more Windows system services started to run as NETWORKSERVICE and services running as NETWORKSERVICE can tamper with other services running under the same identity. Because IIS worker processes run third-party code by default (Classic ASP, ASP.NET, PHP code) it was time to isolate IIS worker processes from other Windows system services and run IIS worker processes under unique identities. The Windows operating system provides a feature called &#8220;Virtual Accounts&#8221; that allows IIS to create unique identities for each of its Application Pools. Click here for more information about Virtual Accounts.</p>
<h3>Configuring IIS Application Pool Identities</h3>
<p>If you are running IIS 7.5 on Windows Server 2008 R2 you don&#8217;t have to do anything. For every Application Pool you create the IIS Admin Process (WAS) will create a virtual account with the name of the new Application Pool and run the Application Pool&#8217;s worker processes under this account.</p>
<p>If you are running Windows Server 2008 you have to change the IdentityType property of the Application Pool you created to &#8220;AppPoolIdentity&#8221;. Here is how:</p>
<ul>
<li>Open the IIS Management Console (INETMGR.MSC).</li>
<li>Open the Application Pools node underneath the machine node. Select the Application Pool you want to change to run under an automatically generated Application Pool Identity.</li>
<li>Right click the Application Pool and select &#8220;Advanced Settings&#8230;&#8221;</li>
</ul>
<div id="attachment_147" class="wp-caption aligncenter" style="width: 453px"><a href="http://blog.nddllc.com/wp-content/uploads/2010/03/AppPool02.png"><img class="size-full wp-image-147" style="width: 443px; height: 528px;" title="AppPool02" src="http://blog.nddllc.com/wp-content/uploads/2010/03/AppPool02.png" alt="Configure AppPool Identity" width="443" height="528" /></a><p class="wp-caption-text">Configuring AppPool Identity</p></div>
<ul>
<li>Select the &#8220;Identity&#8221; list item and click the button with the three dots.</li>
<li>The following dialog appears.</li>
</ul>
<div id="attachment_148" class="wp-caption aligncenter" style="width: 382px"><img class="size-full wp-image-148" title="AppPool03" src="http://blog.nddllc.com/wp-content/uploads/2010/03/AppPool03.png" alt="Selecting AppPool Identity" width="372" height="213" /><p class="wp-caption-text">Selecting AppPool Identity</p></div>
<ul>
<li>Select the Identity Type &#8220;ApplicationPoolIdentity&#8221; from the combo box</li>
</ul>
<p>To do the same step via command-line you can simply call the appcmd command-line tool the following way:</p>
<address>%windir%\system32\inetsrv\appcmd.exe set AppPool &lt;your AppPool&gt; -processModel.identityType:ApplicationPoolIdentity</address>
<h3>Securing Resources</h3>
<p>Whenever a new Application Pool is created the IIS management process  creates a security identifier (SID) representing the name of the  Application Pool itself, i.e. if you create an Application Pool with the  name &#8220;MyNewAppPool&#8221; a security identifier with the name &#8220;MyNewAppPool&#8221;  is created in the Windows Security system. From this point on resources  can be secured using this identity. The identity is not a real user  account however, i.e. it will not show up as a user in the Windows User  Management Console.</p>
<p>You can try this by selecting a file in Windows Explorer and adding  the &#8220;DefaultAppPool&#8221; identity to its Access Control List (ACL).</p>
<ol>
<li>Open Windows Explorer</li>
<li>Select a file or directory.</li>
<li>Right click the file and select &#8220;Properties&#8221;</li>
<li>Select the &#8220;Security&#8221; tab</li>
<li>Click the &#8220;Edit&#8221; and then &#8220;Add&#8221; button</li>
<li>Click the &#8220;Locations&#8221; button and make sure you select your machine.</li>
<li>Enter &#8220;IIS AppPool\DefaultAppPool&#8221; in the &#8220;Enter the object names to  select:&#8221; text box.</li>
<li>Click the &#8220;Check Names&#8221; button and click &#8220;OK&#8221;.</li>
</ol>
<p>By doing this the file or directory you selected will now also allow  the &#8220;DefaultAppPool&#8221; identity access.</p>
<div id="attachment_149" class="wp-caption aligncenter" style="width: 472px"><img class="size-full wp-image-149" title="AppPool04" src="http://blog.nddllc.com/wp-content/uploads/2010/03/AppPool04.png" alt="Securing Resources" width="462" height="246" /><p class="wp-caption-text">Securing Resources for your Process  Identity</p></div>
<p>You can do this via the command-line using the ICACLS tool. The following example gives full access to the DefaultAppPool identity.</p>
<address>ICACLS test.txt /grant &#8220;IIS AppPool\DefaultAppPool&#8221;:F </address>
<p>On Windows 7 and Windows Server 2008 R2 the default is to run Application Pools as this security identifier, i.e. as the Application Pool Identity. To make this happen a new identity type with the name &#8220;AppPoolIdentity&#8221; was introduced. If the &#8220;AppPoolIdentity&#8221; identity type is selected (default on Windows 7 and Windows Server 2008 R2) IIS will run worker processes as the Application Pool identity. With every other identity type the security identifier will only be injected into the access token of the process. If the identifier is injected content can still be ACLed for the AppPool identity but the owner of the token is probably not unique. Here  is an article that explains this concept.</p>
<h3>Accessing the Network</h3>
<p>Using the NETWORKSERVICE account in a domain environment has a great benefit. Worker process running as NETWORKSERVICE access the network as the machine account. Machine accounts are generated when a machine is joined to a domain. They look like this:</p>
<p><strong>&lt;domainname&gt;\&lt;machinename&gt;$,</strong></p>
<p>for example:</p>
<p><strong>mydomain\machine1$</strong></p>
<p>The nice thing about this is that network resources like file shares or SQL Server databases can be ACLed to allow access for this machine account.</p>
<h3>What about AppPool identities?</h3>
<p>The good news is that Application Pool identities also use the machine account to access network resources. No changes are required.</p>
<h2>Note:</h2>
<p>This article <a href="http://learn.iis.net/page.aspx/246/using-fastcgi-to-host-php-applications-on-iis-70/" target="_blank">http://learn.iis.net/page.aspx/246/using-fastcgi-to-host-php-applications-on-iis-70/</a> walks you through the process. This article was written for IIS 7, but will apply to IIS 7.5 as well.</p>
<p>In addition, if your server is 64 bit, you should set &#8216;<strong>enable 32 bit applications</strong>&#8216; to true in your application pools settings.</p>
<p><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save"><img src="http://blog.nddllc.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share/Bookmark"/></a> </p>]]></content:encoded>
			<wfw:commentRss>http://blog.nddllc.com/2010/03/04/iis-7-5-apppool-identities/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>
