IIS7 Handlers - accessPolicy and requireAccess
Question:
Hello:
In IIS 7.0, you can edit a handler mapping in the Handler Mappings applet (like for AspClassic), then click Request Restrictions button, Access tab, and select the "Write" permission. But even when the "Edit Feature Permission" in that site/folder is set to Read+Script+Execute, the handler with the "Write" permission is still disabled!
Why?
How do you both keep a handler enabled and also set its request restriction to "Write" at the same time? I've read through all the IIS help files, they're either silent or incorrect on this question.
Answer:
What you want to do is not achievable via the UI. You have to configure the .config file directly.
This looks like a bug in the UI because the "accessPolicy" and "requireAccess" attributes are not aligned.
Here's what the UI is attempting to do:
- accessPolicy corresponds to the old "Execute Permissions" set of checkboxes
- requireAccess is brand new in IIS7. After we opened up the handler definition in IIS7, it became necessary to add requireAccess so that one could express the concept of "this handler requires script access permissions to execute" so that one could then use accessPolicy to control whether "scripts" can run or not.
Before IIS7, the logical tie between handlers and requireAccess was hardcoded into IIS into statements like:
- StaticFileHandler requires Read Permission
- All Other Handlers require Script Permission
- EXE and DLL require Execute Permission
Starting from IIS7, it is completely wide open. The astute reader should realize that it is possible in IIS7 to do something goofy like set ISAPI Handler to require "no" permissions (instead of Execute) and allow the ISAPI Handler to be executed by IIS Core all the time. However, the actual execution of an ISAPI DLL by the ISAPI Handler is still subject to ISAPI CGI Restriction. This is another example of defense in depth!
What the UI tries to display via the "State" view is: "if you allow only scripts, only these handlers are active". Of course, it is missing the "Write" permission as a filter. Even though the handler require access dialog just added "Write". Thus, when you selected "Write" request restriction for the handler, it makes it impossible for the UI to display as enabled because it does not have "Write" permission as a filter.
I would chalk this up as a bug introduced when WebDAV was added for Windows Server 2008 because that's the main module that needs it. However, if you think about what I just said, this is really easy to work around. Remember, IIS7 does not know what "Execute" permission is (or else the goofy ISAPI Handler configuration would not be possible), so IIS7 does not know what "Write" permission is, either.
Internally, the handler execution logic in IIS7 Core is:
- accessPolicy contains "Text1, Text2, Text3".
- handler's requireAccess contains "Text3".
- requireAccess text is found inside of accessPolicy text. Allow handler execution.
//David
Comments
Anonymous
June 01, 2008
hi David, Now i am use window server 2003 and IIS6, can i update iis6 to iis7 only?Anonymous
June 01, 2008
qflash - IIS7 is only available on Windows Vista and Windows Server 2008. There are no plans for IIS7 to run anywhere else. //DavidAnonymous
April 08, 2009
I ran across a problem where some program wrote noremote write, and so on. I cannot find the equivalent in the GUI. Am I missing something here?Anonymous
January 20, 2016
How can I reach to "script source access of iis7", please somebody guide me. Thanks in advance