feat: 1.0.7

This commit is contained in:
xiaobing.wang
2025-02-14 14:40:58 +08:00
parent b853673100
commit 9086cf52d4
2 changed files with 58 additions and 2 deletions

View File

@@ -1,14 +1,49 @@
# Kong Safeline Plugin
Kong plugin for Chaitin SafeLine Web Application Firewall (WAF). This plugin is used to protect your API from malicious requests. It can be used to block requests that contain malicious content in the request body, query parameters, headers, or URI.
## Installation
## Safeline Prepare
The detection engine of the SafeLine provides services by default via Unix socket. We need to modify it to use TCP, so it can be called by the t1k plugin.
1.Navigate to the configuration directory of the SafeLine detection engine:
```shell
cd /data/safeline/resources/detector/
```
2.Open the `detector.yml` file in a text editor. Modify the bind configuration from Unix socket to TCP by adding the following settings:
```yaml
bind_addr: 0.0.0.0
listen_port: 8000
```
These configuration values will override the default settings in the container, making the SafeLine engine listen on port 8000.
3.Next, map the containers port 8000 to the host machine. First, navigate to the SafeLine installation directory:
```shell
cd /data/safeline
```
4.Open the compose.yaml file in a text editor and add the ports field to the detector container to expose port 8000:
```yaml
...
detect:
ports:
- 8000:8000
...
```
5.Save the changes and restart SafeLine with the following commands:
```shell
docker-compose down
docker-compose up -d
```
This will apply the changes and activate the new configuration.
## Plugin Installation
To install the plugin, run the following command in your Kong server:
```shell
$ luarocks install kong-safeline
```
## Configuration
## Plugin Configuration
You can add the plugin to your API by making the following request:
```shell

View File

@@ -0,0 +1,21 @@
package = "kong-safeline"
version = "1.0.7-1"
source = {
url = "git://github.com/chaitin/kong-safeline.git",
}
description = {
summary = "Kong plugin for Chaitin SafeLine Web Application Firewall",
homepage = "https://github.com/chaitin/SafeLine",
license = "Apache License 2.0",
maintainer = "Xiaobing Wang <xiaobing.wang@chaitin.com>"
}
dependencies = {
"lua-resty-t1k >= 1.1.5"
}
build = {
type = "builtin",
modules = {
["kong.plugins.safeline.handler"] = "kong/plugins/safeline/handler.lua",
["kong.plugins.safeline.schema"] = "kong/plugins/safeline/schema.lua"
}
}