HOWTO: Install ClamAV (Win32) with hMailserver

Use this forum if you have installed hMailServer and want to ask a question related to a production release of hMailServer. Before posting, please read the troubleshooting guide. A large part of all reported issues are already described in detail here.
Post Reply
User avatar
katip
Senior user
Senior user
Posts: 547
Joined: 2006-12-22 07:58
Location: Istanbul

HOWTO: Install ClamAV (Win32) with hMailserver

Post by katip » 2008-05-06 06:57

Hello all,

There is a native W32 build of clamav (i.e. without cygwin) which works perfect for me as command line scanner from within hMailserver or together with ASSP as well: http://w32.clamav.net/downloads/clamAV.msi

Step by step :

.NET 2.x is required
http://www.microsoft.com/downloads/deta ... layLang=en

Install clamav to default folder (Program Files).

pthreadVC2.dll is required but doesn't come with the package. It's attached below. Just unzip and put it to clamav installation folder.

Ignore clamav own install-as-service instructions. Install clamd.exe daemon with an NT wrapper as service. I recommend (simple and rock solid): http://www.pirmasoft.com/runassvc.php

hMailserver admin -> AntiVirus section -> tab "Other" (NOT ClamWin!!!) :
* check "Use external scanner"
* commandline : c:\progra~1\clamav\clamdscan.exe --no-summary --stdout "%FILE%"
* Return value : 1

Browse clamd.conf and freshclam.conf in conf-folder with a text editor (notepad) and modify as you wish (see attachment as working examples from my installation, take care of paths, especially "temp" folder)

Run the service. If it fails see clamd.log in log folder.

Create a scheduled task to freshclam.exe in a batchfile (run every 3 hours for instance) to update virus database. See attached batchfile. Run it once for testing from command line. See freshclam.log in log folder for any error.

HTH
Attachments
pthreadVC2.zip
Required
(20.85 KiB) Downloaded 861 times
freshclam.zip
Batchfile for freshclam.exe
(181 Bytes) Downloaded 771 times
conf.zip
Example config files
(5.19 KiB) Downloaded 821 times
Last edited by ^DooM^ on 2008-05-06 09:41, edited 1 time in total.
Reason: Altered subject
Katip
--
HMS 5.6.7-B2425, MySQL 5.5.46, SpamAssassin 3.4.2, ClamAV 0.101.1 + SaneS & SecuriteI

westdam
Senior user
Senior user
Posts: 727
Joined: 2006-08-01 21:24
Location: Padova, Italy
Contact:

Re: HOWTO: Install ClamAV (Win32) with hMailserver

Post by westdam » 2008-05-27 12:58

with the runassvc executable i've create the freshclam service. after the fresh clam db is updated freshclam service is stopped.


it's similar to above but i dont think freshclam.bat would run if none it's logged in.
this one is working instead .


use the software to create a "freshclam" service
just
net start freshclam

i'm doing this every 12 hours.

User avatar
katip
Senior user
Senior user
Posts: 547
Joined: 2006-12-22 07:58
Location: Istanbul

Re: HOWTO: Install ClamAV (Win32) with hMailserver

Post by katip » 2008-05-27 19:39

Could be an alternative, never tried though.
A correctly set up scheduled task run as expected independently from anyone logged in or not, AFAIK.
Katip
--
HMS 5.6.7-B2425, MySQL 5.5.46, SpamAssassin 3.4.2, ClamAV 0.101.1 + SaneS & SecuriteI

^DooM^
Site Admin
Posts: 13862
Joined: 2005-07-29 16:18
Location: UK

Re: HOWTO: Install ClamAV (Win32) with hMailserver

Post by ^DooM^ » 2008-05-27 21:56

katip wrote:Could be an alternative, never tried though.
A correctly set up scheduled task run as expected independently from anyone logged in or not, AFAIK.
As long as the user that is running the scheduled task has the correct permissions to run the file then yes it should work just fine.
If at first you don't succeed, bomb disposal probably isn't for you! ヅ

cerri
Normal user
Normal user
Posts: 90
Joined: 2008-05-12 17:06

Re: HOWTO: Install ClamAV (Win32) with hMailserver

Post by cerri » 2008-07-24 11:06

This software is working very great.
The problem is that it's quite old...

Is there any other solution to run clamd as a service and use clamdscan?
All other solution that I found aren't working great as ClamAV.

c0r2ar0
New user
New user
Posts: 27
Joined: 2007-06-12 16:46
Location: Italy

Re: HOWTO: Install ClamAV (Win32) with hMailserver

Post by c0r2ar0 » 2008-08-30 11:13

Hello there,
I'm been using ClamAV with clamd as a service in our Windows 2000 Server for about 6 months now. It works perfectly!

The problem is that I've noticed in the past few days that freshclam notify me that the clamav engine is old. This is the exact message:
WARNING: Current functionality level = 27, required = 31

I've the 0.92.1 version downloaded from http://w32.clamav.net and I've seen that it's quite old by now (there's the 0.93.3 out).

