Last active
September 22, 2022 02:41
-
-
Save bensig/cc2c32577a5afaf62a3c594cdfda6e9a to your computer and use it in GitHub Desktop.
Haproxy ban anyone looking for .env files
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Fail2Ban filter configuration file to match failed login attempts to | |
# HAProxy HTTP Authentication protected servers. | |
# | |
# PLEASE NOTE - When a user first hits the HTTP Auth a 401 is returned by the server | |
# which prompts their browser to ask for login details. | |
# This initial 401 is logged by HAProxy. | |
# In other words, even successful logins will have at least 1 fail regex match. | |
# Please keep this in mind when setting findtime and maxretry for jails. | |
# | |
# Author: Jordan Moeser | |
# | |
[INCLUDES] | |
# Read common prefixes. If any customizations available -- read them from | |
# common.local | |
before = common.conf | |
[Definition] | |
_daemon = haproxy | |
# Option: failregex | |
# Notes.: regex to match the password failures messages in the logfile. The | |
# host must be matched by a group named "host". The tag "<HOST>" can | |
# be used for standard IP/hostname matching and is only an alias for | |
# (?:::f{4,6}:)?(?P<host>[\w\-.^_]+) | |
# Values: TEXT | |
# | |
failregex = ^%(__prefix_line)s<HOST>(?::\d+)?\s+.*.env .* | |
# Option: ignoreregex | |
# Notes.: regex to ignore. If this regex matches, the line is ignored. | |
# Values: TEXT | |
# | |
ignoreregex = |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[haproxy-http-auth] | |
# HAProxy by default doesn't log to file you'll need to set it up to forward | |
# logs to a syslog server which would then write them to disk. | |
# See "haproxy-http-auth" filter for a brief cautionary note when setting | |
# maxretry and findtime. | |
logpath = /var/log/haproxy.log | |
enabled = true | |
findtime = 120 | |
maxretry = 1 | |
bantime = -1 | |
[recidive] | |
enabled = true | |
bantime = 31536000 ; 1 year | |
findtime = 18144000 ; 1 month | |
maxretry = 2 | |
logpath = /var/log/fail2ban.log | |
banaction = %(banaction_allports)s | |
[sshd] | |
# To use more aggressive sshd modes set filter parameter "mode" in jail.local: | |
# normal (default), ddos, extra or aggressive (combines all). | |
# See "tests/files/logs/sshd" or "filter.d/sshd.conf" for usage example and details. | |
#mode = normal | |
port = ssh | |
logpath = %(sshd_log)s | |
backend = %(sshd_backend)s |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment