BEM VINDO AO BLOG DO MARCOS CARRARO CRIADOR DO "CARRARO DASHBOARD". MUITO MAIS QUE UM SIMPLES BLOG.

terça-feira, 25 de fevereiro de 2014

Diminuindo Boa parte dos Spans recebidos Postfix

Buenas,

Lá vai um pente fino que criei para poder reter um pouco de spam enviado a empresa.

Vamos lá,

No arquivo main.cnf adicione a seguinte linha.

header_checks = regexp:/etc/postfix/cabecalho.regexp

# vim /etc/postfix/cabecalho.regexp

# Esconde algumas informações
/^Received:/    IGNORE
/^User-Agent:/  IGNORE
/^X-Mailer:/    IGNORE
/^X-MimeOLE:/   IGNORE
/^X-MSMail-Priority:/   IGNORE
/^X-Spam-Status:/   IGNORE
/^X-Spam-Level:/    IGNORE
/^X-Sanitizer:/     IGNORE
/^X-Originating-IP:/    IGNORE
/^Received: from 127.0.0.1/  IGNORE/^Subject: .*    / REJECT Muitos Espacos.

# Bloqueia charset estranhos
/^Content-Type:.*charset=.*(big5|euc-kr|gb2312|iso-.*-jp|ks_c_5601-1987)/ REJECT  Email com charset diferente.
/^Subject:.*=\?(big5|euc-kr|gb2312|iso-.*-jp|ks_c_5601-1987)\?/ REJECT Email com charset diferente.
/^Subject:.*=?KOI8/ REJECT Email com charset diferente.

# Bloqueia emails com data antigas
# Uma atenção especial, nesta parte tem que alterar todo ano :D
/^Date:.*200[0-13]/ REJECT Email com data antiga .
/^Date:.*19[0-9][0-9]/ REJECT Email com data antiga .

# Bloqueia extensões não legais
/^content-(type|disposition):.*name[[:space:]]*=.*\.(exe|bat|avi|vbs|cmd|asd|pif|scr|cpl|cmd|vxd|dll)/ REJECT Email com anexo nao permitido.

# Rejeitado email mal formado
/^Return-Path: <>/ REJECT Email mal formado.


Compilar para o bom funcionamento

# postmap /etc/postfix/cabecalho.regexp

Algumas restrições para quem vai receber os e-mails
smtpd_recipient_restrictions = permit_mynetworks,
                permit_sasl_authenticated,
                reject_unauth_pipelining,
                reject_invalid_hostname,
                reject_non_fqdn_hostname,
                reject_non_fqdn_sender,
                reject_non_fqdn_recipient,
                reject_unknown_sender_domain,
                reject_unknown_recipient_domain,
                reject_unauth_destination,
                reject_rbl_client sbl.spamhaus.org,
                reject_rbl_client sbl-xbl.spamhaus.org,
                reject_rbl_client bl.spamcop.net,
                reject_rbl_client zen.spamhaus.org,
                reject_rbl_client pbl.spamhaus.org,
                reject_rbl_client cbl.abuseat.org,
                check_relay_domains,
                permit


Se alguém tiver mais dicas são bem vindas para ajudar a melhorar.

abraços




Nenhum comentário:

Postar um comentário

Posts que a turma mais esta lendo...

Posts que a turma mais esta lendo...

Marcos Carraro