[AsteriskBrasil] fail2ban ssh

Udson Assis contato em maisvoipshop.com.br
Terça Dezembro 4 17:41:44 BRST 2012


Jony,

Segue iformações abaixo:

Obs: substitui o syslog pelo rsyslog, apos substitiur, quando faços as 6
tentativas com erro o iptables diz ter bloqueado, conforma abaixo, mais na
real nao bloqueou, consigo logar normalmente.

[root em server-asterisk /]# iptables -L
Chain INPUT (policy ACCEPT)
target     prot opt source               destination
fail2ban-SSH  tcp  --  anywhere             anywhere            tcp dpt:ssh
fail2ban-ASTERISK  all  --  anywhere             anywhere

Chain FORWARD (policy ACCEPT)
target     prot opt source               destination

Chain OUTPUT (policy ACCEPT)
target     prot opt source               destination

Chain fail2ban-ASTERISK (1 references)
target     prot opt source               destination
RETURN     all  --  anywhere             anywhere

Chain fail2ban-SSH (1 references)
target     prot opt source               destination
DROP       all  --  189-107-139-80.user.veloxzone.com.br  anywhere
RETURN     all  --  anywhere             anywhere


sshd.conf

##----------------------------------------------------------------

# Fail2Ban configuration file
#
# Author: Cyril Jaquier
#
# $Revision: 728 $
#

[INCLUDES]

# Read common prefixes. If any customizations available -- read them from
# common.local
before = common.conf


[Definition]

_daemon = sshd

# Option:  failregex
# Notes.:  regex to match the password failures messages in the logfile. The
#          host must be matched by a group named "host". The tag "<HOST>"
can
#          be used for standard IP/hostname matching and is only an alias
for
#          (?:::f{4,6}:)?(?P<host>[\w\-.^_]+)
# Values:  TEXT
#
failregex = ^%(__prefix_line)s(?:error: PAM: )?Authentication failure for
.* from <HOST>\s*$
            ^%(__prefix_line)s(?:error: PAM: )?User not known to the
underlying authentication module for .* from <HOST>\s*$
            ^%(__prefix_line)sFailed (?:password|publickey) for .* from
<HOST>(?: port \d*)?(?: ssh\d*)?$
            ^%(__prefix_line)sROOT LOGIN REFUSED.* FROM <HOST>\s*$
            ^%(__prefix_line)s[iI](?:llegal|nvalid) user .* from <HOST>\s*$
            ^%(__prefix_line)sUser \S+ from <HOST> not allowed because not
listed in AllowUsers$
            ^%(__prefix_line)sauthentication failure; logname=\S* uid=\S*
euid=\S* tty=\S* ruser=\S* rhost=<HOST>(?:\s+user=.*)?\s*$
            ^%(__prefix_line)srefused connect from \S+ \(<HOST>\)\s*$
            ^%(__prefix_line)sAddress <HOST> .* POSSIBLE BREAK-IN
ATTEMPT!*\s*$
            ^%(__prefix_line)sUser \S+ from <HOST> not allowed because none
of user's groups are listed in AllowGroups$

# Option:  ignoreregex
# Notes.:  regex to ignore. If this regex matches, the line is ignored.
# Values:  TEXT
#
ignoreregex =


jail.conf

###-----------------------


[ssh-iptables]

enabled  = true
filter   = sshd
action   = iptables[name=SSH, port=ssh, protocol=tcp]
           sendmail-whois[name=SSH, dest=root, sender=fail2ban em example.com]
logpath  = /var/log/secure
maxretry = 5








Em 4 de dezembro de 2012 17:27, Jony do Vale <jonydovale.jh em gmail.com>escreveu:

