# Fail2Ban on Lighttpd

**URL:** https://dietpi.com/forum/t/fail2ban-on-lighttpd/4740
**Category:** Troubleshooting
**Created:** [18 December 2020 13:59 UTC](https://dietpi.com/forum/t/fail2ban-on-lighttpd/4740 "2020-12-18T13:59:37Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![Fabio](https://dietpi.com/forum/letter_avatar_proxy/v4/letter/f/f4b2a3/32.png) [@Fabio](https://dietpi.com/forum/u/Fabio)
#### Post date: [18 December 2020 13:59 UTC](https://dietpi.com/forum/t/fail2ban-on-lighttpd/4740/1 "2020-12-18T13:59:37Z")

</div>

Hello Everyone!  
I’m looking for help to configure Fail2Ban on my dietpi-owncloud server.  
I’ve installed ownCloud directly from dietpi, and everything is working well.  
I would like to improve security with the help of fail2ban.  
I’ve googled a lot, made some tries, but i’m still not able to “ban myself”.  
I’ve installed Fail2ban directly from dietpi.  
I’m colpletely a noob, so please, be patient…  
I’ve readed a lot of tutorial, copy jail.conf to jail.local, same thing the config file and so on…  
But with no results, so i’ve unistalled everything and made a brand new installation.

I’m a noob so please be patient! Ask me everything if you need further infos!  
Thx!

---

<div class="post-metadata">

### Author: ![Joulinar](https://dietpi.com/forum/user_avatar/dietpi.com/joulinar/32/57_2.png) [@Joulinar](https://dietpi.com/forum/u/Joulinar)
#### Post date: [18 December 2020 15:56 UTC](https://dietpi.com/forum/t/fail2ban-on-lighttpd/4740/2 "2020-12-18T15:56:07Z")

</div>

Hi,

many thanks for your message. First, you would need to configure ownCloud to log failed login attempts.

For fail2ban, you would need to specify following 2 files

```nohighlight
nano /etc/fail2ban/filter.d/owncloud.conf

```

```nohighlight
[Definition]
failregex={.*Login failed: \'.*\' \(Remote IP: \'<HOST>\'\)"}
ignoreregex =

```

and

```nohighlight
nano /etc/fail2ban/jail.d/owncloud.conf

```

```nohighlight
[owncloud]
enabled = true
port = 80,443
protocol = tcp
backend = auto
filter = owncloud
maxretry = 3
bantime = 10800
logpath = /mnt/dietpi_userdata/owncloud_data/owncloud.log

```

once done restart fail2ban

```nohighlight
systemctl restart fail2ban.service

```

Now you should see something like this

```nohighlight
root@DietPi3:~# fail2ban-client status owncloud
Status for the jail: owncloud
|- Filter
| |- Currently failed: 1
| |- Total failed: 1
| `- File list: /mnt/dietpi_userdata/owncloud_data/owncloud.log
`- Actions
   |- Currently banned: 0
   |- Total banned: 0
   `- Banned IP list:
root@DietPi3:~#

```

---

<div class="post-metadata">

### Author: ![Fabio](https://dietpi.com/forum/letter_avatar_proxy/v4/letter/f/f4b2a3/32.png) [@Fabio](https://dietpi.com/forum/u/Fabio)
#### Post date: [18 December 2020 16:20 UTC](https://dietpi.com/forum/t/fail2ban-on-lighttpd/4740/3 "2020-12-18T16:20:54Z")

</div>

Thank you Joulinar ,  
i’ve done all the steps, unfortunately if i run:

```nohighlight
systemctl restart fail2ban.service

```

This is what i’m getting also if i’ve done multiple wront attempt to access from the browser:

```nohighlight
root@DietPi:~# fail2ban-client status owncloud
Status for the jail: owncloud
|- Filter
| |- Currently failed: 0
| |- Total failed: 0
| `- File list: /var/www/owncloud/data/owncloud.log
`- Actions
   |- Currently banned: 0
   |- Total banned: 0
   `- Banned IP list:

```

I’ve checked the /mnt/dietpi\_userdata/owncloud\_data/owncloud.log and it have all the log stored…  
Seems like it’s not getting infos from the file…  
Do you have any suggestion?

---

<div class="post-metadata">

### Author: ![Joulinar](https://dietpi.com/forum/user_avatar/dietpi.com/joulinar/32/57_2.png) [@Joulinar](https://dietpi.com/forum/u/Joulinar)
#### Post date: [18 December 2020 16:27 UTC](https://dietpi.com/forum/t/fail2ban-on-lighttpd/4740/4 "2020-12-18T16:27:03Z")

</div>

You specified the wrong log file in your configuration

```nohighlight
 File list: /var/www/owncloud/data/owncloud.log

```

Before adapting my config, you would need to clean the settings you have done before.

---

<div class="post-metadata">

### Author: ![Fabio](https://dietpi.com/forum/letter_avatar_proxy/v4/letter/f/f4b2a3/32.png) [@Fabio](https://dietpi.com/forum/u/Fabio)
#### Post date: [18 December 2020 16:39 UTC](https://dietpi.com/forum/t/fail2ban-on-lighttpd/4740/5 "2020-12-18T16:39:55Z")

</div>

Done!  
Finally i’m locked out! 🤣  
Thanks a lot!
