mirror of
https://gitgud.io/fatchan/haproxy-protection.git
synced 2025-05-09 02:05:37 +00:00
Read from ddos_config table to determine if nojs script should be shown (allowing to be disabled per domain or path
This commit is contained in:
@ -46,8 +46,8 @@ services:
|
||||
|
||||
nginx:
|
||||
ports:
|
||||
- 81:80
|
||||
- 82:80
|
||||
- 1081:80
|
||||
- 1082:80
|
||||
image: "nginx:latest"
|
||||
volumes:
|
||||
- ./nginx:/usr/share/nginx/html
|
||||
|
@ -56,9 +56,12 @@ frontend http-in
|
||||
# http-response set-header alt-svc "h3=\":443\";ma=900;"
|
||||
|
||||
# Or instead, for Tor, to use circuit IDs as "IP":
|
||||
#bind 127.0.0.1:80 accept-proxy
|
||||
# bind 127.0.0.1:80 accept-proxy
|
||||
option forwardfor
|
||||
|
||||
# custom log format
|
||||
log-format "{\"cc\":%{+Q}[capture.req.hdr(1)],\"cip\":\"%ci\",\"cp\":\"%cp\",\"hh\":%{+Q}[capture.req.hdr(0)],\"backend\":\"%b\",\"server\":\"%s\",\"timers\":\"%TR/%Tw/%Tc/%Tr/%Ta\",\"status\":\"%ST\",\"bytes\":\"%B\",\"bs\":\"%U\",\"conns\":\"%ac/%fc/%bc/%sc/%rc\",\"q\":\"%sq/%bq\",\"req\":%{+Q,+E}r,\"GeoIP_Source\":\"GeoIP_Source=%ci\"}"
|
||||
|
||||
# optional geoip handling (maps required) and alt-svc header addition
|
||||
http-request set-var(req.xcc) src,map_ip(/etc/haproxy/map/geoip.map)
|
||||
http-request set-var(req.asn) src,map_ip(/etc/haproxy/map/iptoasn.map)
|
||||
@ -139,8 +142,8 @@ frontend http-in
|
||||
|
||||
# acl for domains in maintenance mode to return maintenance page (after challenge page htp-request return rules, for the footerlogo)
|
||||
acl maintenance_mode hdr(host),lower,map_str(/etc/haproxy/map/maintenance.map) -m found
|
||||
#http-request lua.set-lang-json
|
||||
#http-request return lf-file /etc/haproxy/template/maintenance.html status 200 content-type "text/html; charset=utf-8" hdr "Cache-Control" "private, max-age=30" if maintenance_mode
|
||||
http-request lua.set-lang-json
|
||||
http-request return lf-file /etc/haproxy/template/maintenance.html status 200 content-type "text/html; charset=utf-8" hdr "Cache-Control" "private, max-age=30" if maintenance_mode
|
||||
|
||||
# optional alt-svc header (done after cache so not set in cached responses
|
||||
acl match_server_continent var(txn.xcn) -m str "${HAPROXY_CONTINENT}"
|
||||
|
@ -0,0 +1 @@
|
||||
localhost {"m":1,"t":false}
|
||||
|
@ -1 +1 @@
|
||||
localhost {"pd":27,"pt":"sha256","cex":999,"cip":false}
|
||||
localhost {"pd":27,"pt":"sha256","cex":999,"cip":false,"js":true}
|
||||
|
@ -1 +1 @@
|
||||
localhost 127.0.0.1:81
|
||||
localhost 127.0.0.1:1081
|
||||
|
@ -187,28 +187,30 @@ function _M.view(applet)
|
||||
templates.pow_section,
|
||||
ll["This process is automatic, please wait a moment..."]
|
||||
)
|
||||
local noscript_extra
|
||||
local noscript_prompt
|
||||
if ddos_config["pt"] == "argon2" then
|
||||
noscript_extra = templates.noscript_extra_argon2
|
||||
noscript_prompt = ll["Run this in a linux terminal (requires <code>argon2</code> package installed):"]
|
||||
else
|
||||
noscript_extra = templates.noscript_extra_sha256
|
||||
noscript_prompt = ll["Run this in a linux terminal (requires <code>perl</code>):"]
|
||||
if ddos_config["js"] ~= false then
|
||||
local noscript_extra
|
||||
local noscript_prompt
|
||||
if ddos_config["pt"] == "argon2" then
|
||||
noscript_extra = templates.noscript_extra_argon2
|
||||
noscript_prompt = ll["Run this in a linux terminal (requires <code>argon2</code> package installed):"]
|
||||
else
|
||||
noscript_extra = templates.noscript_extra_sha256
|
||||
noscript_prompt = ll["Run this in a linux terminal (requires <code>perl</code>):"]
|
||||
end
|
||||
noscript_extra_body = string.format(
|
||||
noscript_extra,
|
||||
ll["No JavaScript?"],
|
||||
noscript_prompt,
|
||||
user_key,
|
||||
challenge_hash,
|
||||
expiry,
|
||||
signature,
|
||||
math.ceil(ddos_config["pd"]/8),
|
||||
argon_time,
|
||||
argon_kb,
|
||||
ll["Paste the script output into the box and submit:"]
|
||||
)
|
||||
end
|
||||
noscript_extra_body = string.format(
|
||||
noscript_extra,
|
||||
ll["No JavaScript?"],
|
||||
noscript_prompt,
|
||||
user_key,
|
||||
challenge_hash,
|
||||
expiry,
|
||||
signature,
|
||||
math.ceil(ddos_config["pd"]/8),
|
||||
argon_time,
|
||||
argon_kb,
|
||||
ll["Paste the script output into the box and submit:"]
|
||||
)
|
||||
end
|
||||
|
||||
-- sub in the body sections
|
||||
|
Reference in New Issue
Block a user