mirror of
https://gitgud.io/fatchan/haproxy-protection.git
synced 2025-05-09 02:05:37 +00:00
Incorporate custom example value into cookie
This commit is contained in:
@@ -1 +1 @@
|
|||||||
localhost {"m":0,"t":false}
|
localhost {"m":1,"t":false}
|
||||||
|
@@ -23,10 +23,12 @@ function _M.generate_challenge(context, salt, user_key, ddos_config, is_applet)
|
|||||||
ip = context.sf:src()
|
ip = context.sf:src()
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local custom_value = context:get_var("txn.fp_custom") or ""
|
||||||
|
|
||||||
-- user agent to counter very dumb spammers
|
-- user agent to counter very dumb spammers
|
||||||
local user_agent = _M.get_header_from_context(context, "user-agent", is_applet)
|
local user_agent = _M.get_header_from_context(context, "user-agent", is_applet)
|
||||||
|
|
||||||
local challenge_hash = sha.sha3_256(salt .. ip .. user_key .. user_agent)
|
local challenge_hash = sha.sha3_256(salt .. ip .. user_key .. custom_value .. user_agent)
|
||||||
|
|
||||||
local expiry = core.now()["sec"] + ddos_config["cex"]
|
local expiry = core.now()["sec"] + ddos_config["cex"]
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user