Skip to content

Commit

Permalink
bring in up-to-date versions of topics; move content into auth sectio…
Browse files Browse the repository at this point in the history
…n under Kong Manager
  • Loading branch information
lena-larionova committed Aug 9, 2022
1 parent 49c862d commit f45ff0c
Show file tree
Hide file tree
Showing 18 changed files with 302 additions and 335 deletions.
53 changes: 0 additions & 53 deletions src/gateway/kong-manager/admins/add-admin.md

This file was deleted.

43 changes: 43 additions & 0 deletions src/gateway/kong-manager/auth/basic.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
---
title: Enable Basic Auth for Kong Manager
badge: enterprise
---

## Prerequisites

To enable basic authentication, configure Kong with the following properties:

```
enforce_rbac = on
admin_gui_auth = basic-auth
admin_gui_session_conf = { "secret":"set-your-string-here" }
```

Kong Manager uses the Sessions plugin in the background.
This plugin requires a secret and is configured securely by default.

* Under all circumstances, the `secret` must be manually set to a string.
* If using HTTP instead of HTTPS, `cookie_secure` must be manually set to `false`.
* If using different domains for the Admin API and Kong Manager, `cookie_samesite` must be set to `off`.
Learn more about these properties in [Session Security in Kong Manager](/gateway/{{page.kong_version}}/kong-manager/authentication/sessions/#session-security), and see [example configurations](/gateway/{{page.kong_version}}/kong-manager/authentication/sessions/#example-configurations).


## Steps

1. Start Kong:

```
$ kong start [-c /path/to/kong/conf]
```
2. Choose one of the following options:
* If you created a **Super Admin** via database migration, log in to Kong
Manager with the username `kong_admin` and the password
set in the environment variable.
* If you created a Super Admin via the Kong Manager "Organization" tab
as described in
[How to Create a Super Admin](/gateway/{{page.kong_version}}/kong-manager/authentication/super-admin),
log in with the credentials you created after accepting the email
invitation.
Original file line number Diff line number Diff line change
Expand Up @@ -3,38 +3,36 @@ title: Mapping LDAP Service Directory Groups to Kong Roles
badge: enterprise
---

### Introduction
Service directory mapping allows organizations to use their LDAP Directory for authentication and authorization in {{site.base_gateway}}.

Service Directory Mapping allows organizations to use their LDAP Directory for authentication and authorization in Kong Enterprise.
After starting {{site.base_gateway}} with the desired configuration, you can create new Admins whose usernames match those in your LDAP directory. Those users will then be able to accept invitations to join Kong Manager and log in with their LDAP credentials.

After starting Kong Enterprise with the desired configuration, you can create new Admins whose usernames match those in your LDAP directory. Those users will then be able to accept invitations to join Kong Manager and log in with their LDAP credentials.

How Service Directory Mapping works in Kong:
* Roles are created in Kong Enterprise using the Admin API or Kong Manager.
How service directory mapping works in Kong:
* Roles are created in {{site.base_gateway}} using the Admin API or Kong Manager.
* Groups are created and roles are associated with the groups.
* When users log in to Kong Manager, they get permissions based on the group(s) they belong to.

For example, if a User's Group changes in the Service Directory, their Kong Admin account's associated Role also changes in Kong Enterprise the next time they log in to Kong Manager. The mapping removes the task of manually managing access in Kong Enterprise, as it makes the Service Directory the system of record.
For example, if a user's group changes in the service directory, their Kong admin account's associated role also changes in {{site.base_gateway}} the next time they log in to Kong Manager. The mapping removes the task of manually managing access in {{site.base_gateway}}, as it makes the service directory the system of record.

### Prerequisites
## Prerequisites

* Kong Enterprise installed and configured
* {{site.base_gateway}} installed and configured
* Kong Manager access
* A local LDAP directory

### Configure Service Directory Mapping
## Configure service directory mapping

Configure Service Directory Mapping to use your LDAP Directory for authentication and authorization.
Configure service directory Mapping to use your LDAP Directory for authentication and authorization.

### Step 1: Start Kong Enterprise
## Start {{site.base_gateway}}

From a terminal window, enter:

```
$ kong start [-c /path/to/kong/conf]
```

### Step 2: Enable LDAP Authentication and enforce RBAC
## Enable LDAP Authentication and enforce RBAC

To enable LDAP Authentication and enforce RBAC for Kong Manager, configure Kong with the following properties:

Expand All @@ -45,7 +43,7 @@ enforce_rbac = on

**Note**: When enabling LDAP Authentication in this step, you are enabling and configuring the LDAP Authentication Advanced Plugin for Kong Manager. No other configuration for the plugin is needed.

### Step 3: Configure the Sessions plugin
## Configure the Sessions plugin

Configure the Sessions Plugin for Kong Manager:

Expand All @@ -57,9 +55,9 @@ admin_gui_session_conf = { "secret":"set-your-string-here" }
* Under all circumstances, the secret must be manually set to a string.
* If using HTTP instead of HTTPS, cookie_secure must be manually set to false.
* If using different domains for the Admin API and Kong Manager, cookie_samesite must be set to off. Learn more about these properties in [_Session Security in Kong Manager_](/gateway/{{page.kong_version}}/kong-manager/authentication/sessions/#session-security), and see [_example configurations_](/gateway/{{page.kong_version}}/kong-manager/authentication/sessions/#example-configurations).
* If using different domains for the Admin API and Kong Manager, cookie_samesite must be set to off. Learn more about these properties in [_Session Security in Kong Manager_](/gateway/{{page.kong_version}}/configure/auth/kong-manager/sessions), and see [_example configurations_](/gateway/{{page.kong_version}}/configure/auth/kong-manager/sessions/#example-configurations).

### Step 4: Configure LDAP Authentication for Kong Manager
## Configure LDAP Authentication for Kong Manager

Configure LDAP Authentication for Kong Manager with the following properties. Note the attribute variables are defined below:

Expand Down Expand Up @@ -103,39 +101,39 @@ admin_gui_auth_conf = {
* `group_name_attribute`: `<ENTER_YOUR_GROUP_NAME_ATTRIBUTE_HERE>`: Sets the attribute holding the name of a group, typically called `name` (in Active Directory) or `cn` (in OpenLDAP). The default is the value from `conf.attribute`.
* `group_member_attribute`:`<ENTER_YOUR_GROUP_MEMBER_ATTRIBUTE_HERE>`: Sets the attribute holding the members of the LDAP group. The default is `memberOf`.

### Define Roles with Permissions
## Define roles with permissions

Define **Roles** with **Permissions** in Kong Enterprise, using the Admin API's [**_RBAC endpoints_**](/gateway/{{page.kong_version}}/kong-manager/rbac/) or using Kong Manager's **Teams > [Admins tab](/gateway/{{page.kong_version}}/kong-manager/admins/invite/#invite-an-admin)**. You must manually define which Kong **Roles** correspond to each of the Service Directory's **Groups** using either of the following:
Define Roles with Permissions in {{site.base_gateway}}, using the Admin API's [_RBAC endpoints_](/gateway/{{page.kong_version}}/admin-api/rbac/reference/#update-or-create-a-role) or using Kong Manager's Teams > [Admins tab](/gateway/{{page.kong_version}}/configure/auth/rbac/add-user/). You must manually define which Kong Roles correspond to each of the service directory's Groups using either of the following:

In Kong Manager's **Directory Mapping** section. Go to **Teams > Groups** tab.
With the Admin API's **Directory Mapping** endpoints.
In Kong Manager's Directory Mapping section. Go to Teams > Groups tab.
With the Admin API's Directory Mapping endpoints.

Kong Enterprise will not write to the Service Directory, for example, a Kong Enterprise Admin cannot create **Users** or **Groups** in the directory. You must create **Users** and **Groups** independently before mapping them to Kong Enterprise.
{{site.base_gateway}} will not write to the service directory, for example, a {{site.base_gateway}} Admin cannot create Users or Groups in the directory. You must create Users and Groups independently before mapping them to {{site.base_gateway}}.

### User-Admin Mapping
## User-admin mapping

To map a Service Directory **User** to a Kong **Admin**, you must configure the **Admin's** username as the value of the **User's** name from their LDAP Distinguished Name (DN) corresponding the attribute configured in admin_gui_auth_conf. Creating an **Admin** account in [_Kong Manager_](/gateway/{{page.kong_version}}/kong-manager/admins/add-admin/) or using the [_Admin API_](/gateway/{{page.kong_version}}/admin-api/admins/reference/#invite-an-admin).
To map a service directory User to a Kong Admin, you must configure the Admin's username as the value of the User's name from their LDAP Distinguished Name (DN) corresponding the attribute configured in admin_gui_auth_conf. Creating an Admin account in [_Kong Manager_](/gateway/{{page.kong_version}}/configure/auth/rbac/add-admin) or using the [_Admin API_](/gateway/{{page.kong_version}}/admin-api/admins/reference/#invite-an-admin).

For instructions on how to pair the bootstrapped **Super Admin** with a **Directory User**, see [_How to Set Up a Service Directory User as the First Super Admin_](#set-up-a-directory-user-as-the-first-super-admin).
For instructions on how to pair the bootstrapped Super Admin with a Directory User, see [_How to Set Up a service directory User as the First Super Admin_](/gateway/{{page.kong_version}}/configure/auth/service-directory-mapping/#set-up-a-directory-user-as-the-first-super-admin).

If you already have **Admins** with assigned **Roles** and want to use **Group** mapping instead, it is necessary to first remove all of their Roles. The Service Directory will serve as the system of record for **User** privileges. Assigned **Roles** will affect a user's privileges in addition to any roles mapped from **Groups.**
If you already have Admins with assigned Roles and want to use Group mapping instead, it is necessary to first remove all of their Roles. The service directory will serve as the system of record for User privileges. Assigned Roles will affect a user's privileges in addition to any roles mapped from Groups.

### Group-Role Assignment
## Group-role assignment

Using Service Directory Mapping, **Groups** to **Roles** are mapped. When a user logs in, they are identified with their **Admin** username and then authenticated with the matching **User** credentials in the** Service Directory**. The Groups in the Service Directory are then automatically matched to the associated Roles that the organization has defined.
Using service directory Mapping, Groups to Roles are mapped. When a user logs in, they are identified with their Admin username and then authenticated with the matching User credentials in the service directory. The Groups in the service directory are then automatically matched to the associated Roles that the organization has defined.

#### Example
### Example

1. Wayne Enterprises maps the Service Directory Group, T1-Mgmt, to the Kong Role super-admin.
2. Wayne Enterprises maps a Service Directory User, named bruce-wayne, to a Kong Admin account with the same name, bruce-wayne.
1. Wayne Enterprises maps the service directory Group, T1-Mgmt, to the Kong Role super-admin.
2. Wayne Enterprises maps a service directory User, named bruce-wayne, to a Kong Admin account with the same name, bruce-wayne.
3. The User, bruce-wayne, is assigned to the Group T1-Mgmt in the LDAP Directory.


When bruce-wayne logs in as an Admin to Kong Manager, they will automatically have the Role of super-admin as a result of the mapping.

If Wayne Enterprises decides to revoke bruce-wayne's privileges by removing their assignment to T1-Mgmt, they will no longer have the super-admin Role when they attempt to log in.

### Set Up a Directory User as the First Super Admin
## Set up a directory user as the first super admin

**Important**: Setting up a Directory User as the first Super Admin is recommended by Kong.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,7 @@ title: Enable OIDC for Kong Manager
badge: enterprise
---

### Introduction

Kong Enterprise offers the ability to bind authentication for Kong
{{site.base_gateway}} offers the ability to bind authentication for Kong
Manager **Admins** to an organization's OpenID Connect Identity
Provider using the
**[OpenID Connect Plugin](/hub/kong-inc/openid-connect/)**.
Expand All @@ -14,7 +12,7 @@ Provider using the
manually enable the **Plugin**; the configuration alone will enable
**OIDC** for Kong Manager.

### Prerequisites
## Set up RBAC with OIDC

The following is an example using Google as the IdP and serving Kong Manager
from its default URL, `http://127.0.0.1:8002`.
Expand Down Expand Up @@ -43,17 +41,17 @@ admin_gui_auth_conf={ \
}
```

⚠️**Important:** the **Sessions Plugin** requries a secret and is configured securely by default.
The **Sessions Plugin** requires a secret and is configured securely by default.
* Under all circumstances, the `secret` must be manually set to a string.
* If using HTTP instead of HTTPS, `cookie_secure` must be manually set to `false`.
* If using different domains for the Admin API and Kong Manager, `cookie_samesite` must be set to `off`.
Learn more about these properties in [Session Security in Kong Manager](/gateway/{{page.kong_version}}/kong-manager/authentication/sessions/#session-security), and see [example configurations](/gateway/{{page.kong_version}}/kong-manager/authentication/sessions/#example-configurations).
Learn more about these properties in [Session Security in Kong Manager](/gateway/{{page.kong_version}}/configure/auth/kong-manager/sessions/#session-security), and see [example configurations](/gateway/{{page.kong_version}}/configure/auth/kong-manager/sessions/#example-configurations).

Replace the entries surrounded by `<>` with values that are valid for your IdP.
For example, Google credentials can be found here:
https://console.cloud.google.com/projectselector/apis/credentials

## Step 1
## Create an admin

Create an **Admin** that has a **username** matching the **email** returned from
the Identity Provider upon successful login.
Expand All @@ -72,17 +70,17 @@ $ http POST :8001/admins username="hal9000@sky.net" email="hal9000@sky.net" Kong
ensure the **Admin** receives an email invitation, whereas **username** is the
attribute that the **Plugin** uses with the IdP.

## Step 2
## Assign a role to the admin

Assign the new **Admin** at least one **Role** so they can log in and access
Kong entities.

```bash
$ http POST :8001/admins/<admin_email>/roles roles="<role-name>"
$ http POST :8001/admins/<admin_email>/roles roles="<role-name>" Kong-Admin-Token:<RBAC_TOKEN>
```

For example, if we wanted to grant **hal9000@sky.net** the **Role** of **Super Admin**:

```bash
$ http POST :8001/admins/hal9000@sky.net/roles roles="super-admin"
$ http POST :8001/admins/hal9000@sky.net/roles roles="super-admin" Kong-Admin-Token:<RBAC_TOKEN>
```
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
---
title: Securing Kong Manager
badge: enterprise
title: Authentication and Authorization in Kong Manager
---

Kong Manager enables users with Admin accounts to access Kong entities such
Expand All @@ -9,7 +8,7 @@ as Services, Plugins, and Consumers.
The following document summarizes Kong Manager's controls for *authentication*
and *authorization*.

## Configuring Authentication
## Configuring authentication

{{site.base_gateway}} comes packaged with Authentication Plugins that can be used
to secure Kong Manager. Unlike enabling a Plugin on an entity or cluster,
Expand Down Expand Up @@ -39,7 +38,7 @@ Learn more about these properties in
[Session Security in Kong Manager](/gateway/{{page.kong_version}}/kong-manager/authentication/sessions/#session-security),
and see [example configurations](/gateway/{{page.kong_version}}/kong-manager/authentication/sessions/#example-configurations).

## Access Control with Roles and Workspaces
## Access control with roles and workspaces

An Admin belongs to a Workspace and should have at least one Role
with a set of Permissions. If an Admin is in a Workspace *without*
Expand Down
Loading

0 comments on commit f45ff0c

Please sign in to comment.