Skip to content

Instantly share code, notes, and snippets.

View SergioDevOps's full-sized avatar

Sérgio de Oliveira SergioDevOps

View GitHub Profile
@SergioDevOps
SergioDevOps / modsec-ratelimit.conf
Created January 5, 2023 19:37 — forked from josnidhin/modsec-ratelimit.conf
A simple mod security config for IP Rate limiting Apache server behind a load balancer.
# assumes libapache2-modsecurity is installed
# Reference Mannual - https://github.com/SpiderLabs/ModSecurity/wiki
SecRuleEngine On
<LocationMatch "^/.*">
# initialise the state based on X-Forwarded-For ip address
SecRule REQUEST_HEADERS:X-Forwarded-For "@unconditionalMatch" "phase:2,initcol:ip=%{MATCHED_VAR},pass,nolog,id:100"