python 的 Kerberos 身份验证模块

Kerberos authentication module with python

我有一个 python 程序可以访问 solr,尽管该服务受 kerberos 身份验证保护。我有 kerberos 模块,我找到了 http://python-notes.curiousefficiency.org/en/latest/python_kerberos.html

但我无法让它工作。有人知道吗?

我收到以下错误:

kerberos.authGSSClientStep(krb_context, "")

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
kerberos.GSSError: (('Unspecified GSS failure.  Minor code may provide more information', 851968), ('Cannot determine realm for numeric host address', -1765328141))

Cannot determine realm for numeric host address。我猜您正在使用没有领域的主体(例如:myuser 而不是 myuser@MYREALM.EXAMPLE.COM)并且您的 kerberos 服务器,您的 KDC,已被指定为 IP 地址。如果您出于某种原因确实需要使用 IP 地址,我认为您可以将其映射到您 krb5.conf 中的领域。或者只使用域名。

看到一些代码真的很有帮助。