无法从 Linux 主机使用 Kerberos 查询 AD

No *_*lar 8 openldap active-directory ldap

ldapsearch -H <URL> -b <BASE> -s sub -D <USER> -x -w <PW>
Run Code Online (Sandbox Code Playgroud)

工作正常

kinit <USER>@<REALM>
ldapsearch -H <URL> -b <BASE> -s sub
Run Code Online (Sandbox Code Playgroud)

失败:

text: 000004DC: LdapErr: DSID-0C0906E8, comment: In order to perform this operation a successful bind must be completed on the connection., data 0, v1db1

kinit Administrator@<REALM>
ldapsearch -H <URL> -b <BASE> -s sub
Run Code Online (Sandbox Code Playgroud)

也能正常工作

通常的谷歌搜索没有发现任何感兴趣的东西。(通常有关于时间偏差和使用userPrincipalNamevs 组件名称的评论-D,但是在使用 时应该注意kinit。)

有任何想法吗?

小智 5

我发现在 ldapsearch 命令行上指定“-O maxssf=0”是必要的,这样 GSSAPI AD 搜索才能正常工作。以下命令适用于我通过 SSL 连接搜索 AD 全局目录:

ldapsearch -LLL -O maxssf=0 -Y GSSAPI -H ldaps://ad.realm.local:3269 -b "dc=realm,dc=local" '(sAMAccountName=userid)'
Run Code Online (Sandbox Code Playgroud)

此外,为了使 Kerberos 身份验证与 ldapsearch 一起使用,必须为反向 IP 查找正确配置 DNS。否则,您将收到“无法确定数字主机地址的领域”错误。如有必要,您可以将 AD 服务器的 IP 和主机名放入主机文件中以使其正常工作。


daw*_*wud 2

ldapsearch(1)联机帮助页:

-Y mech
Specify the SASL mechanism to be used for authentication. If it's not specified, the program will choose the best mechanism the server knows. 
Run Code Online (Sandbox Code Playgroud)

例如:

ldapsearch -Y GSSAPI -b "dc=example,dc=com" uid=user
Run Code Online (Sandbox Code Playgroud)

假设你的/etc/gssapi_mech.conf样子是这样的:

# grep -v ^# /etc/gssapi_mech.conf
libgssapi_krb5.so.2             mechglue_internal_krb5_init
Run Code Online (Sandbox Code Playgroud)