IIS Lockdown 工具执行几种重要操作来帮助保护 IIS 5 服务器的安全。所有步骤都是可选的,但了解各个步骤中所发生的情况对于理解各个步骤可能会对服务器产生何种影响是很重要的。您可以在 IIS Insider archives(IIS 有问必答存档)中找到有关此工具的几个问题,它们可能会对您有所帮助,而最完整的处理方法可以在 IIS Lockdown Walkthrough(IIS Lockdown 演练)中找到,其网址为 http://www.iisanswers.com/articles/IIS_Lockdown/IISLockdown.htm。
运行此工具时的可选步骤之一是安装 URLScan。URLScan 是一个 ISAPI 筛选器,它按照您的指定检查所有的传入请求并基于特定的标准拒绝它们。URLScan 是一个独立于 IIS Lockdown 工具的可选程序,但是人们却经常将它与 IIS Lockdown 工具混为一谈,因为安装 URLScan 是该工具的选项之一。换句话说,您不运行 IIS Lockdown 照样可以安装 URLScan,不安装 URLScan 也照样可以运行 IIS Lockdown。
如上所述,安装 URLScan 后,该工具将在 IIS 收到 URL 后对其进行检查并基于 URLScan.ini 中的设置接受或拒绝它们。URLScan 的接受或拒绝请求“规则”基于 URLScan.ini 的内容,URLScan.ini 与 URLScan.dll 安装在一起(默认情况下,URLScan 文件夹位于 winnt\system32\inetsrv 中)。打开 URLScan.ini(在“记事本”或其他文本编辑器中)后,您会在顶端发现名为 [options] 的一节(如下所示):
[options]
UseAllowVerbs=1 ; if 1, use [AllowVerbs] section,
else use [DenyVerbs] section
UseAllowExtensions=0 ; if 1, use [AllowExtensions] section,
else use [DenyExtensions] section
NormalizeUrlBeforeScan=1 ; if 1, canonicalize URL before processing
VerifyNormalization=1 ; if 1, canonicalize URL twice and reject
request if a change occurs
AllowHighBitCharacters=0 ; if 1, allow high bit (ie. UTF8 or MBCS)
characters in URL
AllowDotInPath=0 ; if 1, allow dots that are not file
extensions
RemoveServerHeader=0 ; if 1, remove "Server" header from
response
EnableLogging=1 ; if 1, log UrlScan activity
PerProcessLogging=0 ; if 1, the UrlScan.log filename will
contain a PID (ie. UrlScan.123.log)
AllowLateScanning=0 ; if 1, then UrlScan will load as a
low priority filter.
PerDayLogging=1 ; if 1, UrlScan will produce a new log
each day with activity in the form
UrlScan.010101.log
RejectResponseUrl= ; UrlScan will send rejected requests
to the URL specified here. Default is
/<Rejected-by-UrlScan>
UseFastPathReject=0 ; If 1, then UrlScan will not use the
RejectResponseUrl or allow IIS to log
the request
|
注意:名为 UseAllowExtensions 的选项被设置为 0。右边的注释说明该选项设置为 0 时,将使用 URLScan 的 [DenyExtensions] 节来确定要阻止的文件扩展名。下面是 URLScan.ini 文件中的一个典型的 [DenyExtensions] 节(由 IIS Lockdown 工具使用): |
[DenyExtensions]
;
; Extensions listed here either run code directly on the server,
; are processed as scripts, or are static files that are
; generally not intended to be served out.
;
; Note that these entries are effective if "UseAllowExtensions=0"
; is set in the [Options] section above.
;
; Also note that ASP scripts are denied with the below
; settings. If you wish to enable ASP, remove the
; following extensions from this list:
; .asp
; .cer
; .cdx
; .asa
;
; Deny ASP requests
.asp
.cer
.cdx
.asa
; Deny executables that could run on the server
.exe
.bat
.cmd
.com
; Deny infrequently used scripts
.htw ; Maps to webhits.dll, part of Index Server
.ida ; Maps to idq.dll, part of Index Server
.idq ; Maps to idq.dll, part of Index Server
.htr ; Maps to ism.dll, a legacy administrative tool
.idc ; Maps to httpodbc.dll, a legacy database access tool
.shtm ; Maps to ssinc.dll, for Server Side Includes
.shtml ; Maps to ssinc.dll, for Server Side Includes
.stm ; Maps to ssinc.dll, for Server Side Includes
.printer ; Maps to msw3prt.dll, for Internet Printing Services
; Deny various static files
.ini ; Configuration files
.log ; Log files
.pol ; Policy files
.dat ; Configuration files
您可以看到此列表中包含 .EXE。因此,您之所以会从 IIS 服务器收到一个“404, File Not Found”(404,找不到文件)消息,并不是因为文件不存在,而是因为 URLScan 阻止了它。您只需要删除 URLScan.ini 文件中的该条目便可开始发送您的应用程序。