Zum Inhalt springen

Fail2ban/Nextcloud: Unterschied zwischen den Versionen

Aus Foxwiki
Die Seite wurde neu angelegt: „ == fail2ban nextcloud install == 0. Installieren Sie das Paket fail2ban.<syntaxhighlight lang="bash" highlight="1" copy="" line=""> sudo apt install fail2ban </syntaxhighlight>1. Erstellen Sie die Datei ''/etc/fail2ban/filter.d/nextcloud.conf'':<syntaxhighlight lang="ini" copy="" line=""> [Definition] _groupsre = (?:(?:,?\s*"\w+":(?:"[^"]+"|\w+))*) failregex = ^\{%(_groupsre)s,?\s*"remoteAddr":"<HOST>"%(_groupsre)s,?\s*"message":"Login failed:…“
 
K Dirkwagner verschob die Seite Nextcloud/Installation/AIO/fail2ban nach Fail2ban/Nextcloud
(kein Unterschied)

Version vom 3. November 2025, 08:56 Uhr

fail2ban nextcloud install

0. Installieren Sie das Paket fail2ban.

 sudo apt install fail2ban

1. Erstellen Sie die Datei /etc/fail2ban/filter.d/nextcloud.conf:

[Definition]
_groupsre = (?:(?:,?\s*"\w+":(?:"[^"]+"|\w+))*)
failregex = ^\{%(_groupsre)s,?\s*"remoteAddr":"<HOST>"%(_groupsre)s,?\s*"message":"Login failed:
            ^\{%(_groupsre)s,?\s*"remoteAddr":"<HOST>"%(_groupsre)s,?\s*"message":"Trusted domain error.
datepattern = ,?\s*"time"\s*:\s*"%%Y-%%m-%%d[T ]%%H:%%M:%%S(%%z)?"

2. Erstellen Sie die Datei /etc/fail2ban/jail.d/nextcloud.local:

[nextcloud]
backend = auto
enabled = true
port = 80,443
protocol = tcp
filter = nextcloud
maxretry = 2
bantime = 3m
findtime = 5m
logpath = /var/lib/docker/volumes/nextcloud_aio_nextcloud/_data/data/nextcloud.log
chain=DOCKER-USER
action = iptables-multiport[name=nextcloud, port="80,443", chain="DOCKER-USER"]

3. Fail2ban neu starten

sudo systemctl restart fail2ban