Onto another site: http://hideout.ath.cx/clamav/
I've found a 0.93.1 and 0.94 RC1 and they works, except that I can't run them as a windows service.
I've tried with runclamd or srvany.exe tools but they both won't run clamd.exe, they just run themselves and nothing else.

Anyway I can suggest to use clamd to everyone using hmailserver, it works really better than clamwin or just clamav using clamscan.exe because it won't load virus signatures everytime in memory and this was a real performance gain for our mail server.

Thanks to everyone...

Best regards,
Paolo

User avatar
katip
Senior user
Senior user
Posts: 547
Joined: 2006-12-22 07:58
Location: Istanbul

Re: HOWTO: Install ClamAV (Win32) with hMailserver

Post by katip » 2008-08-30 13:00

Hello,

Indeed, w32.clamav.net seems to have their poject suspended.

I have tried SOSDG build (Cygwin port), solid but too slow compared to w32 builds.

Since yesterday I'm testing another well known native w32 build from http://oss.netfarm.it/clamav/
It's very simple to install (just copy everything to a folder) but there are some essential tweaks to do. Around this evening or tomorrow I hope to be able to post a HowTo about this. For the moment it works fine and very fast...
Katip
--
HMS 5.6.7-B2425, MySQL 5.5.46, SpamAssassin 3.4.2, ClamAV 0.101.1 + SaneS & SecuriteI

westdam
Senior user
Senior user
Posts: 727
Joined: 2006-08-01 21:24
Location: Padova, Italy
Contact:

Re: HOWTO: Install ClamAV (Win32) with hMailserver

Post by westdam » 2008-08-31 02:32

no it's not suspended. the debug version is dated july 08 so it's on develop stage. i think they will just release it slowly.

MAllen
New user
New user
Posts: 17
Joined: 2008-08-31 04:49
Location: Modesto, Calif. USA

Re: HOWTO: Install ClamAV (Win32) with hMailserver

Post by MAllen » 2008-08-31 05:05

You can get runclamd to work with the clamd version from http://hideout.ath.cx/clamav/. You need to use "-c" on the command line in runclamd.ini so that clamd can find its .conf file:

PathToClamd=C:\Program Files\clamAV\clamd.exe -c C:\Progra~1\clamAV\clamd.conf

If you installed clamav in another folder then you'll need to adjust for that. (I used the short file name for the pointer to the clamd.conf file so that clamd wouldn't stumble over it. It may not be needed but since it works I'm not fooling with it.)

Also make sure that the "Foreground yes" option in the clamd.conf file is not commented out. Unless that option is un-commented freshclam isn't able to notify clamd that the definition files have been updated.

Mike

User avatar
katip
Senior user
Senior user
Posts: 547
Joined: 2006-12-22 07:58
Location: Istanbul

Re: HOWTO: Install ClamAV (Win32) with hMailserver

Post by katip » 2008-08-31 13:14

MAllen wrote: PathToClamd=C:\Program Files\clamAV\clamd.exe -c C:\Progra~1\clamAV\clamd.conf
Yes, another point to take care about...

