fail2ban nextcloud won't start

Guides and tutorials for various stuff. Posted by DietPi users.
Post Reply
DietRK
Posts: 3
Joined: Tue Nov 03, 2020 9:07 am

fail2ban nextcloud won't start

Post by DietRK »

After configured fail2ban for nextcloud i'm getting this errors

systemctl status fail2ban.service

Code: Select all

root@DietPi:~# systemctl status fail2ban.service
● fail2ban.service - Fail2Ban Service
   Loaded: loaded (/lib/systemd/system/fail2ban.service; enabled; vendor preset:
 enabled)
   Active: failed (Result: exit-code) since Wed 2020-11-04 13:19:46 C
ET; 22s ago
     Docs: man:fail2ban(1)
  Process: 4587 ExecStartPre=/bin/mkdir -p /var/run/fail2ban (code=exited, statu
s=0/SUCCESS)
  Process: 4588 ExecStart=/usr/bin/fail2ban-server -xf start (code=exite
d, status=255/EXCEPTION)
 Main PID: 4588 (code=exited, status=255/EXCEPTION)

Nov 04 13:19:46 DietPi systemd[1]: Starting Fail2Ban Service...
Nov 04 13:19:46 DietPi systemd[1]: Started Fail2Ban Service.
Nov 04 13:19:46 DietPi fail2ban-server[4588]:  Failed during configuration: Bad
value substitution: option 'action' in section 'nextcloud' contains an interpola
tion key 'action_mw1' which is not a valid option name. Raw value: '%(action_mw1
)s'
Nov 04 13:19:46 DietPi fail2ban-server[4588]:  Async configuration of server fai
led
Nov 04 13:19:46 DietPi systemd[1]: fail2ban.service: Mai
n process exited, code=exited, status=255/EXCEPTION
Nov 04 13:19:46 DietPi systemd[1]: fail2ban.service: Fai
led with result 'exit-code'.
nano /etc/fail2ban/jail.conf

Code: Select all

[nextcloud]
enabled = true
port = 80,443
protocol = tcp
filter = nextcloud
maxretry = 3
logpath = /var/log/nextcloud.log
action = %(action_mwl)s

User avatar
Joulinar
Posts: 2572
Joined: Sat Nov 16, 2019 12:49 am

Re: fail2ban nextcloud won't start

Post by Joulinar »

Hi,

looks like the action you have set is not accepted. Where did you get the config from?

Code: Select all

value substitution: option 'action' in section 'nextcloud' contains an interpola
tion key 'action_mw1' which is not a valid option name. Raw value: '%(action_mw1
)s'
Pls let us know if a solution is working. This could help others if they hit by similar situation. Your DietPi Team
DietRK
Posts: 3
Joined: Tue Nov 03, 2020 9:07 am

Re: fail2ban nextcloud won't start

Post by DietRK »

User avatar
Joulinar
Posts: 2572
Joined: Sat Nov 16, 2019 12:49 am

Re: fail2ban nextcloud won't start

Post by Joulinar »

probably a typo. It should be

> action = %(action_mwl)s

With L like Lima.

On you error message it looks like a 1 (one)
Pls let us know if a solution is working. This could help others if they hit by similar situation. Your DietPi Team
DietRK
Posts: 3
Joined: Tue Nov 03, 2020 9:07 am

Re: fail2ban nextcloud won't start

Post by DietRK »

i tried it several times,
only if comment out action , failban runs

Code: Select all

[nextcloud]
enabled = true
port = 80,443
protocol = tcp
filter = nextcloud
maxretry = 3
logpath = /var/log/nextcloud.log
#action = %(action_mwl)s
fail2ban-client status

Code: Select all

Status
|- Number of jail:	3
`- Jail list:	dropbear, nextcloud, sshd
Maybe a problem of Nextcloud > 16 ?
User avatar
Joulinar
Posts: 2572
Joined: Sat Nov 16, 2019 12:49 am

Re: fail2ban nextcloud won't start

Post by Joulinar »

well your problem is the line action = %(action_mwl)s within your jail.conf file. Best to my knowledge, this is to send email notification. https://wiki.archlinux.org/index.php/fa ... ert_e-mail

But I guess this is not configured on your F2B installation. Found another guide how to setup F2B and Nextcloud https://www.allerstorfer.at/fail2ban-fuer-nextcloud/

Btw: nextcloud.log is located at /mnt/dietpi_userdata/nextcloud_data/nextcloud.log by default.
Pls let us know if a solution is working. This could help others if they hit by similar situation. Your DietPi Team
Post Reply