Tag Archives: ClamAV

Migrate Plesk to ClamAV

Recently a client wanted a free alternative to Plesk’s DrWeb, I went with ClamAV.
Here’s what I did to migrate the system from DrWeb to ClamAV.

REMOVE DRWEB

1. Firstly lets remove DrWeb properly:

/opt/psa/admin/bin/autoinstaller --select-product-id plesk --select-release-current --remove-component drweb

INSTALL CLAMAV

2. Now we can install ClamAV:

apt-get install clamav clamav-base clamav-daemon clamav-freshclam clamav-milter clamsmtp libclamav6

3. Edit /etc/clamav/clamav-milter.conf and set:

MilterSocket /var/run/clamav/clamav-milter.ctl

to

MilterSocket inet:3381@localhost

4. Now edit /etc/postfix/main.cf and add:

milter_default_action = accept
milter_protocol = 6
smtpd_milters = inet:127.0.0.1:12768, inet:127.0.0.1:12345, inet:127.0.0.1:3381
non_smtpd_milters = inet:127.0.0.1:12345, inet:127.0.0.1:3381

Where 12768 = psa-remote, 12345 = OpenDKIM, 3381 = ClamAV.

5. Now we need to restart postfix, clamav-milter and send a test mail and check for these headers..

X-Virus-Scanned: clamav-milter 0.98.6 at hostname
X-Virus-Status: Clean

Your mail should now be scanned by both Spamassasin and ClamAV.
If you are missing the Scanned by header check the file…/etc/clamsmtpd.conf, for

# A header to add to all scanned email
Header: X-AV-Checked: ClamAV using ClamSMTP

And uncomment it.

SET UP FRESHCLAM

6. ClamAV Freshclam, can be set up in several ways, I find it best to use cron for an hourly update.
To configure freshclam run…

dpkg-reconfigure clamav-freshclam

And select cron instead of daemon.

7. You should have a default cron job for freshclam in /etc/cron.d/clamav-freshclam, should you wish to manage the task in Plesk or crontab you should disable first by commenting it out, you can then add the task to crontab like so…

crontab -e
30	*	*	*	*	/usr/bin/freshclam --quiet

8. Now restart freshclam with

service clamav-freshclam restart

And you should be good.
Any questions feel free to contact me.