Fail2ban/Nextcloud: Unterschied zwischen den Versionen
Erscheinungsbild
	
	
Keine Bearbeitungszusammenfassung  | 
				|||
| (Eine dazwischenliegende Version desselben Benutzers wird nicht angezeigt) | |||
| Zeile 1: | Zeile 1: | ||
== Standardinstallation ==  | |||
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:  | |||
            ^\{%(_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)?"  | |||
</syntaxhighlight>2. Erstellen Sie die Datei ''/etc/fail2ban/jail.d/nextcloud.local'':<syntaxhighlight lang="ini" copy="" line="">  | |||
[nextcloud]  | |||
backend = auto  | |||
enabled = true  | |||
port = 80,443  | |||
protocol = tcp  | |||
filter = nextcloud  | |||
maxretry = 5  | |||
bantime = 1h  | |||
findtime = 3m  | |||
logpath = /var/log/nextcloud.log  | |||
</syntaxhighlight>  | |||
3. Fail2ban neu starten  | |||
<syntaxhighlight lang="bash" highlight="1" copy="" line="">  | |||
sudo systemctl restart fail2ban  | |||
</syntaxhighlight>  | |||
4. Überprüfen des Status von Nextcloud Jail:  | |||
<syntaxhighlight lang="bash" highlight="1" copy="" line="">  | |||
fail2ban-client status nextcloud  | |||
</syntaxhighlight>  | |||
== Installation für Nextcloud AIO ==  | == Installation für Nextcloud AIO ==  | ||
| Zeile 21: | Zeile 56: | ||
filter = nextcloud  | filter = nextcloud  | ||
maxretry = 2  | maxretry = 2  | ||
bantime =   | bantime = 1h  | ||
findtime = 5m  | findtime = 5m  | ||
logpath = /var/lib/docker/volumes/nextcloud_aio_nextcloud/_data/data/nextcloud.log  | logpath = /var/lib/docker/volumes/nextcloud_aio_nextcloud/_data/data/nextcloud.log  | ||
chain=DOCKER-USER  | chain=DOCKER-USER  | ||
action = iptables-multiport[name=nextcloud, port="80,443", chain="DOCKER-USER"]  | action = iptables-multiport[name=nextcloud, port="80,443", chain="DOCKER-USER"]  | ||
</syntaxhighlight>3. Fail2ban neu starten<syntaxhighlight lang="bash" highlight="1" copy="" line="">  | </syntaxhighlight>  | ||
3. Fail2ban neu starten  | |||
<syntaxhighlight lang="bash" highlight="1" copy="" line="">  | |||
sudo systemctl restart fail2ban  | sudo systemctl restart fail2ban  | ||
</syntaxhighlight><noinclude>  | </syntaxhighlight>  | ||
4. Überprüfen des Status von Nextcloud Jail:  | |||
<syntaxhighlight lang="bash" highlight="1" copy="" line="">  | |||
fail2ban-client status nextcloud  | |||
</syntaxhighlight>  | |||
<noinclude>  | |||
[[Kategorie:Nextcloud]]  | [[Kategorie:Nextcloud]]  | ||
[[Kategorie:Fail2ban]]  | [[Kategorie:Fail2ban]]  | ||
Aktuelle Version vom 3. November 2025, 15:08 Uhr
Standardinstallation
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 = 5
bantime = 1h
findtime = 3m
logpath = /var/log/nextcloud.log
3. Fail2ban neu starten
sudo systemctl restart fail2ban
4. Überprüfen des Status von Nextcloud Jail:
fail2ban-client status nextcloud
Installation für Nextcloud AIO
Das Autorisierungsprotokoll für die Webschnittstelle von Nextcloud AIO befindet sich unter dem Mount-Pfad des Volumes: /var/lib/docker/volumes/nextcloud_aio_nextcloud/_data/data/nextcloud.log
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 = 1h
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
4. Überprüfen des Status von Nextcloud Jail:
fail2ban-client status nextcloud