• Please be aware: Kaspersky Anti-Virus has been deprecated
    With the upgrade to Plesk Obsidian 18.0.64, "Kaspersky Anti-Virus for Servers" will be automatically removed from the servers it is installed on. We recommend that you migrate to Sophos Anti-Virus for Servers.
  • The Horde webmail has been deprecated. Its complete removal is scheduled for April 2025. For details and recommended actions, see the Feature and Deprecation Plan.
  • We’re working on enhancing the Monitoring feature in Plesk, and we could really use your expertise! If you’re open to sharing your experiences with server and website monitoring or providing feedback, we’d love to have a one-hour online meeting with you.

ClamAV and Plesk 12 - Help

Matt_Auckland

New Pleskian
Hi all,

I've got a Plesk 12 box installed and running on Digital Ocean using CentOS 6.5 64bit.

I've installed Qmail Scanner and Spamassassin via Plesk's "Updates and Upgrades" section, and I installed ClamAV using the following command yum install clamd in terminal.

Unlike the last time I did this, it doesn't want to work out the box. The initial errors of:

ERROR: Please edit example config file /etc/freshclam.conf
ERROR: Can't open/parse the config file /etc/freshclam.conf


I fixed by commenting Example out in the freshclam.conf and clamd.conf files. But it seems like nothing is configured, and I'm getting lost at this point, as I'm not a Linux guru.

Last time I did this in Plesk 8.6 it was configured out of the box, but that doesn't seem to be the case now. Is that because I'm using Plesks Qmail? HELP!

Thanks, Matt
 
It fails with:-

Code:
# service clamd start
Starting Clam AntiVirus Daemon: ERROR: Please define server type (local and/or TCP).
                                                           [FAILED]

When I did this on Plesk 8.6 via the ART yum channel, which I'm also using on this box, it installed with no need to touch the config files.
 
I think that you need to uncomment the "TCPSocket" line in clamd.conf and start service again.
 
Thanks for the reply IgorG. I've also noticed the qmail-scanner-reconfigure command doesn't work either when using the qmail installed via Plesk's "Updates and Upgrades" section.

Do I need to install qmail-scanner via YUM as well as via Plesk, or not?
 
Hi Matt_Auckland,

we are getting closer to a working solution for you... ^^


Yes, some individuell modifications need some more "own" work from you... the commands to install the qmail-scanner would be:

yum install qmail-scanner

and afterwards you should be able to use the command:

qmail-scanner-reconfigure

