ERROR Failed throughout configuration: Haven’t discovered any log file for sshd jail
Se ao configurar o fail2ban você recebe a mensagem: “ERROR Failed throughout configuration: Haven’t discovered any log file for sshd jail” , saiba como resolver seguindo o passo a passo abaixo.
Cheque se o arquivo auth.log existe em seu sistema utilizando o comando abaixo:
[ls -l /var/log/auth.log]
Se não existir, tente instalar o rsyslog e confira se ele aparecerá no sistema:
[sudo apt install rsyslog]
Em seguida, edite seu arquivo jail.native localizado em /and so on/fail2ban .
Dentro do arquivo em [sshd] defina a seguinte configuração:
[port = ssh
logpath = /var/log/auth.log
backend = %(sshd_backend)s]
Em seguida reinicie os serviços sshd e fail2ban:
[sudo systemctl restart sshd]
[sudo systemctl restart fail2ban]
Com outro IP, tente se conectar com usuário errado. Para ver o banimento em funcionamento use o comando abaixo:
[sudo fail2ban-client status sshd]
A saída do comando acima será algo como:
Standing for the jail: sshd
|- Filter
| |- Presently failed: 0
| |- Complete failed: 5
| `- File record: /var/log/auth.log
`- Actions
|- Presently banned: 1
|- Complete banned: 1
`- Banned IP record: xxx.xx.xxx.xxx