Open Distro Elasticsearch - 使用 JWT 向 Kibana 进行身份验证

Open Distro Elasticsearch - Authenticate to Kibana with JWT

我可以获得 open distro 运行 基本身份验证(使用内部用户数据库),现在我需要使用 JWT 令牌对 Kibana 仪表板进行身份验证。

Elasticsearch 配置:

     basic_internal_auth_domain:
        http_enabled: false
        transport_enabled: true
        order: 4
        http_authenticator:
          type: basic
          challenge: true
        authentication_backend:
          type: intern
      proxy_auth_domain:
        http_enabled: false
        transport_enabled: false
        order: 3
        http_authenticator:
          type: proxy
          challenge: false
          config:
            user_header: "x-proxy-user"
            roles_header: "x-proxy-roles"
        authentication_backend:
          type: noop
      jwt_auth_domain:
        enabled: true
        http_enabled: true
        transport_enabled: true
        order: 0
        http_authenticator:
          type: jwt
          challenge: false
          config:
            signing_key: "EdzdXd5weiuSVFyddfjhjhfjjchJGRrZmpkayZPUA=="
            jwt_header: "Authorization"
            jwt_url_parameter: "token"
            roles_key: "roles"
            subject_key: "sub"
        authentication_backend:
          type: noop

Kibana 配置:

server.name: kibana
server.port: 5601
server.host: "127.0.0.1"

elasticsearch.url: https://127.0.0.1:9200
elasticsearch.ssl.verificationMode: none
elasticsearch.username: kibanaserver
elasticsearch.password: kibanaserver
elasticsearch.requestHeadersWhitelist: ["securitytenant","Authorization"]

opendistro_security.auth.type: "jwt"
opendistro_security.jwt.url_param: token

opendistro_security.multitenancy.enabled: true
opendistro_security.multitenancy.tenants.preferred: ["Private", "Global"]
opendistro_security.readonly_mode.roles: ["kibana_read_only"]

此后,当我打开 http://localhost:5601?token=dfkhdfjdfhdjfhdhfkhdjfhjdhfjdhffdjhfdjhf 时,身份验证失败,elasticsearch 日志显示此消息 -

[c.a.o.s.h.HTTPBasicAuthenticator] [node-1] No 'Basic Authorization' header, send 401 and 'WWW-Authenticate Basic'

我已经完全按照文档进行操作,但目前互联网上的内容很少 material,我猜大多数人仍处于 POC 阶段。有什么建议吗?

那些正在寻找答案的人 - 我的 JWT 令牌是错误的,请确保根据您的服务器时间而不是您的本地时间配置 "iat"、"nbf" 和 "exp" .