Enable RBAC in Kong Manager

Enable role-based access control (RBAC) to secure Kong Manager. When RBAC is enabled, Kong Manager will no longer be publicly accessible, and users will need to log in to Kong Manager.

To enable RBAC, you will need the initial KONG_PASSWORD that was used when you first installed Kong Gateway and ran migrations. This is also the default password for the Super Admin, and will be required once RBAC is on.

UNIX-based system or Windows

Docker

  1. Modify configuration settings below in your kong.conf file. Navigate to the file at /etc/kong/kong.conf:

    1. cd /etc/kong/
  2. Copy the kong.conf.default file so you know you have a working copy to fall back to.

    1. cp kong.conf.default kong.conf
  3. Now, edit the following settings in kong.conf:

    1. echo >> enforce_rbac = on >> /etc/kong/kong.conf
    2. echo >> admin_gui_auth = basic-auth >> /etc/kong.conf
    3. echo >> admin_gui_session_conf = {"secret":"secret","storage":"kong","cookie_secure":false}”

    This turns on RBAC, tells Kong Gateway to use basic authentication (username/password), and tells the Sessions plugin how to create a session cookie.

    The cookie is used for all subsequent requests to authenticate the user until it expires. The session has a limited duration and renews at a configurable interval, which helps prevent an attacker from obtaining and using a stale cookie after the session has ended.

  4. Restart Kong Gateway and point to the new config file:

    1. kong restart -c /etc/kong/kong.conf

If you have a Docker installation, run the following command to set the needed environment variables and reload the gateway’s configuration.

Note: Make sure to replace {KONG-CONTAINER-ID} with the ID of your container.

  1. echo "KONG_ENFORCE_RBAC=on
  2. KONG_ADMIN_GUI_AUTH=basic-auth
  3. KONG_ADMIN_GUI_SESSION_CONF='{\"secret\":\"secret\",\"storage\":\"kong\",\"cookie_secure\":false}'
  4. kong reload exit" | docker exec -i {KONG_CONTAINER_ID} /bin/sh

This turns RBAC on, tells Kong Gateway to use basic authentication (username/password), and tells the Sessions plugin how to create a session cookie.

The cookie is used for all subsequent requests to authenticate the user, until it expires. The session has a limited duration and renews at a configurable interval, which helps prevent an attacker from obtaining and using a stale cookie after the session has ended.

Outside of this guide, you will likely want to modify these settings differently, depending on your installation. You can read more about these settings here: Basic Auth for Kong Manager.