Impersonate in Classic ASP - iis

Preparing for the migration of asp-application with Windows 2000 (web1) on Windows 2003 (web2).
On the old server has a folder to share documents, use for imports and exports (\ \ web1 \ folder). I want to provide access to the same folder access asp-application with the new server.
Configuration IIS: anonymous access is allowed, including checking windows. Pool started under the Network Service.
But there is no access.
And there is an interesting fact: if handled locally with the new server as http://localhost, you have access (impersonation works), if handled as http://web2, then there is no access. Error:
Microsoft VBScript runtime error Error '800a0046 '
Permission denied
We some changed security settings, local IE 6 - earned through http://web2 too, but in other browsers (like Opera) does not work. On other machines does not work either.
Put utility procmon from SysInternal. It shows that in both cases is an appeal to the resource, in both cases is impersonation, all the same, but in one case, SUCCESS, and the other ACCESS DENIED.
The entire security system of this application is based on the rights of NTFS, so you can not disable impersonation.
I'm newby in classic asp. I can not understand this case.

Classic ASP does not run under Application Pool account, credentials provided in IIS Anonimous Authenctication tab used instead, usually it is IUSR_MACHINENAME.
Looks like the anonymous authentication fails and Windows authentication used, this is the reason it works locally and in IE which supports Windows authentication by default.
UPDATE: Check this article: How to troubleshoot Kerberos-related issues in IIS
UPDATE 2: Also this can help you diagnose what's going on on IIS side: Authentication and Access Control Diagnostics
I guess the simplest way to access share is to add read permission to Guests group.

you can change the user of the anonymous authentication to be the app pool user , i tested it and it works !
go to iis -> web site \ virtual directory -> authentication -> choose anonymous -> edit -> change user identity to application pool user
screenshot:

Related

IIS write permissions to web root

I created IIS website with following setting (ApplicationPool account is named Fitko)
When I run website and submit form with image, application throw an error
UnauthorizedAccessException: Access to the path
'C:\IISWorkspace\Fitko\upload\instructors' is denied.
System.IO.FileStream.ValidateFileHandle(SafeFileHandle fileHandle)
I gave full permissions to Fitko folder to these accounts
IUSR
Users
Administrators
network service
IIS AppPool\Fitko
yet still the UnauthorizedAccessException exception still throwing.
How can I give access permissions to IIS to write to the folder ?
I solve the issue by enabling windows authentication (I had Anonymous Authentication before, but probably it can be enabled together)
the setting is in
Web Project > Properties > Debug > Web Server Settings
and the flag seems to takes control even when the publish configuration is set to release.
In my opinion, the issue typically indicates a permission error of the specific folder.
What is your Application pool identity? try to right-click the folder and grant Everyone Account full access to the folder.
Besides, under certain cases, this might relate to our website framework technology.
https://github.com/stryker-mutator/stryker-net/issues/272
Feel free to let me know if the problem still exists.
In internet service manager right click on the default website, click on edit permission, click on the security tab the click on edit
Add built-in ISUR account to the website and give the appropriate access
and or add built in IIS_IUSERS account and do the same if the above does not work.

IIS 7.5 App Pool write permissions denied

I have a web application that is running on IIS 7.5 and is having some permission issues. The site will read/serve files, but will not write to any file location under any circumstances. Ideally, I'd be writing to a non-local share, but I'm currently just trying to get the application to write to a local share/drive. I've tried setting the identity to a domain service account set up specifically for this application, the built in Network Service account, and the ApplicationPoolIdentity with no luck. It may be worth mentioning that this server is a virtualized instance running on shared hardware with other servers.
In order to try and grasp the issue, I have granted full control to:
(MACHINE NAME)
(MACHINE NAME)\Users
(MACHINE NAME)\IUSR
(MACHINE NAME)\IIS_IUSRS
(DOMAIN NAME)\(MACHINE NAME)
NT AUTHORITY\NETWORK SERVICE
NT AUTHORITY\SYSTEM
(APPLICATION POOL IDENTITY)
(DOMAIN NAME)\(SERVICE ACCOUNT NAME)
I have manually verified that all these accounts/groups have full control on the security tab of the file/folder.
The app pool is running under the .NET Framework v4.0 on the Integrated Managed Pipeline. I've tried it with Load User Profile set to both true and false with no luck. The site itself is set to application pass-through authentication.
The error thrown in the browser is:
Access to the path 'D:\Dataload\LOG.txt' is denied.
[UnauthorizedAccessException: Access to the path 'D:\Dataload\LOG.txt' is denied.]
I've tried writing to that file with it already created as well as not created. I've also tried calling the file by its server path instead of the drive name.
Viewing the event in Microsoft's Process Monitor:
Operation: CreateFile
Result: ACCESS DENIED
Desired Access: Generic Write, Read Attributes
Disposition: OpenIF
Options:Sequential Access, Synchronous IO Non-Alert, Non-Directory File, Open No Recall
Attributes:n/a
ShareMode: Read
User:NT AUTHORITY\NETWORK SERVICE (this will correctly change depending on the identity I set)
Is there something I am missing with groups or accounts, or possibly an IIS setting I could be overlooking that prevents write access?
I figured out the answer to this a while back and forgot about my post here. In this particular instance, the problem was with the Internet Explorer Enhanced Security Configuration settings on the server. In order to see your settings in Windows Server 2008 R2, go to the Server Manager and have your view on the main page. Once there, go down to the Security Settings section. Here you will see an item called IE Enhanced Security Configuration (ESC), and next to it it's current settings for both administrators and users. In my case, the default settings on this fresh server were set to On for both administrators and users. Setting these to Off allowed the network service account to write to all locations it had been granted proper permissions to, thus solving the problem.

