python - InitializeSecurityContext:指定的目标未知或无法到达
问题描述
总体目标:我正在尝试在 Windows 上使用 Kerberos 通过 LDAP 向 Active Directory 进行身份验证。由于依赖关系,我无法使用python-ldap
or python-gssapi
,因此我正在使用此答案中找到ldap3
的补丁来使用 Kerberos (通过代替)。winkerberos
python-gssapi
示例代码:
from ldap3 import Connection, Server, ALL, IP_V4_PREFERRED, SASL, GSSAPI
domain_controller = input("DC: ")
SERVER = Server(domain_controller,
allowed_referral_hosts=[('*', True)],
get_info=ALL,
mode=IP_V4_PREFERRED)
CONNECTION = {"authentication": SASL,
"sasl_mechanism": GSSAPI,
"check_names": True}
c = Connection(SERVER, **CONNECTION)
c.bind()
抛出:
File "ldap3\core\connection.py", line 550, in bind
response = self.do_sasl_bind(controls)
File "ldap3\core\connection.py", line 1252, in do_sasl_bind
result = sasl_gssapi(self, controls)
File "ldap3\protocol\sasl\kerberos.py", line 54, in sasl_gssapi
base64.b64encode(in_token).decode('ascii')
winkerberos.GSSError: SSPI: InitializeSecurityContext: The specified target is unknown or unreachable
我已经尝试从这里的解决方案@
更改为没有任何区别。套接字正在正确解析 dc fqdn,dc 支持 SASL/GSSAPI 机制,我也可以传递用户名/密码以成功绑定。此处失败的部分听起来是特定于 kerberos 的。/
问题:是什么导致了这个错误,我该如何补救?
解决方案
推荐阅读
- mysql - 在一个变更集中添加具有非空值和唯一约束的 UUID 列
- python - 工作池数据结构
- android - RecycleView 界面崩溃
- node.js - 我的本地主机不刷新,它只在我重新启动计算机时刷新
- excel - 只复制第一个结果而不是整个列表
- hadoop - 分裂何时何地发生?
- .net - 在 HttpContext 中解析服务 configure Action
- php - 将 HTML 标签解析为 PDO MySQL
- apache-spark - 如何使用来自 Keras 的预训练 h5py 模型在 Spark Streaming 中进行实时预测?
- user-interface - 我应该如何开始以及应该使用哪些工具来开发具有令人惊叹的动画的网站?