12/10/2010

Run with Clamav

[1] Configure SMTP Server in order to scan emails to protect from virus or spams. Install clamav first.
# install from DAG

[root@mail ~]#yum --enablerepo=dag -y install clamd amavisd-new


[root@mail ~]#vi /etc/clamd.conf

# line 72: change

LocalSocket /var/run/clamav/clamd.sock

# line 80: make it comment

#TCPSocket 3310

# line 149: change

AllowSupplementaryGroups yes

[root@mail ~]#vi /etc/amavisd.conf

# line 20: specify domain name

$mydomain= 'server.world';

# line 80: make it comment (not notify if virus detected)
#$virus_admin= "virusalert\@$mydomain";

# line 113: uncomment and specify FQDN

$myhostname= 'mail.server.world';

# line 115,116: uncomment

$notify_method= 'smtp:[127.0.0.1]:10025';

$forward_method= 'smtp:[127.0.0.1]:10025';

# line 118: uncomment thease 4 lines

$final_virus_destiny= D_DISCARD;
$final_banned_destiny= D_BOUNCE;
$final_spam_destiny= D_BOUNCE;
$final_bad_header_destiny= D_PASS;

# line 321: uncomment thease 4 lines

['ClamAV-clamd',  &ask_daemon, ["CONTSCAN {}\n", "/var/run/clamav/clamd.sock"],
  qr/\bOK$/, qr/\bFOUND$/,
  qr/^.*?: (?!Infected Archive)(.*) FOUND$/ ],

[root@mail ~]#vi /etc/postfix/main.cf

# add at the bottom

content_filter=smtp-amavis:[127.0.0.1]:10024

[root@mail ~]#vi /etc/postfix/master.cf

# add at the bottom

smtp-amavis unix -       -       n      -     2 smtp
      -o smtp_data_done_timeout=1200
      -o smtp_send_xforward_command=yes
      -o disable_dns_lookups=yes
127.0.0.1:10025 inet n     -     n     -     - smtpd
      -o content_filter=
      -o local_recipient_maps=
      -o relay_recipient_maps=
      -o smtpd_restriction_classes=
      -o smtpd_client_restrictions=
      -o smtpd_helo_restrictions=
      -o smtpd_sender_restrictions=
      -o smtpd_recipient_restrictions=permit_mynetworks,reject
      -o mynetworks=127.0.0.0/8
      -o strict_rfc821_envelopes=yes
      -o smtpd_error_sleep_time=0
      -o smtpd_soft_error_limit=1001
      -o smtpd_hard_error_limit=1000


[root@mail ~]#/etc/rc.d/init.d/clamd start
Stopping Clam AntiVirus Daemon:[ OK ]
Starting Clam AntiVirus Daemon: Running as user clamav (UID 100, GID 101) [ OK ]
[root@mail ~]#/etc/rc.d/init.d/amavisd start
Starting Mail Virus Scanner (amavisd):[ OK ]
[root@mail ~]#/etc/rc.d/init.d/spamassassin start
Starting spamd:[ OK ]
[root@mail ~]#/etc/rc.d/init.d/postfix restart
Shutting down postfix:[ OK ]
Starting postfix:[ OK ]
[root@mail ~]#chkconfig amavisd on
[root@mail ~]#chkconfig spamassassin on
[root@mail ~]#chkconfig clamd on

These lines below are added in header section of emails after this configuration.
     
from: server-world.info

No comments:

Post a Comment