Postfix + MySQL + Submission Port + Dovecot + Postfix Admin no CentOS 6.3
Guia atualizado de instalação do Postfix no CentOS 6.3 com as novas configurações do Dovecot para o MySQL.
Parte 5: Configurando filtro de spam e vírus (opcional)
Pessoal, não usei esta configuração, mas no tutorial original não existia reclamações ou dúvidas sobre ela. Fica a seu gosto usar uma solução separada, ou essa, no mesmo servidor.
Configure o administrador do Razor. Siga os comandos abaixo:
# razor-admin -register -user=usuário -pass=senha
Atualize e restarte o ClamAV:
# freshclam
# service clamd restart
# chkconfig clamd on
Abaixo, segue uma lista do que deve ser trocado. Encontre as linhas abaixo, você pode usar a função de busca do Vim (Shift : / <palavra a ser procurada> enter):
Para:
Atualize o SpamAssassin e inicie o "amavisd-new":
# sa-update
# service amavisd-new start
# chkconfig amavisd-new on
Falando para o Postfix filtrar spam, para isso, apenas descomente as linhas abaixo em /etc/postfix/master.cf:
Troque para:
Esse tutorial é mais uma atualização de alguns pontos em que tive problemas ao colocar um Virtual Domain com MySQL no CentOS 6.3.
Se seguiu o guia com sugeri, reinicie o Postfix e seja feliz!
# service postfix restart
Qualquer dúvida, é só perguntar. Quem tiver alguma coisa a acrescentar, é só escrever, ficarei grato.
Configurando ClamAV daemon
Altere ou cole, esta configuração no arquivo /etc/clamd.conf:
##
## Cconfig file for the Clam AV daemon
## Please read the clamd.conf(5) manual before editing this file.
##
# Logfile
LogFile /var/log/clamav/clamd.log
LogFileMaxSize 20M
LogTime yes
LogSyslog yes
# Pid
PidFile /var/run/clamav/clamd.pid
# Paths
TemporaryDirectory /var/tmp
DatabaseDirectory /var/clamav
LocalSocket /var/run/clamav/clamd
# Sets the group ownership on the unix socket.
# Default: disabled (the primary group of the user running clamd)
#LocalSocketGroup virusgroup
# Misc
FixStaleSocket yes
TCPSocket 3310
TCPAddr 127.0.0.1
MaxConnectionQueueLength 50
MaxThreads 50
ReadTimeout 240
User clamav
AllowSupplementaryGroups yes
# Exe
ScanPE yes
ScanELF yes
DetectBrokenExecutables yes
# Docs
ScanOLE2 yes
ScanPDF yes
# Mail
ScanMail yes
PhishingSignatures yes
PhishingScanURLs yes
# Data Loss Prevention (DLP)
# Enable the DLP module
# Default: No
#StructuredDataDetection yes
# This option sets the lowest number of Credit Card numbers found in a file
# to generate a detect.
# Default: 3
#StructuredMinCreditCardCount 5
# This option sets the lowest number of Social Security Numbers found
# in a file to generate a detect.
# Default: 3
#StructuredMinSSNCount 5
# With this option enabled the DLP module will search for valid
# SSNs formatted as xxx-yy-zzzz
# Default: yes
#StructuredSSNFormatNormal yes
# With this option enabled the DLP module will search for valid
# SSNs formatted as xxxyyzzzz
# Default: no
#StructuredSSNFormatStripped yes
# Archives
ScanArchive yes
ArchiveBlockEncrypted no
## Cconfig file for the Clam AV daemon
## Please read the clamd.conf(5) manual before editing this file.
##
# Logfile
LogFile /var/log/clamav/clamd.log
LogFileMaxSize 20M
LogTime yes
LogSyslog yes
# Pid
PidFile /var/run/clamav/clamd.pid
# Paths
TemporaryDirectory /var/tmp
DatabaseDirectory /var/clamav
LocalSocket /var/run/clamav/clamd
# Sets the group ownership on the unix socket.
# Default: disabled (the primary group of the user running clamd)
#LocalSocketGroup virusgroup
# Misc
FixStaleSocket yes
TCPSocket 3310
TCPAddr 127.0.0.1
MaxConnectionQueueLength 50
MaxThreads 50
ReadTimeout 240
User clamav
AllowSupplementaryGroups yes
# Exe
ScanPE yes
ScanELF yes
DetectBrokenExecutables yes
# Docs
ScanOLE2 yes
ScanPDF yes
ScanMail yes
PhishingSignatures yes
PhishingScanURLs yes
# Data Loss Prevention (DLP)
# Enable the DLP module
# Default: No
#StructuredDataDetection yes
# This option sets the lowest number of Credit Card numbers found in a file
# to generate a detect.
# Default: 3
#StructuredMinCreditCardCount 5
# This option sets the lowest number of Social Security Numbers found
# in a file to generate a detect.
# Default: 3
#StructuredMinSSNCount 5
# With this option enabled the DLP module will search for valid
# SSNs formatted as xxx-yy-zzzz
# Default: yes
#StructuredSSNFormatNormal yes
# With this option enabled the DLP module will search for valid
# SSNs formatted as xxxyyzzzz
# Default: no
#StructuredSSNFormatStripped yes
# Archives
ScanArchive yes
ArchiveBlockEncrypted no
Configure o administrador do Razor. Siga os comandos abaixo:
# razor-admin -register -user=usuário -pass=senha
Atualize e restarte o ClamAV:
# freshclam
# service clamd restart
# chkconfig clamd on
Configurando Amavisd-new
É necessário editar o arquivo /etc/amavisd.confAbaixo, segue uma lista do que deve ser trocado. Encontre as linhas abaixo, você pode usar a função de busca do Vim (Shift : / <palavra a ser procurada> enter):
- $mydomain = 'seu_dominio.com.br'; # Coloque seu domínio
- $log_level = 1; # log em level um
- $sa_tag_level_deflt = -99; # -99 para verificar os headers
- $sa_tag2_level_deflt = 5.0;
- $sa_kill_level_deflt = 9;
- $sa_dsn_cutoff_level = 9;
- $sa_quarantine_cutoff_level = 50;
- $myhostname = 'mail.seu_dominio.com.br';
- $notify_method = 'smtp:[127.0.0.1]:10025';
- $forward_method = 'smtp:[127.0.0.1]:10025';
- $final_banned_destiny = D_DISCARD;
Habilitando o ClamAV
Troque a parte abaixo:# ### http://www.clamav.net/
# ['ClamAV-clamd',
# \&ask_daemon, ["CONTSCAN {}\n", "/var/run/clamav/clamd"],
# qr/\bOK$/m, qr/\bFOUND$/m,
# qr/^.*?: (?!Infected Archive)(.*) FOUND$/m ],
Para:
### http://www.clamav.net/
['ClamAV-clamd',
\&ask_daemon, ["CONTSCAN {}\n", "/var/run/clamav/clamd"],
qr/\bOK$/m, qr/\bFOUND$/m,
qr/^.*?: (?!Infected Archive)(.*) FOUND$/m ],
['ClamAV-clamd',
\&ask_daemon, ["CONTSCAN {}\n", "/var/run/clamav/clamd"],
qr/\bOK$/m, qr/\bFOUND$/m,
qr/^.*?: (?!Infected Archive)(.*) FOUND$/m ],
Atualize o SpamAssassin e inicie o "amavisd-new":
# sa-update
# service amavisd-new start
# chkconfig amavisd-new on
Falando para o Postfix filtrar spam, para isso, apenas descomente as linhas abaixo em /etc/postfix/master.cf:
smtp inet n - n - - smtpd
# -o content_filter=smtp-amavis:127.0.0.1:10024
# -o receive_override_options=no_address_mappings
Troque para:
smtp inet n - n - - smtpd
-o content_filter=smtp-amavis:127.0.0.1:10024
-o receive_override_options=no_address_mappings
-o content_filter=smtp-amavis:127.0.0.1:10024
-o receive_override_options=no_address_mappings
Conclusão
Chegamos ao final. Esta é uma configuração simples, há outras mais complexas, porém, como o Postfix aceita bem modificações em um sistema já funcional, é relativamente fácil melhorar o que coloquei aqui.Esse tutorial é mais uma atualização de alguns pontos em que tive problemas ao colocar um Virtual Domain com MySQL no CentOS 6.3.
Se seguiu o guia com sugeri, reinicie o Postfix e seja feliz!
# service postfix restart
Qualquer dúvida, é só perguntar. Quem tiver alguma coisa a acrescentar, é só escrever, ficarei grato.