mirror of
https://gitgud.io/fatchan/haproxy-protection.git
synced 2025-05-09 02:05:37 +00:00
rename BUCKET_DURATION since its now an expiry time
This commit is contained in:
@ -11,7 +11,7 @@ NOTE: Use either HCAPTCHA_ or RECAPTHCA_, not both.
|
||||
- POW_COOKIE_SECRET - different random string, a salt for pow cookies
|
||||
- HMAC_COOKIE_SECRET - different random string, a salt for pow cookies
|
||||
- RAY_ID - string to identify the HAProxy node by
|
||||
- BUCKET_DURATION - how long between bucket changes, invalidating cookies
|
||||
- CHALLENGE_EXPIRY - how long solution cookies last for, in seconds
|
||||
- CHALLENGE_INCLUDES_IP - any value, whether to lock solved challenges to IP or tor circuit
|
||||
- BACKEND_NAME - Optional, name of backend to build from hosts.map
|
||||
- SERVER_PREFIX - Optional, prefix of server names used in server-template
|
||||
|
@ -31,7 +31,7 @@ services:
|
||||
- POW_COOKIE_SECRET=changeme
|
||||
- HMAC_COOKIE_SECRET=changeme
|
||||
- RAY_ID=docker
|
||||
- BUCKET_DURATION=43200
|
||||
- CHALLENGE_EXPIRY=43200
|
||||
- BACKEND_NAME=servers
|
||||
- SERVER_PREFIX=websrv
|
||||
- CHALLENGE_INCLUDES_IP=1
|
||||
|
@ -7,4 +7,4 @@ tls=%[ssl_fc]
|
||||
tlsv=%sslv
|
||||
sni=%[ssl_fc_sni]
|
||||
vey_id=%[env(RAY_ID)]
|
||||
bucket=%[env(BUCKET_DURATION)]
|
||||
expiry=%[env(CHALLENGE_EXPIRY)]
|
||||
|
@ -1,7 +1,7 @@
|
||||
local _M = {}
|
||||
|
||||
local sha = require("sha")
|
||||
local bucket_duration = tonumber(os.getenv("BUCKET_DURATION"))
|
||||
local challenge_expiry = tonumber(os.getenv("CHALLENGE_EXPIRY"))
|
||||
local challenge_includes_ip = os.getenv("CHALLENGE_INCLUDES_IP")
|
||||
local tor_control_port_password = os.getenv("TOR_CONTROL_PORT_PASSWORD")
|
||||
|
||||
@ -26,7 +26,7 @@ function _M.generate_challenge(context, salt, user_key, is_applet)
|
||||
|
||||
local challenge_hash = sha.sha3_256(salt .. ip .. user_key .. user_agent)
|
||||
|
||||
local expiry = core.now()['sec'] + bucket_duration
|
||||
local expiry = core.now()['sec'] + challenge_expiry
|
||||
|
||||
return challenge_hash, expiry
|
||||
|
||||
|
Reference in New Issue
Block a user