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

3
  • 1
    Try to apt-get purge fail2ban to completely remove the configs and then install again.
    – sebix
    Aug 19, 2015 at 19:15
  • As I wrote in the original post, I've tried that. Thanks though
    – jblz
    Aug 20, 2015 at 19:37
  • But you missed the outputs of all the commands.
    – sebix
    Aug 20, 2015 at 19:42

5 Answers 5

6

I fix the issue with :

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

apt-get install fail2ban
1
  • This did it, the trick being to stop fail2ban during the process... Jan 13, 2020 at 0:55
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).

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

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 ?

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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .