[Serverless] Allow authentication via the Elasticsearch JWT realm with the shared_secret
client authentication type.
#161564
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
In this pull request, we are removing a temporary workaround that enabled the collection of extended Kibana metrics anonymously. Now, the agents authenticate to Kibana via JWT in order to collect the metrics. To support this type of client credentials, Kibana needs to forward the
Es-Client-Authentication
HTTP header with a shared secret to Elasticsearch during authentication. By default, Kibana forwards onlyAuthorization
header by default.NOTE: Right now Kibana doesn't need to support JWT authentication outside of Serverless, but eventually we might extend the default value of
elasticsearch.requestHeadersWhitelist
to includeEs-Client-Authentication
.Testing
Generate keys
NOTE: Test keys mentioned here aren't secret and already publicly exposed.
JWKS (for
xpack.security.authc.realms.jwt.jwt1.pkc_jwkset_path
)Public key
Private key
Generate JWT
eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJodHRwczovL2tpYmFuYS5lbGFzdGljLmNvL2p3dC8iLCJzdWIiOiJhbGVoLnphc3lwa2luQGVsYXN0aWMuY28iLCJhdWQiOiJlbGFzdGljc2VhcmNoIiwibmFtZSI6IkFsZWggWmFzeXBraW4iLCJpYXQiOjk0NjY4NDgwMCwiZXhwIjo0MDcwOTA4ODAwfQ.LBwLDK4CCYHjtmWZ_J0IwKP6BQjH-8LbKUu1Obj2bUAtZcGVrnO_pY1JXCG582BLegq8_RrlxZ0C8GKN-kvuFt7okPEkMqfT6yCi_gt271Xzlbe01IT6DX5WRm7nT6mjNI4USndemquxl0NxHCm07azKD4MUsYIlgp_YW14ZKmHn4fJW0qgDgt4CeRkLQm5QE--rZ7VnlOFvaAsIlC7bLHHvhj_ntMSraFJEXc1JE7va8QX_D6cXpHbszGjnm9G928gJ24XVjUqXuR23yDNcc6socTPbq8WO9tj67cknCZG1An1wtefDOOKiqMKhrHPvBz9eT1CnOm57l63K8LvulQ
Run ES
$ yarn es snapshot --license trial \ -E xpack.security.authc.token.enabled=true \ -E xpack.security.authc.realms.native.native1.order=0 \ -E xpack.security.authc.realms.jwt.jwt1.order=1 \ -E xpack.security.authc.realms.jwt.jwt1.token_type=access_token \ -E xpack.security.authc.realms.jwt.jwt1.client_authentication.type=shared_secret \ -E xpack.security.authc.realms.jwt.jwt1.client_authentication.shared_secret=my_super_secret \ -E xpack.security.authc.realms.jwt.jwt1.allowed_issuer=https://kibana.elastic.co/jwt/ \ -E xpack.security.authc.realms.jwt.jwt1.allowed_subjects=aleh.zasypkin@elastic.co \ -E xpack.security.authc.realms.jwt.jwt1.allowed_audiences=elasticsearch \ -E xpack.security.authc.realms.jwt.jwt1.allowed_signature_algorithms=[RS256] \ -E xpack.security.authc.realms.jwt.jwt1.claims.principal=sub \ -E xpack.security.authc.realms.jwt.jwt1.pkc_jwkset_path=/.../jwks.json <--- CHANGE PATH
Run Kibana
Authenticate with JWT
Elasticsearch endpoint
Kibana endpoint
cc @lukeelmers @elastic/kibana-security