api - client side (untested)
This commit is contained in:
@@ -11,7 +11,10 @@ local bad_behavior_count_time = {{ BAD_BEHAVIOR_COUNT_TIME }}
|
||||
local bad_behavior_ban_time = {{ BAD_BEHAVIOR_BAN_TIME }}
|
||||
|
||||
if use_bad_behavior then
|
||||
behavior.count(bad_behavior_status_codes, bad_behavior_threshold, bad_behavior_count_time, bad_behavior_ban_time)
|
||||
local new_bad_behavior_ban = false
|
||||
if not behavior.is_banned() then
|
||||
new_bad_behavior_ban = behavior.count(bad_behavior_status_codes, bad_behavior_threshold, bad_behavior_count_time, bad_behavior_ban_time)
|
||||
end
|
||||
end
|
||||
|
||||
-- remote API
|
||||
@@ -20,8 +23,11 @@ local remoteapi = require "remoteapi"
|
||||
|
||||
if use_remote_api then
|
||||
if ngx.status == ngx.HTTP_FORBIDDEN then
|
||||
-- TODO check if IP is global + good reason
|
||||
local res, data = remoteapi.ip(ngx.var.remote_addr, "other")
|
||||
local reason = "other"
|
||||
if use_bad_behavior and new_bad_behavior_ban then
|
||||
reason = "behavior"
|
||||
end
|
||||
local res, data = remoteapi.ip(ngx.var.remote_addr, reason)
|
||||
if res then
|
||||
logger.log(ngx.NOTICE, "REMOTE API", "Successfully reported ip " .. ngx.var.remote_addr)
|
||||
else
|
||||
|
||||
Reference in New Issue
Block a user