Guide updated on 29th of February 2016

Configure clamav

Clamav is the antivirus system we 'll use

dpkg-reconfigure clamav-base
Change clamav user/group to qscand and keep all of the other default settings (Group - Owner)

dpkg-reconfigure clamav-freshclam
Choose daemon + your location + default answers

chown -R qscand:clamav /var/log/clamav /var/lib/clamav /var/run/clamav
chown qscand:qscand /etc/clamav/freshclam.conf
chmod 600 /etc/clamav/freshclam.conf
ln -s /var/log/clamav /var/log/qmail/clamav

sed -i 's/DatabaseOwner clamav/DatabaseOwner qscand/' /etc/clamav/freshclam.conf
sed -i 's/clamav adm/qscand qscand/' /etc/logrotate.d/clamav-freshclam
sed -i 's/clamav adm/qscand qscand/' /etc/logrotate.d/clamav-daemon

Restart the services

/etc/init.d/clamav-daemon restart
/etc/init.d/clamav-freshclam restart

If you experience some issues at this step (for instance if you have not followed the instruction about the ownership change), check the followings :

1 Check /etc/clamav/freshclam.conf to verify the DatabaseOwner option :

DatabaseOwner qscand

2 Check /etc/clamav/clamd.conf to verify the LocalSocketGroup and User options :

LocalSocketGroup qscand
User qscand

3 Check both /etc/logrotate.d/clamav-freshclam and /etc/logrotate.d/clamav-daemon :

create 640 qscand qscand

If you have adapted those two files, run this

chown qscand:clamav /var/log/clamav/clamav.log
chown qscand:clamav /var/log/clamav/freshclam.log

4 If you have changed something above, restart the services

/etc/init.d/clamav-daemon restart
/etc/init.d/clamav-freshclam restart

Configure courier

Users comments
Thibs - 06/05/2011 14:27

@Coreux :

Just launch following commands:

aptitude update
aptitude safe-upgrade
Coreux - 03/05/2011 04:21

root@srvmail:/var/lib/clamav# /etc/init.d/clamav-daemon restart
Stopping ClamAV daemon: clamd.
Starting ClamAV daemon: clamd LibClamAV Warning: **************************************************
LibClamAV Warning: ***  The virus database is older than 7 days!  ***
LibClamAV Warning: ***   Please update it as soon as possible.    ***
LibClamAV Warning: **************************************************

Color Coded Qmail Installation Key
  Regular Black Text     Qmail installation notes and summaries by the author.
  Bold Black Text     Commands to be run by you, the installer.
  Bold/Regular Red Text    Vital and/or critical information.
  Regular Blue text     Denotes helpful tips and hints or hyperlinks.
  Regular Orange Text     Command line output.
  Bold/Regular green text     Denotes the contents of a file or script.