lua-cs-bouncer-mcaptcha/nginx/access.lua
2022-01-13 09:48:05 +01:00

9 lines
320 B
Lua

local cs = require "crowdsec"
ok, remediation, err = cs.allowIp(ngx.var.remote_addr)
if err ~= nil then
ngx.log(ngx.ERR, "[Crowdsec] bouncer error: " .. err)
end
if not ok then
ngx.log(ngx.ALERT, "[Crowdsec] denied '" .. ngx.var.remote_addr .. "' with '"..remediation.."'")
ngx.exit(ngx.HTTP_FORBIDDEN)
end