Loading...
Loading...
Compare original and translation side by side
Deployment note: Not all realms are available on every deployment type. See Deployment Compatibility for self-managed vs. ECH vs. Serverless details.
部署说明: 并非所有领域都适用于每种部署类型。有关自托管、ECH和无服务器的详细信息,请查看 部署兼容性。
ELASTICSEARCH_PASSWORDELASTICSEARCH_API_KEY.env.env.envexportELASTICSEARCH_PASSWORDELASTICSEARCH_API_KEY.env.env.envexport_authenticate_authenticate| Item | Description |
|---|---|
| Elasticsearch URL | Cluster endpoint (e.g. |
| Credentials | Depends on the realm — see the methods below |
| Realms configured | Authentication realms and their identity backends must already be configured (realm chain, IdP, LDAP/AD, Kerberos, PKI/TLS) |
.env.env| 项 | 描述 |
|---|---|
| Elasticsearch URL | 集群端点(如 |
| 凭据 | 取决于领域——请参阅下方的方法 |
| 领域已配置 | 身份验证领域及其身份后端必须已完成配置(领域链、IdP、LDAP/AD、Kerberos、PKI/TLS) |
.env.envcurl -u "${ELASTICSEARCH_USERNAME}:${ELASTICSEARCH_PASSWORD}" "${ELASTICSEARCH_URL}/_security/_authenticate"curl -u "${ELASTICSEARCH_USERNAME}:${ELASTICSEARCH_PASSWORD}" "${ELASTICSEARCH_URL}/_security/_authenticate"elasticsearch-userscurl -u "${FILE_USER}:${FILE_PASSWORD}" "${ELASTICSEARCH_URL}/_security/_authenticate"elasticsearch-userscurl -u "${FILE_USER}:${FILE_PASSWORD}" "${ELASTICSEARCH_URL}/_security/_authenticate"curl -u "${LDAP_USER}:${LDAP_PASSWORD}" "${ELASTICSEARCH_URL}/_security/_authenticate"curl -u "${LDAP_USER}:${LDAP_PASSWORD}" "${ELASTICSEARCH_URL}/_security/_authenticate"sAMAccountNamecurl -u "${AD_USER}:${AD_PASSWORD}" "${ELASTICSEARCH_URL}/_security/_authenticate"sAMAccountNamecurl -u "${AD_USER}:${AD_PASSWORD}" "${ELASTICSEARCH_URL}/_security/_authenticate"curl --cert "${CLIENT_CERT}" --key "${CLIENT_KEY}" --cacert "${CA_CERT}" \
"${ELASTICSEARCH_URL}/_security/_authenticate"curl --cert "${CLIENT_CERT}" --key "${CLIENT_KEY}" --cacert "${CA_CERT}" \
"${ELASTICSEARCH_URL}/_security/_authenticate"elasticsearch.ymlelasticsearch.ymlelasticsearch.ymlPOST /_security/oidc/authenticateelasticsearch.ymlPOST /_security/oidc/authenticateelasticsearch.ymlid_tokenaccess_tokencurl -H "Authorization: Bearer ${JWT_TOKEN}" "${ELASTICSEARCH_URL}/_security/_authenticate"id_tokenaccess_tokenelasticsearch.ymlid_tokenaccess_tokencurl -H "Authorization: Bearer ${JWT_TOKEN}" "${ELASTICSEARCH_URL}/_security/_authenticate"kinit "${KERBEROS_PRINCIPAL}"
curl --negotiate -u : "${ELASTICSEARCH_URL}/_security/_authenticate"--negotiate-u :kinitkinit "${KERBEROS_PRINCIPAL}"
curl --negotiate -u : "${ELASTICSEARCH_URL}/_security/_authenticate"--negotiate-u :kinitAuthorizationcurl -H "Authorization: ApiKey ${ELASTICSEARCH_API_KEY}" "${ELASTICSEARCH_URL}/_security/_authenticate"ELASTICSEARCH_API_KEYencodedid:api_keyAuthorizationcurl -H "Authorization: ApiKey ${ELASTICSEARCH_API_KEY}" "${ELASTICSEARCH_URL}/_security/_authenticate"ELASTICSEARCH_API_KEYencodedid:api_keycurl <auth_flags> "${ELASTICSEARCH_URL}/_security/_authenticate"usernamerolesauthentication_realm.type | Realm |
|---|---|
| Native |
| File |
| LDAP |
| Active Directory |
| PKI |
| SAML |
| OpenID Connect |
| JWT |
| Kerberos |
authentication_type"api_key"curl <auth_flags> "${ELASTICSEARCH_URL}/_security/_authenticate"usernamerolesauthentication_realm.type | 领域 |
|---|---|
| 原生 |
| 文件 |
| LDAP |
| Active Directory |
| PKI |
| SAML |
| OpenID Connect |
| JWT |
| Kerberos |
authentication_type"api_key"curl -X POST "${ELASTICSEARCH_URL}/_security/api_key" \
<auth_flags> \
-H "Content-Type: application/json" \
-d '{
"name": "'"${KEY_NAME}"'",
"expiration": "30d",
"role_descriptors": {
"'"${ROLE_NAME}"'": {
"cluster": [],
"indices": [
{
"names": ["'"${INDEX_PATTERN}"'"],
"privileges": ["read"]
}
]
}
}
}'idapi_keyencodedencodedrole_descriptorsLimitation: An API key cannot create another API key with privileges. The derived key is created with no effective access. Usewith user credentials instead.POST /_security/api_key/grant
curl -X POST "${ELASTICSEARCH_URL}/_security/api_key" \
<auth_flags> \
-H "Content-Type: application/json" \
-d '{
"name": "'"${KEY_NAME}"'",
"expiration": "30d",
"role_descriptors": {
"'"${ROLE_NAME}"'": {
"cluster": [],
"indices": [
{
"names": ["'"${INDEX_PATTERN}"'"],
"privileges": ["read"]
}
]
}
}
}'idapi_keyencodedencodedrole_descriptors限制: API密钥无法创建具有权限的其他API密钥。派生密钥创建时没有有效访问权限。请改用用户凭据或。POST /_security/api_key/grant
curl "${ELASTICSEARCH_URL}/_security/api_key?name=${KEY_NAME}" <auth_flags>
curl -X DELETE "${ELASTICSEARCH_URL}/_security/api_key" \
<auth_flags> \
-H "Content-Type: application/json" \
-d '{"name": "'"${KEY_NAME}"'"}'curl "${ELASTICSEARCH_URL}/_security/api_key?name=${KEY_NAME}" <auth_flags>
curl -X DELETE "${ELASTICSEARCH_URL}/_security/api_key" \
<auth_flags> \
-H "Content-Type: application/json" \
-d '{"name": "'"${KEY_NAME}"'"}'metrics-*POST /_security/api_key
{
"name": "metrics-reader-key",
"expiration": "90d",
"role_descriptors": {
"metrics-reader": {
"indices": [
{
"names": ["metrics-*"],
"privileges": ["read", "view_index_metadata"]
}
]
}
}
}metrics-*POST /_security/api_key
{
"name": "metrics-reader-key",
"expiration": "90d",
"role_descriptors": {
"metrics-reader": {
"indices": [
{
"names": ["metrics-*"],
"privileges": ["read", "view_index_metadata"]
}
]
}
}
}GET /_security/_authenticate{
"username": "joe",
"authentication_realm": { "name": "ldap1", "type": "ldap" },
"authentication_type": "realm"
}GET /_security/_authenticate{
"username": "joe",
"authentication_realm": { "name": "ldap1", "type": "ldap" },
"authentication_type": "realm"
}curl -H "Authorization: Bearer ${JWT_TOKEN}" "https://my-cluster:9200/_security/_authenticate"authentication_realm.type"jwt"curl -H "Authorization: Bearer ${JWT_TOKEN}" "https://my-cluster:9200/_security/_authenticate"authentication_realm.type"jwt"| Method | Best for | Trade-offs |
|---|---|---|
| Native user | Interactive use, simple setups | Password must be stored or prompted |
| File user | Disaster recovery, bootstrap | Must be configured on every node |
| API key | Programmatic access, CI/CD, scoped access | Cannot be retrieved after creation |
| LDAP / AD | Enterprise directory integration | Requires network access to directory server |
| PKI certificate | Service-to-service, mutual TLS environments | Requires PKI infrastructure and PKI realm |
| SAML | Kibana SSO via enterprise IdP | Browser-only; not for REST clients |
| OIDC | Kibana SSO via OpenID Connect provider | Browser-only; not for REST clients |
| JWT | Token-based service and user authentication | Requires external token issuer and realm config |
| Kerberos | Windows/enterprise Kerberos environments | Requires KDC, DNS, time sync infrastructure |
| 方法 | 最佳适用场景 | 权衡因素 |
|---|---|---|
| 原生用户 | 交互式使用、简单设置 | 密码必须存储或提示输入 |
| 文件用户 | 灾难恢复、引导配置 | 必须在每个节点上配置 |
| API密钥 | 程序化访问、CI/CD、范围受限访问 | 创建后无法再次检索 |
| LDAP / AD | 企业目录集成 | 需要与目录服务器的网络访问权限 |
| PKI证书 | 服务到服务、双向TLS环境 | 需要PKI基础设施和PKI领域 |
| SAML | 通过企业IdP实现Kibana单点登录 | 仅支持浏览器;不适用于REST客户端 |
| OIDC | 通过OpenID Connect提供商实现Kibana单点登录 | 仅支持浏览器;不适用于REST客户端 |
| JWT | 基于令牌的服务和用户身份验证 | 需要外部令牌颁发者和领域配置 |
| Kerberos | Windows/企业Kerberos环境 | 需要KDC、DNS、时间同步基础设施 |
elasticsuperuserelasticelasticsuperuserelasticPOST /_security/api_key/grantexpirationrole_descriptorsGET /_security/_authenticatechangemepassword123POST /_security/api_key/grantexpirationrole_descriptorsGET /_security/_authenticatechangemepassword123| Realm | Self-managed | ECH | Serverless |
|---|---|---|---|
| Native | Yes | Yes | Not available |
| File | Yes | Not available | Not available |
| LDAP | Yes | Not available | Not available |
| Active Directory | Yes | Not available | Not available |
| PKI | Yes | Limited | Not available |
| SAML | Yes | Yes (deployment config) | Organization-level |
| OIDC | Yes | Yes (deployment config) | Not available |
| JWT | Yes | Yes (deployment config) | Not available |
| Kerberos | Yes | Not available | Not available |
| API keys | Yes | Yes | Yes |
elasticsearch-userselastic| 领域 | 自托管 | ECH | 无服务器 |
|---|---|---|---|
| 原生 | 是 | 是 | 不可用 |
| 文件 | 是 | 不可用 | 不可用 |
| LDAP | 是 | 不可用 | 不可用 |
| Active Directory | 是 | 不可用 | 不可用 |
| PKI | 是 | 受限 | 不可用 |
| SAML | 是 | 是(部署配置) | 组织级 |
| OIDC | 是 | 是(部署配置) | 不可用 |
| JWT | 是 | 是(部署配置) | 不可用 |
| Kerberos | 是 | 不可用 | 不可用 |
| API密钥 | 是 | 是 | 是 |
elasticsearch-userselastic