Zum Inhalt springen

Fail2ban/Nextcloud: Unterschied zwischen den Versionen

Aus Foxwiki
K Dirkwagner verschob die Seite Nextcloud/Installation/AIO/fail2ban nach Fail2ban/Nextcloud
Keine Bearbeitungszusammenfassung
Zeile 25: Zeile 25:
sudo systemctl restart fail2ban
sudo systemctl restart fail2ban
</syntaxhighlight><noinclude>
</syntaxhighlight><noinclude>
[[Kategorie:Nextcloud]]
[[Kategorie:Fail2ban]]

Version vom 3. November 2025, 08:57 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