このページは、まだ日本語ではご利用いただけません。翻訳中です。
旧バージョンのドキュメントを参照しています。
最新のドキュメントはこちらをご参照ください。
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
- Modify configuration settings below in your
kong.conf
file. Navigate to the file at /etc/kong/kong.conf
:
- Copy the
kong.conf.default
file so you know you have a working copy to fall back to.
cp kong.conf.default kong.conf
-
Now, edit the following settings in kong.conf
:
echo >> “enforce_rbac = on” >> /etc/kong/kong.conf
echo >> “admin_gui_auth = basic-auth” >> /etc/kong.conf
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.
- Restart Kong Gateway and point to the new config file:
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.
echo "KONG_ENFORCE_RBAC=on
KONG_ADMIN_GUI_AUTH=basic-auth
KONG_ADMIN_GUI_SESSION_CONF='{\"secret\":\"secret\",\"storage\":\"kong\",\"cookie_secure\":false}'
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.