IIS 7中的Kerberos身份验证

And*_*ndi 9 authentication wcf iis-7 ntlm kerberos

我们使用集成的Windows身份验证在虚拟目录中设置了一些Web内容.虚拟目录在使用自定义标识(自定义用户帐户)的应用程序池下运行.问题是NTLM身份验证有效,但Kerberos身份验证不起作用.这是在IIS 6下工作的相同配置,但我们需要迁移到IIS 7并且Kerberos身份验证不起作用.

以下是有关我的环境的更多信息:

虚拟目录验证设置:

  • 除Windows身份验证外禁用所有内容
  • 启用内核模式身份验证:已启用

应用池设置:

  • 管理管道模式:经典
  • 身份:自定义本地用户

Web.config设置:

  • 身份验证模式="Windows"
  • system.serviceModel/bindings/basicHttpBinding/binding/security/mode = TransportCredentialOnly
  • system.serviceModel/bindings/basicHttpBinding/binding/security/transport/clientCredentailType = Windows
  • serviceHostingEnvironment/aspNetCompatibilityEnabled = true

虚拟目录权限:

  • 自定义本地组:我们将域用户添加到本地组以访问该服务

OS设置:

  • IIS 7
  • Windows Server 2008 x64标准SP2

以下是我从fiddler比较IIS 6到IIS 7的分析.在IIS 6中,Kerberos身份验证工作正常,应用程序池运行自定义标识.

参考(IIS 6)(作品):

小提琴手:

(使用domain\user)

请求1(无身份验证)

No Proxy-Authorization Header is present.
No Authorization Header is present.
Run Code Online (Sandbox Code Playgroud)

回复1(401)(挑战)

No Proxy-Authenticate Header is present.
WWW-Authenticate Header is present: Negotiate
WWW-Authenticate Header is present: NTLM
Run Code Online (Sandbox Code Playgroud)

请求2(Kerberos票证)

Authorization Header (Negotiate) appears to contain a Kerberos ticket:
<data>
Run Code Online (Sandbox Code Playgroud)

回复2(401)(Kerberos回复)

WWW-Authenticate Header (Negotiate) appears to be a Kerberos reply:
<data>
Run Code Online (Sandbox Code Playgroud)

请求3(Kerberos票证)

Authorization Header (Negotiate) appears to contain a Kerberos ticket:
<data>
Run Code Online (Sandbox Code Playgroud)

回复3(401)(Kerberos回复)

WWW-Authenticate Header (Negotiate) appears to be a Kerberos reply:
<data>
Run Code Online (Sandbox Code Playgroud)

请求4(Kerberos票证)

Authorization Header (Negotiate) appears to contain a Kerberos ticket:
<data>
Run Code Online (Sandbox Code Playgroud)

回应4(200)(Kerberos回复)

WWW-Authenticate Header (Negotiate) appears to be a Kerberos reply:
<data>
Run Code Online (Sandbox Code Playgroud)

事务完成,浏览器显示页面.


(IIS 7)(不起作用):

小提琴手:

(使用domain\user)

请求1(无身份验证)

No Proxy-Authorization Header is present.
No Authorization Header is present.
Run Code Online (Sandbox Code Playgroud)

回复1(401)(谈判)

No Proxy-Authenticate Header is present.
WWW-Authenticate Header is present: Negotiate
WWW-Authenticate Header is present: NTLM
Run Code Online (Sandbox Code Playgroud)

请求2(Kerberos票证)

Authorization Header (Negotiate) appears to contain a Kerberos ticket:
<data>
Run Code Online (Sandbox Code Playgroud)

回应2(401)(谈判)

No Proxy-Authenticate Header is present.
WWW-Authenticate Header is present: Negotiate
WWW-Authenticate Header is present: NTLM
Run Code Online (Sandbox Code Playgroud)

请注意,IIS 7不接受响应2中的 Kerberos票证.知道为什么不呢?我是否需要在IIS 7中重新配置一些内容才能使Kerberos身份验证正常工作?

And*_*ndi 11

解析度

为了让IIS让IIS 7协商身份验证,我必须将applicationHost.config文件中我的虚拟目录的windowsAuthentication元素的useAppPoolCredentials设置为true.执行以下任一命令即可完成此操作:

%windir%\system32\inetsrv\appcmd.exe set config -section:system.webServer/security/authentication/windowsAuthentication -useAppPoolCredentials:true
Run Code Online (Sandbox Code Playgroud)

申请个人申请:

首先解锁:

%windir%\system32\inetsrv\appcmd.exe unlock config /section:windowsAuthentication
Run Code Online (Sandbox Code Playgroud)

然后申请:

%windir%\system32\inetsrv\appcmd.exe set config "Default Web Site/myApp/" /section:windowsAuthentication -useAppPoolCredentials:true
Run Code Online (Sandbox Code Playgroud)

注意 - 这实际上不会使Kerberos工作.它的作用使IIS 7的行为类似于IIS 6.这意味着如果服务器和客户端之间的Kerberos协商失败,那么服务器将自动回退到NTLM.这实际上是使身份验证适用于我(NTLM)的事情.