3

我在实施基于 Active Directory (Windows Server 2008 R2) 和 Java 的正确身份验证时遇到问题。

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

[LDAP: error code 49 - 80090308: LdapErr: DSID-0C0903A9, comment: AcceptSecurityContext error, data 533, v1db1

533告诉我该帐户已锁定/禁用。它工作正常 - 至少在我的开发环境中。启用/禁用帐户会立即更改身份验证结果。

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

在 Active Directory 配置中寻找什么?我没有任何池和任何 AD 复制...

[编辑]:Wireshark 转储

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

0000   30 50 02 01 01 60 4b 02 01 03 04 3c 43 4e 3d 67  0P...`K....<CN=g
0010   72 7a 65 67 6f 72 7a 20 67 72 7a 79 62 65 6b 2c  rzegorz grzybek,
0020   63 6e 3d 75 73 65 72 73 2c 64 63 3d xx xx xx xx  cn=users,dc=xxxx
0030   xx xx xx xx xx 2c 64 63 3d xx xx 2c 64 63 3d xx  xxxxx,dc=xx,dc=x
0040   xx xx 2c 64 63 3d 70 6c 80 08 xx xx xx xx xx xx  xx,dc=pl..xxxxxx
0050   xx xx                                            xx

这是回应 - 普通resultCode: success (0)

0000   30 84 00 00 00 10 02 01 01 61 84 00 00 00 07 0a  0........a......
0010   01 00 04 00 04 00                                ......

对无效密码的响应是:

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:

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

2:

An account was successfully logged on.

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

Logon Type:         3

New Logon:
    Security ID:        MS\Guest
    Account Name:       Guest
    Account Domain:     MS
    Logon ID:       0x38cd57
    Logon GUID:     {00000000-0000-0000-0000-000000000000}

是否有可能,通过 LDAP 正确登录禁用帐户会导致登录访客帐户?

4

1 回答 1

4

终于我得到了解决方案!

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

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

Failure Information:
    Failure Reason:     Unknown user name or bad password.
    Status:         0xc000006d
    Sub Status:     0xc000006a

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

1.

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

2.

...
Account Whose Credentials Were Used:
    Account Name:       Guest
    Account Domain:     MS
    Logon GUID:     {00000000-0000-0000-0000-000000000000}
...

3.

...
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}
...

4.

An account was logged off.

Subject:
    Security ID:        MS\Guest
    Account Name:       Guest
    Account Domain:     MS
    Logon ID:       0x3ad7cf

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

Failure Information:
    Failure Reason:     Account currently disabled.
    Status:         0xc000006e
    Sub Status:     0xc0000072

是不是很奇怪?这不是 AD/LDAP 中的错误吗?

于 2013-11-21T12:35:09.037 回答