0

I tried to install Fail2ban on my Centos 7 machine to prevent force brute connection on ssh server.

I'm using a private key with a passphrase to connect. I tested Fail2ban but it doesn't block me when i put a bad passphrase.

I just want to insist that i'm usinfg my private key to connect to ssh.

Thanks for help :)

config file

config file

4
  • Welcome to Super User! Could you please edit your answer and add your fail2ban config files? How do you know if fail2ban is supposed ban those connections you mentioned? Feb 4, 2020 at 19:50
  • Actually, i tested with a bad passphrase for 3 attempts and fail2ban didn't block me. Feb 6, 2020 at 13:58
  • Sounds like a configuration issue. Can you check? What do the logs say? Feb 6, 2020 at 14:50
  • In the log i didn't see anything related to the private key connection or any error. He didn't even detect that i'm connecting to my ssh server with my private key Feb 6, 2020 at 15:22

1 Answer 1

0

I think if you still can SSH to the box after putting bad passphrase to the SSH Key, mean that you doing something wrong there.

Passphrase of private key is used to access the key it self, and if you type bad passphrase then no action its taken with that SSH Key.

Please verify which keys you have loaded

ssh-add -l

and you should list all loaded keys to ssh agent. And then after this you could have look into authorised_keys file under ~/.ssh/authorised_keys where you storing your publics keys which are used for private key verification when you connecting to remote server. And just remove equivalent public key which was generated to allow the private key to make connection.

You must log in to answer this question.

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