> For the complete documentation index, see [llms.txt](https://mariadb.com/docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://mariadb.com/docs/tools/enterprise/control-center/admin-guide/open-id/kerberos-authentication.md).

# How to Authenticate to Control Center With Kerberos

Set up GridGain 8 Control Center to authenticate users with Kerberos through Keycloak, using OAuth2, a KDC, and browser SPNEGO.

## Prerequisites

* A running [**Keycloak**](https://www.keycloak.org/) server
* A **Kerberos** KDC and realm, or the ability to create one
* A [**GridGain 8 Control Center**](https://mariadb.com/docs/tools/enterprise/control-center.md) instance

## Overview

This guide walks you through setting up [Control Center](https://mariadb.com/docs/tools/enterprise/control-center.md) to use [Kerberos authentication](https://www.fortinet.com/resources/cyberglossary/kerberos-authentication#:~:text=Kerberos%20authentication%20allows%20service%20systems,are%20interacting%20with%20are%20authentic) with [Keycloak](https://www.keycloak.org/).

![Kerberos authentication architecture](https://2850516351-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FkuTXWg0NDbRx6XUeYpGD%2Fuploads%2Fgit-blob-f67235c54fcc49a5e405641e0d6330ca74cab530%2Fauth-architecture.png?alt=media)

This guide uses the following software versions:

* Control Center 2023.3
* Keycloak 19.0.2
* Kerberos 5 1.19.2

The setup has five steps:

1. [Configure Control Center to use OAuth2 Keycloak authentication](#configure-control-center-to-use-oauth2-keycloak-authentication)
2. [Set up Kerberos server on Ubuntu](#set-up-kerberos-server-on-ubuntu)
3. [Create Kerberos principals](#create-kerberos-principals)
4. [Configure Keycloak to log in with a Kerberos ticket](#configure-keycloak-to-log-in-with-a-kerberos-ticket)
5. [Sign in to Control Center with the Kerberos user](#sign-in-to-control-center-with-the-kerberos-user)

## Configure Control Center to use OAuth2 Keycloak Authentication

1. Open the **Keycloak Administration console** in your browser and log in as administrator.
2. Create the `gridgain` realm:
   1. Initiate realm creation.

      ![Initiate realm creation](https://2850516351-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FkuTXWg0NDbRx6XUeYpGD%2Fuploads%2Fgit-blob-444f7b57af9336c8d5b08323b72a220d0fe22447%2Fscreen-7.png?alt=media)
   2. Enter the name "gridgain" and save the new realm.

      ![Save the new realm](https://2850516351-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FkuTXWg0NDbRx6XUeYpGD%2Fuploads%2Fgit-blob-6b3a1d41680bc49806e65e91df37b6d5f2e3f371%2Fscreen-8.png?alt=media)
3. Create the `control-center` client:
   1. Initiate client creation.

      ![Initiate client creation](https://2850516351-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FkuTXWg0NDbRx6XUeYpGD%2Fuploads%2Fgit-blob-96ca006c4cc56a45e761102549a6ec23a032cdb3%2Fscreen-9.png?alt=media)
   2. Enter the values as they appear in the screenshot below and click **Next**.

      ![Enter client values](https://2850516351-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FkuTXWg0NDbRx6XUeYpGD%2Fuploads%2Fgit-blob-e1aba33969a4b505b1ec740fc5b01754cda2be20%2Fscreen-10.png?alt=media)
   3. Enter the values as they appear in the screenshot below and click **Save**.

      ![Enter client values and save](https://2850516351-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FkuTXWg0NDbRx6XUeYpGD%2Fuploads%2Fgit-blob-3de218568e01839c2805bee1b4fb8679b3c28f7e%2Fscreen-11.png?alt=media)
4. On the **Client Details** page, define access settings for the client you have created. Use your actual Control Center host address and port number.

   ![Client Details access settings](https://2850516351-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FkuTXWg0NDbRx6XUeYpGD%2Fuploads%2Fgit-blob-da921d7f1cd482ef589a28a2b3a825f1ebc66c4e%2Fscreen-12.png?alt=media)

   * Root URL: http\://\[cc-host]:\[cc-port]
   * Home URL: http\://\[cc-host]:\[cc-port]/api/v1/oauth2/login/keycloak
   * Valid Redirect URIs: http\://\[cc-host]:\[cc-port]/\*
5. On the **Credentials** tab, copy **Client secret**, which is required to set up the Control Center connection to Keycloak.

   ![Copy the client secret](https://2850516351-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FkuTXWg0NDbRx6XUeYpGD%2Fuploads%2Fgit-blob-8a0e2f8b561313d861c34cad0f460b1d00340b42%2Fscreen-13.png?alt=media)
6. Click the **OpenID endpoint configuration** link on the **Realm Settings** page.

   ![OpenID endpoint configuration link](https://2850516351-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FkuTXWg0NDbRx6XUeYpGD%2Fuploads%2Fgit-blob-a1d646e484bb990d172ac29849e0a20f540f1c3a%2Fscreen-14.png?alt=media)
7. On the page that opens, define the following settings.

   ![Define endpoint settings](https://2850516351-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FkuTXWg0NDbRx6XUeYpGD%2Fuploads%2Fgit-blob-bec568daa54fd358a2d49f8b8b211161703d0afc%2Fscreen-15.png?alt=media)
8. Create a new Control Center user:
   1. Initiate user creation.

      ![Initiate user creation](https://2850516351-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FkuTXWg0NDbRx6XUeYpGD%2Fuploads%2Fgit-blob-8ea8a8d5a285821123eb083eb8ddd9e584e6fd7a%2Fscreen-16.png?alt=media)
   2. Enter the values as they appear in the screenshot below and click **Create**.

      ![Enter user values and create](https://2850516351-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FkuTXWg0NDbRx6XUeYpGD%2Fuploads%2Fgit-blob-9afed4c7506a9460531c39be47cd21fc8c4deefd%2Fscreen-17.png?alt=media)
9. Manually set up a password for `cc-user`:

   1. Initiate the **Set password** procedure.

      ![Initiate the set password procedure](https://2850516351-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FkuTXWg0NDbRx6XUeYpGD%2Fuploads%2Fgit-blob-35f5bf1803deca4c665cfb9009c7beabcde80235%2Fscreen-18.png?alt=media)
   2. Enter the required password and click **Save**.

      ![Enter password and save](https://2850516351-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FkuTXWg0NDbRx6XUeYpGD%2Fuploads%2Fgit-blob-e863d679f16ca30a4e31555d54d21505e92fe28e%2Fscreen-19.png?alt=media)

   You can now authenticate to Control Center as `cc-user` with the password you created in the previous step.
10. Edit the Control Center's `application.yaml` configuration. Use the values from step 5 and step 7 above. Replace `[kc-url]` with the actual Keycloak network address.

    ```yaml
    spring.security.oauth2.client:
      registration:
        keycloak:
          client-id: control-center
          client-secret: <secret>
          scope: openid, profile, roles
      provider:
        keycloak:
          authorization-uri: http://[kc-url]/realms/gridgain/protocol/openid-connect/auth
          token-uri: http://[kc-url]/realms/gridgain/protocol/openid-connect/token
          jwk-set-uri: http://[kc-url]/realms/gridgain/protocol/openid-connect/certs
    ```

## Set up Kerberos Server on Ubuntu

1. Install the Key Distribution Center and Kerberos Admin Service:

   ```bash
   $ sudo apt install krb5-admin-server krb5-kdc
   ```

   During installation, set the following properties:

   * Default realm: `EXAMPLE.COM`
   * Kerberos server: `kdc.example.com`
   * Admin server: `kdc.example.com`
2. Create a realm:

   ```bash
   $ sudo krb5_newrealm
   ```

## Create Kerberos Principals

1. Create a new principal to be used by Keycloak:

   ```bash
   $ sudo kadmin.local -q 'addprinc -randkey HTTP/kdc.example.com@EXAMPLE.COM'
   ```
2. Generate the principal keytab file:

   ```bash
   $ sudo kadmin.local -q 'ktadd -k /tmp/http.keytab HTTP/kdc.example.com@EXAMPLE.COM'
   ```
3. Place the `http.keytab` file on the Keycloak machine locally.
4. Create a principal and keytab to be used by Control Center:

   ```bash
   $ sudo kadmin.local -q 'addprinc -randkey krb-user@EXAMPLE.COM'
   $ sudo kadmin.local -q 'ktadd -k /tmp/krb-user.keytab krb-user@EXAMPLE.COM'
   ```

## Configure Keycloak to log in With a Kerberos Ticket

1. Select the `gridgain` realm and go to **User Federation**.

   ![Select the gridgain realm and open User Federation](https://2850516351-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FkuTXWg0NDbRx6XUeYpGD%2Fuploads%2Fgit-blob-e5f81c898841ce1cec31a0980dbe6e22848f1603%2Fscreen-1.png?alt=media)
2. Add the **Kerberos** provider and click **Save**.

   ![Add the Kerberos provider](https://2850516351-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FkuTXWg0NDbRx6XUeYpGD%2Fuploads%2Fgit-blob-76c5ac7188e37d26331ce25de8ae46f9851f84f0%2Fscreen-2.png?alt=media)
3. From the side menu, select **Authentication**.

   ![Select Authentication](https://2850516351-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FkuTXWg0NDbRx6XUeYpGD%2Fuploads%2Fgit-blob-fc3df8280f560e6016681b1fc8601f86b65e1f95%2Fscreen-3.png?alt=media)
4. Add **Kerberos** as an alternative step to the **Browser** flow.

   ![Add Kerberos as an alternative step to the Browser flow](https://2850516351-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FkuTXWg0NDbRx6XUeYpGD%2Fuploads%2Fgit-blob-a73a2f856271849f3ba332afba925870a7f26d24%2Fscreen-4.png?alt=media)

## Sign in to Control Center With the Kerberos User

1. Install the Kerberos client on the client side (if not already installed):

   ```bash
   $ sudo apt install krb5-user
   ```

   During installation, configure the realm host.
2. Authenticate to Kerberos as `krb-user` with the keytab you created in step 3.3:

   ```bash
   $ kinit -kt /tmp/krb-user.keytab krb-user@EXAMPLE.COM
   ```
3. Check whether the Kerberos tickets have been successfully granted by the KDC:

   ```bash
   $ klist
   ```

   The response should be:

   ```
   Ticket cache: FILE:/tmp/krb5cc_1000

   Default principal: krb-user@EXAMPLE.COM

   Valid starting       Expires              Service principal

   10/16/2022 12:19:10  10/16/2022 22:19:10  krbtgt/EXAMPLE.COM@EXAMPLE.COM

   renew until 10/17/2022 12:19:09
   ```
4. Launch your browser (Chrome in this guide) with SPNEGO enabled to allow Kerberos authentication with Keycloak:

   ```bash
   $ /usr/bin/google-chrome-stable --auth-server-whitelist="*.example.com" --auth-negotiate-delegate-whitelist="*.example.com"
   ```
5. Open Control Center in the browser and select the **Sign in to your account with OpenID** option.

   ![Sign in with OpenID](https://2850516351-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FkuTXWg0NDbRx6XUeYpGD%2Fuploads%2Fgit-blob-0d1316f2ea5c1161e231ff59bb49cb5ddd5ef88e%2Fscreen-5.png?alt=media)

   Authentication with the Kerberos principal is performed automatically.

   ![Authentication with the Kerberos principal](https://2850516351-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FkuTXWg0NDbRx6XUeYpGD%2Fuploads%2Fgit-blob-b435a09d381fd57847f4d7a706f572e02c6e9dc1%2Fscreen-6.png?alt=media)

## Related

* [Keycloak documentation](https://www.keycloak.org/docs/latest/server_admin/index.html#_kerberos) - Configuring Kerberos user federation in Keycloak.
* [OpenID Connect Authentication](https://mariadb.com/docs/tools/enterprise/control-center/admin-guide/open-id.md) - Setting up OpenID Connect authentication in Control Center.

<sub>*This page is: Copyright © 2026 MariaDB. All rights reserved.*</sub>

{% @marketo/form formId="4316" %}
