【问题标题】:How to use PKI Authentication to use the Opensearch Dashboards API?如何使用 PKI 身份验证来使用 Opensearch Dashboards API?
【发布时间】:2021-10-05 11:06:15
【问题描述】:

我正在尝试使用 OpenSearch Dashboards API (Amazon Kibana fork) 添加搜索索引。我使用的是 1.0 版并且还设置了安全插件。我使用 TLS PKI 与 OpenSearch (Elasticsearch) 交互没有任何问题。但是,每当我尝试使用 TLS PKI 身份验证与 OpenSearch Dashboard API 交互时,都会收到错误消息。我能够在仪表板中设置 PKI 以向 OpenSearch 进行身份验证,而不会出现任何问题。下面是 shell 上使用 curl 的有效命令,但我希望在完成后使用 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?我研究了插件文档,但找不到任何我缺少的项目。

【问题讨论】:

    标签: kibana opensearch opensearch-dashboards opensearch-security-plugin


    【解决方案1】:

    您是否尝试过对 Opensearch 服务进行简单查询,例如:

    curl -XGET -k https://$(hostname):9200/ --key MYKEY.key --cert MYCERT.crt 
    

    如果这个不起作用,可能需要检查 opensearch.yml 文件中配置的证书。

    【讨论】:

    猜你喜欢
    • 2021-11-30
    • 2017-03-06
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-04-30
    • 2021-01-22
    • 2011-09-15
    • 2019-08-22
    相关资源
    最近更新 更多