Last active
September 15, 2017 02:13
-
-
Save briped/acd91d0a1a20ca198c6c3e0daa458b82 to your computer and use it in GitHub Desktop.
Fail2Ban configuration files for Domoticz behind NGINX Reverse Proxy
This file contains 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 jail configuration file for Domoticz behind NGINX Reverse Proxy. | |
# nginx-domoticz.conf | |
# | |
# The X-Forwarded-For IP isn't logged in the Domoticz log, and so any failed | |
# attempts will show the NGINX reverse proxy IP rather than the actual IP. | |
# | |
# Workaround is to look at all attempts and then set the maxretry number to 5. | |
# This doesn't protect against distributed attempts. | |
# | |
# Author: Brian Schmidt Pedersen | |
# | |
[nginx-domoticz] | |
enabled = true | |
port = http,https | |
filter = nginx-domoticz | |
logpath = %(nginx_access_log)s | |
maxretry= 5 |
This file contains 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 for Domoticz behind NGINX Reverse Proxy. | |
# nginx-domoticz.conf | |
# | |
# The X-Forwarded-For IP isn't logged in the Domoticz log, and so any failed | |
# attempts will show the NGINX reverse proxy IP rather than the actual IP. | |
# | |
# Workaround is to check for the logincheck parameter, and ban if more than | |
# maxretry attempts, and then set the maxretry number to a higher value. Also | |
# checking all attempts that get a 401 (Unauthorized), as failed API attempts | |
# will show this. This doesn't protect against distributed attempts. | |
# | |
# Author: Brian Schmidt Pedersen | |
# | |
[Definition] | |
failregex = ^<HOST> -[^"]*"GET /json\.htm\?type=command¶m=logincheck&[^"]*" 200 | |
^<HOST> -[^"]*"GET /json\.htm\?[^"]*" 401 | |
ignoreregex = |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment