Skip to content

Commit

Permalink
Merge pull request #11 from bunkerity/dev
Browse files Browse the repository at this point in the history
Remove "order" key from coraza plugin & fix discord and slack
  • Loading branch information
fl0ppy-d1sk authored May 23, 2023
2 parents 545226e + 0aa84c5 commit 8d7b93c
Show file tree
Hide file tree
Showing 3 changed files with 78 additions and 80 deletions.
126 changes: 62 additions & 64 deletions coraza/plugin.json
Original file line number Diff line number Diff line change
@@ -1,67 +1,65 @@
{
"id": "coraza",
"order": 999,
"name": "Coraza",
"description": "Use Coraza as a library to inspect client request",
"version": "0.1",
"stream":"no",
"settings": {
"USE_CORAZA": {
"context": "multisite",
"default": "no",
"help": "Activate Coraza library",
"id": "use coraza library",
"label": "Coraza",
"regex": "^(no|yes)$",
"type": "check"
},
"CORAZA_API": {
"context": "global",
"default": "http://bunkerweb-golang-1:8090",
"help": "Address of the CORAZA API.",
"id": "coraza-api",
"label": "Coraza Api",
"regex": "^.*$",
"type": "text"
},
"USE_OWASP_CRS":{
"context":"global",
"default":"yes",
"help":"Enable OWASP Core Rule Set.",
"id":"OWASP_coreruleset",
"label":"Coreruleset",
"regex": "^(no|yes)$",
"type": "check"
},
"CORAZA_SEC_AUDIT_ENGINE": {
"context": "multisite",
"default": "On",
"help": "SecAuditEngine directive of coraza.",
"id": "coraza-sec-audit-engine",
"label": "SecAuditEngine",
"regex": "^(On|RelevantOnly|Off)$",
"type": "select",
"select": ["On", "RelevantOnly", "Off"]
},
"CORAZA_SEC_RULE_ENGINE": {
"context": "multisite",
"default": "On",
"help": "SecRuleEngine directive of coraza.",
"id": "coraza-sec-rule-engine",
"label": "SecRuleEngine",
"regex": "^(On|DetectionOnly|Off)$",
"type": "select",
"id": "coraza",
"name": "Coraza",
"description": "Use Coraza as a library to inspect client request",
"version": "0.1",
"stream": "no",
"settings": {
"USE_CORAZA": {
"context": "multisite",
"default": "no",
"help": "Activate Coraza library",
"id": "use coraza library",
"label": "Coraza",
"regex": "^(no|yes)$",
"type": "check"
},
"CORAZA_API": {
"context": "global",
"default": "http://bunkerweb-golang-1:8090",
"help": "Address of the CORAZA API.",
"id": "coraza-api",
"label": "Coraza Api",
"regex": "^.*$",
"type": "text"
},
"USE_OWASP_CRS": {
"context": "global",
"default": "yes",
"help": "Enable OWASP Core Rule Set.",
"id": "OWASP_coreruleset",
"label": "Coreruleset",
"regex": "^(no|yes)$",
"type": "check"
},
"CORAZA_SEC_AUDIT_ENGINE": {
"context": "multisite",
"default": "On",
"help": "SecAuditEngine directive of coraza.",
"id": "coraza-sec-audit-engine",
"label": "SecAuditEngine",
"regex": "^(On|RelevantOnly|Off)$",
"type": "select",
"select": ["On", "RelevantOnly", "Off"]
},
"CORAZA_SEC_RULE_ENGINE": {
"context": "multisite",
"default": "On",
"help": "SecRuleEngine directive of coraza.",
"id": "coraza-sec-rule-engine",
"label": "SecRuleEngine",
"regex": "^(On|DetectionOnly|Off)$",
"type": "select",
"select": ["On", "DetectionOnly", "Off"]
},
"CORAZA_SEC_AUDIT_LOG_PARTS": {
"context": "multisite",
"default": "ABCFHZ",
"help": "SecAuditLogParts directive of coraza.",
"id": "coraza-sec-audit-log-parts",
"label": "SecAuditLogParts",
"regex": "^A(([B-K])(?!.*\\2))+Z$",
"type": "text"
}

}
},
"CORAZA_SEC_AUDIT_LOG_PARTS": {
"context": "multisite",
"default": "ABCFHZ",
"help": "SecAuditLogParts directive of coraza.",
"id": "coraza-sec-audit-log-parts",
"label": "SecAuditLogParts",
"regex": "^A(([B-K])(?!.*\\2))+Z$",
"type": "text"
}
}
}
16 changes: 8 additions & 8 deletions discord/discord.lua
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
local class = require "middleclass"
local plugin = require "bunkerweb.plugin"
local utils = require "bunkerweb.utils"
local cjson = require "cjson"
local http = require "resty.http"
local class = require "middleclass"
local plugin = require "bunkerweb.plugin"
local utils = require "bunkerweb.utils"
local cjson = require "cjson"
local http = require "resty.http"

local discord = class("discord", plugin)
local discord = class("discord", plugin)

function discord:initialize()
-- Call parent initialize
Expand Down Expand Up @@ -43,7 +43,7 @@ function discord:log(bypass_use_discord)
end
end

function discord:send(premature, data)
function discord:send(self, data)
local httpc, err = http.new()
if not httpc then
self.logger:log(ngx.ERR, "can't instantiate http object : " .. err)
Expand Down Expand Up @@ -97,4 +97,4 @@ function discord:log_default()
return self:log(true)
end

return discord
return discord
16 changes: 8 additions & 8 deletions slack/slack.lua
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
local class = require "middleclass"
local plugin = require "bunkerweb.plugin"
local utils = require "bunkerweb.utils"
local cjson = require "cjson"
local http = require "resty.http"
local class = require "middleclass"
local plugin = require "bunkerweb.plugin"
local utils = require "bunkerweb.utils"
local cjson = require "cjson"
local http = require "resty.http"

local slack = class("slack", plugin)
local slack = class("slack", plugin)

function slack:initialize()
-- Call parent initialize
Expand Down Expand Up @@ -43,7 +43,7 @@ function slack:log(bypass_use_slack)
end
end

function slack:send(premature, data)
function slack:send(self, data)
local httpc, err = http.new()
if not httpc then
self.logger:log(ngx.ERR, "can't instantiate http object : " .. err)
Expand Down Expand Up @@ -97,4 +97,4 @@ function slack:log_default()
return self:log(true)
end

return slack
return slack

0 comments on commit 8d7b93c

Please sign in to comment.