如何在Python Elasticsearch下使用Kerberos?

发布于 2025-01-22 22:38:27 字数 577 浏览 2 评论 0 原文

我检查了 es 软件包使用我的kerberos令牌的方式。

我可以通过浏览器, curl curl -negotiate -U 来达到 es 请求带有 requests_kerberos (使用共同可选 config),但带有python elasticsearch软件包,调用简单 es.cat。 health()我得到 401 authenticationException ...

我的问题是:

  • 我在哪里错了,我想念什么?
  • 甚至有可能迫使ES Python Lib使用Kerberos还是在引擎盖下起作用?

提前致谢。

I checked the documentation of elasticsearch:7.x but still didn't find the way how I can force the python ES package to use my kerberos token.

I can reach the ES through a browser, curl ( curl --negotiate -u ) and requests with requests_kerberos ( with mutual OPTIONAL config ) but with the python elasticsearch package calling a simple es.cat.health() I get 401 AuthenticationException...

My questions are:

  • where was I wrong, what did I miss?
  • is it even possible to force the ES python lib to use kerberos or does it work under the hood?

Thanks in advance.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

简美 2025-01-29 22:38:27

看来我们已经找到了一个解决方案,但基本上不是来自文档。

我已经在文档中阅读了有关 elasticsearch 对象可以接收 http_auth 输入的,但不幸的是,我没有找到它的确切等待。

因此,您可以将 elasticsearch 强制使用 httpkerberosauth request> requests_kerberos lib以相同的方式使用,以便将其用于简单的获取请求>

es = Elasticsearch(<host>, http_auth=HTTPKerberosAuth(mutual_authentication=OPTIONAL))

它运行良好,但是欢迎任何其他建议,知识共享或评论。

It seems We've found a solution, but basically not from the docs.

I've read in the doc about the Elasticsearch object can receive http_auth input, but unfortunately I didn't find what it exactly waits for.

So, you can force the Elasticsearch to use the HTTPKerberosAuth class from the requests_kerberos lib in same way as you can use that for a simple get request >

es = Elasticsearch(<host>, http_auth=HTTPKerberosAuth(mutual_authentication=OPTIONAL))

It works well, but any other suggestions, knowledge share or comments are welcomed.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文