You need something that monitors your sshd
server logs and adds the client IP address to the banned list when the number of failures reaches the threshold level. fail2ban
is the usual tool for this.
More specifically, you'll need a firewalld
-aware backend component for fail2ban
, i.e. fail2ban-firewalld
.
Here is a tutorial for RHEL/CentOS 7: https://devops.ionos.com/tutorials/install-fail2ban-on-centos-7-to-protect-ssh-via-firewalld/
If you are using RHEL 8, EPEL has fail2ban-firewalld
packages for it too. The procedure should be pretty much the same.
The Fedora Project has more details on configuration: https://fedoraproject.org/wiki/Fail2ban_with_FirewallD
Here's a link to the actual fail2ban project, which includes more documentation for integrating fail2ban on various services: http://www.fail2ban.org/wiki/index.php/Main_Page