imthenachoman / How-To-Secure-A-Linux-Server

An evolving how-to guide for securing a Linux server.
Creative Commons Attribution Share Alike 4.0 International
17.25k stars 1.1k forks source link

Fail2Ban fails to add sshd jail #36

Closed Destarianon closed 3 years ago

Destarianon commented 5 years ago

Using Ubuntu 18.04 when running the command sudo fail2ban-client add sshd

I receive the error message: name 'noduplicates' is not defined

The config file is exactly as described in the guide. All previous fail2ban commands ran successfully with no warnings.

imthenachoman commented 5 years ago

What is the output of sudo grep -i -R noduplicates /etc/fail2ban?

Destarianon commented 5 years ago

The output is completely blank.

imthenachoman commented 5 years ago

Humm. I am not sure why you are getting that error. I can' find anything in the docs or online. Try posting on https://askubuntu.com/. I will keep looking too.

Destarianon commented 5 years ago

I have worked around the issue by removing the [sshd] jail from the default configuration which seems to have cleared up the error, but doesn't really explain what caused it to begin with.

imthenachoman commented 5 years ago

Did you take a backup? What was in the [sshd] jail from the default configuration?

celine168 commented 5 years ago

I know this is an old issue, but this is what it says in etc/fail2ban/jail.d/defaults-debian.conf:

[sshd]
enabled = true
siebenbrunner commented 5 years ago

fyi, I had the same issue, and simply changing [sshd] to [ssh] and then running sudo fail2bain-client add ssh fixed it. Also, I added the whole section in the /etc/fail2ban/jail.local file instead of creating a separate one.

hellresistor commented 4 years ago

I think Isn't needed add the sshd because are inside of jail.local file and/or /jail.d/defaults-debian.conf

lgaida commented 4 years ago

I'm setting up a server with on Debian 10 (Buster) and i'm also getting name 'noduplicates' is not defined after running sudo fail2ban-client add sshd

However sudo fail2ban-client status still lists sshd and even sudo fail2ban-client status sshd prints the expected output as per README.md

As celine168 and hellresistor already said: looks like you don't have to add sshd on your own since it is enabled by default

imthenachoman commented 3 years ago

Closing as this issue seems resolved. Thanks!