centos8 fail2ban no funciona

centos8 fail2ban no funciona

Estoy ejecutando fail2ban en CentOS 8 con ssh y Nginx configurados. Ambos muestran que las direcciones IP están bloqueadas cuando hago el estado del cliente fail2ban, pero en realidad no están bloqueados por firewalld. Estoy siendo bombardeado con ataques ssh y no sucede nada en el lado del firewall. Estoy ejecutando "tcpdump - en cualquier puerto 80, 443 o 22" y veo varios intentos fallidos. Nuevamente, fail2ban los ve y dice que están prohibidos, pero en realidad no lo están. ¿¿Alguna sugerencia??

[DEFAULT] 
ignoreip = 127.0.0.1 192.168.1.0/24
bantime  = 21600
findtime  = 300
maxretry = 3
banaction = iptables-multiport
backend = systemd

[sshd] 
enabled = true

[nginx-http-auth]
enabled  = true
filter   = nginx-http-auth
port     = http,https
logpath  = /var/log/gitlab/nginx/error.log

[nginx-noscript]
enabled  = true
port     = http,https
filter   = nginx-noscript
logpath  = /var/log/gitlab/nginx/access.log
maxretry = 6

[nginx-badbots]
enabled  = true
port     = http,https
filter   = nginx-badbots
logpath  = /var/log/gitlab/nginx/access.log
maxretry = 2

[nginx-nohome]
enabled  = true
port     = http,https
filter   = nginx-nohome
logpath  = /var/log/gitlab/nginx/access.log
maxretry = 2

[nginx-noproxy]
enabled  = true
port     = http,https
filter   = nginx-noproxy
logpath  = /var/log/gitlab/nginx/access.log
maxretry = 2

[gitlab]
enabled = true
port = http,https
filter = gitlab
logpath = /var/log/gitlab/gitlab_error.log

Respuesta1

Si realmente estás usando firewalld, asegúrate de usar un archivo compatible con firewalld, banactioncomo firewallcmd-ipset.

Respuesta2

Su configuración se ve bien, especialmente si ve la IP listada en el resultado de fail2ban-client status sshd.

¿Cómo verificas si la ip ha sido prohibida? Así lo compruebo en un sistema del que soy responsable con una ip prohibida.

            iptables -L f2b-sshd
Chain f2b-sshd (1 references)
target     prot opt source               destination         
REJECT     all  --  120.29.125.240       anywhere             reject-with icmp-port-unreachable
RETURN     all  --  anywhere             anywhere

Si no figura allí, ¿será simplemente que se está prohibiendo y eliminando la prohibición demasiado rápido? Sé que tu configuración está configurada en 6 horas, lo que debería ser suficiente.

De lo contrario, también puede consultar /var/log/fail2ban.log para ver si hay actividad que pueda ser relevante. Por ejemplo:

2020-12-04 09:17:07,590 fail2ban.filter         [9089]: INFO    [sshd] Found 120.29.125.240
2020-12-04 09:17:09,883 fail2ban.filter         [9089]: INFO    [sshd] Found 120.29.125.240
2020-12-04 09:17:12,163 fail2ban.filter         [9089]: INFO    [sshd] Found 120.29.125.240
2020-12-04 09:17:14,381 fail2ban.filter         [9089]: INFO    [sshd] Found 120.29.125.240
2020-12-04 09:17:16,874 fail2ban.filter         [9089]: INFO    [sshd] Found 120.29.125.240
2020-12-04 09:17:17,805 fail2ban.actions        [9089]: NOTICE  [sshd] Ban 120.29.125.240

información relacionada