[AsteriskBrasil] Fail2ban

Alclicio Vieira alclicio em gmail.com
Domingo Junho 3 14:53:51 BRT 2012


Pessoal,

Segui esse tutorial, porém ainda aparentemente ainda não está funcionando o
Fail2ban


##########################################################################

*Configurando o Fail2Ban*

Agora nós precisamos fazer com que o fail2ban seja capaz de identificar
ataques contra o asterisk.

Os arquivos de configuração ficam em:* /etc/fail2ban/filter.d*

Vamos criar aqui um arquivo para o asterisk.

#touch asterisk.conf

Este arquivo deve conter o seguinte:

[INCLUDES]

[Definition]
failregex = NOTICE.* .*: Registration from ‘.*’ failed for ‘<HOST>’ – Wrong
password
            NOTICE.* .*: Registration from ‘.*’ failed for ‘<HOST>’ – No
matching peer found
            NOTICE.* .*: Registration from ‘.*’ failed for ‘<HOST>’ –
Username/auth name mismatch
            NOTICE.* .*: Registration from ‘.*’ failed for ‘<HOST>’ –
Device does not match ACL
            NOTICE.* <HOST> failed to authenticate as ‘.*’$
            NOTICE.* .*: No registration for peer ‘.*’ \(from <HOST>\)
            NOTICE.* .*: Host <HOST> failed MD5 authentication for ‘.*’ (.*)
            NOTICE.* .*: Failed to authenticate user .*@<HOST>.*
ignoreregex =

No aquivo* /etc/fail2ban/jail.conf*  inclua as seguintes linhas:

[asterisk-iptables]

enabled  = true
filter   = asterisk
action   = iptables-allports[name=ASTERISK, protocol=all]
           sendmail-whois[name=ASTERISK, dest=root, sender=
alclicio em gmail.com] #aqui devo colocar meu email ?
logpath  = /var/log/asterisk/full
maxretry = 3
bantime = 259200
*Maxretry *determina a quantidade de erros que o fail2ban vai aceitar de um
determinado host antes de bani-lo.

*O* *bantime* é em segundos, portanto neste caso qualquer tentativa de
ataque ao asterisk será banida por 72 horas.

Para não banir você mesmo, no jail.conf, procure pela tag [DEFAULT], no
paramento ignoreip informe seu ip.

Edite o */etc/asterisk/logger.conf* e defina o dateformat da seguinte forma.

 [general]
dateformat=%F %T

Na sessão [logfiles] você deve inserir a seguinte linha:

syslog.local0 => notice

Feito isso é só dar reload no logger

asterisk -rx ”logger reload”

Para verificar se o fail2ban subiu, basta rodar o seguinte comando:

*iptables -L -v*

As seguintes linhas devem aparecer:

Chain fail2ban-ASTERISK (1 references)
 pkts bytes target     prot opt in     out     source
destination
6287K 1158M RETURN     all  –  any    any     anywhere             anywhere

Estou configurando no elastix 2.3.0, tem algo a mais a fazer? tentei
autenticar um ramal externo com a senha errada por mais de 3 vezes e ainda
não está banindo.

-- 
ALCLICIO VIEIRA,
ITIL® V3 Certification,
Crea-DF 10476 Telecom

Phone:55 (11) 3509-2505 - São Paulo
Phone:55 (61) 4063-7110 - Brasília
Phone:55 (62) 3416-7800 - Goiás
-------------- Próxima Parte ----------
Um anexo em HTML foi limpo...
URL: http://listas.asteriskbrasil.org/pipermail/asteriskbrasil/attachments/20120603/fbf8d3fc/attachment.htm 


Mais detalhes sobre a lista de discussão AsteriskBrasil