- ·上一篇文章:个人主页的数据库解决方案ASP
- ·下一篇文章:asp动态生成wbmp图片的程序
安全技巧:配置 IIS 4.0 证书鉴定
;
但是,我将着重讲IE 4.0。)从客户端浏览http://server name/certsrv/certenroll/ceenroll.asp。Certificate
Enrollment Form(证书登记表)将让你填写客户证书的各个细节。正确填写各项并点击Submit Request(提交要求)。当提交要
求时,将调用IE 4.0的Web Server Enrollment Page(服务器的登记页)。在该页面上点击Download(下传)就能把客户证书安
装到浏览器上。选择View菜单,依次选择Internet Options, Content, Personal,可以检查客户证书是否正常安装了,你将在
IE 4.0的Client Authentication(客户验证)窗口中看到此客户证书。
在安装完客户证书之后,你需要让IIS知道此证书的拥有者被授权访问站点上受安全保护的区域。因为IIS的网络安全性是基于
Windows NT用户帐号的,所以IIS需要某种方法能将每个客户证书映射到服务器上某个NT用户或组的帐号上。实际上,IIS是利用
用客户证书映射表(Client Certificate Mapping table)来实现这一点的。为了创建客户证书映射,你必须将每个证书单独从
一个文本文件中引入IIS。这尽管是个繁琐的过程,但却可能是创建相应映射的唯一的方法。所以,必须找到某种方法能捕获客户浏
览器中安装的客户证书,并将其存放到文本文件中。最方便的办法是修改ASP(Active Server Pages,动态服务器网页)代码来实
现。清单1列出了把客户证书写入到一个文本文件中的ASP代码。
清单1 将客户证书写到文本文件的ASP代码
<% @Language = VBScript %>
<% Response.Buffer = True %>
<html>
<head>
<title>Client Certificate Capture</title>
</head>
<body>
<%
'Instantiate the ASP FileSystemObject in order
'to create a text file
Set fs = Server.CreateObject("Scripting.FileSystemObject")
'Create text file using append mode
Set outStream = fs.OpenTextFile( "C:\Inetpub\wwwroot\certificates\cert.txt", 8, True )
'Save certificate issuer information to text file
outStream.WriteLine( "# Issuer: " & Request.ClientCertificate("Issuer") )
'Extract certificate subject (user) and account information
'from certificate
su = Request.ClientCertificate( "Subject" )
mx = len(su)
for x = 1 to mx
if mid(su,x,1)=chr(10) or mid(su,x,1)=chr(13) then
su=left(su,x-1)+";"+right(su,mx-x)
end if
next
outStream.WriteLine( "# Subject: " & su )
outStream.WriteLine( "# Account: " & Request.ServerVariables("REMOTE_USER") )
'Extract encrypted certificate text from certificate; encode text as 64-bit data
uue = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"
outStream.WriteLine( "-----BEGIN CERTIFIC
但是,我将着重讲IE 4.0。)从客户端浏览http://server name/certsrv/certenroll/ceenroll.asp。Certificate
Enrollment Form(证书登记表)将让你填写客户证书的各个细节。正确填写各项并点击Submit Request(提交要求)。当提交要
求时,将调用IE 4.0的Web Server Enrollment Page(服务器的登记页)。在该页面上点击Download(下传)就能把客户证书安
装到浏览器上。选择View菜单,依次选择Internet Options, Content, Personal,可以检查客户证书是否正常安装了,你将在
IE 4.0的Client Authentication(客户验证)窗口中看到此客户证书。
在安装完客户证书之后,你需要让IIS知道此证书的拥有者被授权访问站点上受安全保护的区域。因为IIS的网络安全性是基于
Windows NT用户帐号的,所以IIS需要某种方法能将每个客户证书映射到服务器上某个NT用户或组的帐号上。实际上,IIS是利用
用客户证书映射表(Client Certificate Mapping table)来实现这一点的。为了创建客户证书映射,你必须将每个证书单独从
一个文本文件中引入IIS。这尽管是个繁琐的过程,但却可能是创建相应映射的唯一的方法。所以,必须找到某种方法能捕获客户浏
览器中安装的客户证书,并将其存放到文本文件中。最方便的办法是修改ASP(Active Server Pages,动态服务器网页)代码来实
现。清单1列出了把客户证书写入到一个文本文件中的ASP代码。
清单1 将客户证书写到文本文件的ASP代码
<% @Language = VBScript %>
<% Response.Buffer = True %>
<html>
<head>
<title>Client Certificate Capture</title>
</head>
<body>
<%
'Instantiate the ASP FileSystemObject in order
'to create a text file
Set fs = Server.CreateObject("Scripting.FileSystemObject")
'Create text file using append mode
Set outStream = fs.OpenTextFile( "C:\Inetpub\wwwroot\certificates\cert.txt", 8, True )
'Save certificate issuer information to text file
outStream.WriteLine( "# Issuer: " & Request.ClientCertificate("Issuer") )
'Extract certificate subject (user) and account information
'from certificate
su = Request.ClientCertificate( "Subject" )
mx = len(su)
for x = 1 to mx
if mid(su,x,1)=chr(10) or mid(su,x,1)=chr(13) then
su=left(su,x-1)+";"+right(su,mx-x)
end if
next
outStream.WriteLine( "# Subject: " & su )
outStream.WriteLine( "# Account: " & Request.ServerVariables("REMOTE_USER") )
'Extract encrypted certificate text from certificate; encode text as 64-bit data
uue = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"
outStream.WriteLine( "-----BEGIN CERTIFIC

