Skip to content

Commit

Permalink
Merge pull request #39 from celevra/patch-4
Browse files Browse the repository at this point in the history
Update bouncer.lua
  • Loading branch information
fl0ppy-d1sk authored May 11, 2024
2 parents d50be0b + 98d0297 commit 9a607d6
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion crowdsec/lib/bouncer.lua
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ local runtime = {}
-- remediations are stored in cache as int (shared dict tags)
-- we need to translate IDs to text with this.
runtime.remediations = {}
runtime.remediations["0"] = "allow"
runtime.remediations["1"] = "ban"
runtime.remediations["2"] = "captcha"

Expand Down Expand Up @@ -374,7 +375,7 @@ local function live_query(ip)
if body == "null" then -- no result from API, no decision for this IP
-- set ip in cache and DON'T block it
local key = item_to_string(ip, "ip")
local succ, err, forcible = runtime.cache:set(key, true, runtime.conf["CACHE_EXPIRATION"], 1)
local succ, err, forcible = runtime.cache:set(key, true, runtime.conf["CACHE_EXPIRATION"], 0)
if not succ then
ngx.log(ngx.ERR, "failed to add ip '" .. ip .. "' in cache: "..err)
end
Expand Down

0 comments on commit 9a607d6

Please sign in to comment.