Setup Fail2ban with Owncloud 8.1.0

For security reasons it it a good idea to setup fai2ban on you Owncloud server in the matter of facts it should be by law! It will
prevent bruteforce attacks. For an example it can set a limit for unsuceed logins, so it somone try’s
guess your password you can set a limit in fail2ban so they can try 3 times in 10 minutes and afterwards get’s banned for an hour.
Everyone should have this on their server, it dosn’t take more than 2 minutes to setup and afterwards you should be secured against bruteforceattacks.

First install fail2ban

Create a .conf file

paste the conent below in the file

Create a jail for Owncloud

again paste the content below in the file

Restart fail2ban to register the changes.

You can test if it is working probably. (Remember to change the location of the logs if needed)

  • Maarten Hoogveld

    Nice article!
    The Fail2Ban filter however has a small error in the regex. A single quote after the part is missing.
    This is the correct line:
    failregex={“reqId”:”.*”,”remoteAddr”:”.*”,”app”:”core”,”message”:”Login failed: ‘.*’ (Remote IP: ”)”,”level”:2,”time”:”.*”}

    • Thanks! i will correct this imediatley!

  • mr3 mr4

    Thanks, good guide worked with nextcloud also just changed all names owncloud->nextcloud