NextcloudPi fail2ban password-protection für public shares
Hallo zusammen,
ich habe auf einem Raspberry Pi 4 4Gb NextcloudPi als heimische Cloud installiert.
Versionen:
- NextcloudPi V 1.26.2
- Nextcloud 18.0.5.1
NextcloudPi kommt u.a. mit aktivierbarem und vorkonfiguriertem fail2ban zum Schutz vor brute-force Attacken für ssh und und den https-User-Login, was auch wunderbar funktioniert.
Mir ist jedoch aufgefallen, dass der fail2ban-Schutz nicht die Passwortabfrage bei öffentlich geteilten Shares umfasst.
Im Nextcloudforum gibt es zu dieser Frage einen Thread:
(How to ban IP via shared links protected form https://help.nextcloud.com/t/how-to-ban-ip-via-shared-links-protected-fo ..)
Fail2ban is correctly banning IPs that try to force the login form. That’s really fine, and I would like to extend this feature to the form on shared links protected by password. Is there a way to do that?
mit einer leider nur kurzen und zumindest für mich (und einen weiteren User dort) nicht klaren Antwort:
Yeah, you’re right about bruteforce. And concerning Fail2ban, there’s a way to catch people trying to log on the shared link password page.
I’ve created a filter with this regex:
And it works ! It’s important to keep the 200 response code, cause in case of success, it’s a redirection 303.
Inhalt der nextcloud.conf von fail2ban (/etc/fail2ban/filter.d/nextcloud.conf)
Hat vielleicht jemand eine Idee, wie man das umzusetzen könnte?
Vorweg schon einmal vielen Dank.
ich habe auf einem Raspberry Pi 4 4Gb NextcloudPi als heimische Cloud installiert.
Versionen:
- NextcloudPi V 1.26.2
- Nextcloud 18.0.5.1
NextcloudPi kommt u.a. mit aktivierbarem und vorkonfiguriertem fail2ban zum Schutz vor brute-force Attacken für ssh und und den https-User-Login, was auch wunderbar funktioniert.
Mir ist jedoch aufgefallen, dass der fail2ban-Schutz nicht die Passwortabfrage bei öffentlich geteilten Shares umfasst.
Im Nextcloudforum gibt es zu dieser Frage einen Thread:
(How to ban IP via shared links protected form https://help.nextcloud.com/t/how-to-ban-ip-via-shared-links-protected-fo ..)
Fail2ban is correctly banning IPs that try to force the login form. That’s really fine, and I would like to extend this feature to the form on shared links protected by password. Is there a way to do that?
mit einer leider nur kurzen und zumindest für mich (und einen weiteren User dort) nicht klaren Antwort:
Yeah, you’re right about bruteforce. And concerning Fail2ban, there’s a way to catch people trying to log on the shared link password page.
I’ve created a filter with this regex:
^<HOST> - - .*"POST /s/******ENTER*HASH*******/authenticate/showShare HTTP/2.0" 200
Inhalt der nextcloud.conf von fail2ban (/etc/fail2ban/filter.d/nextcloud.conf)
[INCLUDES]
before = common.conf
[Definition]
_groupsre = (?:(?:,?\s*"\w+":(?:"[^"]+"|\w+))*)
failregex = ^\{%(_groupsre)s,?\s*"remoteAddr":"<HOST>"%(_groupsre)s,?\s*"message":"Login failed:
datepattern = ,?\s*"time"\s*:\s*"%%Y-%%m-%%d[T ]%%H:%%M:%%S(%%z)?"
ignoreregex =
Hat vielleicht jemand eine Idee, wie man das umzusetzen könnte?
Vorweg schon einmal vielen Dank.
Bitte markiere auch die Kommentare, die zur Lösung des Beitrags beigetragen haben
Content-ID: 583635
Url: https://administrator.de/forum/nextcloudpi-fail2ban-password-protection-fuer-public-shares-583635.html
Ausgedruckt am: 30.04.2025 um 02:04 Uhr
1 Kommentar