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.

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.

  1. Download the Keycloak from their official website. This guide will use keycloak docker image

  2. Run Keycloak: run docker run -e KEYCLOAK_USER= -e KEYCLOAK_PASSWORD= jboss/keycloak where USERNAME and PASSWORD are credentials for your admin account

  3. log in as admin

  4. 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.

keycloak_screenshot

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

keycloak_screenshot

Then, configure the OpenID Connect (OIDC) client

keycloak_screenshot

kibana.yml (without ssl enabled)

To verify all OpenID Endpoint Configuration-based, you can open OpenID Endpoint Configuration page in the kibana realm

keycloak_screenshot

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

keycloak_screenshot

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:

Last updated

Was this helpful?