Meanwhile I have observed that when I kill clamd by windows taskmanager, it restarts itself again after 30 seconds. That's great in case the service somehow fails, but nowhere documented I think?? Has anyone experinced this?
(It's about http://hideout.ath.cx/clamav build)
Katip
--
HMS 5.6.7-B2425, MySQL 5.5.46, SpamAssassin 3.4.2, ClamAV 0.101.1 + SaneS & SecuriteI

MAllen
New user
New user
Posts: 17
Joined: 2008-08-31 04:49
Location: Modesto, Calif. USA

Re: HOWTO: Install ClamAV (Win32) with hMailserver

Post by MAllen » 2008-08-31 20:18

Meanwhile I have observed that when I kill clamd by windows taskmanager, it restarts itself again after 30 seconds.
Are you sure that runclamd isn't running? That's how it works.

c0r2ar0
New user
New user
Posts: 27
Joined: 2007-06-12 16:46
Location: Italy

Re: HOWTO: Install ClamAV (Win32) with hMailserver

Post by c0r2ar0 » 2008-09-01 07:36

You can get runclamd to work with the clamd version from http://hideout.ath.cx/clamav/. You need to use "-c" on the command line in runclamd.ini so that clamd can find its .conf file:

PathToClamd=C:\Program Files\clamAV\clamd.exe -c C:\Progra~1\clamAV\clamd.conf
I've tried this option in my runclamd.ini file changing the path to my clamAV folder (c:\clamAV) but it doesn't work, clamd.exe never stard when I try to start runclamd service. It starts just the runclamd.exe

As OS I use Windows 2000 Professional, it might be a compatibility problem!

Anyway now I'm trying to use the clamd.exe starting it from the command line (I know this is not a good way to run it, but I must use it in some ways!).

Thanks a lot for your interest.

Best regards,
Paolo

c0r2ar0
New user
New user
Posts: 27
Joined: 2007-06-12 16:46
Location: Italy

Re: HOWTO: Install ClamAV (Win32) with hMailserver

Post by c0r2ar0 » 2008-09-01 08:49

Finally I've found the problem that didn't get my clamd.exe 0.94RC1 (or even 0.93.1) runs as a service!

The problem was in the windows registry, the new clamav version needs a registry entry like this:

-----------------------------
[HKEY_LOCAL_MACHINE\SOFTWARE\ClamAV]
"ConfigDir"="C:\\ClamAV"
"DataDir"="C:\\ClamAV\\data"
-----------------------------

Without this registry entry clamd.exe won't works as a service!

Anyway thanks to everyone who replied and always thanks to martin that created this wonderful mailserver!!!

Best regards,
Paolo

MAllen
New user
New user
Posts: 17
Joined: 2008-08-31 04:49
Location: Modesto, Calif. USA

Re: HOWTO: Install ClamAV (Win32) with hMailserver

Post by MAllen » 2008-09-01 08:56

That's interesting.

Where did you find this requirement? Was there documentation somewhere? The source code? Or just error and trial?

Mike

c0r2ar0
New user
New user
Posts: 27
Joined: 2007-06-12 16:46
Location: Italy

Re: HOWTO: Install ClamAV (Win32) with hMailserver

Post by c0r2ar0 » 2008-09-01 09:08

MAllen wrote:
Where did you find this requirement? Was there documentation somewhere? The source code? Or just error and trial?

Mike
I haven't found any related documentation... I've just tried since I was trying this ClamAV solution http://oss.netfarm.it/clamav/ as suggested in this thread and I've noticed that in that ClamAV solution there's a reg file inside that insert those entries in the windows registry.

So I've tried to do that even for the other version and it worked perfectly!!!

Anyway I've also seen that without those entries, even if I start clamd.exe from the command line, it didn't load the virus signatures, infact the clamd.exe process just allocated about 500 kb of memory instead with those registry entries it allocates about 80 Mb !!!! And as I can see from the log file, it finds viruses and phising (without those entries it didn't find anything!).

MAllen
New user
New user
Posts: 17
Joined: 2008-08-31 04:49
Location: Modesto, Calif. USA

Re: HOWTO: Install ClamAV (Win32) with hMailserver

Post by MAllen » 2008-09-01 09:51

Thanks for the information.

While my system is working without those settings (ver 0.93.1) I'll bookmark this thread for future use.

westdam
Senior user
Senior user
Posts: 727
Joined: 2006-08-01 21:24
Location: Padova, Italy
Contact:

Re: HOWTO: Install ClamAV (Win32) with hMailserver

Post by westdam » 2008-10-13 17:11

damn, my clamd w32 verison is outdated a bit ( 0.92) do you suggest to use the http://oss.netfarm.it/clamav/ version instead the w32.clamav.net?

c0r2ar0
New user
New user
Posts: 27
Joined: 2007-06-12 16:46
Location: Italy

Re: HOWTO: Install ClamAV (Win32) with hMailserver

Post by c0r2ar0 » 2008-10-14 08:06

even the clamAv you can find at http://hideout.ath.cx/clamav/ is good and working. I'm currently using it without problems!

Best regards,
Paolo

arvin8
New user
New user
Posts: 17
Joined: 2008-10-12 01:55

Re: HOWTO: Install ClamAV (Win32) with hMailserver

Post by arvin8 » 2008-10-21 22:49

I'm fed up with clamwin...
which build of clamAV u guys are recommending?

- The official development of the original w32 seems to be stopped(latest release was on feb. and they seem to be skkipping the scheduled july release)
- They say that SOSDG version is not as fast as the official w32 build(also not good with resources as w32 is)
- I do know nothing about the tBB build. Any opinions?
- What about the netfarm build? Do you find it ok or trustable?(what if the abandon the project in future)
- And the ath build... It looks lie a complete solution but did you have any experiences with it?

Is netfarm the logical choice to go for or should we prefer ath?

c0r2ar0
New user
New user
Posts: 27
Joined: 2007-06-12 16:46
Location: Italy

Re: HOWTO: Install ClamAV (Win32) with hMailserver

Post by c0r2ar0 » 2008-10-22 08:25

On our servers (we have two servers with about 70 domains and 700 mailboxes) we use the ath version and it works great!!!!
It takes about 80 mb of ram that is not a lot... we get scanned about 10000 emails per day without having problems!! No viruses passes at all!!!

Best regards,
Paolo

MAllen
New user
New user
Posts: 17
Joined: 2008-08-31 04:49
Location: Modesto, Calif. USA

Re: HOWTO: Install ClamAV (Win32) with hMailserver

Post by MAllen » 2008-10-23 06:43

The programmers for two of the versions mentioned above are active on the offical mailing list http://lists.clamav.net/pipermail/clamav-win32.

The two native Win32 versions are at:
http://hideout.ath.cx/clamav and
http://oss.netfarm.it/clamav/

Post Reply