HowTo: ClamAV Milter with Postfix

Spam is not the only problem on a mailserver. Nowadays malware is often sent by mail. I use clamav-milter to reject harmful mails, it is a open-source tool-kit to detect many types of malicious software. This is a quick guide to include ClamAV to your mailserver.



  • at least 1GB Ram
  • Postfix
apt-get install clamav-milter clamav-unofficial-sigs
apt-get install arj bzip2 cabextract cpio file gzip lzop nomarch p7zip pax rar rpm unrar unzip zip zoo

In /etc/clamav/clamav-milter.conf

MilterSocket /var/spool/postfix/clamav/clamav-milter.ctl
FixStaleSocket true
User clamav
AllowSupplementaryGroups true
ReadTimeout 120
Foreground false
PidFile /var/run/clamav/
ClamdSocket unix:/var/run/clamav/clamd.ctl
OnClean Accept
OnInfected Quarantine
OnFail Defer
AddHeader Replace
LogSyslog true
LogFacility LOG_MAIL
LogVerbose false
LogInfected Full
LogClean Off
MaxFileSize 25M
TemporaryDirectory /tmp
LogFile /var/log/clamav/clamav-milter.log
LogTime true
LogFileUnlock false
LogFileMaxSize 0M
MilterSocketGroup clamav
MilterSocketMode 660

In /etc/default/clamav-milter


In /etc/postfix/

smtpd_milters = unix:/clamav/clamav-milter.ctl

Restart services…

freshclam && clamav-unofficial-sigs && service clamav-milter restart && service clamav-daemon restart && service postfix restart 

~ Alex

Leave a Reply

Your email address will not be published. Required fields are marked *