Files
infrastructure/roles/fail2ban/templates/nginx-limit-req.jail.j2

23 lines
767 B
Django/Jinja

#
# {{ansible_managed}}
#
[nginx-limit-req]
enabled = true
filter = nginx-limit-req
logpath = /var/log/nginx/*/error.log
findtime = {{ fail2ban_nginx_limit_req_findtime }}
bantime = {{ fail2ban_nginx_limit_req_bantime }}
maxretry = {{ fail2ban_nginx_limit_req_maxretry }}
{% if not fail2ban_nginx_limit_req_bantime_increment %}
bantime.increment = false
{% endif %}
{% if nginx_stream_deny is defined and nginx_stream_deny %}
# Behind the HAProxy ADN, ban at the nginx stream layer (by real client IP)
# instead of firewalld, which cannot match traffic arriving from the ADN.
banaction = nginx-stream-deny
{% endif %}
# Do not fail2ban these limit_req zones, they only return 429.
ignoreregex = by zone "(?:{{ fail2ban_nginx_limit_req_ignore_zones | join('|') }})"