centos8 fail2ban não funciona

centos8 fail2ban não funciona

Estou executando o fail2ban no CentOS 8 com ssh e Nginx configurados. Ambos estão mostrando ip's sendo bloqueados quando eu faço o fail2ban-client status , mas na verdade eles não estão sendo bloqueados pelo firewalld. Estou sendo bombardeado com ataques ssh e nada está acontecendo no lado do firewall. Estou executando "tcpdump - qualquer porta 80 ou porta 443 ou porta 22" e vendo várias tentativas malsucedidas. Mais uma vez, o fail2ban os vê e diz que foram banidos, mas na verdade não foram banidos. Alguma sugestão??

[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

Responder1

Se você estiver realmente usando o firewalld, certifique-se de usar um firewall compatível, banactioncomo firewallcmd-ipset.

Responder2

Sua configuração parece boa, especialmente se você estiver vendo o ip listado na saída do fail2ban-client status sshd.

Como você está verificando se o ip foi banido? É assim que verifico em um sistema de minha responsabilidade com ip banido.

            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

Se não estiver listado lá, será que está sendo banido e desbanido muito rapidamente? Eu sei que sua configuração está definida para 6 horas, o que deve ser longo o suficiente.

Caso contrário, você também pode verificar /var/log/fail2ban.log em busca de atividades que possam ser relevantes. Por exemplo:

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

informação relacionada