Cobra Forum

Plesk Panel => Plesk Service/Interface => Topic started by: mahesh on Nov 06, 2024, 07:58 AM

Title: Unable to create a subscription or open Jails in Fail2Ban: f2bmng failed: ERROR:
Post by: mahesh on Nov 06, 2024, 07:58 AM
Question
Unable to create a subscription or open Jails in Fail2Ban: f2bmng failed: ERROR:f2bmng
Symptoms
Error: hosting update is failed: f2bmng failed: ERROR:f2bmng:Command '['/bin/rpm', '-qf', '--queryformat', '%{NAME}\\n', '/etc/fail2ban/jail.conf', '/etc/fail2ban/jail.d/plesk.conf', '/etc/fail2ban/jail.local']' returned non-zero exit status 3

ERR [panel] Domain Service Web not exists: domain=example.com, id=270

Error: Unable to get the list of jails: f2bmng failed: ERROR:__main__:Command '['/bin/rpm', '-qf', '--queryformat', '%{NAME}\\n', '/etc/fail2ban/jail.conf', '/etc/fail2ban/jail.d/plesk.conf', '/etc/fail2ban/jail.local']' returned non-zero exit status 1.

Error: Unable to get the list of jails: f2bmng failed: ERROR:__main__:Failed to get packages by files: package manager returned 4 lines instead of expected 3. Command was ['/usr/bin/dpkg', '-S', '/etc/fail2ban/jail.conf', '/etc/fail2ban/jail.d/plesk.conf', '/etc/fail2ban/jail.local'] and returned exit status 1. Your package system might be inconsistent. Please check it for issues with 'plesk sbin pum --check --full'..

Could not configure fail2ban to track logs of the domain. Logs will be automatically tracked the next time fail2ban service restarts. f2bmng failed: ERROR:main:Command ['set', 'plesk-apache', 'addlogpath', '/var/www/vhosts/system/example.com/logs/error_log'] failed with error PermissionError(13, 'Permission denied')

ERR The jail recidive was not found.

Cause
Incorrect installation of Fail2Ban.

Resolution
Perform a clean reinstallation of Fail2ban following these steps:

1.Connect to the server via SSH

2.Back up Fail2ban folder:

#cp -a /etc/fail2ban /root/fail2ban_backup
3.Uninstall Fail2ban:

#plesk installer --select-release-current --remove-component fail2ban
4.Move Fail2ban left-over old installation files:

#mv /etc/fail2ban /root/fail2ban_old
5.Install Fail2ban:

#plesk installer --select-release-current --install-component fail2ban
6.Restore Fail2ban configuration:

#mv /root/fail2ban_backup/jail.local /etc/fail2ban/.
7.Restart Fail2Ban service:

#systemctl restart fail2ban.service