Link Search Menu Expand Document Documentation Menu

OpenID Connect 故障排除

本页面包含使用 OpenID Connect 与安全插件进行故障排除的步骤。


目录


将日志级别设置为 debug

为帮助排查 OpenID Connect,请在 OpenSearch 上将日志级别设置为 debug。在 config/log4j2.properties 中添加以下行并重启节点

logger.securityjwt.name = com.amazon.dlic.auth.http.jwt
logger.securityjwt.level = trace

此设置会在日志文件中打印大量有用信息。如果这些信息不足,您还可以将日志级别设置为 trace

“尝试从 IdP 获取端点失败”

此错误表示安全插件无法访问 IdP 的元数据端点。在 opensearch_dashboards.yml 中,检查以下设置

plugins.security.openid.connect_url: "http://keycloak.example.com:8080/auth/realms/master/.well-known/openid-configuration"

如果此错误发生在 OpenSearch 上,请在 config.yml 中检查以下设置

openid_auth_domain:
  enabled: true
  order: 1
  http_authenticator:
    type: "openid"
    ...
    config:
      openid_connect_url: http://keycloak.examplesss.com:8080/auth/realms/master/.well-known/openid-configuration
    ...

“ValidationError: 子项 ‘opensearch_security’ 失败”

这表示 OpenSearch Dashboards 的一个或多个配置设置缺失。

检查 opensearch_dashboards.yml 并确保您已设置以下最低配置

plugins.security.openid.connect_url: "..."
plugins.security.openid.client_id: "..."
plugins.security.openid.client_secret: "..."

“认证失败。请提供新的令牌。”

此错误可能有多种根本原因。

残留的 Cookie 或缓存的凭据

请删除所有缓存的浏览器数据,或在隐私浏览窗口中重试。

客户端密钥错误

为了将访问令牌交换为身份令牌,大多数 IdP 要求您提供客户端密钥。检查 opensearch_dashboards.yml 中的客户端密钥是否与您的 IdP 配置的客户端密钥匹配

plugins.security.openid.client_secret: "..."

“从 JWT 声明中获取主题失败”

此错误记录在 OpenSearch 上,表示无法从 ID 令牌中提取用户名。确保以下设置与您的 IdP 颁发的 JWT 中的声明匹配

openid_auth_domain:
  enabled: true
  order: 1
  http_authenticator:
    type: "openid"
    ...
    config:
      subject_key: <subject key>
    ...

“使用 roles_key 从 JWT 声明中获取角色失败”

此错误表示您在 config.yml 中配置的角色密钥在您的 IdP 颁发的 JWT 中不存在。确保以下设置与您的 IdP 颁发的 JWT 中的声明匹配

openid_auth_domain:
  enabled: true
  order: 1
  http_authenticator:
    type: "openid"
    ...
    config:
      roles_key: <roles key>
    ...