From af8834f4f4137b31268398692308ff0e7ef2dc44 Mon Sep 17 00:00:00 2001 From: Eric Nemchik Date: Thu, 7 Jul 2022 17:11:23 +0000 Subject: [PATCH 01/29] Lots of config changes --- Dockerfile | 2 +- .../fail2ban/action.d/apprise-api.conf | 49 ++ root/defaults/fail2ban/action.d/apprise.conf | 40 +- .../fail2ban/action.d/discord-webhook.conf | 42 + .../fail2ban/action.d/iptables-common.conf | 7 - .../fail2ban/filter.d/airsonic-http-auth.conf | 3 +- .../fail2ban/filter.d/emby-http-auth.conf | 9 +- .../fail2ban/filter.d/filebrowser.conf | 4 + root/defaults/fail2ban/filter.d/gitea.conf | 7 +- .../fail2ban/filter.d/homeassistant.conf | 3 +- .../fail2ban/filter.d/nginx-http-418.conf | 3 + .../fail2ban/filter.d/nginx-http-auth.conf | 17 - .../fail2ban/filter.d/nginx-http-badbots.conf | 21 - .../filter.d/nginx-http-botsearch.conf | 23 - .../fail2ban/filter.d/nginx-http-deny.conf | 2 + root/defaults/fail2ban/filter.d/nzbget.conf | 4 + .../defaults/fail2ban/filter.d/overseerr.conf | 4 + root/defaults/fail2ban/filter.d/servarr.conf | 4 + .../fail2ban/filter.d/unifi-controller.conf | 7 + .../fail2ban/filter.d/unraid-webgui.conf | 7 + .../fail2ban/filter.d/vaultwarden.conf | 4 + root/defaults/fail2ban/jail.conf | 738 +++++++++++++++++- .../fail2ban/jail.d/airsonic-http-auth.conf | 2 + .../fail2ban/jail.d/emby-http-auth.conf | 3 +- .../defaults/fail2ban/jail.d/filebrowser.conf | 2 + root/defaults/fail2ban/jail.d/gitea.conf | 1 + .../fail2ban/jail.d/homeassistant.conf | 4 +- .../fail2ban/jail.d/nginx-http-418.conf | 2 + .../fail2ban/jail.d/nginx-http-auth.conf | 5 - .../fail2ban/jail.d/nginx-http-badbots.conf | 6 +- .../fail2ban/jail.d/nginx-http-botsearch.conf | 5 - .../fail2ban/jail.d/nginx-http-deny.conf | 2 + root/defaults/fail2ban/jail.d/nzbget.conf | 4 +- root/defaults/fail2ban/jail.d/overseerr.conf | 2 + root/defaults/fail2ban/jail.d/prowlarr.conf | 2 + root/defaults/fail2ban/jail.d/radarr.conf | 4 +- root/defaults/fail2ban/jail.d/sonarr.conf | 4 +- .../fail2ban/jail.d/unifi-controller.conf | 9 + .../defaults/fail2ban/jail.d/unraid-sshd.conf | 9 + .../fail2ban/jail.d/unraid-webgui.conf | 9 + .../defaults/fail2ban/jail.d/vaultwarden.conf | 6 +- root/defaults/fail2ban/jail.local | 26 - .../{paths-common.local => paths-lsio.conf} | 6 +- root/etc/logrotate.d/fail2ban | 7 +- 44 files changed, 960 insertions(+), 160 deletions(-) create mode 100644 root/defaults/fail2ban/action.d/apprise-api.conf create mode 100644 root/defaults/fail2ban/action.d/discord-webhook.conf delete mode 100644 root/defaults/fail2ban/action.d/iptables-common.conf delete mode 100644 root/defaults/fail2ban/filter.d/nginx-http-auth.conf delete mode 100644 root/defaults/fail2ban/filter.d/nginx-http-badbots.conf delete mode 100644 root/defaults/fail2ban/filter.d/nginx-http-botsearch.conf create mode 100644 root/defaults/fail2ban/filter.d/unifi-controller.conf create mode 100644 root/defaults/fail2ban/filter.d/unraid-webgui.conf delete mode 100644 root/defaults/fail2ban/jail.d/nginx-http-auth.conf delete mode 100644 root/defaults/fail2ban/jail.d/nginx-http-botsearch.conf create mode 100644 root/defaults/fail2ban/jail.d/unifi-controller.conf create mode 100644 root/defaults/fail2ban/jail.d/unraid-sshd.conf create mode 100644 root/defaults/fail2ban/jail.d/unraid-webgui.conf delete mode 100644 root/defaults/fail2ban/jail.local rename root/defaults/fail2ban/{paths-common.local => paths-lsio.conf} (83%) diff --git a/Dockerfile b/Dockerfile index a5232c5..586e7ff 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM ghcr.io/linuxserver/baseimage-alpine:3.14 +FROM ghcr.io/linuxserver/baseimage-alpine:3.16 # set version label ARG BUILD_DATE diff --git a/root/defaults/fail2ban/action.d/apprise-api.conf b/root/defaults/fail2ban/action.d/apprise-api.conf new file mode 100644 index 0000000..ef0e683 --- /dev/null +++ b/root/defaults/fail2ban/action.d/apprise-api.conf @@ -0,0 +1,49 @@ +[Definition] + +# Option: actionstart +# Notes.: command executed once at the start of Fail2Ban. +# Values: CMD +# +actionstart = curl -X POST -d '{"tag": "f2b", "type": "info", "body": "The jail as been started successfully."}' \ + -H "Content-Type: application/json" \ + + +# Option: actionstop +# Notes.: command executed once at the end of Fail2Ban +# Values: CMD +# +actionstop = curl -X POST -d '{"tag": "f2b", "type": "info", "body": "The jail has been stopped."}' \ + -H "Content-Type: application/json" \ + + +# Option: actioncheck +# Notes.: command executed once before each actionban command +# Values: CMD +# +actioncheck = + +# Option: actionban +# Notes.: command executed when banning an IP. Take care that the +# command is executed with Fail2Ban user rights. +# Tags: See jail.conf(5) man page +# Values: CMD +# + +actionban = curl -X POST -d '{"tag": "f2b", "type": "warning", "body": "The IP has just been banned from after attempts."}' \ + -H "Content-Type: application/json" \ + + +# Option: actionunban +# Notes.: command executed when unbanning an IP. Take care that the +# command is executed with Fail2Ban user rights. +# Tags: See jail.conf(5) man page +# Values: CMD +# + +actionunban = curl -X POST -d '{"tag": "f2b", "type": "success", "body": "The IP has just been unbanned from ."}' \ + -H "Content-Type: application/json" \ + + +[Init] + +url = http://apprise:8000/notify/default diff --git a/root/defaults/fail2ban/action.d/apprise.conf b/root/defaults/fail2ban/action.d/apprise.conf index c4c6c1c..e3cee2b 100644 --- a/root/defaults/fail2ban/action.d/apprise.conf +++ b/root/defaults/fail2ban/action.d/apprise.conf @@ -1,18 +1,22 @@ +# Fail2Ban configuration file +# +# Author: Chris Caron +# +# + [Definition] # Option: actionstart -# Notes.: command executed on demand at the first ban (or at the start of Fail2Ban if actionstart_on_demand is set to false). +# Notes.: command executed once at the start of Fail2Ban. # Values: CMD # -actionstart = curl -X POST -d '{"tag": "f2b", "type": "info", "body": "The guard in is waking up."}' \ - -H "Content-Type: application/json" \ - +actionstart = printf %%b "The jail as been started successfully." | -t "[Fail2Ban] : started on `uname -n`" # Option: actionstop -# Notes.: command executed at the stop of jail (or at the end of Fail2Ban) +# Notes.: command executed once at the end of Fail2Ban # Values: CMD # -actionstop = +actionstop = printf %%b "The jail has been stopped." | -t "[Fail2Ban] : stopped on `uname -n`" # Option: actioncheck # Notes.: command executed once before each actionban command @@ -23,29 +27,23 @@ actioncheck = # Option: actionban # Notes.: command executed when banning an IP. Take care that the # command is executed with Fail2Ban user rights. -# Tags: IP address -# number of failures -#