add fail2ban config files

This commit is contained in:
Mario Fetka 2023-01-08 19:43:31 +01:00
parent ae8f129b70
commit 45b4cf7c69
6 changed files with 48 additions and 1 deletions

View File

@ -6,7 +6,7 @@ Installscript / Systemd Files / Themes German&English
bash -c "$(wget -qLO - https://gitea.disconnected-by-peer.at/geos_one/mystic/raw/branch/main/install.sh)" bash -c "$(wget -qLO - https://gitea.disconnected-by-peer.at/geos_one/mystic/raw/branch/main/install.sh)"
#Thankyou Thankyou
https://vswitchzero.com/mystic-systemd/ for the initial systemd scripts for mis and mrc https://vswitchzero.com/mystic-systemd/ for the initial systemd scripts for mis and mrc
https://tteck.github.io/Proxmox/ for the layout of the install script and the cool error tracker. https://tteck.github.io/Proxmox/ for the layout of the install script and the cool error tracker.

View File

@ -0,0 +1,21 @@
# Fail2Ban configuration file
#
# Author: Mario Fetka <mario.fetka@gmail.com>
#
#
[Definition]
actionstart = touch /var/run/fail2ban/fail2ban.mysticbbs
actionstop = rm -f /var/run/fail2ban/fail2ban.mysticbbs
actioncheck =
actionban = grep -qxF '<ip>' @MYSTIC_DIR@/data/blacklist.txt || echo '<ip>' >> @MYSTIC_DIR@/data/blacklist.txt
actionunban = sed -e '/<ip>/d' -i @MYSTIC_DIR@/data/blacklist.txt
[Init]
init = Mystic BBS notifications

View File

@ -0,0 +1,12 @@
# Fail2Ban filter for Mystic BBS
[INCLUDES]
before = common.conf
[Definition]
_daemon = mis
failregex = ^%(__prefix_line)s.*(TELNET|SSH) .*Auto banning IP <HOST>$
ignoreregex =

View File

@ -0,0 +1,9 @@
[mysticbbs]
enabled = true
port = 23
protocol = tcp
filter = mysticbbs
logpath = @MYSTIC_DIR@/logs/mis.log
maxretry = 1
action = iptables-ipset-proto6-allports
mysticbbs

View File

@ -0,0 +1 @@
put into /etc/systemd/system/fail2ban.service.d/override.conf

View File

@ -0,0 +1,4 @@
[Service]
ExecStartPost=/usr/bin/sh -c "while ! [ -S /var/run/fail2ban/fail2ban.sock ]; do sleep 1; done"
ExecStartPost=/usr/bin/chgrp fail2ban /var/run/fail2ban/fail2ban.sock
ExecStartPost=/usr/bin/chmod g+w /var/run/fail2ban/fail2ban.sock