Java Active Directory允许使用禁用的帐户创建InitialContext

Java Active Directory允许使用禁用的帐户创建InitialContext,java,active-directory,Java,Active Directory,我无法基于Active Directory(Windows Server 2008 R2)和Java实现正确的身份验证 假定的流程是在AD(属性)中禁用帐户时→ 账户→ 帐户选项→ “帐户被禁用”复选框),当使用com.sun.jndi.ldap.LdapCtxFactory连接时,我应该从AD获得以下异常: [LDAP: error code 49 - 80090308: LdapErr: DSID-0C0903A9, comment: AcceptSecurityContext error,

我无法基于Active Directory(Windows Server 2008 R2)和Java实现正确的身份验证

假定的流程是在AD(属性)中禁用帐户时→ 账户→ 帐户选项→ “帐户被禁用”复选框),当使用
com.sun.jndi.ldap.LdapCtxFactory连接时,我应该从AD获得以下异常:

[LDAP: error code 49 - 80090308: LdapErr: DSID-0C0903A9, comment: AcceptSecurityContext error, data 533, v1db1
533
告诉我帐户已锁定/禁用。而且它工作得很好——至少在我的开发环境中是这样。启用/禁用帐户会立即更改身份验证结果

但是,它在客户机器的生产环境中不工作。。。我可以成功创建一个
InitialContext
(否
533
),但是在成功绑定之后的搜索操作以错误结束,即我没有执行查找所需的授权

在Active Directory配置中查找什么?我没有任何池和任何广告复制

[编辑]:Wireshark转储

以下是绑定到已禁用帐户的请求(仅已解码LDAP协议):

对无效密码的响应是:

0000   30 84 00 00 00 68 02 01 01 61 84 00 00 00 5f 0a  0....h...a...._.
0010   01 31 04 00 04 58 38 30 30 39 30 33 30 38 3a 20  .1...X80090308: 
0020   4c 64 61 70 45 72 72 3a 20 44 53 49 44 2d 30 43  LdapErr: DSID-0C
0030   30 39 30 33 41 39 2c 20 63 6f 6d 6d 65 6e 74 3a  0903A9, comment:
0040   20 41 63 63 65 70 74 53 65 63 75 72 69 74 79 43   AcceptSecurityC
0050   6f 6e 74 65 78 74 20 65 72 72 6f 72 2c 20 64 61  ontext error, da
0060   74 61 20 35 32 65 2c 20 76 31 64 62 31 00        ta 52e, v1db1.
并在更改后发送正确的密码,立即导致成功绑定

顺便说一下,使用LDAPS(端口636)不会改变任何事情,我仍然可以绑定到禁用的帐户

编辑:在虚拟服务器上重新创建问题

我已经启用了LDAP/AD事件的详细日志记录,这就是我得到的:

对于禁用的帐户,将不正确的LDAP绑定到Active Directory会导致单个事件:

An account failed to log on.

Subject:
    Security ID:        SYSTEM
    Account Name:       CENTRALA$
    Account Domain:     XXX
    Logon ID:       0x3e7

Logon Type:         3

Account For Which Logon Failed:
    Security ID:        NULL SID
    Account Name:       MY_ACTUAL_DOMAIN_NAME_OF_BLOCKED_USER
    Account Domain:     XXX
对于禁用的
帐户,使用
正确的
LDAP绑定到Active Directory会导致以下事件:

1:

2:


是否有可能,通过LDAP正确登录到禁用的帐户会导致登录到来宾帐户???

最终我得到了解决方案

问题是。。。已启用来宾帐户

AD/LDAP绑定到密码不正确的启用或禁用帐户会导致以下事件:

Failure Information:
    Failure Reason:     Unknown user name or bad password.
    Status:         0xc000006d
    Sub Status:     0xc000006a
Failure Information:
    Failure Reason:     Account currently disabled.
    Status:         0xc000006e
    Sub Status:     0xc0000072
AD/LDAP绑定到密码正确的禁用帐户会导致以下事件:

一,

二,

三,

四,

禁用来宾帐户后,使用正确的密码将AD/LDAP绑定到禁用的帐户会导致以下事件:

Failure Information:
    Failure Reason:     Unknown user name or bad password.
    Status:         0xc000006d
    Sub Status:     0xc000006a
Failure Information:
    Failure Reason:     Account currently disabled.
    Status:         0xc000006e
    Sub Status:     0xc0000072
这不是很奇怪吗?
这不是AD/LDAP中的一个错误吗?

您真的确定上下文是立即创建的,而不是在第一次查找时创建的吗?请使用Wireshark进行验证。我现在无法使用Wireshark-我只有员工朋友可以使用电话。但是他检查了禁用帐户后使用Apache Directory Studio启动的绑定,并且连接(绑定)仍然成功。您是否等待了一段合理的时间,直到信息通过所有DC复制?只有一个DC。。。同时,
runas/user:disabled user cmd
按预期工作(禁用用户失败,启用用户成功)。。。明天我将和Wireshark一起去那里…好的,请这样做并报告。我认为这是Microsoft的一项功能。当Microsoft JIRA实例重新工作时,我将提出一个问题:)嗯,在MS设置JIRA实例之前,地狱很可能会冻结。
Failure Information:
    Failure Reason:     Unknown user name or bad password.
    Status:         0xc000006d
    Sub Status:     0xc000006a
The computer attempted to validate the credentials for an account.

Authentication Package: MICROSOFT_AUTHENTICATION_PACKAGE_V1_0
Logon Account:  Guest
Source Workstation: CENTRALA
Error Code: 0x0
...
Account Whose Credentials Were Used:
    Account Name:       Guest
    Account Domain:     MS
    Logon GUID:     {00000000-0000-0000-0000-000000000000}
...
...
Logon Type:         3

New Logon:
    Security ID:        MS\Guest
    Account Name:       Guest
    Account Domain:     MS
    Logon ID:       0x3ad7cf
    Logon GUID:     {00000000-0000-0000-0000-000000000000}
...
An account was logged off.

Subject:
    Security ID:        MS\Guest
    Account Name:       Guest
    Account Domain:     MS
    Logon ID:       0x3ad7cf
Failure Information:
    Failure Reason:     Account currently disabled.
    Status:         0xc000006e
    Sub Status:     0xc0000072