Which IIS Account should I grant directory access privileges to?

I've moved my codebase to a new directory and need to grant the IIS account read/write privileges on a few folders to allow access by the ASP.Net runtime. I believe NETWORKSERVICE is no longer used for this purpose (as mentioned in this earlier question:
ASP.Net which user account running Web Service on IIS 7?) but, try as I might I can't seem to be able to add the IISAppPool/IIS Worker Process the article links to.
I've found a MyDomain/IIS_WPG account but this isn't the one that is listed in Task Manager for the w3wp process. Can someone help?
UPDATE:
Even odder - the Application Pool for the website in question uses the LocalSystem identity which I thought would be able to access pretty much the entire machine. Is there something incorrect about my basic machine/Windows setup?

modify content of xml file from published code

I am trying to modify an xml file from my aspx code. The file is in another directory from my project like in D:\folder\file.xml When publishing my code and running it I am receiving an error as not to be able to access this directory, access in denied. Which user account shall I add to this folder in security option to be able to modify it. I tried adding IIS user but it does not seem to work. Any other workaround this ?
Check which identity that's associated with the application pool, and grant that user access to the folder.
You didn't specify which version of IIS you're using, but here's a decent article on how application pools work
I solved the issue finally..
In my pc I am using Win Xp and had to grant ASP.NET machine account user appropriate rights on the file while on the server that i am finally publishing the code I am using Windows Web Server 2008 and the matching ASP.NET Machine Account was Network Service i granted the same rights here and now i can modify the file successfully.
I am using IIS 7.5 on this machine.
I think your approach Tchami has the same idea. So I am marking it as the answer :) Thank you

How to give Website permission to create further Websites in IIS 7.5?

I'm creating a website in IIS 7.5 (with Windows 7) that needs to be able to create further websites. I've written code that uses Microsoft.Web.Administration to create the website programmatically, and this works fine when I run it as administrator.
Now I'm trying to use the same code in the context of my web application. It fails with the error
Error: Cannot read configuration file due to insufficient permissions
for the file redirection.config (which I understand is located in %WinDir%/System32/inetsrv/config).
I've tried creating a new apppool for this specific website, running under the IIS AppPool[AppPoolName] identity. I've then tried to grant that identity permission to edit the IIS config using
ManagementAuthorization.Grant(#"IIS AppPool\MyAppPool", "Default Web Site", false);
but I still get the same error.
What else should I try?
This probably isn't the wisest approach from a security viewpoint. If this site is hijacked then your attackers will be able to interfere with those files (to no good purpose) or even just delete them.
The way we approached this was to separate website creation tasks into a windows service running with the correct rights to perform these activities. In this service is a remoting end point (although these days you'd probably want to use WCF).
We then created a proxy assembly that is signed and registered in the GAC (it would also need to be marked with the APTCA attribute if you're running at less than Full Trust). This assembly passes on the relevant calls to the remoting endpoint in the windows service from the admin web app/service.
This allows us to run the admin site at least privilege and in partial trust mode. The scope of what can be done by way of site admin tasks is narrowed somewhat by whatever functionality is exposed in the windows service application.
This is a technique known as sandboxing.
I've found a way to do it, but I would very much like to hear expert opinion on whether this is a wise thing to do.
I granted Modify and Write permissions for the IIS AppPool\MyAppPool account to %WinDir%/System32/inetsrv/config and the three .config files inside it.

Resources