Avature / kong-docker-compose

:satellite: Kong API Gateway distribution used by Avature organization, includes some extra security features, Kong's UI and configuration database
Other
13 stars 4 forks source link
kong kong-distribution konga-ui mtls

Description:

This is the Avature's Kong API Gateway docker-compose distribution

What it includes?

It includes the following docker-compose services:

It also includes the following custom Kong plugins, pre-built and included in the docker-compose project:

Preconditions:

Installing a development environment (debian based distro):

Basic usage:

Building debian package:

Pre-requisites:

Install these dependencies:

  1. fakeroot v1.22
  2. debhelper (>= 9),
  3. dh-exec
cd kong-docker-compose
./buildDebian.sh

Installation

Installing debian-package (production environment):

To install the debian package run:

dpkg -i ../kong-docker-compose_X.Y.Z_all.deb

Then run start or startDev script (according to your needs):

./{start, startDev}.sh

After installing, copy the .env.example file:

cp .env.example .env

And modify it according to your needs.

FAQ/Troubleshooting Dev Environment:

Creating network "kong_kong-net" with the default driver
ERROR: could not find an available, non-overlapping IPv4 address pool among the defaults to assign to the network

Issue the following container-destructive commands:

yes | docker network prune
yes | docker system prune
sudo ip link delete tun0
genrsa: Can't open "certs/server-ca-key.key" for writing, No such file or directory
Can't open certs/server-ca-key.key for reading, No such file or directory
139896872256512:error:02001002:system library:fopen:No such file or directory:crypto/bio/bss_file.c:69:fopen('certs/server-ca-key.key','r')

You can run the certificates creation script with sudo:

sudo ./createCerts.sh -ssl

Client Authentication with mutual TLS

The connection between Kong's admin API and its clients must be done via mutual TLS client authentication using client certificates signed by the kong distribution server's CA.

To hit the secured admin API using mTLS you must first create a consumer using the register endpoint /instances/register provided by the mtls certs manager plugin, example call to create a consumer:

{
  "csr": "Certificate sign request data",
  "instance": {
    "name": "test-instance.ourdomain.org", "description": "A description for the instance"
  }
}

Where:

Is the content of a certificate signing request (including the markers of start and end) that can be generated with openssl command.

Is the hostname of the consumer instance that will be client for the admin API of Kong.

Is a string used to describe the client that will be added as a consumer for Kong that will be stored as a tag in the Kong's consumer table.

The certificates can be signed off by the mtls certs manager kong plugin via instances/register API endpoint.

For more details about client auth workflow click here

Running The Tests:

For contract tests run this command:

cd test && PACT_BROKER_URL=https://pact-broker.yourserver.com ./test_admin_api_contracts

Repleace the environment variable with your pact-broker deployment.

Contribuiting:

TODO:

  1. The active boolean flag in the konga_kong_nodes table of the Konga DB isn't true by default which forces the user to manually "activate" the connection to the Kong server after setup (this could be automated some way)