IIS Intranet 应用程序中的 Kerberos 身份验证问题 - 云与本地
Kerberos authentication issues in IIS Intranet Apps - Cloud vs On Premises
我有一个问题困扰了我几个星期。
我们正在将我们的开发环境从本地转移到 AWS EC2 实例,包括我们的 IIS 服务器。这托管了许多网络服务、ASP.Net 和 .Net Core 内联网应用程序。
其中大部分使用 Windows 身份验证,并且 none 面向外部世界。
一些应用程序在两种环境中都可以正常工作,但其中一些应用程序可以在本地环境中工作,但不能在 AWS 环境中工作,我要么得到 windows 身份验证弹出窗口,要么 401 (未授权)“HTTP 请求未经客户端身份验证方案 'Anonymous'。从服务器收到的身份验证 header 是 'Negotiate,NTLM'”。
具有委派权限的特定域帐户下的所有应用程序 运行,并且为该帐户设置了一个 SPN 到托管各种应用程序数据库的 SQL 服务器(也在AWS).
在提供程序下,所有应用程序都先协商,然后是 NTLM。
大多数应用程序只启用了 Windows 身份验证,有些应用程序启用了 ASP.Net 模拟
也启用了,但与那些有这个设置和那个工作的那些没有关联。
我尝试根据此 post 设置 DisableStrictNameChecking:Unable to get windows authentication to work through local IIS
其他 post我已阅读:
ASP.net kerberos dropping down to NTLM sporadically
Add a Kerberos authentication to existing WebService in asp.net c#
WCF service access from client application when user is behind proxy
Error: The remote server returned an error: (401) Unauthorized
Many Web Service calls caused 401 Unauthorized response randomly
(401) Unauthorized error : WCF security/binding
其中一个应用程序在 web.config 中包含以下部分:
<system.web>
<authorization>
<allow users="*" />
<!-- Allowing all users. If the users dont have access then they see this page.. -->
</authorization>
</system.web>
</location>
<system.web>
<compilation targetFramework="4.7" />
<authentication mode="Windows" />
<identity impersonate="true" />
<customErrors mode="Off" />
<authorization>
<allow roles="XXXX\Development/>
<deny users="*" />
</authorization>
</system.web>
此应用程序在 AWS 中运行,我进入了 NoAccess.aspx 页面(我不是 Development AD 组的成员)。然后我删除了配置的“位置路径”部分,重新启动了应用程序池并获得了登录提示(如预期的那样)。
当我重新添加该部分并重新启动应用程序池时,我不再访问该页面,只是立即收到 401 错误消息“HTTP 请求未经客户端身份验证方案 'Anonymous' 授权。身份验证 header 从服务器收到的是 'Negotiate,NTLM'".
有人知道为什么会这样吗?我无法在那些有效的应用程序和那些无效的应用程序之间找到共同点。
我打开了增强型日志记录,并且在 运行使用其中一个应用程序无法运行时看到了以下警告。有趣的是,它显示我已通过身份验证(并且我有权使用 运行 该应用程序)。
Event code: 3005
Event message: An unhandled exception has occurred.
Event time: 6/8/2021 12:09:45 PM
Event time (UTC): 6/8/2021 12:09:45 AM
Event ID: fd6819aa0e4e4011a54d98790112c2f8
Event sequence: 8
Event occurrence: 1
Event detail code: 0
Application information:
Application domain: /LM/W3SVC/3/ROOT/ContactManagementApp-1-132675845823847857
Trust level: Full
Application Virtual Path: /ContactManagementApp
Application Path: D:\Applications\ContactManagementApp\
Machine name: SRV123
Process information:
Process ID: 1224
Process name: w3wp.exe
Account name: DOMAIN\SRV123-iis
Exception information:
Exception type: WebException
Exception message: The remote server returned an error: (401) Unauthorized.
at System.Net.HttpWebRequest.GetResponse()
at System.ServiceModel.Channels.HttpChannelFactory`1.HttpRequestChannel.HttpChannelRequest.WaitForReply(TimeSpan timeout)
Request information:
Request URL: http://SRV123/ContactManagementApp/contact.aspx
Request path: /ContactManagementApp/contact.aspx
User host address: 123.123.123.123
User: DOMAIN\userName
Is authenticated: True
Authentication Type: Negotiate
Thread account name: DOMAIN\SRV123-iis
Thread information:
Thread ID: 7
Thread account name: DOMAIN\SRV123-iis
Is impersonating: False
Stack trace: at System.Net.HttpWebRequest.GetResponse()
at System.ServiceModel.Channels.HttpChannelFactory`1.HttpRequestChannel.HttpChannelRequest.WaitForReply(TimeSpan timeout)
Custom event details:
有什么我需要看的想法吗? kerberos 是否存在超时问题?
我通过在 AWS 中设置只读域控制器设法解决了这个问题。工作理论是,在与本地 DC 对话时,kerberos 存在某种超时问题。
我有一个问题困扰了我几个星期。
我们正在将我们的开发环境从本地转移到 AWS EC2 实例,包括我们的 IIS 服务器。这托管了许多网络服务、ASP.Net 和 .Net Core 内联网应用程序。
其中大部分使用 Windows 身份验证,并且 none 面向外部世界。
一些应用程序在两种环境中都可以正常工作,但其中一些应用程序可以在本地环境中工作,但不能在 AWS 环境中工作,我要么得到 windows 身份验证弹出窗口,要么 401 (未授权)“HTTP 请求未经客户端身份验证方案 'Anonymous'。从服务器收到的身份验证 header 是 'Negotiate,NTLM'”。
具有委派权限的特定域帐户下的所有应用程序 运行,并且为该帐户设置了一个 SPN 到托管各种应用程序数据库的 SQL 服务器(也在AWS).
在提供程序下,所有应用程序都先协商,然后是 NTLM。
大多数应用程序只启用了 Windows 身份验证,有些应用程序启用了 ASP.Net 模拟 也启用了,但与那些有这个设置和那个工作的那些没有关联。
我尝试根据此 post 设置 DisableStrictNameChecking:Unable to get windows authentication to work through local IIS
其他 post我已阅读:
ASP.net kerberos dropping down to NTLM sporadically
Add a Kerberos authentication to existing WebService in asp.net c#
WCF service access from client application when user is behind proxy
Error: The remote server returned an error: (401) Unauthorized
Many Web Service calls caused 401 Unauthorized response randomly
(401) Unauthorized error : WCF security/binding
其中一个应用程序在 web.config 中包含以下部分:
<system.web>
<authorization>
<allow users="*" />
<!-- Allowing all users. If the users dont have access then they see this page.. -->
</authorization>
</system.web>
</location>
<system.web>
<compilation targetFramework="4.7" />
<authentication mode="Windows" />
<identity impersonate="true" />
<customErrors mode="Off" />
<authorization>
<allow roles="XXXX\Development/>
<deny users="*" />
</authorization>
</system.web>
此应用程序在 AWS 中运行,我进入了 NoAccess.aspx 页面(我不是 Development AD 组的成员)。然后我删除了配置的“位置路径”部分,重新启动了应用程序池并获得了登录提示(如预期的那样)。
当我重新添加该部分并重新启动应用程序池时,我不再访问该页面,只是立即收到 401 错误消息“HTTP 请求未经客户端身份验证方案 'Anonymous' 授权。身份验证 header 从服务器收到的是 'Negotiate,NTLM'".
有人知道为什么会这样吗?我无法在那些有效的应用程序和那些无效的应用程序之间找到共同点。
我打开了增强型日志记录,并且在 运行使用其中一个应用程序无法运行时看到了以下警告。有趣的是,它显示我已通过身份验证(并且我有权使用 运行 该应用程序)。
Event code: 3005
Event message: An unhandled exception has occurred.
Event time: 6/8/2021 12:09:45 PM
Event time (UTC): 6/8/2021 12:09:45 AM
Event ID: fd6819aa0e4e4011a54d98790112c2f8
Event sequence: 8
Event occurrence: 1
Event detail code: 0
Application information:
Application domain: /LM/W3SVC/3/ROOT/ContactManagementApp-1-132675845823847857
Trust level: Full
Application Virtual Path: /ContactManagementApp
Application Path: D:\Applications\ContactManagementApp\
Machine name: SRV123
Process information:
Process ID: 1224
Process name: w3wp.exe
Account name: DOMAIN\SRV123-iis
Exception information:
Exception type: WebException
Exception message: The remote server returned an error: (401) Unauthorized.
at System.Net.HttpWebRequest.GetResponse()
at System.ServiceModel.Channels.HttpChannelFactory`1.HttpRequestChannel.HttpChannelRequest.WaitForReply(TimeSpan timeout)
Request information:
Request URL: http://SRV123/ContactManagementApp/contact.aspx
Request path: /ContactManagementApp/contact.aspx
User host address: 123.123.123.123
User: DOMAIN\userName
Is authenticated: True
Authentication Type: Negotiate
Thread account name: DOMAIN\SRV123-iis
Thread information:
Thread ID: 7
Thread account name: DOMAIN\SRV123-iis
Is impersonating: False
Stack trace: at System.Net.HttpWebRequest.GetResponse()
at System.ServiceModel.Channels.HttpChannelFactory`1.HttpRequestChannel.HttpChannelRequest.WaitForReply(TimeSpan timeout)
Custom event details:
有什么我需要看的想法吗? kerberos 是否存在超时问题?
我通过在 AWS 中设置只读域控制器设法解决了这个问题。工作理论是,在与本地 DC 对话时,kerberos 存在某种超时问题。