8

So my fail2ban wasn't working and in attempts to make it work the config files got messy. Decided to start from scratch.

I ran these as sudo

apt-get remove fail2ban

apt-get purge fail2ban

rm -r /etc/fail2ban

In hopes I'd completely remove it as the first two commands kept the messy config files.

So now when I apt-get install fail2ban it downloads and installs the package, however has this when I try to run it

 * Starting authentication failure monitor fail2ban                                                                                                                                                                            ERROR  Found no accessible config files for 'fail2ban' under /etc/fail2ban
ERROR  No section: 'Definition'
ERROR  No section: 'Definition'
ERROR  Found no accessible config files for 'fail2ban' under /etc/fail2ban
ERROR  Found no accessible config files for 'jail' under /etc/fail2ban
ERROR  No section: 'Definition'
ERROR  No section: 'Definition'

These config files are indeed missing. Why aren't they recreated when I reinstalled F2B? How can I start from scratch and reinstall it as default?

I'm using Ubuntu 14.04.2 LTS

jblz
  • 215
  • 1
  • 3
  • 11

5 Answers5

6

I fix the issue with :

service fail2ban stop
rm -r /etc/fail2ban/
apt-get purge fail2ban

apt-get install fail2ban
Sky Voyager
  • 252
  • 3
  • 7
3

I have a similar problem with some configs and I just solved it. Try to get them from:

/usr/share/doc/fail2ban/dist-config

You can copy jail.conf and fail2ban.conf to /etc/fail2ban

There are other many other sources in folders action.d/ and filter.d/ and you can copy then into /etc/fail2ban/ corresponding folder (as you said).

Rutrus
  • 131
  • 2
2

Download the files you need directly from GitHub.

cd /etc/fail2ban/
wget https://raw.githubusercontent.com/fail2ban/fail2ban/0.11/config/fail2ban.conf
wget https://raw.githubusercontent.com/fail2ban/fail2ban/0.11/config/jail.conf
0

[ssh-ddos] jail in fact is served by sshd.conf.

The solution is to add directive

filter = sshd

under [ssh-ddos] section

Please note the comment under [ssh-ddos] directive that explains the difference:

This jail corresponds to the standard configuration in Fail2ban. The mail-whois action send a notification e-mail with a whois request in the body.

This solution worked for me. Originally found here

Alex Langer
  • 172
  • 6
0

You should list your files in /etc/fail2ban:

ls -lh /etc/fail2ban

There should be a jail.conf and fail2ban.conf along with their respective jail.d , fail2ban.d, filter.d and action.d directories for the .conf files.

filter.d and action.d should be populated with several default .conf files for different services.

The error is telling you there are no files.

Also, what do you have in /var/log/fail2ban.log ?

Leo Gallego
  • 1,893
  • 9
  • 17