CentOS 6
Sponsored Link

Postfix + Clamav - ClamSMTP
2014/08/22
 
Configure Virus-Scanning with Postfix + Clamav.
[1]
[2] Install Clamd and Clamsmtp.
# install from EPEL

[root@mail ~]#
yum --enablerepo=epel -y install clamd clamsmtp
[root@mail ~]#
vi /etc/clamsmtpd.conf
# line 22: uncomment

Listen: 0.0.0.0:10025
# line 28: uncomment

Header: X-Virus-Scanned: ClamAV using ClamSMTP
# line 34: uncomment

Action: drop
[root@mail ~]#
/etc/rc.d/init.d/clamsmtpd start

Starting ClamSmtpd:                  [  OK  ]
[root@mail ~]#
/etc/rc.d/init.d/clamsmtp-clamd start

Starting clamd.clamsmtp:             [  OK  ]
[root@mail ~]#
chkconfig clamsmtpd on

[root@mail ~]#
chkconfig clamsmtp-clamd on

[3] If SELinux is enabled, change rules to start Clamd.
[root@mail ~]#
setsebool -P antivirus_can_scan_system on

[root@mail ~]#
setsebool -P antivirus_use_jit on
[4] Configure Postfix.
[root@mail ~]#
vi /etc/postfix/main.cf
# add follows to the end

content_filter = scan:127.0.0.1:10025
[root@mail ~]#
vi /etc/postfix/master.cf
# add follows to the end

scan unix -       -       n       -       16       smtp
   -o smtp_data_done_timeout=1200
   -o smtp_send_xforward_command=yes
   -o disable_dns_lookups=yes
127.0.0.1:10026 inet n       -       n       -       16       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_style=host
   -o smtpd_authorized_xforward_hosts=127.0.0.0/8

[root@mail ~]#
/etc/rc.d/init.d/postfix restart

Shutting down postfix:                  [  OK  ]
Starting postfix:                       [  OK  ]
  These lines below are added in header section of emails after this configuration and emails with known Virus will not sent to Clients.
Matched Content
 
Tweet