如何使用 PKI 身份验证来使用 Opensearch Dashboards API?

我正在尝试使用 OpenSearch Dashboards API(Amazon Kibana fork)来添加搜索索引。我使用的是 1.0 版,并且还设置了安全插件。我在使用 TLS PKI 与 OpenSearch (Elasticsearch) 交互时没有任何问题。但是,每当我尝试使用 TLS PKI 身份验证与 OpenSearch Dashboard API 交互时,都会收到错误消息。我能够在 Dashboards 中设置 PKI 以对 OpenSearch 进行身份验证,没有任何问题。这是使用 curl 在 shell 上的有效命令,但我希望在完成后使用 python:

curl -X POST --cert MYCERT.crt --key MYKEY.key --cacert MY-CA-BUNDLE.crt https://HOSTNAME:5601/api/saved_objects/index-pattern/test-index -H 'kbn-xsrf: true' -H 'Content-Type: application/json' -d'  { "attributes": {  "title": "test-index-*","timeFieldName": "@timestamp"  } }'

我收到以下 JSON 消息错误:

{"statusCode":401,"error":"Unauthorized","message":"Authentication required"}

如果我改为使用带有“简单”用户名/密码的 API,同样的命令会起作用:

curl -X POST -u username:PASSWORD https://HOSTNAME:5601/api/saved_objects/index-pattern/test-index -H 'kbn-xsrf: true' -H 'Content-Type: application/json' -d'  { "attributes": {  "title": "test-index-*","timeFieldName": "@timestamp"  } }'

但是,我似乎无法找到一种方法来允许我的 ansible 使用 PKI 证书向 API 发出命令,我正在寻找这样做,以便我可以禁用简单的身份验证。有谁知道我缺少什么设置或者我是否滥用 API?我已经研究了插件文档,但我找不到任何我遗漏的项目。

YUEYOUJING 回答:如何使用 PKI 身份验证来使用 Opensearch Dashboards API?

暂时没有好的解决方案,如果你有好的解决方案,请发邮件至:iooj@foxmail.com
本文链接:https://www.f2er.com/13758.html

大家都在问