【问题标题】:Active Directory allows creating InitialContext with disabled accountActive Directory 允许使用禁用帐户创建 InitialContext
【发布时间】:2013-09-09 10:38:26
【问题描述】:

我在实施基于 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 配置中寻找什么?我没有任何池和任何 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 以 incorrect 绑定到 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 正确登录禁用帐户会导致登录 Guest 帐户??

【问题讨论】:

  • 您确定上下文是立即创建的,而不是在第一次查找时创建的吗?使用 Wireshark 进行验证。
  • 我现在无法使用 Wireshark - 我只有朋友员工的电话访问权限。但是他使用 Apache Directory Studio在禁用帐户后启动检查了绑定,并且连接(绑定)仍然成功。
  • 您是否等待了一段合理的时间,直到信息通过所有 DC 复制?
  • 只有一个 DC...同时,runas /user:disabled-user cmd 按预期工作(禁用用户失败,启用用户成功)...明天我会和 Wireshark 一起去那里...
  • 好的,请这样做并报告。

标签: java active-directory


【解决方案1】:

我终于找到了解决办法!

问题是...启用了访客帐户。

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 中的错误吗?

【讨论】:

  • 我认为这是微软的一项功能。
  • 当 Microsoft JIRA 实例再次工作时,我会提出问题 :)
  • 好吧,在 MS 建立 JIRA 实例之前,地狱很可能会冻结。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2012-06-05
  • 1970-01-01
  • 2011-06-08
  • 1970-01-01
相关资源
最近更新 更多