mirror of
https://gitgud.io/fatchan/haproxy-protection.git
synced 2025-05-09 02:05:37 +00:00
Make blocked and whitelist maps multi tenant
This commit is contained in:
@ -69,7 +69,9 @@ frontend http-in
|
||||
http-request return status 200 content-type "text/plain; charset=utf-8" lf-file /etc/haproxy/template/trace.txt if { path /.basedflare/cgi/trace }
|
||||
|
||||
# acl for blocked IPs/subnets
|
||||
acl blocked_ip_or_subnet src,map_ip(/etc/haproxy/map/blocked.map) -m found
|
||||
acl found_in_blocked_map src,map_ip(/etc/haproxy/map/blocked.map) -m found
|
||||
acl blocked_ip_or_subnet var(txn.blocked_ip_or_subnet) -m bool
|
||||
http-request lua.set-ip-var "blocked" "txn.blocked_ip_or_subnet" if found_in_blocked_map
|
||||
http-request deny deny_status 403 if blocked_ip_or_subnet
|
||||
|
||||
# ratelimit (and for tor, kill circuit) on POST bot-check. legitimate users shouldn't hit this.
|
||||
@ -78,7 +80,9 @@ frontend http-in
|
||||
# http-request tarpit if { sc_http_req_rate(0) gt 1 }
|
||||
|
||||
# acl for lua check whitelisted IPs/subnets and some excluded paths
|
||||
acl is_excluded src,map_ip(/etc/haproxy/map/whitelist.map) -m found
|
||||
acl found_in_whitelist_map src,map_ip(/etc/haproxy/map/whitelist.map) -m found
|
||||
acl is_excluded var(txn.whitelist_ip_or_subnet) -m bool
|
||||
http-request lua.set-ip-var "whitelist" "txn.whitelist_ip_or_subnet" if found_in_whitelist_map
|
||||
acl is_excluded src -f /etc/haproxy/map/crawler-whitelist.map
|
||||
acl is_excluded path /favicon.ico /.basedflare/pow-icon #add more
|
||||
|
||||
|
Reference in New Issue
Block a user