-
Notifications
You must be signed in to change notification settings - Fork 647
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
net/haproxy: Support for GPC General Purpose Counters #1123
Comments
|
Ok, some more detail around what I was doing and managed to figure out which might help you. The example I attached in the original issue is what I thought would work but I found a better one (for my goal). I have HAProxy reverse proxying my Unifi NVR VM and applying a Lets Encrypt cert, but I wanted to use some of the common ACLs to protect it further. The NVR also has fail2ban running with a script updating an alias on OPNSense via the API to block IPs that get the password wrong too often, the problem there is due to keepalives and the nature of pf adding an IP to the alias doesnt block until the next connection. Hence HAProxy ACLs to disconnect the abusive user and let pf take over if they connect again since stick tables are reset on restart. This is what I based things on: A few things I ran into:
|
|
@seizedengine Thanks for keeping this issue updated! Could you please provide the final haproxy.conf (excerpt) for reference? This would help me when adding the missing pieces to the plugin. |
|
@fraenki Config is below, I redacted some minor stuff and unrelated frontends/backends but this is the relevant stuff. Also keep in mind this is my first time using HAProxy so I could be way off base on some things... ` ` |
Is support for gpc counters in stick tables and ACLs planned? Gpc as in general purpose counters.
They are used most often in the abuse prevention and blocking type rules.
Some examples:
https://www.haproxy.com/blog/bot-protection-with-haproxy/
https://cbonte.github.io/haproxy-dconv/1.7/configuration.html#7 (search for gpc0)
`frontend http
# Use General Purpose Couter 0 in SC0 as a global abuse counter
# protecting all our sites
stick-table type ip size 1m expire 5m store gpc0
tcp-request connection track-sc0 src
tcp-request connection reject if { sc0_get_gpc0 gt 0 }
...
use_backend http_dynamic if { path_end .php }
backend http_dynamic
# if a source makes too fast requests to this dynamic site (tracked
# by SC1), block it globally in the frontend.
stick-table type ip size 1m expire 5m store http_req_rate(10s)
acl click_too_fast sc1_http_req_rate gt 10
acl mark_as_abuser sc0_inc_gpc0(http) gt 0
tcp-request content track-sc1 src
tcp-request content reject if click_too_fast mark_as_abuser`
The text was updated successfully, but these errors were encountered: