【问题标题】:ASP classic active directory query permissions issue. ASP error 80072020ASP 经典活动目录查询权限问题。 ASP 错误 80072020
【发布时间】:2014-06-16 20:43:59
【问题描述】:

我有一个使用 IIS 6 在 Windows 2003 上运行的 ASP 经典 Intranet 站点。在您问为什么它是一个站点之前,我继承了该站点,目前它无法更改。我正在尝试转换站点的一部分,该站点在需要离开的旧数据库上进行查找,而不是在 AD 中查找用户并根据他们是否是安全组的成员授予权限。我的代码使用 VBscript 在 AD 中搜索用户并获取他们的组成员身份。我遇到的问题似乎是 IIS 中的双跳或权限问题,它阻止了我。这是我的代码:

<%
Dim sLogonUser : sLogonUser = Request.ServerVariables("Logon_User")
Dim sDomain : sDomain = Mid(sLogonUser, 1, Instr(1, sLogonUser, "\") - 1)
Dim sLogonName : sLogonName = Mid(sLogonUser, Instr(1, sLogonUser, "\") + 1)

response.write sDomain
response.write sLogonName
' Create ADO connection to Active Directory
'
Dim oConnection
Set oConnection = CreateObject("ADODB.Connection")
With oConnection
    .Provider = "ADsDSOObject"
    .Mode = "1" 'Read
    .Properties("Encrypt Password") = True 
    .Open "Active Directory Provider"
End With

' Create command to search user in Active Directory
'
Dim oCommand
Set oCommand = CreateObject("ADODB.Command")
oCommand.ActiveConnection = oConnection

' Build the ADsPath element of the CommandText
'
Dim oRoot
Dim oDomain
Dim sADsPath
Dim sFilter
Dim sAttribsToReturn
Dim sDepth
Dim oRS
Dim i
Dim value
Dim c_EmployeeDirectoryConnectionString


Set oRoot = GetObject("LDAP://" & sDomain & "/rootdse")
Set oDomain = GetObject("LDAP://" & sDomain & "/" & oRoot.Get("defaultNamingContext"))
sADsPath = "<" & oDomain.ADsPath & ">"

' Build the filter element of the CommandText
'
sFilter = "(&(objectCategory=Person)(objectClass=user)(sAMAccountName=" & sLogonName & "))"

' Build the returned attributes element of the CommandText
'
sAttribsToReturn = "distinguishedName,memberOf"

' Build the depth element of the CommandText
'
sDepth = "subTree"

' Assemble the CommandText
'
ocommand.CommandText = sADsPath & ";" & sFilter & ";" & sAttribsToReturn & ";" & sDepth

' Execute the query
'
Set oRS = ocommand.Execute

' Only one user should meet the criteria
'
If (oRS.RecordCount = 1) Then
    ' Get that user's info
    '
    oRS.MoveFirst
    For i = 0 To oRS.Fields.Count - 1

        ' memberOf
        '
        If (oRS.Fields(i).Name = "memberOf") Then
            ' adVariant
            '
            For Each value In oRS.Fields(i).Value
                if Instr(value, "testgroup") <> 0 then
                response.write "member of testgroup"
                End If
            Next


        End If
    Next


End If
%>

当您运行代码时,您可以正确获取用户,但是当它去查找他们到 AD 时,它会失败并出现错误:'80072020' &lt;iis site path&gt;/test.asp, line 44

当我在网络服务器上本地运行或从我的机器远程运行时出现错误。 Web 服务器配置了集成的 Windows 身份验证。匿名身份验证已关闭,站点设置为使用作为域服务帐户运行的应用程序池标识。我对 IIS 知之甚少,无法知道问题出在哪里,但我认为我的设置有误。如果我硬编码用户名并在匿名身份验证下运行,它将很好地查找用户。任何朝着正确方向的帮助或推动都会很棒。

【问题讨论】:

    标签: iis asp-classic active-directory kerberos


    【解决方案1】:

    您是否尝试过授予 IUSR_machinename 和 IWAM_machinename 对相关文件夹的完全更改权限?

    【讨论】:

      【解决方案2】:

      原来是 kerberos 问题。 IIS 站点未正确配置为使用 kerberos。因此,当用户加载页面时,它会从 Windows 身份验证中获取他们的域登录名并尝试将其传递给 AD,并且由于所有用户都对域具有读取权限,因此他们应该能够查找组成员身份。但由于它没有使用 kerberos,因此无法将凭据发送到 AD 进行查询。

      为 IIS 网络服务器和运行应用程序池的域帐户添加 SPN,然后将服务帐户设置为可信任以进行 kerberos 身份验证,从而解决了该问题。

      我用这个帖子作为参考:similar issue

      我使用这个工具来帮助我解决 kerberos 问题:Kerberos Delegation utility for IIS

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2013-11-03
        • 2014-07-27
        • 1970-01-01
        相关资源
        最近更新 更多