ArecaBay enables enterprises to Discover, Monitor, and Secure APIs at object/data level.

ArecaBay’s Kong plugin installed in the Kong cluster is one type of ArecaBay MicroSensors that are light-weight software components built to access real-time API call level data without any modification to the applications or their runtime. They enable ArecaBay’s Dynamic API Risk Trackers (DART) and API DLP: a set of API level trackers and Data Leakage Prevention.

DART provides an API data security posture dashboard for DevSecOps to continuously discover and monitor APIs across all clouds with zero-impact to apps. DART’s anomaly detection enables API DLP to take policy action against highly targeted data fields and transactions. Please visit this link for more details.

In addition to API Security, for developers and/or DevOps, ArecaBay’s Kong plugin can be used to monitor and log application API calls with selective object level data.


Terminology

  • plugin: a plugin executing actions inside Kong before or after a request has been proxied to the upstream API.
  • Service: the Kong entity representing an external upstream API or microservice.
  • Route: the Kong entity representing a way to map downstream requests to upstream services.
  • Consumer: the Kong entity representing a developer or machine using the API. When using Kong, a Consumer only communicates with Kong which proxies every call to the said upstream API.
  • Credential: a unique string associated with a Consumer, also referred to as an API key.
  • upstream service: this refers to your own API/service sitting behind Kong, to which client requests are forwarded.
  • API: a legacy entity used to represent your upstream services. Deprecated in favor of Services since CE 0.13.0 and EE 0.32.

Configuration

Enabling the plugin on a Service

Configure this plugin on a Service by making the following request:

$ curl -X POST http://kong:8001/services/{service}/plugins \
    --data "name=ab-microsensor"  \
    --data "config.ab_localbay_ip=" \
    --data "config.ab_localbay_port=" \
    --data "config.ab_tenant_id=" \
    --data "config.ab_localbay_passphrase=" \
    --data "config.ab_microsensor_name=" \
    --data "config.ab_microsensor_id="

  • service: the id or name of the Service that this plugin configuration will target.

Enabling the plugin on a Route

Configure this plugin on a Route with:

$ curl -X POST http://kong:8001/routes/{route_id}/plugins \
    --data "name=ab-microsensor"  \
    --data "config.ab_localbay_ip=" \
    --data "config.ab_localbay_port=" \
    --data "config.ab_tenant_id=" \
    --data "config.ab_localbay_passphrase=" \
    --data "config.ab_microsensor_name=" \
    --data "config.ab_microsensor_id="

  • route_id: the id of the Route that this plugin configuration will target.

Enabling the plugin on a Consumer

You can use the http://localhost:8001/plugins endpoint to enable this plugin on specific Consumers:

$ curl -X POST http://kong:8001/plugins \
    --data "name=ab-microsensor" \
    --data "consumer_id={consumer_id}"  \
    --data "config.ab_localbay_ip=" \
    --data "config.ab_localbay_port=" \
    --data "config.ab_tenant_id=" \
    --data "config.ab_localbay_passphrase=" \
    --data "config.ab_microsensor_name=" \
    --data "config.ab_microsensor_id="

Where consumer_id is the id of the Consumer we want to associate with this plugin.

You can combine consumer_id and service_id

in the same request, to furthermore narrow the scope of the plugin.

Enabling the plugin on an API

If you are using an older version of Kong with the legacy API entity (deprecated in favor of Services since CE 0.13.0 and EE 0.32.), you can configure this plugin on top of such an API by making the following request:

$ curl -X POST http://kong:8001/apis/{api}/plugins \
    --data "name=ab-microsensor"  \
    --data "config.ab_localbay_ip=" \
    --data "config.ab_localbay_port=" \
    --data "config.ab_tenant_id=" \
    --data "config.ab_localbay_passphrase=" \
    --data "config.ab_microsensor_name=" \
    --data "config.ab_microsensor_id="

  • api: either id or name of the API that this plugin configuration will target.

Global plugins

All plugins can be configured using the http://kong:8001/plugins/ endpoint. A plugin which is not associated to any Service, Route or Consumer (or API, if you are using an older version of Kong) is considered "global", and will be run on every request. Read the Plugin Reference and the Plugin Precedence sections for more information.

Parameters

Here's a list of all the parameters which can be used in this plugin's configuration:

form parameterdefaultdescription
nameThe name of the plugin to use, in this case ab-microsensor
service_idThe id of the Service which this plugin will target.
route_idThe id of the Route which this plugin will target.
enabledtrueWhether this plugin will be applied.
consumer_idThe id of the Consumer which this plugin will target.
api_idThe id of the API which this plugin will target. Note: The API Entity is deprecated in favor of Services since CE 0.13.0 and EE 0.32.
config.ab_localbay_ip

The ArecaBay LocalBay IP that this plugin will connect and provide API event data.

config.ab_localbay_port

The ArecaBay LocalBay Port that this plugin will connect and provide API event data.

config.ab_tenant_id

The tenant id specific to the ArecaBay LocalBay.

config.ab_localbay_passphrase

The passphrase for authentication with LocalBay.

config.ab_microsensor_name

The name of this microsensor to be used for display purposes in the web console.

config.ab_microsensor_id

The id of this microsensor.

Installation

The installation of ArecaBay’s Kong Plugin and the corresponding ArecaBay components is extremely simple and easy. It involves the following two steps:

  1. Install and setup ArecaBay’s Kong Plugin
  2. Access ArecaBay Cloud Webconsole and configure ArecaBay Kong Plugin as a MicroSensor

Install and setup ArecaBay’s Kong Plugin

Install the ArecaBay’s Kong plugin (ab-microsensor) on each node in your Kong cluster via luarocks. As this plugin source is already hosted in Luarocks.org, please run the below command:

luarocks install kong-plugin-ab-microsensor

Add to the custom_plugins list in your Kong configuration (on each Kong node):

custom_plugins = ab-microsensor

Access ArecaBay Cloud Webconsole and setup LocalBay

Please visit the following page https://www.arecabay.com/partners/kong and request your ArecaBay Cloud Webconsole account. Follow the quickstart guide within the Webconsole to configure your Kong Plugin as a MicroSensor. This involves providing details for the Kong Plugin MicroSensor and downloading the setup script. Run the setup script which internally uses the Kong Admin API to configure & run the Kong Plugin as a global plugin.