gpt4 book ai didi

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

转载 作者:塔克拉玛干 更新时间:2023-11-02 08:16:56 24 4
gpt4 key购买 nike

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

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

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

533 告诉我该帐户已被锁定/禁用。它运行良好——至少在我的开发环境中是这样。启用/禁用帐户会立即更改身份验证结果。

然而,它在客户机器的生产环境中不起作用...我可以成功创建一个 InitialContext(没有 533),但是稍后搜索操作成功绑定(bind)以错误结束,我没有必要的授权来执行查找。

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

[编辑]:Wireshark 转储

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

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.

修改后发送正确的密码,立即绑定(bind)成功。

顺便说一句 - 使用 LDAPS(端口 636)不会改变任何东西 - 我仍然可以绑定(bind)到已禁用的帐户。

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

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

对于已禁用的帐户,LDAP 以不正确的方式绑定(bind)到 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 以正确的方式绑定(bind)到 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 帐户?

最佳答案

终于找到答案了!

问题是……启用了 guest 帐户。

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

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

AD/LDAP 绑定(bind)到具有正确密码的已禁用帐户会导致以下事件:

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

禁用 guest 帐户后,AD/LDAP 绑定(bind)到具有正确 密码的已禁用帐户会导致以下事件:

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

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

关于java - Active Directory 允许使用禁用的帐户创建 InitialContext,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18696360/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com