search close

Kong Plugin Install

access_time Updated Sep 21, 2021

About the Kong Plugin

The Kong plugin is a feature of the NGINX module, which allows it to function as a Kong plugin. Accordingly, the process for installing the Kong plugin involves installing the Signal Sciences agent and NGINX module, and modifying the NGINX module configuration to enable it for use with Kong.

Installation

Install the Agent

Install the Signal Sciences Agent by following the instructions for your environment here:
https://docs.signalsciences.net/install-guides/#step-1-agent-installation

Add Agent TCP Listener Config Option

You will need to add the TCP listener config option to the agent configuration file, located at /etc/sigsci/agent.conf.

Add the following lines to agent.conf. Replace <AGENT-LISTENER-IP> with the host IP address (likely 127.0.0.1) and <AGENT-LISTENER-PORT> with the TCP port on which the agent will listen for connections from the module (there is no default, but we suggest port 737 to minimize the chance of conflicts with other services):

rpc-address=<AGENT-LISTENER-IP>:<AGENT-LISTENER-PORT>

Download the NGINX Module

Download and extract the latest Signal Sciences NGINX module by running the following commands:

curl -O  https://dl.signalsciences.net/sigsci-module-nginx/sigsci-module-nginx_latest.tar.gz
sudo mkdir -p /opt/sigsci/nginx
sudo tar -xf sigsci-module-nginx_latest.tar.gz -C /opt/sigsci/nginx

Update the Kong Plugin Config Options

As with the agent configuration file, you will also need to edit the Kong plugin’s config options to reflect the host IP address and the port used for communication with the agent. Edit the following lines in /opt/sigsci/nginx/kong/plugins/signalsciences/handler.lua to replace "localhost" and 12345 with the host IP address and port:

sigsci.agenthost = "localhost"
sigsci.agentport = 12345

Update the Kong Configuration File

Add the following lines to the Kong configuration file at /etc/kong/kong.conf:

plugins=signalsciences
lua_package_path=/opt/sigsci/nginx/?.lua

Enable the Kong Plugin

Enable the Kong plugin by running the following command, after replacing <KONG-GATEWAY-IP:PORT> with the Kong IP address and port (for example, 127.0.0.1:1234):

curl -i -X POST --url http://<KONG-GATEWAY-IP:PORT>/plugins/ --data 'name=signalsciences'