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:

INSTALL CLAMAV

2. Now we can install ClamAV:

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

to

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

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..

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

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…

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…

8. Now restart freshclam with

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

Creating ECC Certificates

Here’s a very quick guide on creating ECC 256Bit Self-Signed Certificates with OpenSSL and Ubuntu 12 and 14.

1. Firstly lets create a folder to hold the files..

2. Move to that directory…

3. Now lets create the key

4. Create the request

5. Create the certificate

6. While we are here, lets combine the private key and certificate into a .pem file.

You now have a Self-Signed ECC 256Bit SHA256 certificate for your domain, and a .csr file for use at your favourite CA.

Should you wish to have ECC 384 Bit, simply replace “prime256v1” in step three, with secp384r1,
and “-sha256” in step five with -sha384.

Enjoy!

Creating DH Parameters

By default DH Parameters are just 1024bits in Ubuntu 12.04.5 LTS which is considered weak by todays standards.
You will need to create a new one of either 2048Bit or 4096Bit depending on your certificates public key size.

1. Create a folder to hold the dhparams…

2. Move to that directory

3. Create the new DH Parameters, at 2048Bit

And 4096Bit (this will take some time)

5. You can also create DSA versions, at 2048Bit…

And 4096Bit

Now you can add the directives to your servers, Courier-Imap, Dovecot, Nginx and Postfix.

Courier-Imap

Dovecot (creates it’s own)

Nginx

Postfix

Enjoy!