3

When enabled sshd jail i see Starting fail2ban: ERROR NOK: ("Failed to initialize any backend for Jail 'sshd'",) ERROR NOK: ('sshd',) In logs : ERROR Backend 'systemd' failed to initialize due to No module named systemd ERROR Failed to initialize any backend for Jail 'sshd'

Centos 6.7 no have systemd module . CentOS 6.7, python 2.6

3 Answers 3

5

Just replace in you jail config backend to auto From

[sshd]
enabled = true
filter = sshd
port    = ssh
logpath = %(sshd_log)s
backend = %(sshd_backend)s

To

[sshd]
enabled = true
filter = sshd
port    = ssh
logpath = %(sshd_log)s
backend = auto

And restart service service fail2ban restart

2
  • 2
    I'm guessing it was broken in/by fail2ban-0.9.6-1.el6.noarch. Fix above works for me - thanks Feb 20, 2017 at 8:23
  • @TheGingerDog is right; and also from 0.9.6-1, you'll need to configure the path to mysqld.log
    – Achilles
    Feb 25, 2017 at 11:13
1

The reason for this error is that after installation of fail2ban the configuration file /etc/fail2ban/paths-fedora.conf contains several lines, which set backends for some applications to systemd, which is not present in CentOS 6.x.

Just remove all strings like

syslog_backend = systemd
sshd_backend = systemd
dropbear_backend = systemd
proftpd_backend = systemd
pureftpd_backend = systemd
wuftpd_backend = systemd
postfix_backend = systemd
dovecot_backend = systemd

from /etc/fail2ban/paths-fedora.conf (or search for the file, which contains such strings, using grep). In this case you do not need to change backend = %(sshd_backend)s to backend = auto -- everything will work fine without such changes.

0

I was able to fix this by editing the paths-common.conf file from:

default_backend = %(default/backend)s

to:

default_backend = pynotify or default_backend = auto

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.