Add Mystic BBS f2b with systemd overrwrite

This commit is contained in:
Mario Fetka 2024-05-16 14:55:15 +02:00
parent c5986ded53
commit e701d4990c
5 changed files with 49 additions and 0 deletions

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/denylist.txt || echo '<ip>' >> @MYSTIC_DIR@/data/denylist.txt
actionunban = sed -e '/<ip>/d' -i @MYSTIC_DIR@/data/denylist.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,3 @@
https://docs.linuxfabrik.ch/monitoring-plugins/fail2ban.html
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