Access Control with Workspaces and Teams
At a high level, securing Kong Gateway administration is a two-step process:
- Turn on RBAC.
- Create a workspace and an admin for segregated administration.
In the following sections, you will need the account’s password to log in to Kong Gateway, and the kong_admin_uri
needs to be configured to avoid getting CORS errors.
- RBAC is
- You are logged in as the super admin or a user that has
/admins
and read and write access.
For this example, start by creating a simple workspace called SecureWorkspace
.
Log in to Kong Manager with the built-in Super Admin account,
kong_admin
, and its password.Remember, this is the initial you used when you ran migrations during installation.
If you have logged in successfully, then you can start administering your Kong Gateway cluster.
If this step did not work, and you know the credentials are correct, then something is likely wrong with your Kong Gateway configuration. Double-check the settings. If the cause of the problem still isn’t clear, work with your Kong Konnect account team and for assistance.
- Access your Kong Manager instance.
- On the workspaces tab, click on New Workspace.
Create a workspace named
SecureWorkspace
and select a color or image for the workspace avatar.Each workspace name should be unique, regardless of letter case. For example, naming one workspace “Payments” and another one “payments” will create two different workspaces that appear identical.
Click Create New Workspace.
- In the new workspace, click Teams.
- From the Teams page, click the Roles tab to view the default roles that come with Kong Gateway.
Select SecureWorkspace to see its assigned roles.
Role Description workspace-admin Can administer the objects in a workspace but can’t add new administrators to the workspace. workspace-portal-admin Can manage the Dev Portal. workspace-read-only Can view anything in the workspace, but can’t make any changes. workspace-super-admin Can do anything inside the workspace.
Notes:
Caution Granting access to the default workspace gives access to all workspaces in the organization.
The default workspace only has three roles: workspace-admin, workspace-super-admin, and workspace-read-only. Every other workspace will have the four roles mentioned above.
You can also create custom roles by clicking on the Add Role button and specifying the endpoints that the administrator with the role will be able to interact with.
Next, create an admin for the SecureWorkspace, granting them permissions to manage only that workspace.
- From the Teams > Admins tab, click Invite Admin.
Ensure that Enable RBAC Token is enabled.
This setting lets the admin use the Admin API as well as Kong Manager. If you don’t want this user to access the Admin API, uncheck this box.
Click Add/Edit Roles.
- In the Workspace Access dialog, select the SecureWorkspace.
Select the workspace-admin role, which makes this user the workspace administrator for the SecureWorkspace.
When you are done adding roles, you are redirected back to the Invite Admin dialog.
Important: Before you move on, make sure the Enable RBAC Token checkbox is checked. The RBAC token is what allows the new admin to send a token to the Admin API to configure the system programmatically.
Click Invite Admin to send the invite.
If you don’t have SMTP enabled, you can generate a registration link for the new administrator manually.
- Back on the Teams page, click the administrator you just created.
Click the Generate registration link button.
Using this link, the new administrator can go to a web browser and paste it in to initiate his/her account and create an initial password. Again, normally, this would happen through SMTP, and the user would get this link through an email.
Click the copy icon to copy the registration link, then save it.
Send the registration link to the new administrator, or use it yourself to test the login in the following steps.
Open a different browser or an incognito tab in the current browser.
Enter the registration link you copied previously into the browser to log in with the new administrator.
If the registration link has expired, you can generate a new one by logging in with your
kong_admin
administrator and generating a new link.Enter a new password for your new administrator (save this in a secure place) and click the Register button.
If everything went well, you should see an “Account Setup Success” message.
- Click the Login button to be taken to a new screen to log in with your new administrator.
You are now controlling access to Kong Gateway administration with RBAC.