Fail2Ban fails to start: Action already exists

Created:

2017-04-28 00:21:56 UTC

Modified:

2017-08-08 13:24:08 UTC

1

Was this article helpful?


Have more questions?

Submit a request

Fail2Ban fails to start: Action already exists

Symptoms

The following error appears on Fail2Ban restart via Plesk administration panel:

f2bmng failed: ERROR NOK: ('ssh',)
ERROR NOK: ('Action iptables already exists',)
ERROR NOK: ('recidive',)
ERROR NOK: ('Action iptables-allports already exists',)
ERROR NOK: ('plesk-proftpd',)
ERROR NOK: ('Action iptables-multiport already exists',)
ERROR NOK: ('plesk-postfix',)
ERROR NOK: ('Action iptables-multiport already exists',)
ERROR NOK: ('plesk-dovecot',)
ERROR NOK: ('Action iptables-multiport already exists',)
ERROR NOK: ('plesk-roundcube',)
ERROR NOK: ('Action iptables-multiport already exists',)
ERROR NOK: ('plesk-apache',)
ERROR NOK: ('Action iptables-multiport already exists',)
ERROR NOK: ('plesk-apache-badbot',)
ERROR:f2bmng:Command '['/usr/bin/fail2ban-client', 'reload']' returned non-zero exit status 255

 The following error appears in /var/log/fail2ban.log:

2017-04-28 04:43:20,322 fail2ban.filter [28401]: ERROR /var/www/vhosts/system/example.com/logs/access_ssl_log already exists
2017-04-28 04:43:20,488 fail2ban.filter [28401]: ERROR /var/www/vhosts/system/example2.com/logs/proxy_access_ssl_log already exists
2017-04-28 04:43:20,710 fail2ban.filter [28401]: ERROR /var/www/vhosts/system/example3.com/logs/proxy_access_log already exists
2017-04-28 04:43:20,891 fail2ban.filter [28401]: ERROR /var/www/vhosts/system/example4.com/logs/access_log already exists

 The following error appears in /var/log/messages:

May 3 09:53:11 cloud-plesk1 systemd: fail2ban.service start operation timed out. Terminating.
May 3 09:53:11 cloud-plesk1 fail2ban-client: WARNING Caught signal 15. Exiting
May 3 09:53:11 cloud-plesk1 systemd: fail2ban.service: control process exited, code=exited status=255
May 3 09:53:11 cloud-plesk1 systemd: Failed to start Fail2Ban Service.
May 3 09:53:11 cloud-plesk1 systemd: Unit fail2ban.service entered failed state.
May 3 09:53:11 cloud-plesk1 systemd: fail2ban.service failed.
May 3 09:53:11 cloud-plesk1 systemd: fail2ban.service holdoff time over, scheduling restart.
May 3 09:53:11 cloud-plesk1 systemd: Starting Fail2Ban Service...

 

Over 300 domains are hosted on the server.

Cause

Fail2Ban is trying to start in infinite loop.

With this significant number of domains, the start time of fail2ban service exceeds the systemd services start timeout that is 90 seconds. After 90 seconds, systemd sends to service SIGTERM and retries to start the service again.

Resolution

1. Increase the timeout for Fail2Ban service in /lib/systemd/system/fail2ban.service:

TimeoutStartSec=700

 

2. Apply the changes and restart the service:

# systemctl daemon-reload

# service fail2ban restart

Have more questions? Submit a request
Please sign in to leave a comment.