Fail2ban perde algumas tentativas de relé

3

Eu tenho algumas tentativas de retransmissão como estas no meu mail.log (elas totalizam 281 tentativas de conexão em menos de 3 minutos):

May 16 04:58:30 MyServer postfix/smtpd[18950]: connect from unknown[xx.yy.zzz.www]
May 16 04:58:30 MyServer postfix/smtpd[18951]: warning: xx.yy.zzz.www: hostname xx-yy-zzz-www.network.domain verification failed: No address associated with hostname
May 16 04:58:30 MyServer postfix/smtpd[18951]: connect from unknown[xx.yy.zzz.www]
May 16 04:58:31 MyServer postfix/smtpd[18947]: warning: unknown[xx.yy.zzz.www]: SASL LOGIN authentication failed: authentication failure
May 16 04:58:31 MyServer postfix/smtpd[18952]: warning: xx.yy.zzz.www: hostname xx-yy-zzz-www.network.domain verification failed: No address associated with hostname
May 16 04:58:31 MyServer postfix/smtpd[18952]: connect from unknown[xx.yy.zzz.www]
May 16 04:58:31 MyServer postfix/smtpd[18947]: disconnect from unknown[xx.yy.zzz.www]
May 16 04:58:32 MyServer postfix/smtpd[18922]: warning: unknown[xx.yy.zzz.www]: SASL LOGIN authentication failed: authentication failure
May 16 04:58:32 MyServer postfix/smtpd[18947]: warning: xx.yy.zzz.www: hostname xx-yy-zzz-www.network.domain verification failed: No address associated with hostname
May 16 04:58:32 MyServer postfix/smtpd[18947]: connect from unknown[xx.yy.zzz.www]
May 16 04:58:33 MyServer postfix/smtpd[18953]: warning: xx.yy.zzz.www: hostname xx-yy-zzz-www.network.domain verification failed: No address associated with hostname
May 16 04:58:33 MyServer postfix/smtpd[18953]: connect from unknown[xx.yy.zzz.www]
May 16 04:58:33 MyServer postfix/smtpd[18922]: disconnect from unknown[xx.yy.zzz.www]
May 16 04:58:33 MyServer postfix/smtpd[18948]: warning: unknown[xx.yy.zzz.www]: SASL LOGIN authentication failed: authentication failure
May 16 04:58:33 MyServer postfix/smtpd[18949]: warning: unknown[xx.yy.zzz.www]: SASL LOGIN authentication failed: authentication failure
May 16 04:58:33 MyServer postfix/smtpd[18922]: warning: xx.yy.zzz.www: hostname xx-yy-zzz-www.network.domain verification failed: No address associated with hostname
May 16 04:58:33 MyServer postfix/smtpd[18922]: connect from unknown[xx.yy.zzz.www]
May 16 04:58:34 MyServer postfix/smtpd[18948]: disconnect from unknown[xx.yy.zzz.www]
May 16 04:58:34 MyServer postfix/smtpd[18949]: disconnect from unknown[xx.yy.zzz.www]
May 16 04:58:34 MyServer postfix/smtpd[18948]: warning: xx.yy.zzz.www: hostname xx-yy-zzz-www.network.domain verification failed: No address associated with hostname
May 16 04:58:34 MyServer postfix/smtpd[18948]: connect from unknown[xx.yy.zzz.www]
May 16 04:58:34 MyServer postfix/smtpd[18949]: warning: xx.yy.zzz.www: hostname xx-yy-zzz-www.network.domain verification failed: No address associated with hostname
May 16 04:58:34 MyServer postfix/smtpd[18949]: connect from unknown[xx.yy.zzz.www]
May 16 04:58:35 MyServer postfix/smtpd[18950]: warning: unknown[xx.yy.zzz.www]: SASL LOGIN authentication failed: authentication failure
May 16 04:58:35 MyServer postfix/smtpd[18951]: warning: unknown[xx.yy.zzz.www]: SASL LOGIN authentication failed: authentication failure
May 16 04:58:35 MyServer postfix/smtpd[18950]: disconnect from unknown[xx.yy.zzz.www]

Eu acho que o filtro sasl (que está ativado) deve cuidar deles, mas o ip nunca é banido. Parece que não há correspondência com a expressão failregex no filtro sasl.conf:

# Fail2Ban configuration file
#
# Author: Yaroslav Halchenko
#
# $Revision: 728 $
#

[Definition]

# 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 = (?i): warning: [-._\w]+\[<HOST>\]: SASL (?:LOGIN|PLAIN|(?:CRAM|DIGEST)-MD5) authentication failed(: [A-Za-z0-9+/]*={0,2})?$

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

Alguma dica sobre o que está falhando aqui? Qualquer maneira de corrigir o problema?

Editar: Uma pergunta mais simples que poderia ser um começo para solucionar esse problema: os avisos de LOGIN SASL em mail.log correspondem à expressão failregex? Eu realmente não sei como testá-lo, e eu não tenho conhecimento suficiente sobre a regex sintax para resolver isso sozinho.

Obrigado antecipadamente.

    
por luri 17.05.2011 / 20:22

1 resposta

1

A última parte da expressão regular não corresponde a "falha de autenticação"

A parte com falha da regex parece corresponder a uma string base64:

(: [A-Za-z0-9+/]*={0,2})?*={0,2})?

Como a "falha de autenticação" deve ser bloqueada, sugiro substituir essa parte da regex por:

(: ([A-Za-z0-9+/]*={0,2})?*={0,2})|authentication failure)?

Esta é uma adição à regra antiga e corresponderia a : authentication failure .

    
por Lekensteyn 03.06.2011 / 15:54

Tags