mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 17:59:23 -04:00
## Summary In this PR we: * Allow using JWT credentials to grant API keys * Extend default value of `elasticsearch.requestHeadersWhitelist` to include both `authorization` and `es-client-authentication` to support JWT with required client authentication _by default_. See https://www.elastic.co/guide/en/elasticsearch/reference/8.11/jwt-auth-realm.html#jwt-realm-configuration * Add API integration tests for both JWTs with client authentication and without it __NOTE:__ We're not gating this functionality with the config flag (`xpack.security.authc.http.jwt.taggedRoutesOnly`) as we did for the Serverless offering. It'd be a breaking change as we already implicitly support JWT authentication without client authentication, and to be honest, it's not really necessary anyway. ## Testing Refer to the `Testing` section in this PR description: https://github.com/elastic/kibana/pull/159117. Or run already pre-configured Kibana functional test server: 1. `node scripts/functional_tests_server.js --config x-pack/test/security_api_integration/api_keys.config.ts` 2. Create a role mapping for JWT user: ```bash curl -X POST --location "http://localhost:9220/_security/role_mapping/jwt" \ -H "Authorization: Basic ZWxhc3RpYzpjaGFuZ2VtZQ==" \ -H "Accept: application/json" \ -H "Content-Type: application/json" \ -d "{ \"roles\": [ \"superuser\" ], \"enabled\": true, \"rules\": { \"all\": [{\"field\" : { \"realm.name\" : \"jwt_with_secret\" }}] } }" ``` 3. Send any Kibana API request with the following credentials: ```bash curl -X POST --location "xxxx" -H 'Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJodHRwczovL2tpYmFuYS5lbGFzdGljLmNvL2p3dC8iLCJzdWIiOiJlbGFzdGljLWFnZW50IiwiYXVkIjoiZWxhc3RpY3NlYXJjaCIsIm5hbWUiOiJFbGFzdGljIEFnZW50IiwiaWF0Ijo5NDY2ODQ4MDAsImV4cCI6NDA3MDkwODgwMH0.P7RHKZlLskS5DfVRqoVO4ivoIq9rXl2-GW6hhC9NvTSkwphYivcjpTVcyENZvxTTvJJNqcyx6rF3T-7otTTIHBOZIMhZauc5dob-sqcN_mT2htqm3BpSdlJlz60TBq6diOtlNhV212gQCEJMPZj0MNj7kZRj_GsECrTaU7FU0A3HAzkbdx15vQJMKZiFbbQCVI7-X2J0bZzQKIWfMHD-VgHFwOe6nomT-jbYIXtCBDd6fNj1zTKRl-_uzjVqNK-h8YW1h6tE4xvZmXyHQ1-9yNKZIWC7iEaPkBLaBKQulLU5MvW3AtVDUhzm6--5H1J85JH5QhRrnKYRon7ZW5q1AQ' -H 'ES-Client-Authentication: SharedSecret my_super_secret' ....for example.... curl -X GET --location "http://localhost:5620/internal/security/me" \ -H 'Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJodHRwczovL2tpYmFuYS5lbGFzdGljLmNvL2p3dC8iLCJzdWIiOiJlbGFzdGljLWFnZW50IiwiYXVkIjoiZWxhc3RpY3NlYXJjaCIsIm5hbWUiOiJFbGFzdGljIEFnZW50IiwiaWF0Ijo5NDY2ODQ4MDAsImV4cCI6NDA3MDkwODgwMH0.P7RHKZlLskS5DfVRqoVO4ivoIq9rXl2-GW6hhC9NvTSkwphYivcjpTVcyENZvxTTvJJNqcyx6rF3T-7otTTIHBOZIMhZauc5dob-sqcN_mT2htqm3BpSdlJlz60TBq6diOtlNhV212gQCEJMPZj0MNj7kZRj_GsECrTaU7FU0A3HAzkbdx15vQJMKZiFbbQCVI7-X2J0bZzQKIWfMHD-VgHFwOe6nomT-jbYIXtCBDd6fNj1zTKRl-_uzjVqNK-h8YW1h6tE4xvZmXyHQ1-9yNKZIWC7iEaPkBLaBKQulLU5MvW3AtVDUhzm6--5H1J85JH5QhRrnKYRon7ZW5q1AQ' \ -H 'ES-Client-Authentication: SharedSecret my_super_secret' \ -H "Accept: application/json" ---- { "username": "elastic-agent", "roles": [ "superuser" ], "full_name": null, "email": null, "metadata": { "jwt_claim_sub": "elastic-agent", "jwt_token_type": "access_token", "jwt_claim_iss": "https://kibana.elastic.co/jwt/", "jwt_claim_name": "Elastic Agent", "jwt_claim_aud": [ "elasticsearch" ] }, "enabled": true, "authentication_realm": { "name": "jwt_with_secret", "type": "jwt" }, "lookup_realm": { "name": "jwt_with_secret", "type": "jwt" }, "authentication_type": "realm", "authentication_provider": { "type": "http", "name": "__http__" }, "elastic_cloud_user": false } ``` __Fixes:__ https://github.com/elastic/kibana/issues/171522 ---- Release note: The default value of the `elasticsearch.requestHeadersWhitelist` configuration option has been expanded to include the `es-client-authentication` HTTP header, in addition to `authorization`. --------- Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com> |
||
---|---|---|
.. | ||
kibana.yml | ||
node.options | ||
README.md | ||
serverless.es.yml | ||
serverless.oblt.yml | ||
serverless.security.yml | ||
serverless.yml |
as work on serverless picks up we will add config values to these files that
define how Kibana will run in "serverless" modes. To start Kibana locally with
this configuration, pass --serverless={mode}
or run yarn serverless-{mode}
valid modes are currently: es
, oblt
, and security
configuration is applied in the following order, later values override
- serverless.yml (serverless configs go first)
- serverless.{mode}.yml (serverless configs go first)
- base config, in this preference order:
- my-config.yml(s) (set by --config)
- env-config.yml (described by
env.KBN_CONFIG_PATHS
) - kibana.yml (default @
env.KBN_PATH_CONF
/kibana.yml)
- kibana.dev.yml
- serverless.dev.yml
- serverless.{mode}.dev.yml