FAIL2BAN

Un conjunto de programas para limitar los intentos de autenticación por fuerza bruta.

Ver comando report_fail2ban.

Desde el momento que lo instalas ya queda asegurado el acceso por ssh, aunque se pueden modificar los parámetros de configuración.

sudo apt install fail2ban  # Ubuntu/Debian
sudo systemctl enable --now fail2ban

Fichero de configuración para activar fail2ban para nginx

/etc/fail2ban/jail.local
[nginx-http-auth]
enabled = true
port = http,https
filter = nginx-http-auth
logpath = /var/log/nginx/error.log
maxretry = 3
bantime = 1d
 
[nginx-botsearch]
enabled = true
port = http,https
logpath = /var/log/nginx/access.log
maxretry = 2
bantime = 1d

Y para verificar las IPs bloqueadas:

sudo fail2ban-client status nginx-http-auth
sudo fail2ban-client status nginx-botsearch
sudo fail2ban-client status sshd