crowdsec - fix bugs and update example

This commit is contained in:
bunkerity
2021-05-18 14:03:16 +02:00
parent 7c6a13c549
commit 600484b16e
8 changed files with 62 additions and 23 deletions

View File

@@ -1,9 +0,0 @@
init_by_lua_block {
local cs = require "crowdsec.CrowdSec"
local ok, err = cs.init("/usr/local/lib/lua/crowdsec/crowdsec.conf")
if ok == nil then
ngx.log(ngx.ERR, "[Crowdsec] " .. err)
error()
end
ngx.log(ngx.NOTICE, "[Crowdsec] Initialisation done")
}

View File

@@ -7,6 +7,7 @@ local use_abusers = %USE_ABUSERS%
local use_tor_exit_nodes = %USE_TOR_EXIT_NODES%
local use_user_agents = %USE_USER_AGENTS%
local use_referrers = %USE_REFERRERS%
local use_crowdsec = %USE_CROWDSEC%
if use_proxies then
dataloader.load_ip("/etc/nginx/proxies.list", ngx.shared.proxies_data)
@@ -28,4 +29,14 @@ if use_referrers then
dataloader.load_raw("/etc/nginx/referrers.list", ngx.shared.referrers_data)
end
if use_crowdsec then
local cs = require "crowdsec.CrowdSec"
local ok, err = cs.init("/usr/local/lib/lua/crowdsec/crowdsec.conf")
if ok == nil then
ngx.log(ngx.ERR, "[CROWDSEC] " .. err)
error()
end
ngx.log(ngx.ERR, "[CROWDSEC] *NOT AN ERROR* initialisation done")
end
}

View File

@@ -91,9 +91,6 @@ http {
%BLOCK_REFERRERS%
%BAD_BEHAVIOR%
# crowdsec init
%USE_CROWDSEC%
# shared memory zone for limit_req
%LIMIT_REQ_ZONE%