domingo, 20 de janeiro de 2013

Antivírus - Amavis                               

Para utilizar o Amavis em conjunto com o Postfix, de forma que todos os e-mails passem primeiro pelo antivírus, e só depois sejam encaminhados para as caixas postais dos usuários. O Amavisd "intercepta" as novas mensagens, entregando-as ao executável do Clamav. De acordo com a configuração, as mensagens com arquivos infectados podem ser simplesmente deletadas, ou colocadas em uma pasta de quarentena. 

Lembrando que já foram incluídas as linhas de configuração do antivírus ( Amavis ) no arquivo de configuração /etc/postfix/main.cf e no arquivo  /etc/postfix/master.cf



Vamos instalar o antivirus Amavis.

# apt-get update

# apt-get autoclean

# apt-get autoremove

# apt-get install amavis



Precisaremos adicionar uma linha no arquivo /etc/postfix/main.cf e algumas linhas no arquivo /etc/postfix/master.conf.

# nano /etc/postfix/main.cf

content_filter = smtp-amavis:[127.0.0.1]:10024

ctrl + x + y + enter ( para salvar e sair do arquivo )



Agora vamos adicionar as linhas abaixo do Amavis no final do arquivo.

# nano /etc/postfix/master.cf

smtp-amavis       unix  -       -       -       -       10       smtp
        -o smtp_data_done_timeout=1200
        -o smtp_send_xforward_command=yes
        -o disable_dns_lookups=yes
        -o max_use=20
        -o smtp_generic_maps=



127.0.0.1:10025 inet    n -     -       -       -       smtpd
        -o content_filter=
        -o smtpd_delay_reject=no
        -o smtpd_client_restrictions=permit_mynetworks,reject
        -o smtpd_helo_restrictions=
        -o smtpd_sender_restrictions=
        -o smtpd_recipient_restrictions=permit_mynetworks,reject
        -o smtpd_end_of_data_restrictions=
        -o smtpd_restriction_classes=
        -o mynetworks=127.0.0.0/8
        -o smtpd_error_sleep_time=0
        -o smtpd_soft_error_limit=1001
        -o smtpd_hard_error_limit=1000
        -o smtpd_client_connection_count_limit=0
        -o smtpd_client_connection_rate_limit=0
         -o receive_override_options=no_header_body_checks,no_unknown_recipient_checks
        -o local_header_rewrite_clients=
        -o local_recipient_maps=
        -o relay_recipient_maps=
        -o strict_rfc821_envelopes=yes

ctrl + x + y + enter ( para salvar e sair do arquivo )



# nano /etc/amavis/conf.d/05-node_id

use strict;
# $myhostname is used by amavisd-new for node identification, and it is
# important to get it right (e.g. for ESMTP EHLO, loop detection, and so on).
chomp($myhostname = `hostname --fqdn`);
# To manually set $myhostname, edit the following line with the correct Fully
# Qualified Domain Name (FQDN) and remove the # at the beginning of the line.
$myhostname = "ns1.juralinux.com.br";
1;  # ensure a defined return

ctrl + x + y + enter ( para salvar e sair do arquivo )


Após terminar a configuração, reinicie todos os serviços para atualizá-los:

# /etc/init.d/amavis start

# /etc/init.d/postfix restart




# telnet localhost 10024
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
220 [127.0.0.1] ESMTP amavisd-new service ready
telnet> quit
Connection closed.




# telnet localhost 10025
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
220 ns1.juralinux.com.br ESMTP Postfix (Debian/GNU)
^]
telnet> quit
Connection closed.


# netstat -anlp | grep ama
tcp   0      0 127.0.0.1:10024 0.0.0.0:*  LISTEN    6564/amavisd (ch8-a



------------------------------------------------------------------------------------------------------------------------
===[ Sharing Knowledge ]===   -  Obrigado - Thank you - Danke - Merci - Grazie - Gracias - arigatou gozaimasu
“We make a living by what we get, but we make a life by what we give.”  - Give and you will receive - just share :)
------------------------------------------------------------------------------------------------------------------------


Nenhum comentário:

Postar um comentário