> Udson,
>
> Desculpa pedir as informações aos poucos, mas por favor enviar
>
> - /etc/fail2ban/filter.d/ssh.conf
>
> - /etc/fail2ban/jail.conf
>
> - saida da CLI durante a tentativa de invasâo
>
> *Jony do Vale*
> +55 85 97489412
> GTalk:jonydovale.jh em gmail.com
> MSN: jonydovale em hotmail.com
>
>
>
> On 4 December 2012 15:16, Udson Assis <contato em maisvoipshop.com.br> wrote:
>
>> Roger,
>>
>> Fiz o indicado, parei o syslog, mais estou com problemas para startar o
>> rsyslog:
>>
>>
>> [root em server-asterisk ~]# /etc/init.d/rsyslog start
>> Iniciando o registrador do sistema: usage: rsyslogd [-c<version>]
>> [-46AdnqQvwx] [-l<hostlist>] [-s<domainlist>]
>>                 [-f<conffile>] [-i<pidfile>] [-N<level>] [-M<module load
>> path>]
>>                 [-u<number>]
>> To run rsyslogd in native mode, use "rsyslogd -c3 <other options>"
>>
>> For further information see http://www.rsyslog.com/doc
>>                                                            [FALHOU]
>>
>>
>>
>>
>> Em 4 de dezembro de 2012 15:53, Roger Pitigliani <rogerwinter em gmail.com>escreveu:
>>
>>> /etc/init.d/rsyslog start
>>
>>
>>
>>
>> --
>> Udson Assis
>> Maisvoipshop | BrfoneTelecom
>> www.maisvoipshop.com.br -- www.brfonetelecom.com.br
>> E-mail: contato em maisvoipshop.com.br
>> Skype: atendimentomaisvoipshop
>> Msn: contato em maisvoipshop.com.br
>> Gtalk: contatomaisvoipshop em gmail.com
>> Tel.: (31) 4062-7899
>>
>>
>> _______________________________________________
>> KHOMP Inovação: External Board Series
>> Módulos de 1/2 rack e 1U para todas as interfaces e soluções Asterisk e
>> FreeSWITCH.
>> Tenha a External Series Experience na sua aplicação. Visite www.khomp.com
>> _______________________________________________
>> DIGIVOICE  Fabricante de Placas de Voz e Channel Bank
>> 20 anos de experiência com E1(R2/ISDN), FXS, FXO e GSM
>> Centro Treinamento - Curso de PABX IP -  Asterisk  - Site
>> www.digivoice.com.br
>> ________
>> YEALINK: Telefones IP e VídeoPhones IP com o melhor custo/benefício do
>> mercado.
>> email: yealink em commlogik.com.br | www.commlogik.com.br | (11) 5503-1011
>> ______________________________________________
>> Para remover seu email desta lista, basta enviar um email em branco para
>> asteriskbrasil-unsubscribe em listas.asteriskbrasil.org
>>
>
>
> _______________________________________________
> KHOMP Inovação: External Board Series
> Módulos de 1/2 rack e 1U para todas as interfaces e soluções Asterisk e
> FreeSWITCH.
> Tenha a External Series Experience na sua aplicação. Visite www.khomp.com
> _______________________________________________
> DIGIVOICE  Fabricante de Placas de Voz e Channel Bank
> 20 anos de experiência com E1(R2/ISDN), FXS, FXO e GSM
> Centro Treinamento - Curso de PABX IP -  Asterisk  - Site
> www.digivoice.com.br
> ________
> YEALINK: Telefones IP e VídeoPhones IP com o melhor custo/benefício do
> mercado.
> email: yealink em commlogik.com.br | www.commlogik.com.br | (11) 5503-1011
> ______________________________________________
> Para remover seu email desta lista, basta enviar um email em branco para
> asteriskbrasil-unsubscribe em listas.asteriskbrasil.org
>



-- 
Udson Assis
Maisvoipshop | BrfoneTelecom
www.maisvoipshop.com.br -- www.brfonetelecom.com.br
E-mail: contato em maisvoipshop.com.br
Skype: atendimentomaisvoipshop
Msn: contato em maisvoipshop.com.br
Gtalk: contatomaisvoipshop em gmail.com
Tel.: (31) 4062-7899
-------------- Próxima Parte ----------
Um anexo em HTML foi limpo...
URL: http://listas.asteriskbrasil.org/pipermail/asteriskbrasil/attachments/20121204/00fd250a/attachment-0001.htm 


Mais detalhes sobre a lista de discussão AsteriskBrasil