Keycloak
OpenID Connect (OIDC) SSO Integration with Keycloak as an identity provider.
This document will guide you through the task of setting up an excellent, open-source identity provider (KeyCloak) to work as an external authenticator and authorizer system for your ELK stack. The scenario is the usual:
A centralised, large Elasticsearch cluster
A Kibana installation
We want one, centralised multi tenant Elasticsearch + Kibana;
But with some more enterprise requirements:
Users need to be able to change their passwords independently
Users need to verify their emails
Group managers need to be able to add, remove, block (only) their users.
Multi factor authentication (MFA) is a requirement.
What is Keycloak
Keycloak is an advanced authentication server that lets user administer their credentials, and speaks many authentication protocols, Including OpenID Connect (OIDC) SSO.
Setup KeyCloak
This tutorial was created using KeyCloak 14.0.0.
Download the Keycloak from their official website. This guide will use keycloak docker image
Run Keycloak: run docker run -e KEYCLOAK_USER= -e KEYCLOAK_PASSWORD= jboss/keycloak where USERNAME and PASSWORD are credentials for your admin account
log in as admin
Follow the explanation below, or (if your KC version is the same or close enough to this) use the import function to load this configuration file
If you imported the JSON file, you should have a "ror" realm, and an OpenID Connect (OIDC) client called "ror_oidc" (keep this ID or change the "clientID" setting in kibana.yml). Please now select "ror" realm, navigate to "clients", click "ror_oidc" client and double-check everything matches with your use case, as this guide assumes both Kibana, Elasticsearch, and Keycloak are running on "localhost".
Configure Keycloak to work with ROR
First, we want to create a new dedicated "ror" realm, so we don't interfere with any other use of this Keycloak installation.

Then, let's create an OpenId Connect client for this realm:

Then, configure the OpenID Connect (OIDC) client

kibana.yml (without ssl enabled)
To verify all OpenID Endpoint Configuration-based, you can open OpenID Endpoint Configuration page in the kibana realm

To provide clientSecret value, you need to open ror_oidc client (or your custom client name)

Setup Elasticsearch with ReadonlyREST
Our elasticsearch can be run with or without SSL. To make it available on HTTPS (more detailed info in our documentation), so we modify the elasticsearch.yml
append to elasticsearch.yml
Write in readonlyrest.yml
There are three rule types available, depending on what you want to achieve:
ror_kbn_authentication (handles only authentication)
ror_kbn_authorization (handles only authorization)
ror_kbn_auth (authentication + authorization in a single rule)
Last updated
Was this helpful?