If you still experience issues/problems, a known solution is to switch to postfix and back to qmail again, because you force Plesk to re-install qmail and its packages ( with all it's settings ), wihtout any modifications to the current eMail - accounts or their folders. Please make sure to include some command outputs and/or depending log - entries if you experience further issues, because it is much easier to suggest work-arounds, if we are aware of the whole situation.

 
Ah ok, I assumed that because I had already installed Plesks Qmail via "Updates and Upgrades", that I wouldn't need to install qmail-scanner via YUM channel. I assumed running both would break it.

Another another not I'm running Plesks Spamassassin as well. I take it that won't break anything either?

To be on the safe side, I've taken a snapshot of the server, and will attempt this now.
 
Ok it seems to be working. Some minor issues that I overcame, but I'll explain all just incase someone else has the same problems.

Before I start with the explanation, is there anyway to test this is working?



So kicking off I started with Plesk's Qmail and Spamassassin installed via the control panel.

Next, from terminal I ran yum install clamd followed by yum install qmail-scanner (thanks UFHH01).

At this stage clamd won't work out of the box. When you run the freshclam command for the first time you'll get this error:

Code:
# freshclam
ERROR: Please edit the example config file /etc/freshclam.conf
ERROR: Can't open/parse the config file /etc/freshclam.conf

So you need to edit the /etc/freshclam.conf file and comment out the word Example. Then when you re-run the freshclam command this error will come up:

Code:
# freshclam
ERROR: Can't create temporary directory /var/clamav/clamav-f6df56085fdcc627fea887a8a0c30c1d.tmp
Hint: The database directory must be writable for UID 492 or GID 494

# ERROR: Can't create temporary directory /var/clamav/clamav-f6df56085fdcc627fea88

So to fix this you need to set the permissions for writting to that folder, to the user clamav (thanks to http://pclosmag.com/html/Issues/201202/page10.html for that) using this command:

Code:
# chown clamav:clamav /var/clamav

Ok, third time of running the freshclam command is the charm, although you might see these errors during the first database update:

Code:
ClamAV update process started at Tue Nov 25 17:56:12 2014
main.cvd is up to date (version: 55, sigs: 2424225, f-level: 60, builder: neo)
ERROR: Can't open /var/clamav/mirrors.dat for writing
Downloading daily-19680.cdiff [100%]
ERROR: Can't open /var/clamav/mirrors.dat for writing
daily.cld updated (version: 19680, sigs: 1274659, f-level: 63, builder: neo)
bytecode.cvd is up to date (version: 242, sigs: 46, f-level: 63, builder: dgoddard)
ERROR: Can't open /var/clamav/mirrors.dat for writing
Database updated (3698930 signatures) from db.us.clamav.net (IP: 194.8.197.22)

But don't worry, that is only because those files don't exist yet, until freshclam runs for the first time.

Next you need to run the service clamd start command, which will bring up this error:

Code:
# service clamd start
Starting Clam AntiVirus Daemon: ERROR: Please edit the example config file /etc/clamd.conf
ERROR: Can't open/parse the config file /etc/clamd.conf
                                                           [FAILED]

Again to fix this, you need to edit the /etc/clamd.conf file and comment out the word Example. Also locate the line TCPSocket 3310 and uncomment it (thanks to IgorG). That will help you avoid this error:

Code:
# service clamd start
Starting Clam AntiVirus Daemon: ERROR: Please define server type (local and/or TCP).
                                                           [FAILED]

After that, to finish the install I ran the following commands:

Code:
# chkconfig clamd on
# freshclam -d -c 2
# qmail-scanner-reconfigure
Reconfiguring spamassassin settings: Done
Reconfiguring clamav settings: Done
Configuring qmail-scanner: OK

And that, he says fingers crossed, should do it.
 
What was the final outcome of this... having issues with qmail-scanner 2.10 from atomic repo and would like to get this
working without breaking plesk 12 qmail and dovecot

I had it running years ago under plesk 9 and 10 but am at a loss now
 
Well in short my answer is above.

I used Plesk's Qmail, and did the install above.

I did notice the other day that a Clamd update broke the virus scanning side of mail delivery, but running the qmail-scanner-reconfigure command fixed the issue. It was most likely a permissions/ownership issue, due to the update.

The steps above are what I followed to resolve the issue, and I've also written a PDF guide which includes qmail and clamd installation and configuration, as part of my "Installing CentOS 6.5 and Plesk on a Digital Ocean Droplet". That guide also covers "Fixing The Passive FTP Issue", and "Adding Support for FTP Over TLS" which I recently came across when FileZilla updated their FTP app.

Happy to share the guide with anyone who needs it. It's designed for newbies, but great quick reference for everybody else.
 
I have some site with malware so I will use ClamAV to help Maldect scan for malware in website files. Dr. Web will scan for viruses on email accounts. Both can be installed in the same server?
 
Honestly, not sure. General rule of thumb on a computer is never use more than one Anti-Virus, as two can greatly affect the system performance, and can return false positives.

However that might not be the case on Linux. Personally though I tend to only use one, and that is ClamAV/Clamd.

And yes, it can scan for Malware as well as Anti-Virus. I've used it in the past for that.
 
Hi,
I know this is a old post but i got an unreporter error and I couldn't find any clue on how to fix it.
I followed all the instructions and evarythig went really (maybe too much)well untill i use:
service clamd start (after modifing the clamd.conf file)
and i got:
Starting Clam AntiVirus Daemon: ERROR: Incorrect argument format for option TCPSocket
ERROR: Can't open/parse the config file /etc/clamd.conf

The line in clamd.conf look like:
# TCP port address.
# Default: no
TCPSocket 331

What am I missing?

Running plesk 12 on centos x64
 
Wrote error:
The line in clamd.conf look like:
# TCP port address.
# Default: no
TCPSocket 3310
 
Hi Lapo.

Sorry for the late reply, Christmas and all that.

This issue normally also happens after updates to Clamd.

Simply run the following:

# qmail-scanner-reconfigure
# service clamd start​

That should do it.
 
Back
Top