Skip to content

Instantly share code, notes, and snippets.

@briped
Last active March 29, 2019 07:36
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save briped/c0094151c31a4dd59740f5da18c3b6e9 to your computer and use it in GitHub Desktop.
Save briped/c0094151c31a4dd59740f5da18c3b6e9 to your computer and use it in GitHub Desktop.
Fail2Ban configuration files for PlexPy behind NGINX Reverse Proxy Raw
# Fail2Ban jail configuration file for PlexPy behind NGINX Reverse Proxy.
# nginx-plexpy.conf
#
# The X-Forwarded-For IP (or any IP for that matter) isn't logged in the PlexPy
# log, and so any failed attempts cannot be blocked using Fail2Ban.
#
# 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-plexpy]
enabled = true
port = http,https
filter = nginx-plexpy
logpath = %(nginx_access_log)s
maxretry= 5
# Fail2Ban filter configuration file for PlexPy behind NGINX Reverse Proxy.
# nginx-plexpy.conf
#
# The X-Forwarded-For IP (or any IP for that matter) isn't logged in the PlexPy
# log, and so any failed attempts cannot be blocked using Fail2Ban.
#
# 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
#
[Definition]
failregex = ^<HOST> -[^"]*"POST /auth/login[^"]*"
ignoreregex =
@modem7
Copy link

modem7 commented Mar 28, 2019

Heya,

I've changed a few things to make it work with the latest version of Tautulli:

[nginx-plexpy]
enabled = true
port = http,https
filter = nginx-plexpy
logpath = /var/log/nginx/tautulli.access.log
maxretry= 3
bantime = 3600 #1 hour
ignoreip = 127.0.0.1/8

[Definition]
failregex = ^ -.* 401
ignoreregex =

This seems to block any attempts now, previous regex didn't like the latest log format which has updated to include IP addresses as well now (still no username however). It's not pretty, but unfortunately regexes certainly aren't my strong point!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment