Fail2ban configuration with nextcloud installed on external hard drive

Good morning, I have problems with configuring fail2ban with nextcloud. I installed nextcloud on an external hard drive. Everything works except the integration with fail2ban. I followed the guide at this link: https://docs.nextcloud.com/server/19/admin_manual/installation/harden_server.html?highlight=fail2ban
But when I start the service I have the following error, although the logpath path is correct: “Failed during configuration: Have not found any log file for nextcloud jail”. Could someone help me? Thank you so much in advance!

this is the file “nextcloud.log” in your Nextcloud data folder

Yes, it exists and its path (followed by “nextcloud.log”, obv) is that one I correctly put as logpath nextcloud.local, under jail.d folder

Did you restart the service after altering the path to the logfile?

service fail2ban restart

To reload fail2ban the command should be

sudo fail2ban-client reload if you don’t want to flush banned IP’s and sudo fail2ban-client restart if you do

Check status and running jail’s with

sudo fail2ban-client status

or

sudo fail2ban-client status [jail]

You can also start, add, stop jail’s and append log paths using the fail2ban-client command

man fail2ban-client
man fail2ban

https://www.mankier.com/1/fail2ban-client

1 Like

After what I did, it doesn’t start: after executing “service fail2ban restart”, it fails telling me:

Then the jail is not configured yet.
Propably this link would be helpful: https://www.allerstorfer.at/fail2ban-fuer-nextcloud/

The link from Sanook should work but if it doesn’t I’d recommend checking the version installed and checking how to set the variables for that release version on fail2ban GitHub wiki

You should also be able to manually set the log path with the fail2ban-client command

Here is their wiki page for a proper fail2ban configuration

1 Like